src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy
author wenzelm
Fri, 29 Jul 2016 20:34:07 +0200
changeset 63566 e5abbdee461a
parent 63492 a662e8139804
child 63593 bbcb05504fdc
permissions -rw-r--r--
more accurate cong del; tuned proofs;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41959
b460124855b8 tuned headers;
wenzelm
parents: 41413
diff changeset
     1
(*  Title:      HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
     2
    Authors: Robert Himmelmann, TU Muenchen; Bogdan Grechuk, University of Edinburgh; LCP
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     3
*)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     4
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
     5
section \<open>Convex sets, functions and related things\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     6
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     7
theory Convex_Euclidean_Space
44132
0f35a870ecf1 full import paths
huffman
parents: 44125
diff changeset
     8
imports
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
     9
  Topology_Euclidean_Space
44132
0f35a870ecf1 full import paths
huffman
parents: 44125
diff changeset
    10
  "~~/src/HOL/Library/Convex"
0f35a870ecf1 full import paths
huffman
parents: 44125
diff changeset
    11
  "~~/src/HOL/Library/Set_Algebras"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    12
begin
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    13
63305
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    14
(*FIXME move up e.g. to Library/Convex.thy, but requires the "support" primitive*)
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    15
lemma convex_supp_setsum:
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    16
  assumes "convex S" and 1: "supp_setsum u I = 1"
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    17
      and "\<And>i. i \<in> I \<Longrightarrow> 0 \<le> u i \<and> (u i = 0 \<or> f i \<in> S)"
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    18
    shows "supp_setsum (\<lambda>i. u i *\<^sub>R f i) I \<in> S"
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    19
proof -
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    20
  have fin: "finite {i \<in> I. u i \<noteq> 0}"
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    21
    using 1 setsum.infinite by (force simp: supp_setsum_def support_def)
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    22
  then have eq: "supp_setsum(\<lambda>i. u i *\<^sub>R f i) I =
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    23
            setsum (\<lambda>i. u i *\<^sub>R f i) {i \<in> I. u i \<noteq> 0}"
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    24
    by (force intro: setsum.mono_neutral_left simp: supp_setsum_def support_def)
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    25
  show ?thesis
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    26
    apply (simp add: eq)
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    27
    apply (rule convex_setsum [OF fin \<open>convex S\<close>])
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    28
    using 1 assms apply (auto simp: supp_setsum_def support_def)
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    29
    done
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    30
qed
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    31
3b6975875633 Urysohn's lemma, Dugundji extension theorem and many other proofs
paulson <lp15@cam.ac.uk>
parents: 63301
diff changeset
    32
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
    33
lemma dim_image_eq:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
    34
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
    35
  assumes lf: "linear f"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
    36
    and fi: "inj_on f (span S)"
53406
d4374a69ddff tuned proofs;
wenzelm
parents: 53374
diff changeset
    37
  shows "dim (f ` S) = dim (S::'n::euclidean_space set)"
d4374a69ddff tuned proofs;
wenzelm
parents: 53374
diff changeset
    38
proof -
d4374a69ddff tuned proofs;
wenzelm
parents: 53374
diff changeset
    39
  obtain B where B: "B \<subseteq> S" "independent B" "S \<subseteq> span B" "card B = dim S"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
    40
    using basis_exists[of S] by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
    41
  then have "span S = span B"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
    42
    using span_mono[of B S] span_mono[of S "span B"] span_span[of B] by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
    43
  then have "independent (f ` B)"
63128
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
    44
    using independent_inj_on_image[of B f] B assms by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
    45
  moreover have "card (f ` B) = card B"
53406
d4374a69ddff tuned proofs;
wenzelm
parents: 53374
diff changeset
    46
    using assms card_image[of f B] subset_inj_on[of f "span S" B] B span_inc by auto
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
    47
  moreover have "(f ` B) \<subseteq> (f ` S)"
53406
d4374a69ddff tuned proofs;
wenzelm
parents: 53374
diff changeset
    48
    using B by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
    49
  ultimately have "dim (f ` S) \<ge> dim S"
53406
d4374a69ddff tuned proofs;
wenzelm
parents: 53374
diff changeset
    50
    using independent_card_le_dim[of "f ` B" "f ` S"] B by auto
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
    51
  then show ?thesis
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
    52
    using dim_image_le[of f S] assms by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
    53
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
    54
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
    55
lemma linear_injective_on_subspace_0:
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
    56
  assumes lf: "linear f"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
    57
    and "subspace S"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
    58
  shows "inj_on f S \<longleftrightarrow> (\<forall>x \<in> S. f x = 0 \<longrightarrow> x = 0)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
    59
proof -
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
    60
  have "inj_on f S \<longleftrightarrow> (\<forall>x \<in> S. \<forall>y \<in> S. f x = f y \<longrightarrow> x = y)"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
    61
    by (simp add: inj_on_def)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
    62
  also have "\<dots> \<longleftrightarrow> (\<forall>x \<in> S. \<forall>y \<in> S. f x - f y = 0 \<longrightarrow> x - y = 0)"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
    63
    by simp
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
    64
  also have "\<dots> \<longleftrightarrow> (\<forall>x \<in> S. \<forall>y \<in> S. f (x - y) = 0 \<longrightarrow> x - y = 0)"
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
    65
    by (simp add: linear_diff[OF lf])
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
    66
  also have "\<dots> \<longleftrightarrow> (\<forall>x \<in> S. f x = 0 \<longrightarrow> x = 0)"
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
    67
    using \<open>subspace S\<close> subspace_def[of S] subspace_diff[of S] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
    68
  finally show ?thesis .
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
    69
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
    70
61952
546958347e05 prefer symbols for "Union", "Inter";
wenzelm
parents: 61945
diff changeset
    71
lemma subspace_Inter: "\<forall>s \<in> f. subspace s \<Longrightarrow> subspace (\<Inter>f)"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
    72
  unfolding subspace_def by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
    73
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
    74
lemma span_eq[simp]: "span s = s \<longleftrightarrow> subspace s"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
    75
  unfolding span_def by (rule hull_eq) (rule subspace_Inter)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
    76
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
    77
lemma substdbasis_expansion_unique:
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
    78
  assumes d: "d \<subseteq> Basis"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
    79
  shows "(\<Sum>i\<in>d. f i *\<^sub>R i) = (x::'a::euclidean_space) \<longleftrightarrow>
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
    80
    (\<forall>i\<in>Basis. (i \<in> d \<longrightarrow> f i = x \<bullet> i) \<and> (i \<notin> d \<longrightarrow> x \<bullet> i = 0))"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
    81
proof -
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
    82
  have *: "\<And>x a b P. x * (if P then a else b) = (if P then x * a else x * b)"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
    83
    by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
    84
  have **: "finite d"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
    85
    by (auto intro: finite_subset[OF assms])
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
    86
  have ***: "\<And>i. i \<in> Basis \<Longrightarrow> (\<Sum>i\<in>d. f i *\<^sub>R i) \<bullet> i = (\<Sum>x\<in>d. if x = i then f x else 0)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
    87
    using d
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
    88
    by (auto intro!: setsum.cong simp: inner_Basis inner_setsum_left)
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
    89
  show ?thesis
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
    90
    unfolding euclidean_eq_iff[where 'a='a] by (auto simp: setsum.delta[OF **] ***)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
    91
qed
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
    92
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
    93
lemma independent_substdbasis: "d \<subseteq> Basis \<Longrightarrow> independent d"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
    94
  by (rule independent_mono[OF independent_Basis])
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
    95
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
    96
lemma dim_cball:
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
    97
  assumes "e > 0"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
    98
  shows "dim (cball (0 :: 'n::euclidean_space) e) = DIM('n)"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
    99
proof -
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   100
  {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   101
    fix x :: "'n::euclidean_space"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
   102
    define y where "y = (e / norm x) *\<^sub>R x"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   103
    then have "y \<in> cball 0 e"
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62381
diff changeset
   104
      using assms by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   105
    moreover have *: "x = (norm x / e) *\<^sub>R y"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   106
      using y_def assms by simp
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   107
    moreover from * have "x = (norm x/e) *\<^sub>R y"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   108
      by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   109
    ultimately have "x \<in> span (cball 0 e)"
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62381
diff changeset
   110
      using span_mul[of y "cball 0 e" "norm x/e"] span_inc[of "cball 0 e"]
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62381
diff changeset
   111
      by (simp add: span_superset)
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   112
  }
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   113
  then have "span (cball 0 e) = (UNIV :: 'n::euclidean_space set)"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   114
    by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   115
  then show ?thesis
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   116
    using dim_span[of "cball (0 :: 'n::euclidean_space) e"] by (auto simp add: dim_UNIV)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   117
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   118
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   119
lemma indep_card_eq_dim_span:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   120
  fixes B :: "'n::euclidean_space set"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   121
  assumes "independent B"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   122
  shows "finite B \<and> card B = dim (span B)"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   123
  using assms basis_card_eq_dim[of B "span B"] span_inc by auto
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   124
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   125
lemma setsum_not_0: "setsum f A \<noteq> 0 \<Longrightarrow> \<exists>a \<in> A. f a \<noteq> 0"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   126
  by (rule ccontr) auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   127
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
   128
lemma subset_translation_eq [simp]:
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
   129
    fixes a :: "'a::real_vector" shows "op + a ` s \<subseteq> op + a ` t \<longleftrightarrow> s \<subseteq> t"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
   130
  by auto
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
   131
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
   132
lemma translate_inj_on:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   133
  fixes A :: "'a::ab_group_add set"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   134
  shows "inj_on (\<lambda>x. a + x) A"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   135
  unfolding inj_on_def by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   136
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   137
lemma translation_assoc:
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   138
  fixes a b :: "'a::ab_group_add"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   139
  shows "(\<lambda>x. b + x) ` ((\<lambda>x. a + x) ` S) = (\<lambda>x. (a + b) + x) ` S"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   140
  by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   141
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   142
lemma translation_invert:
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   143
  fixes a :: "'a::ab_group_add"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   144
  assumes "(\<lambda>x. a + x) ` A = (\<lambda>x. a + x) ` B"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   145
  shows "A = B"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   146
proof -
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   147
  have "(\<lambda>x. -a + x) ` ((\<lambda>x. a + x) ` A) = (\<lambda>x. - a + x) ` ((\<lambda>x. a + x) ` B)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   148
    using assms by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   149
  then show ?thesis
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   150
    using translation_assoc[of "-a" a A] translation_assoc[of "-a" a B] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   151
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   152
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   153
lemma translation_galois:
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   154
  fixes a :: "'a::ab_group_add"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   155
  shows "T = ((\<lambda>x. a + x) ` S) \<longleftrightarrow> S = ((\<lambda>x. (- a) + x) ` T)"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   156
  using translation_assoc[of "-a" a S]
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   157
  apply auto
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   158
  using translation_assoc[of a "-a" T]
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   159
  apply auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   160
  done
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   161
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
   162
lemma convex_translation_eq [simp]: "convex ((\<lambda>x. a + x) ` s) \<longleftrightarrow> convex s"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
   163
  by (metis convex_translation translation_galois)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
   164
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   165
lemma translation_inverse_subset:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   166
  assumes "((\<lambda>x. - a + x) ` V) \<le> (S :: 'n::ab_group_add set)"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   167
  shows "V \<le> ((\<lambda>x. a + x) ` S)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   168
proof -
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   169
  {
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   170
    fix x
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   171
    assume "x \<in> V"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   172
    then have "x-a \<in> S" using assms by auto
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   173
    then have "x \<in> {a + v |v. v \<in> S}"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   174
      apply auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   175
      apply (rule exI[of _ "x-a"])
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   176
      apply simp
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   177
      done
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   178
    then have "x \<in> ((\<lambda>x. a+x) ` S)" by auto
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   179
  }
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   180
  then show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   181
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   182
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
   183
lemma convex_linear_image_eq [simp]:
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
   184
    fixes f :: "'a::real_vector \<Rightarrow> 'b::real_vector"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
   185
    shows "\<lbrakk>linear f; inj f\<rbrakk> \<Longrightarrow> convex (f ` s) \<longleftrightarrow> convex s"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
   186
    by (metis (no_types) convex_linear_image convex_linear_vimage inj_vimage_image_eq)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
   187
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   188
lemma basis_to_basis_subspace_isomorphism:
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   189
  assumes s: "subspace (S:: ('n::euclidean_space) set)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   190
    and t: "subspace (T :: ('m::euclidean_space) set)"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   191
    and d: "dim S = dim T"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   192
    and B: "B \<subseteq> S" "independent B" "S \<subseteq> span B" "card B = dim S"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   193
    and C: "C \<subseteq> T" "independent C" "T \<subseteq> span C" "card C = dim T"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   194
  shows "\<exists>f. linear f \<and> f ` B = C \<and> f ` S = T \<and> inj_on f S"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   195
proof -
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   196
  from B independent_bound have fB: "finite B"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   197
    by blast
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   198
  from C independent_bound have fC: "finite C"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   199
    by blast
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   200
  from B(4) C(4) card_le_inj[of B C] d obtain f where
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
   201
    f: "f ` B \<subseteq> C" "inj_on f B" using \<open>finite B\<close> \<open>finite C\<close> by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   202
  from linear_independent_extend[OF B(2)] obtain g where
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   203
    g: "linear g" "\<forall>x \<in> B. g x = f x" by blast
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   204
  from inj_on_iff_eq_card[OF fB, of f] f(2)
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   205
  have "card (f ` B) = card B" by simp
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   206
  with B(4) C(4) have ceq: "card (f ` B) = card C" using d
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   207
    by simp
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   208
  have "g ` B = f ` B" using g(2)
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   209
    by (auto simp add: image_iff)
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   210
  also have "\<dots> = C" using card_subset_eq[OF fC f(1) ceq] .
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   211
  finally have gBC: "g ` B = C" .
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   212
  have gi: "inj_on g B" using f(2) g(2)
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   213
    by (auto simp add: inj_on_def)
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   214
  note g0 = linear_indep_image_lemma[OF g(1) fB, unfolded gBC, OF C(2) gi]
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   215
  {
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   216
    fix x y
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   217
    assume x: "x \<in> S" and y: "y \<in> S" and gxy: "g x = g y"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   218
    from B(3) x y have x': "x \<in> span B" and y': "y \<in> span B"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   219
      by blast+
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   220
    from gxy have th0: "g (x - y) = 0"
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
   221
      by (simp add: linear_diff[OF g(1)])
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   222
    have th1: "x - y \<in> span B" using x' y'
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   223
      by (metis span_sub)
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   224
    have "x = y" using g0[OF th1 th0] by simp
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   225
  }
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   226
  then have giS: "inj_on g S" unfolding inj_on_def by blast
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   227
  from span_subspace[OF B(1,3) s]
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   228
  have "g ` S = span (g ` B)"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   229
    by (simp add: span_linear_image[OF g(1)])
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   230
  also have "\<dots> = span C"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   231
    unfolding gBC ..
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   232
  also have "\<dots> = T"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   233
    using span_subspace[OF C(1,3) t] .
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   234
  finally have gS: "g ` S = T" .
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   235
  from g(1) gS giS gBC show ?thesis
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   236
    by blast
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   237
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   238
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   239
lemma closure_bounded_linear_image_subset:
44524
04ad69081646 generalize some lemmas
huffman
parents: 44523
diff changeset
   240
  assumes f: "bounded_linear f"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   241
  shows "f ` closure S \<subseteq> closure (f ` S)"
44524
04ad69081646 generalize some lemmas
huffman
parents: 44523
diff changeset
   242
  using linear_continuous_on [OF f] closed_closure closure_subset
04ad69081646 generalize some lemmas
huffman
parents: 44523
diff changeset
   243
  by (rule image_closure_subset)
04ad69081646 generalize some lemmas
huffman
parents: 44523
diff changeset
   244
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   245
lemma closure_linear_image_subset:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   246
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::real_normed_vector"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   247
  assumes "linear f"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   248
  shows "f ` (closure S) \<subseteq> closure (f ` S)"
44524
04ad69081646 generalize some lemmas
huffman
parents: 44523
diff changeset
   249
  using assms unfolding linear_conv_bounded_linear
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   250
  by (rule closure_bounded_linear_image_subset)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   251
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   252
lemma closed_injective_linear_image:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   253
    fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   254
    assumes S: "closed S" and f: "linear f" "inj f"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   255
    shows "closed (f ` S)"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   256
proof -
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   257
  obtain g where g: "linear g" "g \<circ> f = id"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   258
    using linear_injective_left_inverse [OF f] by blast
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   259
  then have confg: "continuous_on (range f) g"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   260
    using linear_continuous_on linear_conv_bounded_linear by blast
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   261
  have [simp]: "g ` f ` S = S"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   262
    using g by (simp add: image_comp)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   263
  have cgf: "closed (g ` f ` S)"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61762
diff changeset
   264
    by (simp add: \<open>g \<circ> f = id\<close> S image_comp)
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   265
  have [simp]: "{x \<in> range f. g x \<in> S} = f ` S"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   266
    using g by (simp add: o_def id_def image_def) metis
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   267
  show ?thesis
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   268
    apply (rule closedin_closed_trans [of "range f"])
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   269
    apply (rule continuous_closedin_preimage [OF confg cgf, simplified])
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   270
    apply (rule closed_injective_image_subspace)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   271
    using f
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   272
    apply (auto simp: linear_linear linear_injective_0)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   273
    done
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   274
qed
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   275
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   276
lemma closed_injective_linear_image_eq:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   277
    fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   278
    assumes f: "linear f" "inj f"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   279
      shows "(closed(image f s) \<longleftrightarrow> closed s)"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   280
  by (metis closed_injective_linear_image closure_eq closure_linear_image_subset closure_subset_eq f(1) f(2) inj_image_subset_iff)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   281
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   282
lemma closure_injective_linear_image:
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   283
    fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   284
    shows "\<lbrakk>linear f; inj f\<rbrakk> \<Longrightarrow> f ` (closure S) = closure (f ` S)"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   285
  apply (rule subset_antisym)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   286
  apply (simp add: closure_linear_image_subset)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   287
  by (simp add: closure_minimal closed_injective_linear_image closure_subset image_mono)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   288
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   289
lemma closure_bounded_linear_image:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   290
    fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   291
    shows "\<lbrakk>linear f; bounded S\<rbrakk> \<Longrightarrow> f ` (closure S) = closure (f ` S)"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   292
  apply (rule subset_antisym, simp add: closure_linear_image_subset)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   293
  apply (rule closure_minimal, simp add: closure_subset image_mono)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   294
  by (meson bounded_closure closed_closure compact_continuous_image compact_eq_bounded_closed linear_continuous_on linear_conv_bounded_linear)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   295
44524
04ad69081646 generalize some lemmas
huffman
parents: 44523
diff changeset
   296
lemma closure_scaleR:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   297
  fixes S :: "'a::real_normed_vector set"
44524
04ad69081646 generalize some lemmas
huffman
parents: 44523
diff changeset
   298
  shows "(op *\<^sub>R c) ` (closure S) = closure ((op *\<^sub>R c) ` S)"
04ad69081646 generalize some lemmas
huffman
parents: 44523
diff changeset
   299
proof
04ad69081646 generalize some lemmas
huffman
parents: 44523
diff changeset
   300
  show "(op *\<^sub>R c) ` (closure S) \<subseteq> closure ((op *\<^sub>R c) ` S)"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   301
    using bounded_linear_scaleR_right
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   302
    by (rule closure_bounded_linear_image_subset)
44524
04ad69081646 generalize some lemmas
huffman
parents: 44523
diff changeset
   303
  show "closure ((op *\<^sub>R c) ` S) \<subseteq> (op *\<^sub>R c) ` (closure S)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   304
    by (intro closure_minimal image_mono closure_subset closed_scaling closed_closure)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   305
qed
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   306
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   307
lemma fst_linear: "linear fst"
53600
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53406
diff changeset
   308
  unfolding linear_iff by (simp add: algebra_simps)
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   309
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   310
lemma snd_linear: "linear snd"
53600
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53406
diff changeset
   311
  unfolding linear_iff by (simp add: algebra_simps)
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   312
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
   313
lemma fst_snd_linear: "linear (\<lambda>(x,y). x + y)"
53600
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53406
diff changeset
   314
  unfolding linear_iff by (simp add: algebra_simps)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   315
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   316
lemma scaleR_2:
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   317
  fixes x :: "'a::real_vector"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   318
  shows "scaleR 2 x = x + x"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   319
  unfolding one_add_one [symmetric] scaleR_left_distrib by simp
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   320
62618
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
   321
lemma scaleR_half_double [simp]:
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
   322
  fixes a :: "'a::real_normed_vector"
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
   323
  shows "(1 / 2) *\<^sub>R (a + a) = a"
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
   324
proof -
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
   325
  have "\<And>r. r *\<^sub>R (a + a) = (r * 2) *\<^sub>R a"
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
   326
    by (metis scaleR_2 scaleR_scaleR)
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
   327
  then show ?thesis
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
   328
    by simp
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
   329
qed
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
   330
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   331
lemma vector_choose_size:
62381
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
   332
  assumes "0 \<le> c"
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
   333
  obtains x :: "'a::{real_normed_vector, perfect_space}" where "norm x = c"
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
   334
proof -
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
   335
  obtain a::'a where "a \<noteq> 0"
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
   336
    using UNIV_not_singleton UNIV_eq_I set_zero singletonI by fastforce
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
   337
  then show ?thesis
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
   338
    by (rule_tac x="scaleR (c / norm a) a" in that) (simp add: assms)
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
   339
qed
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
   340
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
   341
lemma vector_choose_dist:
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
   342
  assumes "0 \<le> c"
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
   343
  obtains y :: "'a::{real_normed_vector, perfect_space}" where "dist x y = c"
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
   344
by (metis add_diff_cancel_left' assms dist_commute dist_norm vector_choose_size)
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
   345
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
   346
lemma sphere_eq_empty [simp]:
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
   347
  fixes a :: "'a::{real_normed_vector, perfect_space}"
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
   348
  shows "sphere a r = {} \<longleftrightarrow> r < 0"
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
   349
by (auto simp: sphere_def dist_norm) (metis dist_norm le_less_linear vector_choose_dist)
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   350
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   351
lemma setsum_delta_notmem:
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   352
  assumes "x \<notin> s"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   353
  shows "setsum (\<lambda>y. if (y = x) then P x else Q y) s = setsum Q s"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   354
    and "setsum (\<lambda>y. if (x = y) then P x else Q y) s = setsum Q s"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   355
    and "setsum (\<lambda>y. if (y = x) then P y else Q y) s = setsum Q s"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   356
    and "setsum (\<lambda>y. if (x = y) then P y else Q y) s = setsum Q s"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
   357
  apply (rule_tac [!] setsum.cong)
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   358
  using assms
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   359
  apply auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   360
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   361
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   362
lemma setsum_delta'':
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   363
  fixes s::"'a::real_vector set"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   364
  assumes "finite s"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   365
  shows "(\<Sum>x\<in>s. (if y = x then f x else 0) *\<^sub>R x) = (if y\<in>s then (f y) *\<^sub>R y else 0)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   366
proof -
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   367
  have *: "\<And>x y. (if y = x then f x else (0::real)) *\<^sub>R x = (if x=y then (f x) *\<^sub>R x else 0)"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   368
    by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   369
  show ?thesis
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
   370
    unfolding * using setsum.delta[OF assms, of y "\<lambda>x. f x *\<^sub>R x"] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   371
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   372
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   373
lemma if_smult: "(if P then x else (y::real)) *\<^sub>R v = (if P then x *\<^sub>R v else y *\<^sub>R v)"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
   374
  by (fact if_distrib)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   375
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   376
lemma dist_triangle_eq:
44361
75ec83d45303 remove unnecessary euclidean_space class constraints
huffman
parents: 44349
diff changeset
   377
  fixes x y z :: "'a::real_inner"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   378
  shows "dist x z = dist x y + dist y z \<longleftrightarrow>
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   379
    norm (x - y) *\<^sub>R (y - z) = norm (y - z) *\<^sub>R (x - y)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   380
proof -
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   381
  have *: "x - y + (y - z) = x - z" by auto
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   382
  show ?thesis unfolding dist_norm norm_triangle_eq[of "x - y" "y - z", unfolded *]
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   383
    by (auto simp add:norm_minus_commute)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   384
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   385
53406
d4374a69ddff tuned proofs;
wenzelm
parents: 53374
diff changeset
   386
lemma norm_minus_eqI: "x = - y \<Longrightarrow> norm x = norm y" by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   387
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   388
lemma Min_grI:
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   389
  assumes "finite A" "A \<noteq> {}" "\<forall>a\<in>A. x < a"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   390
  shows "x < Min A"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   391
  unfolding Min_gr_iff[OF assms(1,2)] using assms(3) by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   392
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   393
lemma norm_lt: "norm x < norm y \<longleftrightarrow> inner x x < inner y y"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   394
  unfolding norm_eq_sqrt_inner by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   395
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   396
lemma norm_le: "norm x \<le> norm y \<longleftrightarrow> inner x x \<le> inner y y"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   397
  unfolding norm_eq_sqrt_inner by simp
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   398
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
   399
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
   400
subsection \<open>Affine set and affine hull\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   401
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   402
definition affine :: "'a::real_vector set \<Rightarrow> bool"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   403
  where "affine s \<longleftrightarrow> (\<forall>x\<in>s. \<forall>y\<in>s. \<forall>u v. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> s)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   404
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   405
lemma affine_alt: "affine s \<longleftrightarrow> (\<forall>x\<in>s. \<forall>y\<in>s. \<forall>u::real. (1 - u) *\<^sub>R x + u *\<^sub>R y \<in> s)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   406
  unfolding affine_def by (metis eq_diff_eq')
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   407
62948
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
   408
lemma affine_empty [iff]: "affine {}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   409
  unfolding affine_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   410
62948
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
   411
lemma affine_sing [iff]: "affine {x}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   412
  unfolding affine_alt by (auto simp add: scaleR_left_distrib [symmetric])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   413
62948
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
   414
lemma affine_UNIV [iff]: "affine UNIV"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   415
  unfolding affine_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   416
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
   417
lemma affine_Inter [intro]: "(\<And>s. s\<in>f \<Longrightarrow> affine s) \<Longrightarrow> affine (\<Inter>f)"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
   418
  unfolding affine_def by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   419
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 60176
diff changeset
   420
lemma affine_Int[intro]: "affine s \<Longrightarrow> affine t \<Longrightarrow> affine (s \<inter> t)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   421
  unfolding affine_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   422
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
   423
lemma affine_scaling: "affine s \<Longrightarrow> affine (image (\<lambda>x. c *\<^sub>R x) s)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
   424
  apply (clarsimp simp add: affine_def)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
   425
  apply (rule_tac x="u *\<^sub>R x + v *\<^sub>R y" in image_eqI)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
   426
  apply (auto simp: algebra_simps)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
   427
  done
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
   428
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 60176
diff changeset
   429
lemma affine_affine_hull [simp]: "affine(affine hull s)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   430
  unfolding hull_def
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   431
  using affine_Inter[of "{t. affine t \<and> s \<subseteq> t}"] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   432
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   433
lemma affine_hull_eq[simp]: "(affine hull s = s) \<longleftrightarrow> affine s"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   434
  by (metis affine_affine_hull hull_same)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   435
62948
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
   436
lemma affine_hyperplane: "affine {x. a \<bullet> x = b}"
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
   437
  by (simp add: affine_def algebra_simps) (metis distrib_right mult.left_neutral)
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
   438
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   439
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
   440
subsubsection \<open>Some explicit formulations (from Lars Schewe)\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   441
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   442
lemma affine:
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   443
  fixes V::"'a::real_vector set"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   444
  shows "affine V \<longleftrightarrow>
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   445
    (\<forall>s u. finite s \<and> s \<noteq> {} \<and> s \<subseteq> V \<and> setsum u s = 1 \<longrightarrow> (setsum (\<lambda>x. (u x) *\<^sub>R x)) s \<in> V)"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   446
  unfolding affine_def
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   447
  apply rule
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   448
  apply(rule, rule, rule)
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
   449
  apply(erule conjE)+
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   450
  defer
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   451
  apply (rule, rule, rule, rule, rule)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   452
proof -
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   453
  fix x y u v
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   454
  assume as: "x \<in> V" "y \<in> V" "u + v = (1::real)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   455
    "\<forall>s u. finite s \<and> s \<noteq> {} \<and> s \<subseteq> V \<and> setsum u s = 1 \<longrightarrow> (\<Sum>x\<in>s. u x *\<^sub>R x) \<in> V"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   456
  then show "u *\<^sub>R x + v *\<^sub>R y \<in> V"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   457
    apply (cases "x = y")
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   458
    using as(4)[THEN spec[where x="{x,y}"], THEN spec[where x="\<lambda>w. if w = x then u else v"]]
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   459
      and as(1-3)
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   460
    apply (auto simp add: scaleR_left_distrib[symmetric])
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   461
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   462
next
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   463
  fix s u
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   464
  assume as: "\<forall>x\<in>V. \<forall>y\<in>V. \<forall>u v. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> V"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   465
    "finite s" "s \<noteq> {}" "s \<subseteq> V" "setsum u s = (1::real)"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
   466
  define n where "n = card s"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   467
  have "card s = 0 \<or> card s = 1 \<or> card s = 2 \<or> card s > 2" by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   468
  then show "(\<Sum>x\<in>s. u x *\<^sub>R x) \<in> V"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   469
  proof (auto simp only: disjE)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   470
    assume "card s = 2"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   471
    then have "card s = Suc (Suc 0)"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   472
      by auto
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   473
    then obtain a b where "s = {a, b}"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   474
      unfolding card_Suc_eq by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   475
    then show ?thesis
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   476
      using as(1)[THEN bspec[where x=a], THEN bspec[where x=b]] using as(4,5)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   477
      by (auto simp add: setsum_clauses(2))
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   478
  next
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   479
    assume "card s > 2"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   480
    then show ?thesis using as and n_def
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   481
    proof (induct n arbitrary: u s)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   482
      case 0
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   483
      then show ?case by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   484
    next
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   485
      case (Suc n)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   486
      fix s :: "'a set" and u :: "'a \<Rightarrow> real"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   487
      assume IA:
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   488
        "\<And>u s.  \<lbrakk>2 < card s; \<forall>x\<in>V. \<forall>y\<in>V. \<forall>u v. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> V; finite s;
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   489
          s \<noteq> {}; s \<subseteq> V; setsum u s = 1; n = card s \<rbrakk> \<Longrightarrow> (\<Sum>x\<in>s. u x *\<^sub>R x) \<in> V"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   490
        and as:
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   491
          "Suc n = card s" "2 < card s" "\<forall>x\<in>V. \<forall>y\<in>V. \<forall>u v. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> V"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   492
           "finite s" "s \<noteq> {}" "s \<subseteq> V" "setsum u s = 1"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   493
      have "\<exists>x\<in>s. u x \<noteq> 1"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   494
      proof (rule ccontr)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   495
        assume "\<not> ?thesis"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   496
        then have "setsum u s = real_of_nat (card s)"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   497
          unfolding card_eq_setsum by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   498
        then show False
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
   499
          using as(7) and \<open>card s > 2\<close>
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   500
          by (metis One_nat_def less_Suc0 Zero_not_Suc of_nat_1 of_nat_eq_iff numeral_2_eq_2)
45498
2dc373f1867a avoid numeral-representation-specific rules in metis proof
huffman
parents: 45051
diff changeset
   501
      qed
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   502
      then obtain x where x:"x \<in> s" "u x \<noteq> 1" by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   503
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   504
      have c: "card (s - {x}) = card s - 1"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   505
        apply (rule card_Diff_singleton)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
   506
        using \<open>x\<in>s\<close> as(4)
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   507
        apply auto
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   508
        done
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   509
      have *: "s = insert x (s - {x})" "finite (s - {x})"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
   510
        using \<open>x\<in>s\<close> and as(4) by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   511
      have **: "setsum u (s - {x}) = 1 - u x"
49530
wenzelm
parents: 49529
diff changeset
   512
        using setsum_clauses(2)[OF *(2), of u x, unfolded *(1)[symmetric] as(7)] by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   513
      have ***: "inverse (1 - u x) * setsum u (s - {x}) = 1"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
   514
        unfolding ** using \<open>u x \<noteq> 1\<close> by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   515
      have "(\<Sum>xa\<in>s - {x}. (inverse (1 - u x) * u xa) *\<^sub>R xa) \<in> V"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   516
      proof (cases "card (s - {x}) > 2")
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   517
        case True
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   518
        then have "s - {x} \<noteq> {}" "card (s - {x}) = n"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   519
          unfolding c and as(1)[symmetric]
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
   520
        proof (rule_tac ccontr)
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   521
          assume "\<not> s - {x} \<noteq> {}"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
   522
          then have "card (s - {x}) = 0" unfolding card_0_eq[OF *(2)] by simp
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   523
          then show False using True by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   524
        qed auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   525
        then show ?thesis
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   526
          apply (rule_tac IA[of "s - {x}" "\<lambda>y. (inverse (1 - u x) * u y)"])
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   527
          unfolding setsum_right_distrib[symmetric]
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   528
          using as and *** and True
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   529
          apply auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   530
          done
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   531
      next
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   532
        case False
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   533
        then have "card (s - {x}) = Suc (Suc 0)"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   534
          using as(2) and c by auto
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   535
        then obtain a b where "(s - {x}) = {a, b}" "a\<noteq>b"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   536
          unfolding card_Suc_eq by auto
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   537
        then show ?thesis
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   538
          using as(3)[THEN bspec[where x=a], THEN bspec[where x=b]]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
   539
          using *** *(2) and \<open>s \<subseteq> V\<close>
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   540
          unfolding setsum_right_distrib
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   541
          by (auto simp add: setsum_clauses(2))
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   542
      qed
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   543
      then have "u x + (1 - u x) = 1 \<Longrightarrow>
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   544
          u x *\<^sub>R x + (1 - u x) *\<^sub>R ((\<Sum>xa\<in>s - {x}. u xa *\<^sub>R xa) /\<^sub>R (1 - u x)) \<in> V"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   545
        apply -
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   546
        apply (rule as(3)[rule_format])
51524
7cb5ac44ca9e rename RealVector.thy to Real_Vector_Spaces.thy
hoelzl
parents: 51480
diff changeset
   547
        unfolding  Real_Vector_Spaces.scaleR_right.setsum
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   548
        using x(1) as(6)
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   549
        apply auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   550
        done
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   551
      then show "(\<Sum>x\<in>s. u x *\<^sub>R x) \<in> V"
49530
wenzelm
parents: 49529
diff changeset
   552
        unfolding scaleR_scaleR[symmetric] and scaleR_right.setsum [symmetric]
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   553
        apply (subst *)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   554
        unfolding setsum_clauses(2)[OF *(2)]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
   555
        using \<open>u x \<noteq> 1\<close>
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   556
        apply auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   557
        done
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   558
    qed
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   559
  next
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   560
    assume "card s = 1"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   561
    then obtain a where "s={a}"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   562
      by (auto simp add: card_Suc_eq)
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   563
    then show ?thesis
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   564
      using as(4,5) by simp
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
   565
  qed (insert \<open>s\<noteq>{}\<close> \<open>finite s\<close>, auto)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   566
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   567
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   568
lemma affine_hull_explicit:
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   569
  "affine hull p =
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   570
    {y. \<exists>s u. finite s \<and> s \<noteq> {} \<and> s \<subseteq> p \<and> setsum u s = 1 \<and> setsum (\<lambda>v. (u v) *\<^sub>R v) s = y}"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   571
  apply (rule hull_unique)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   572
  apply (subst subset_eq)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   573
  prefer 3
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   574
  apply rule
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   575
  unfolding mem_Collect_eq
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   576
  apply (erule exE)+
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   577
  apply (erule conjE)+
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   578
  prefer 2
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   579
  apply rule
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   580
proof -
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   581
  fix x
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   582
  assume "x\<in>p"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   583
  then show "\<exists>s u. finite s \<and> s \<noteq> {} \<and> s \<subseteq> p \<and> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = x"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   584
    apply (rule_tac x="{x}" in exI)
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   585
    apply (rule_tac x="\<lambda>x. 1" in exI)
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   586
    apply auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   587
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   588
next
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   589
  fix t x s u
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   590
  assume as: "p \<subseteq> t" "affine t" "finite s" "s \<noteq> {}"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   591
    "s \<subseteq> p" "setsum u s = 1" "(\<Sum>v\<in>s. u v *\<^sub>R v) = x"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   592
  then show "x \<in> t"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   593
    using as(2)[unfolded affine, THEN spec[where x=s], THEN spec[where x=u]]
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   594
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   595
next
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   596
  show "affine {y. \<exists>s u. finite s \<and> s \<noteq> {} \<and> s \<subseteq> p \<and> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = y}"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   597
    unfolding affine_def
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   598
    apply (rule, rule, rule, rule, rule)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   599
    unfolding mem_Collect_eq
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   600
  proof -
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   601
    fix u v :: real
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   602
    assume uv: "u + v = 1"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   603
    fix x
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   604
    assume "\<exists>s u. finite s \<and> s \<noteq> {} \<and> s \<subseteq> p \<and> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = x"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   605
    then obtain sx ux where
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   606
      x: "finite sx" "sx \<noteq> {}" "sx \<subseteq> p" "setsum ux sx = 1" "(\<Sum>v\<in>sx. ux v *\<^sub>R v) = x"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   607
      by auto
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   608
    fix y
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   609
    assume "\<exists>s u. finite s \<and> s \<noteq> {} \<and> s \<subseteq> p \<and> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = y"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   610
    then obtain sy uy where
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   611
      y: "finite sy" "sy \<noteq> {}" "sy \<subseteq> p" "setsum uy sy = 1" "(\<Sum>v\<in>sy. uy v *\<^sub>R v) = y" by auto
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   612
    have xy: "finite (sx \<union> sy)"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   613
      using x(1) y(1) by auto
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   614
    have **: "(sx \<union> sy) \<inter> sx = sx" "(sx \<union> sy) \<inter> sy = sy"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   615
      by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   616
    show "\<exists>s ua. finite s \<and> s \<noteq> {} \<and> s \<subseteq> p \<and>
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   617
        setsum ua s = 1 \<and> (\<Sum>v\<in>s. ua v *\<^sub>R v) = u *\<^sub>R x + v *\<^sub>R y"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   618
      apply (rule_tac x="sx \<union> sy" in exI)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   619
      apply (rule_tac x="\<lambda>a. (if a\<in>sx then u * ux a else 0) + (if a\<in>sy then v * uy a else 0)" in exI)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
   620
      unfolding scaleR_left_distrib setsum.distrib if_smult scaleR_zero_left
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
   621
        ** setsum.inter_restrict[OF xy, symmetric]
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   622
      unfolding scaleR_scaleR[symmetric] Real_Vector_Spaces.scaleR_right.setsum [symmetric]
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   623
        and setsum_right_distrib[symmetric]
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   624
      unfolding x y
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   625
      using x(1-3) y(1-3) uv
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   626
      apply simp
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   627
      done
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   628
  qed
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   629
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   630
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   631
lemma affine_hull_finite:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   632
  assumes "finite s"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   633
  shows "affine hull s = {y. \<exists>u. setsum u s = 1 \<and> setsum (\<lambda>v. u v *\<^sub>R v) s = y}"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   634
  unfolding affine_hull_explicit and set_eq_iff and mem_Collect_eq
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   635
  apply (rule, rule)
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   636
  apply (erule exE)+
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   637
  apply (erule conjE)+
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   638
  defer
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   639
  apply (erule exE)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   640
  apply (erule conjE)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   641
proof -
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   642
  fix x u
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   643
  assume "setsum u s = 1" "(\<Sum>v\<in>s. u v *\<^sub>R v) = x"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   644
  then show "\<exists>sa u. finite sa \<and>
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   645
      \<not> (\<forall>x. (x \<in> sa) = (x \<in> {})) \<and> sa \<subseteq> s \<and> setsum u sa = 1 \<and> (\<Sum>v\<in>sa. u v *\<^sub>R v) = x"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   646
    apply (rule_tac x=s in exI, rule_tac x=u in exI)
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   647
    using assms
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   648
    apply auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   649
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   650
next
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   651
  fix x t u
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   652
  assume "t \<subseteq> s"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   653
  then have *: "s \<inter> t = t"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   654
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   655
  assume "finite t" "\<not> (\<forall>x. (x \<in> t) = (x \<in> {}))" "setsum u t = 1" "(\<Sum>v\<in>t. u v *\<^sub>R v) = x"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   656
  then show "\<exists>u. setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = x"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   657
    apply (rule_tac x="\<lambda>x. if x\<in>t then u x else 0" in exI)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
   658
    unfolding if_smult scaleR_zero_left and setsum.inter_restrict[OF assms, symmetric] and *
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   659
    apply auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   660
    done
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   661
qed
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   662
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   663
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
   664
subsubsection \<open>Stepping theorems and hence small special cases\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   665
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   666
lemma affine_hull_empty[simp]: "affine hull {} = {}"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   667
  by (rule hull_unique) auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   668
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   669
lemma affine_hull_finite_step:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   670
  fixes y :: "'a::real_vector"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   671
  shows
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   672
    "(\<exists>u. setsum u {} = w \<and> setsum (\<lambda>x. u x *\<^sub>R x) {} = y) \<longleftrightarrow> w = 0 \<and> y = 0" (is ?th1)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   673
    and
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   674
    "finite s \<Longrightarrow>
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   675
      (\<exists>u. setsum u (insert a s) = w \<and> setsum (\<lambda>x. u x *\<^sub>R x) (insert a s) = y) \<longleftrightarrow>
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   676
      (\<exists>v u. setsum u s = w - v \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y - v *\<^sub>R a)" (is "_ \<Longrightarrow> ?lhs = ?rhs")
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   677
proof -
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   678
  show ?th1 by simp
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   679
  assume fin: "finite s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   680
  show "?lhs = ?rhs"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   681
  proof
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   682
    assume ?lhs
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   683
    then obtain u where u: "setsum u (insert a s) = w \<and> (\<Sum>x\<in>insert a s. u x *\<^sub>R x) = y"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   684
      by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   685
    show ?rhs
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   686
    proof (cases "a \<in> s")
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   687
      case True
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   688
      then have *: "insert a s = s" by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   689
      show ?thesis
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   690
        using u[unfolded *]
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   691
        apply(rule_tac x=0 in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   692
        apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   693
        done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   694
    next
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   695
      case False
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   696
      then show ?thesis
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   697
        apply (rule_tac x="u a" in exI)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   698
        using u and fin
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   699
        apply auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   700
        done
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   701
    qed
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   702
  next
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   703
    assume ?rhs
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   704
    then obtain v u where vu: "setsum u s = w - v"  "(\<Sum>x\<in>s. u x *\<^sub>R x) = y - v *\<^sub>R a"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   705
      by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   706
    have *: "\<And>x M. (if x = a then v else M) *\<^sub>R x = (if x = a then v *\<^sub>R x else M *\<^sub>R x)"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   707
      by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   708
    show ?lhs
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   709
    proof (cases "a \<in> s")
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   710
      case True
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   711
      then show ?thesis
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   712
        apply (rule_tac x="\<lambda>x. (if x=a then v else 0) + u x" in exI)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   713
        unfolding setsum_clauses(2)[OF fin]
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   714
        apply simp
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
   715
        unfolding scaleR_left_distrib and setsum.distrib
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   716
        unfolding vu and * and scaleR_zero_left
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
   717
        apply (auto simp add: setsum.delta[OF fin])
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   718
        done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   719
    next
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
   720
      case False
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   721
      then have **:
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   722
        "\<And>x. x \<in> s \<Longrightarrow> u x = (if x = a then v else u x)"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   723
        "\<And>x. x \<in> s \<Longrightarrow> u x *\<^sub>R x = (if x = a then v *\<^sub>R x else u x *\<^sub>R x)" by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   724
      from False show ?thesis
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   725
        apply (rule_tac x="\<lambda>x. if x=a then v else u x" in exI)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   726
        unfolding setsum_clauses(2)[OF fin] and * using vu
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
   727
        using setsum.cong [of s _ "\<lambda>x. u x *\<^sub>R x" "\<lambda>x. if x = a then v *\<^sub>R x else u x *\<^sub>R x", OF _ **(2)]
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
   728
        using setsum.cong [of s _ u "\<lambda>x. if x = a then v else u x", OF _ **(1)]
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   729
        apply auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   730
        done
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   731
    qed
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   732
  qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   733
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   734
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   735
lemma affine_hull_2:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   736
  fixes a b :: "'a::real_vector"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   737
  shows "affine hull {a,b} = {u *\<^sub>R a + v *\<^sub>R b| u v. (u + v = 1)}"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   738
  (is "?lhs = ?rhs")
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   739
proof -
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   740
  have *:
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
   741
    "\<And>x y z. z = x - y \<longleftrightarrow> y + z = (x::real)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   742
    "\<And>x y z. z = x - y \<longleftrightarrow> y + z = (x::'a)" by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   743
  have "?lhs = {y. \<exists>u. setsum u {a, b} = 1 \<and> (\<Sum>v\<in>{a, b}. u v *\<^sub>R v) = y}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   744
    using affine_hull_finite[of "{a,b}"] by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   745
  also have "\<dots> = {y. \<exists>v u. u b = 1 - v \<and> u b *\<^sub>R b = y - v *\<^sub>R a}"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   746
    by (simp add: affine_hull_finite_step(2)[of "{b}" a])
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   747
  also have "\<dots> = ?rhs" unfolding * by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   748
  finally show ?thesis by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   749
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   750
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   751
lemma affine_hull_3:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   752
  fixes a b c :: "'a::real_vector"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   753
  shows "affine hull {a,b,c} = { u *\<^sub>R a + v *\<^sub>R b + w *\<^sub>R c| u v w. u + v + w = 1}"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   754
proof -
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   755
  have *:
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
   756
    "\<And>x y z. z = x - y \<longleftrightarrow> y + z = (x::real)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   757
    "\<And>x y z. z = x - y \<longleftrightarrow> y + z = (x::'a)" by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   758
  show ?thesis
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   759
    apply (simp add: affine_hull_finite affine_hull_finite_step)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   760
    unfolding *
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   761
    apply auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   762
    apply (rule_tac x=v in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   763
    apply (rule_tac x=va in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   764
    apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   765
    apply (rule_tac x=u in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   766
    apply force
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   767
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   768
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   769
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   770
lemma mem_affine:
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   771
  assumes "affine S" "x \<in> S" "y \<in> S" "u + v = 1"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   772
  shows "u *\<^sub>R x + v *\<^sub>R y \<in> S"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   773
  using assms affine_def[of S] by auto
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   774
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   775
lemma mem_affine_3:
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   776
  assumes "affine S" "x \<in> S" "y \<in> S" "z \<in> S" "u + v + w = 1"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   777
  shows "u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> S"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   778
proof -
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   779
  have "u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> affine hull {x, y, z}"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   780
    using affine_hull_3[of x y z] assms by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   781
  moreover
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   782
  have "affine hull {x, y, z} \<subseteq> affine hull S"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   783
    using hull_mono[of "{x, y, z}" "S"] assms by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   784
  moreover
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   785
  have "affine hull S = S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   786
    using assms affine_hull_eq[of S] by auto
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
   787
  ultimately show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   788
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   789
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   790
lemma mem_affine_3_minus:
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   791
  assumes "affine S" "x \<in> S" "y \<in> S" "z \<in> S"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   792
  shows "x + v *\<^sub>R (y-z) \<in> S"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   793
  using mem_affine_3[of S x y z 1 v "-v"] assms
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   794
  by (simp add: algebra_simps)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   795
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
   796
corollary mem_affine_3_minus2:
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
   797
    "\<lbrakk>affine S; x \<in> S; y \<in> S; z \<in> S\<rbrakk> \<Longrightarrow> x - v *\<^sub>R (y-z) \<in> S"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
   798
  by (metis add_uminus_conv_diff mem_affine_3_minus real_vector.scale_minus_left)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
   799
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   800
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
   801
subsubsection \<open>Some relations between affine hull and subspaces\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   802
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   803
lemma affine_hull_insert_subset_span:
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   804
  "affine hull (insert a s) \<subseteq> {a + v| v . v \<in> span {x - a | x . x \<in> s}}"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   805
  unfolding subset_eq Ball_def
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   806
  unfolding affine_hull_explicit span_explicit mem_Collect_eq
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
   807
  apply (rule, rule)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
   808
  apply (erule exE)+
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
   809
  apply (erule conjE)+
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   810
proof -
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   811
  fix x t u
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   812
  assume as: "finite t" "t \<noteq> {}" "t \<subseteq> insert a s" "setsum u t = 1" "(\<Sum>v\<in>t. u v *\<^sub>R v) = x"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   813
  have "(\<lambda>x. x - a) ` (t - {a}) \<subseteq> {x - a |x. x \<in> s}"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   814
    using as(3) by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   815
  then show "\<exists>v. x = a + v \<and> (\<exists>S u. finite S \<and> S \<subseteq> {x - a |x. x \<in> s} \<and> (\<Sum>v\<in>S. u v *\<^sub>R v) = v)"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   816
    apply (rule_tac x="x - a" in exI)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   817
    apply (rule conjI, simp)
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   818
    apply (rule_tac x="(\<lambda>x. x - a) ` (t - {a})" in exI)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   819
    apply (rule_tac x="\<lambda>x. u (x + a)" in exI)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   820
    apply (rule conjI) using as(1) apply simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   821
    apply (erule conjI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   822
    using as(1)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
   823
    apply (simp add: setsum.reindex[unfolded inj_on_def] scaleR_right_diff_distrib
49530
wenzelm
parents: 49529
diff changeset
   824
      setsum_subtractf scaleR_left.setsum[symmetric] setsum_diff1 scaleR_left_diff_distrib)
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   825
    unfolding as
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   826
    apply simp
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   827
    done
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   828
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   829
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   830
lemma affine_hull_insert_span:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   831
  assumes "a \<notin> s"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   832
  shows "affine hull (insert a s) = {a + v | v . v \<in> span {x - a | x.  x \<in> s}}"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   833
  apply (rule, rule affine_hull_insert_subset_span)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   834
  unfolding subset_eq Ball_def
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   835
  unfolding affine_hull_explicit and mem_Collect_eq
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   836
proof (rule, rule, erule exE, erule conjE)
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
   837
  fix y v
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   838
  assume "y = a + v" "v \<in> span {x - a |x. x \<in> s}"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   839
  then obtain t u where obt: "finite t" "t \<subseteq> {x - a |x. x \<in> s}" "a + (\<Sum>v\<in>t. u v *\<^sub>R v) = y"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   840
    unfolding span_explicit by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
   841
  define f where "f = (\<lambda>x. x + a) ` t"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   842
  have f: "finite f" "f \<subseteq> s" "(\<Sum>v\<in>f. u (v - a) *\<^sub>R (v - a)) = y - a"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
   843
    unfolding f_def using obt by (auto simp add: setsum.reindex[unfolded inj_on_def])
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   844
  have *: "f \<inter> {a} = {}" "f \<inter> - {a} = f"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   845
    using f(2) assms by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   846
  show "\<exists>sa u. finite sa \<and> sa \<noteq> {} \<and> sa \<subseteq> insert a s \<and> setsum u sa = 1 \<and> (\<Sum>v\<in>sa. u v *\<^sub>R v) = y"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   847
    apply (rule_tac x = "insert a f" in exI)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   848
    apply (rule_tac x = "\<lambda>x. if x=a then 1 - setsum (\<lambda>x. u (x - a)) f else u (x - a)" in exI)
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   849
    using assms and f
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   850
    unfolding setsum_clauses(2)[OF f(1)] and if_smult
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
   851
    unfolding setsum.If_cases[OF f(1), of "\<lambda>x. x = a"]
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   852
    apply (auto simp add: setsum_subtractf scaleR_left.setsum algebra_simps *)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   853
    done
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   854
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   855
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   856
lemma affine_hull_span:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   857
  assumes "a \<in> s"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   858
  shows "affine hull s = {a + v | v. v \<in> span {x - a | x. x \<in> s - {a}}}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   859
  using affine_hull_insert_span[of a "s - {a}", unfolded insert_Diff[OF assms]] by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   860
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   861
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
   862
subsubsection \<open>Parallel affine sets\<close>
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   863
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
   864
definition affine_parallel :: "'a::real_vector set \<Rightarrow> 'a::real_vector set \<Rightarrow> bool"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   865
  where "affine_parallel S T \<longleftrightarrow> (\<exists>a. T = (\<lambda>x. a + x) ` S)"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   866
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   867
lemma affine_parallel_expl_aux:
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   868
  fixes S T :: "'a::real_vector set"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   869
  assumes "\<forall>x. x \<in> S \<longleftrightarrow> a + x \<in> T"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   870
  shows "T = (\<lambda>x. a + x) ` S"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   871
proof -
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   872
  {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   873
    fix x
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   874
    assume "x \<in> T"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   875
    then have "( - a) + x \<in> S"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   876
      using assms by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   877
    then have "x \<in> ((\<lambda>x. a + x) ` S)"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   878
      using imageI[of "-a+x" S "(\<lambda>x. a+x)"] by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   879
  }
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   880
  moreover have "T \<ge> (\<lambda>x. a + x) ` S"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   881
    using assms by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   882
  ultimately show ?thesis by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   883
qed
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   884
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   885
lemma affine_parallel_expl: "affine_parallel S T \<longleftrightarrow> (\<exists>a. \<forall>x. x \<in> S \<longleftrightarrow> a + x \<in> T)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   886
  unfolding affine_parallel_def
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   887
  using affine_parallel_expl_aux[of S _ T] by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   888
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   889
lemma affine_parallel_reflex: "affine_parallel S S"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   890
  unfolding affine_parallel_def
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   891
  apply (rule exI[of _ "0"])
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   892
  apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   893
  done
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   894
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   895
lemma affine_parallel_commut:
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   896
  assumes "affine_parallel A B"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   897
  shows "affine_parallel B A"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   898
proof -
54230
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 53676
diff changeset
   899
  from assms obtain a where B: "B = (\<lambda>x. a + x) ` A"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   900
    unfolding affine_parallel_def by auto
54230
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 53676
diff changeset
   901
  have [simp]: "(\<lambda>x. x - a) = plus (- a)" by (simp add: fun_eq_iff)
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 53676
diff changeset
   902
  from B show ?thesis
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   903
    using translation_galois [of B a A]
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   904
    unfolding affine_parallel_def by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   905
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   906
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   907
lemma affine_parallel_assoc:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   908
  assumes "affine_parallel A B"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   909
    and "affine_parallel B C"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
   910
  shows "affine_parallel A C"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   911
proof -
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   912
  from assms obtain ab where "B = (\<lambda>x. ab + x) ` A"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
   913
    unfolding affine_parallel_def by auto
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
   914
  moreover
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   915
  from assms obtain bc where "C = (\<lambda>x. bc + x) ` B"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   916
    unfolding affine_parallel_def by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   917
  ultimately show ?thesis
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   918
    using translation_assoc[of bc ab A] unfolding affine_parallel_def by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   919
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   920
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   921
lemma affine_translation_aux:
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   922
  fixes a :: "'a::real_vector"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   923
  assumes "affine ((\<lambda>x. a + x) ` S)"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   924
  shows "affine S"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   925
proof -
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   926
  {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   927
    fix x y u v
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   928
    assume xy: "x \<in> S" "y \<in> S" "(u :: real) + v = 1"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   929
    then have "(a + x) \<in> ((\<lambda>x. a + x) ` S)" "(a + y) \<in> ((\<lambda>x. a + x) ` S)"
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   930
      by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   931
    then have h1: "u *\<^sub>R  (a + x) + v *\<^sub>R (a + y) \<in> (\<lambda>x. a + x) ` S"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   932
      using xy assms unfolding affine_def by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   933
    have "u *\<^sub>R (a + x) + v *\<^sub>R (a + y) = (u + v) *\<^sub>R a + (u *\<^sub>R x + v *\<^sub>R y)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   934
      by (simp add: algebra_simps)
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   935
    also have "\<dots> = a + (u *\<^sub>R x + v *\<^sub>R y)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
   936
      using \<open>u + v = 1\<close> by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   937
    ultimately have "a + (u *\<^sub>R x + v *\<^sub>R y) \<in> (\<lambda>x. a + x) ` S"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   938
      using h1 by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   939
    then have "u *\<^sub>R x + v *\<^sub>R y : S" by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   940
  }
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   941
  then show ?thesis unfolding affine_def by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   942
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   943
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   944
lemma affine_translation:
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   945
  fixes a :: "'a::real_vector"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   946
  shows "affine S \<longleftrightarrow> affine ((\<lambda>x. a + x) ` S)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   947
proof -
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   948
  have "affine S \<Longrightarrow> affine ((\<lambda>x. a + x) ` S)"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   949
    using affine_translation_aux[of "-a" "((\<lambda>x. a + x) ` S)"]
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   950
    using translation_assoc[of "-a" a S] by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   951
  then show ?thesis using affine_translation_aux by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   952
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   953
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   954
lemma parallel_is_affine:
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   955
  fixes S T :: "'a::real_vector set"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   956
  assumes "affine S" "affine_parallel S T"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   957
  shows "affine T"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   958
proof -
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   959
  from assms obtain a where "T = (\<lambda>x. a + x) ` S"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
   960
    unfolding affine_parallel_def by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   961
  then show ?thesis
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   962
    using affine_translation assms by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   963
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   964
44361
75ec83d45303 remove unnecessary euclidean_space class constraints
huffman
parents: 44349
diff changeset
   965
lemma subspace_imp_affine: "subspace s \<Longrightarrow> affine s"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   966
  unfolding subspace_def affine_def by auto
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   967
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   968
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
   969
subsubsection \<open>Subspace parallel to an affine set\<close>
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
   970
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   971
lemma subspace_affine: "subspace S \<longleftrightarrow> affine S \<and> 0 \<in> S"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   972
proof -
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   973
  have h0: "subspace S \<Longrightarrow> affine S \<and> 0 \<in> S"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   974
    using subspace_imp_affine[of S] subspace_0 by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   975
  {
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   976
    assume assm: "affine S \<and> 0 \<in> S"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   977
    {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   978
      fix c :: real
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
   979
      fix x
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
   980
      assume x: "x \<in> S"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   981
      have "c *\<^sub>R x = (1-c) *\<^sub>R 0 + c *\<^sub>R x" by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   982
      moreover
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
   983
      have "(1 - c) *\<^sub>R 0 + c *\<^sub>R x \<in> S"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
   984
        using affine_alt[of S] assm x by auto
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   985
      ultimately have "c *\<^sub>R x \<in> S" by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   986
    }
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
   987
    then have h1: "\<forall>c. \<forall>x \<in> S. c *\<^sub>R x \<in> S" by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   988
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   989
    {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   990
      fix x y
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
   991
      assume xy: "x \<in> S" "y \<in> S"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
   992
      define u where "u = (1 :: real)/2"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   993
      have "(1/2) *\<^sub>R (x+y) = (1/2) *\<^sub>R (x+y)"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   994
        by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   995
      moreover
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   996
      have "(1/2) *\<^sub>R (x+y)=(1/2) *\<^sub>R x + (1-(1/2)) *\<^sub>R y"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
   997
        by (simp add: algebra_simps)
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
   998
      moreover
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
   999
      have "(1 - u) *\<^sub>R x + u *\<^sub>R y \<in> S"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  1000
        using affine_alt[of S] assm xy by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1001
      ultimately
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
  1002
      have "(1/2) *\<^sub>R (x+y) \<in> S"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1003
        using u_def by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1004
      moreover
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  1005
      have "x + y = 2 *\<^sub>R ((1/2) *\<^sub>R (x+y))"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1006
        by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1007
      ultimately
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  1008
      have "x + y \<in> S"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1009
        using h1[rule_format, of "(1/2) *\<^sub>R (x+y)" "2"] by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1010
    }
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1011
    then have "\<forall>x \<in> S. \<forall>y \<in> S. x + y \<in> S"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1012
      by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1013
    then have "subspace S"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1014
      using h1 assm unfolding subspace_def by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1015
  }
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1016
  then show ?thesis using h0 by metis
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1017
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1018
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1019
lemma affine_diffs_subspace:
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
  1020
  assumes "affine S" "a \<in> S"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1021
  shows "subspace ((\<lambda>x. (-a)+x) ` S)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1022
proof -
54230
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 53676
diff changeset
  1023
  have [simp]: "(\<lambda>x. x - a) = plus (- a)" by (simp add: fun_eq_iff)
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1024
  have "affine ((\<lambda>x. (-a)+x) ` S)"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  1025
    using  affine_translation assms by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1026
  moreover have "0 : ((\<lambda>x. (-a)+x) ` S)"
53333
e9dba6602a84 tuned proofs;
wenzelm
parents: 53302
diff changeset
  1027
    using assms exI[of "(\<lambda>x. x\<in>S \<and> -a+x = 0)" a] by auto
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  1028
  ultimately show ?thesis using subspace_affine by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1029
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1030
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1031
lemma parallel_subspace_explicit:
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  1032
  assumes "affine S"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  1033
    and "a \<in> S"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  1034
  assumes "L \<equiv> {y. \<exists>x \<in> S. (-a) + x = y}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  1035
  shows "subspace L \<and> affine_parallel S L"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1036
proof -
54230
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 53676
diff changeset
  1037
  from assms have "L = plus (- a) ` S" by auto
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 53676
diff changeset
  1038
  then have par: "affine_parallel S L"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  1039
    unfolding affine_parallel_def ..
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  1040
  then have "affine L" using assms parallel_is_affine by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1041
  moreover have "0 \<in> L"
54230
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 53676
diff changeset
  1042
    using assms by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1043
  ultimately show ?thesis
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1044
    using subspace_affine par by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1045
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1046
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1047
lemma parallel_subspace_aux:
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1048
  assumes "subspace A"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1049
    and "subspace B"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1050
    and "affine_parallel A B"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1051
  shows "A \<supseteq> B"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1052
proof -
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  1053
  from assms obtain a where a: "\<forall>x. x \<in> A \<longleftrightarrow> a + x \<in> B"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1054
    using affine_parallel_expl[of A B] by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1055
  then have "-a \<in> A"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1056
    using assms subspace_0[of B] by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1057
  then have "a \<in> A"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1058
    using assms subspace_neg[of A "-a"] by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1059
  then show ?thesis
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  1060
    using assms a unfolding subspace_def by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1061
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1062
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1063
lemma parallel_subspace:
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1064
  assumes "subspace A"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1065
    and "subspace B"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1066
    and "affine_parallel A B"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1067
  shows "A = B"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1068
proof
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1069
  show "A \<supseteq> B"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1070
    using assms parallel_subspace_aux by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1071
  show "A \<subseteq> B"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1072
    using assms parallel_subspace_aux[of B A] affine_parallel_commut by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1073
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1074
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1075
lemma affine_parallel_subspace:
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1076
  assumes "affine S" "S \<noteq> {}"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1077
  shows "\<exists>!L. subspace L \<and> affine_parallel S L"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1078
proof -
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1079
  have ex: "\<exists>L. subspace L \<and> affine_parallel S L"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  1080
    using assms parallel_subspace_explicit by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1081
  {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1082
    fix L1 L2
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1083
    assume ass: "subspace L1 \<and> affine_parallel S L1" "subspace L2 \<and> affine_parallel S L2"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1084
    then have "affine_parallel L1 L2"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1085
      using affine_parallel_commut[of S L1] affine_parallel_assoc[of L1 S L2] by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1086
    then have "L1 = L2"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1087
      using ass parallel_subspace by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1088
  }
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1089
  then show ?thesis using ex by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1090
qed
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1091
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1092
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1093
subsection \<open>Cones\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1094
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1095
definition cone :: "'a::real_vector set \<Rightarrow> bool"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1096
  where "cone s \<longleftrightarrow> (\<forall>x\<in>s. \<forall>c\<ge>0. c *\<^sub>R x \<in> s)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1097
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1098
lemma cone_empty[intro, simp]: "cone {}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1099
  unfolding cone_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1100
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1101
lemma cone_univ[intro, simp]: "cone UNIV"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1102
  unfolding cone_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1103
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1104
lemma cone_Inter[intro]: "\<forall>s\<in>f. cone s \<Longrightarrow> cone (\<Inter>f)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1105
  unfolding cone_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1106
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  1107
lemma subspace_imp_cone: "subspace S \<Longrightarrow> cone S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  1108
  by (simp add: cone_def subspace_mul)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  1109
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1110
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1111
subsubsection \<open>Conic hull\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1112
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1113
lemma cone_cone_hull: "cone (cone hull s)"
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44142
diff changeset
  1114
  unfolding hull_def by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1115
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1116
lemma cone_hull_eq: "cone hull s = s \<longleftrightarrow> cone s"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1117
  apply (rule hull_eq)
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1118
  using cone_Inter
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1119
  unfolding subset_eq
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1120
  apply auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1121
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1122
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1123
lemma mem_cone:
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1124
  assumes "cone S" "x \<in> S" "c \<ge> 0"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1125
  shows "c *\<^sub>R x : S"
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1126
  using assms cone_def[of S] by auto
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1127
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1128
lemma cone_contains_0:
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1129
  assumes "cone S"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1130
  shows "S \<noteq> {} \<longleftrightarrow> 0 \<in> S"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1131
proof -
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1132
  {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1133
    assume "S \<noteq> {}"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1134
    then obtain a where "a \<in> S" by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1135
    then have "0 \<in> S"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1136
      using assms mem_cone[of S a 0] by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1137
  }
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1138
  then show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1139
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1140
44361
75ec83d45303 remove unnecessary euclidean_space class constraints
huffman
parents: 44349
diff changeset
  1141
lemma cone_0: "cone {0}"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1142
  unfolding cone_def by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1143
61952
546958347e05 prefer symbols for "Union", "Inter";
wenzelm
parents: 61945
diff changeset
  1144
lemma cone_Union[intro]: "(\<forall>s\<in>f. cone s) \<longrightarrow> cone (\<Union>f)"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1145
  unfolding cone_def by blast
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1146
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1147
lemma cone_iff:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1148
  assumes "S \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1149
  shows "cone S \<longleftrightarrow> 0 \<in> S \<and> (\<forall>c. c > 0 \<longrightarrow> (op *\<^sub>R c) ` S = S)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1150
proof -
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1151
  {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1152
    assume "cone S"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1153
    {
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1154
      fix c :: real
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1155
      assume "c > 0"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1156
      {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1157
        fix x
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1158
        assume "x \<in> S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1159
        then have "x \<in> (op *\<^sub>R c) ` S"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1160
          unfolding image_def
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1161
          using \<open>cone S\<close> \<open>c>0\<close> mem_cone[of S x "1/c"]
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  1162
            exI[of "(\<lambda>t. t \<in> S \<and> x = c *\<^sub>R t)" "(1 / c) *\<^sub>R x"]
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1163
          by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1164
      }
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1165
      moreover
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1166
      {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1167
        fix x
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1168
        assume "x \<in> (op *\<^sub>R c) ` S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1169
        then have "x \<in> S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1170
          using \<open>cone S\<close> \<open>c > 0\<close>
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1171
          unfolding cone_def image_def \<open>c > 0\<close> by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1172
      }
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1173
      ultimately have "(op *\<^sub>R c) ` S = S" by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1174
    }
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1175
    then have "0 \<in> S \<and> (\<forall>c. c > 0 \<longrightarrow> (op *\<^sub>R c) ` S = S)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1176
      using \<open>cone S\<close> cone_contains_0[of S] assms by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1177
  }
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1178
  moreover
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1179
  {
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1180
    assume a: "0 \<in> S \<and> (\<forall>c. c > 0 \<longrightarrow> (op *\<^sub>R c) ` S = S)"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1181
    {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1182
      fix x
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1183
      assume "x \<in> S"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1184
      fix c1 :: real
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1185
      assume "c1 \<ge> 0"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1186
      then have "c1 = 0 \<or> c1 > 0" by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1187
      then have "c1 *\<^sub>R x \<in> S" using a \<open>x \<in> S\<close> by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1188
    }
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1189
    then have "cone S" unfolding cone_def by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1190
  }
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1191
  ultimately show ?thesis by blast
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1192
qed
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1193
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1194
lemma cone_hull_empty: "cone hull {} = {}"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1195
  by (metis cone_empty cone_hull_eq)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1196
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1197
lemma cone_hull_empty_iff: "S = {} \<longleftrightarrow> cone hull S = {}"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1198
  by (metis bot_least cone_hull_empty hull_subset xtrans(5))
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1199
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1200
lemma cone_hull_contains_0: "S \<noteq> {} \<longleftrightarrow> 0 \<in> cone hull S"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1201
  using cone_cone_hull[of S] cone_contains_0[of "cone hull S"] cone_hull_empty_iff[of S]
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1202
  by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1203
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1204
lemma mem_cone_hull:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1205
  assumes "x \<in> S" "c \<ge> 0"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1206
  shows "c *\<^sub>R x \<in> cone hull S"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1207
  by (metis assms cone_cone_hull hull_inc mem_cone)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1208
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1209
lemma cone_hull_expl: "cone hull S = {c *\<^sub>R x | c x. c \<ge> 0 \<and> x \<in> S}"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1210
  (is "?lhs = ?rhs")
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1211
proof -
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1212
  {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1213
    fix x
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1214
    assume "x \<in> ?rhs"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  1215
    then obtain cx :: real and xx where x: "x = cx *\<^sub>R xx" "cx \<ge> 0" "xx \<in> S"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1216
      by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1217
    fix c :: real
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1218
    assume c: "c \<ge> 0"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1219
    then have "c *\<^sub>R x = (c * cx) *\<^sub>R xx"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  1220
      using x by (simp add: algebra_simps)
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1221
    moreover
56536
aefb4a8da31f made mult_nonneg_nonneg a simp rule
nipkow
parents: 56480
diff changeset
  1222
    have "c * cx \<ge> 0" using c x by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1223
    ultimately
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  1224
    have "c *\<^sub>R x \<in> ?rhs" using x by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1225
  }
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1226
  then have "cone ?rhs"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1227
    unfolding cone_def by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1228
  then have "?rhs \<in> Collect cone"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1229
    unfolding mem_Collect_eq by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1230
  {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1231
    fix x
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1232
    assume "x \<in> S"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1233
    then have "1 *\<^sub>R x \<in> ?rhs"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  1234
      apply auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1235
      apply (rule_tac x = 1 in exI)
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1236
      apply auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1237
      done
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1238
    then have "x \<in> ?rhs" by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1239
  }
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1240
  then have "S \<subseteq> ?rhs" by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1241
  then have "?lhs \<subseteq> ?rhs"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1242
    using \<open>?rhs \<in> Collect cone\<close> hull_minimal[of S "?rhs" "cone"] by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1243
  moreover
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1244
  {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1245
    fix x
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1246
    assume "x \<in> ?rhs"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  1247
    then obtain cx :: real and xx where x: "x = cx *\<^sub>R xx" "cx \<ge> 0" "xx \<in> S"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1248
      by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1249
    then have "xx \<in> cone hull S"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1250
      using hull_subset[of S] by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1251
    then have "x \<in> ?lhs"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  1252
      using x cone_cone_hull[of S] cone_def[of "cone hull S"] by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1253
  }
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1254
  ultimately show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1255
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1256
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1257
lemma cone_closure:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1258
  fixes S :: "'a::real_normed_vector set"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1259
  assumes "cone S"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1260
  shows "cone (closure S)"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1261
proof (cases "S = {}")
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1262
  case True
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1263
  then show ?thesis by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1264
next
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1265
  case False
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1266
  then have "0 \<in> S \<and> (\<forall>c. c > 0 \<longrightarrow> op *\<^sub>R c ` S = S)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1267
    using cone_iff[of S] assms by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1268
  then have "0 \<in> closure S \<and> (\<forall>c. c > 0 \<longrightarrow> op *\<^sub>R c ` closure S = closure S)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1269
    using closure_subset by (auto simp add: closure_scaleR)
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1270
  then show ?thesis
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
  1271
    using False cone_iff[of "closure S"] by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1272
qed
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1273
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1274
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1275
subsection \<open>Affine dependence and consequential theorems (from Lars Schewe)\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1276
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1277
definition affine_dependent :: "'a::real_vector set \<Rightarrow> bool"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1278
  where "affine_dependent s \<longleftrightarrow> (\<exists>x\<in>s. x \<in> affine hull (s - {x}))"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1279
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1280
lemma affine_dependent_subset:
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1281
   "\<lbrakk>affine_dependent s; s \<subseteq> t\<rbrakk> \<Longrightarrow> affine_dependent t"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1282
apply (simp add: affine_dependent_def Bex_def)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1283
apply (blast dest: hull_mono [OF Diff_mono [OF _ subset_refl]])
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1284
done
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1285
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1286
lemma affine_independent_subset:
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1287
  shows "\<lbrakk>~ affine_dependent t; s \<subseteq> t\<rbrakk> \<Longrightarrow> ~ affine_dependent s"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1288
by (metis affine_dependent_subset)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1289
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1290
lemma affine_independent_Diff:
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1291
   "~ affine_dependent s \<Longrightarrow> ~ affine_dependent(s - t)"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1292
by (meson Diff_subset affine_dependent_subset)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1293
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1294
lemma affine_dependent_explicit:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1295
  "affine_dependent p \<longleftrightarrow>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1296
    (\<exists>s u. finite s \<and> s \<subseteq> p \<and> setsum u s = 0 \<and>
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1297
      (\<exists>v\<in>s. u v \<noteq> 0) \<and> setsum (\<lambda>v. u v *\<^sub>R v) s = 0)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1298
  unfolding affine_dependent_def affine_hull_explicit mem_Collect_eq
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1299
  apply rule
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1300
  apply (erule bexE, erule exE, erule exE)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1301
  apply (erule conjE)+
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1302
  defer
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1303
  apply (erule exE, erule exE)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1304
  apply (erule conjE)+
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1305
  apply (erule bexE)
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1306
proof -
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1307
  fix x s u
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1308
  assume as: "x \<in> p" "finite s" "s \<noteq> {}" "s \<subseteq> p - {x}" "setsum u s = 1" "(\<Sum>v\<in>s. u v *\<^sub>R v) = x"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1309
  have "x \<notin> s" using as(1,4) by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1310
  show "\<exists>s u. finite s \<and> s \<subseteq> p \<and> setsum u s = 0 \<and> (\<exists>v\<in>s. u v \<noteq> 0) \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = 0"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1311
    apply (rule_tac x="insert x s" in exI, rule_tac x="\<lambda>v. if v = x then - 1 else u v" in exI)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1312
    unfolding if_smult and setsum_clauses(2)[OF as(2)] and setsum_delta_notmem[OF \<open>x\<notin>s\<close>] and as
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1313
    using as
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1314
    apply auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1315
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1316
next
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1317
  fix s u v
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1318
  assume as: "finite s" "s \<subseteq> p" "setsum u s = 0" "(\<Sum>v\<in>s. u v *\<^sub>R v) = 0" "v \<in> s" "u v \<noteq> 0"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1319
  have "s \<noteq> {v}"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1320
    using as(3,6) by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1321
  then show "\<exists>x\<in>p. \<exists>s u. finite s \<and> s \<noteq> {} \<and> s \<subseteq> p - {x} \<and> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = x"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1322
    apply (rule_tac x=v in bexI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1323
    apply (rule_tac x="s - {v}" in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1324
    apply (rule_tac x="\<lambda>x. - (1 / u v) * u x" in exI)
49530
wenzelm
parents: 49529
diff changeset
  1325
    unfolding scaleR_scaleR[symmetric] and scaleR_right.setsum [symmetric]
wenzelm
parents: 49529
diff changeset
  1326
    unfolding setsum_right_distrib[symmetric] and setsum_diff1[OF as(1)]
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1327
    using as
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1328
    apply auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1329
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1330
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1331
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1332
lemma affine_dependent_explicit_finite:
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1333
  fixes s :: "'a::real_vector set"
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1334
  assumes "finite s"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1335
  shows "affine_dependent s \<longleftrightarrow>
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1336
    (\<exists>u. setsum u s = 0 \<and> (\<exists>v\<in>s. u v \<noteq> 0) \<and> setsum (\<lambda>v. u v *\<^sub>R v) s = 0)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1337
  (is "?lhs = ?rhs")
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1338
proof
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1339
  have *: "\<And>vt u v. (if vt then u v else 0) *\<^sub>R v = (if vt then (u v) *\<^sub>R v else 0::'a)"
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1340
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1341
  assume ?lhs
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1342
  then obtain t u v where
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1343
    "finite t" "t \<subseteq> s" "setsum u t = 0" "v\<in>t" "u v \<noteq> 0"  "(\<Sum>v\<in>t. u v *\<^sub>R v) = 0"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1344
    unfolding affine_dependent_explicit by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1345
  then show ?rhs
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1346
    apply (rule_tac x="\<lambda>x. if x\<in>t then u x else 0" in exI)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  1347
    apply auto unfolding * and setsum.inter_restrict[OF assms, symmetric]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1348
    unfolding Int_absorb1[OF \<open>t\<subseteq>s\<close>]
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1349
    apply auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1350
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1351
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1352
  assume ?rhs
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1353
  then obtain u v where "setsum u s = 0"  "v\<in>s" "u v \<noteq> 0" "(\<Sum>v\<in>s. u v *\<^sub>R v) = 0"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1354
    by auto
49529
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1355
  then show ?lhs unfolding affine_dependent_explicit
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1356
    using assms by auto
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1357
qed
d523702bdae7 tuned proofs;
wenzelm
parents: 47445
diff changeset
  1358
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1359
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1360
subsection \<open>Connectedness of convex sets\<close>
44465
fa56622bb7bc move connected_real_lemma to the one place it is used
huffman
parents: 44457
diff changeset
  1361
51480
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51475
diff changeset
  1362
lemma connectedD:
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51475
diff changeset
  1363
  "connected S \<Longrightarrow> open A \<Longrightarrow> open B \<Longrightarrow> S \<subseteq> A \<union> B \<Longrightarrow> A \<inter> B \<inter> S = {} \<Longrightarrow> A \<inter> S = {} \<or> B \<inter> S = {}"
61426
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61222
diff changeset
  1364
  by (rule Topological_Spaces.topological_space_class.connectedD)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1365
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1366
lemma convex_connected:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1367
  fixes s :: "'a::real_normed_vector set"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1368
  assumes "convex s"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1369
  shows "connected s"
51480
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51475
diff changeset
  1370
proof (rule connectedI)
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51475
diff changeset
  1371
  fix A B
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51475
diff changeset
  1372
  assume "open A" "open B" "A \<inter> B \<inter> s = {}" "s \<subseteq> A \<union> B"
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51475
diff changeset
  1373
  moreover
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51475
diff changeset
  1374
  assume "A \<inter> s \<noteq> {}" "B \<inter> s \<noteq> {}"
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51475
diff changeset
  1375
  then obtain a b where a: "a \<in> A" "a \<in> s" and b: "b \<in> B" "b \<in> s" by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  1376
  define f where [abs_def]: "f u = u *\<^sub>R a + (1 - u) *\<^sub>R b" for u
51480
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51475
diff changeset
  1377
  then have "continuous_on {0 .. 1} f"
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56369
diff changeset
  1378
    by (auto intro!: continuous_intros)
51480
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51475
diff changeset
  1379
  then have "connected (f ` {0 .. 1})"
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51475
diff changeset
  1380
    by (auto intro!: connected_continuous_image)
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51475
diff changeset
  1381
  note connectedD[OF this, of A B]
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51475
diff changeset
  1382
  moreover have "a \<in> A \<inter> f ` {0 .. 1}"
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51475
diff changeset
  1383
    using a by (auto intro!: image_eqI[of _ _ 1] simp: f_def)
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51475
diff changeset
  1384
  moreover have "b \<in> B \<inter> f ` {0 .. 1}"
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51475
diff changeset
  1385
    using b by (auto intro!: image_eqI[of _ _ 0] simp: f_def)
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51475
diff changeset
  1386
  moreover have "f ` {0 .. 1} \<subseteq> s"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1387
    using \<open>convex s\<close> a b unfolding convex_def f_def by auto
51480
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51475
diff changeset
  1388
  ultimately show False by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1389
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1390
61426
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61222
diff changeset
  1391
corollary connected_UNIV[intro]: "connected (UNIV :: 'a::real_normed_vector set)"
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61222
diff changeset
  1392
  by(simp add: convex_connected)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1393
62131
1baed43f453e nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
paulson
parents: 62097
diff changeset
  1394
proposition clopen:
1baed43f453e nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
paulson
parents: 62097
diff changeset
  1395
  fixes s :: "'a :: real_normed_vector set"
1baed43f453e nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
paulson
parents: 62097
diff changeset
  1396
  shows "closed s \<and> open s \<longleftrightarrow> s = {} \<or> s = UNIV"
1baed43f453e nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
paulson
parents: 62097
diff changeset
  1397
apply (rule iffI)
1baed43f453e nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
paulson
parents: 62097
diff changeset
  1398
 apply (rule connected_UNIV [unfolded connected_clopen, rule_format])
1baed43f453e nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
paulson
parents: 62097
diff changeset
  1399
 apply (force simp add: open_openin closed_closedin, force)
1baed43f453e nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
paulson
parents: 62097
diff changeset
  1400
done
1baed43f453e nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
paulson
parents: 62097
diff changeset
  1401
1baed43f453e nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
paulson
parents: 62097
diff changeset
  1402
corollary compact_open:
1baed43f453e nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
paulson
parents: 62097
diff changeset
  1403
  fixes s :: "'a :: euclidean_space set"
1baed43f453e nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
paulson
parents: 62097
diff changeset
  1404
  shows "compact s \<and> open s \<longleftrightarrow> s = {}"
1baed43f453e nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
paulson
parents: 62097
diff changeset
  1405
  by (auto simp: compact_eq_bounded_closed clopen)
1baed43f453e nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
paulson
parents: 62097
diff changeset
  1406
62948
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
  1407
corollary finite_imp_not_open:
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
  1408
    fixes S :: "'a::{real_normed_vector, perfect_space} set"
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
  1409
    shows "\<lbrakk>finite S; open S\<rbrakk> \<Longrightarrow> S={}"
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
  1410
  using clopen [of S] finite_imp_closed not_bounded_UNIV by blast
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
  1411
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1412
corollary empty_interior_finite:
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1413
    fixes S :: "'a::{real_normed_vector, perfect_space} set"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1414
    shows "finite S \<Longrightarrow> interior S = {}"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1415
  by (metis interior_subset finite_subset open_interior [of S] finite_imp_not_open)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  1416
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1417
text \<open>Balls, being convex, are connected.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1418
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  1419
lemma convex_prod:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1420
  assumes "\<And>i. i \<in> Basis \<Longrightarrow> convex {x. P i x}"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  1421
  shows "convex {x. \<forall>i\<in>Basis. P i (x\<bullet>i)}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  1422
  using assms unfolding convex_def
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  1423
  by (auto simp: inner_add_left)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  1424
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  1425
lemma convex_positive_orthant: "convex {x::'a::euclidean_space. (\<forall>i\<in>Basis. 0 \<le> x\<bullet>i)}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  1426
  by (rule convex_prod) (simp add: atLeast_def[symmetric] convex_real_interval)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1427
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1428
lemma convex_local_global_minimum:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1429
  fixes s :: "'a::real_normed_vector set"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1430
  assumes "e > 0"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1431
    and "convex_on s f"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1432
    and "ball x e \<subseteq> s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1433
    and "\<forall>y\<in>ball x e. f x \<le> f y"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1434
  shows "\<forall>y\<in>s. f x \<le> f y"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1435
proof (rule ccontr)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1436
  have "x \<in> s" using assms(1,3) by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1437
  assume "\<not> ?thesis"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1438
  then obtain y where "y\<in>s" and y: "f x > f y" by auto
62087
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 61952
diff changeset
  1439
  then have xy: "0 < dist x y"  by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1440
  then obtain u where "0 < u" "u \<le> 1" and u: "u < e / dist x y"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1441
    using real_lbound_gt_zero[of 1 "e / dist x y"] xy \<open>e>0\<close> by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1442
  then have "f ((1-u) *\<^sub>R x + u *\<^sub>R y) \<le> (1-u) * f x + u * f y"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1443
    using \<open>x\<in>s\<close> \<open>y\<in>s\<close>
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1444
    using assms(2)[unfolded convex_on_def,
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1445
      THEN bspec[where x=x], THEN bspec[where x=y], THEN spec[where x="1-u"]]
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1446
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1447
  moreover
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1448
  have *: "x - ((1 - u) *\<^sub>R x + u *\<^sub>R y) = u *\<^sub>R (x - y)"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1449
    by (simp add: algebra_simps)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1450
  have "(1 - u) *\<^sub>R x + u *\<^sub>R y \<in> ball x e"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1451
    unfolding mem_ball dist_norm
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1452
    unfolding * and norm_scaleR and abs_of_pos[OF \<open>0<u\<close>]
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1453
    unfolding dist_norm[symmetric]
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1454
    using u
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1455
    unfolding pos_less_divide_eq[OF xy]
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1456
    by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1457
  then have "f x \<le> f ((1 - u) *\<^sub>R x + u *\<^sub>R y)"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1458
    using assms(4) by auto
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1459
  ultimately show False
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1460
    using mult_strict_left_mono[OF y \<open>u>0\<close>]
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1461
    unfolding left_diff_distrib
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1462
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1463
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1464
60800
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  1465
lemma convex_ball [iff]:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1466
  fixes x :: "'a::real_normed_vector"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  1467
  shows "convex (ball x e)"
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1468
proof (auto simp add: convex_def)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1469
  fix y z
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1470
  assume yz: "dist x y < e" "dist x z < e"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1471
  fix u v :: real
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1472
  assume uv: "0 \<le> u" "0 \<le> v" "u + v = 1"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1473
  have "dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1474
    using uv yz
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1475
    using convex_on_dist [of "ball x e" x, unfolded convex_on_def,
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1476
      THEN bspec[where x=y], THEN bspec[where x=z]]
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1477
    by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1478
  then show "dist x (u *\<^sub>R y + v *\<^sub>R z) < e"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1479
    using convex_bound_lt[OF yz uv] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1480
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1481
60800
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  1482
lemma convex_cball [iff]:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1483
  fixes x :: "'a::real_normed_vector"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1484
  shows "convex (cball x e)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1485
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1486
  {
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1487
    fix y z
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1488
    assume yz: "dist x y \<le> e" "dist x z \<le> e"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1489
    fix u v :: real
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1490
    assume uv: "0 \<le> u" "0 \<le> v" "u + v = 1"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1491
    have "dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1492
      using uv yz
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1493
      using convex_on_dist [of "cball x e" x, unfolded convex_on_def,
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1494
        THEN bspec[where x=y], THEN bspec[where x=z]]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1495
      by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1496
    then have "dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> e"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1497
      using convex_bound_le[OF yz uv] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1498
  }
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1499
  then show ?thesis by (auto simp add: convex_def Ball_def)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1500
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1501
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  1502
lemma connected_ball [iff]:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1503
  fixes x :: "'a::real_normed_vector"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1504
  shows "connected (ball x e)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1505
  using convex_connected convex_ball by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1506
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  1507
lemma connected_cball [iff]:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1508
  fixes x :: "'a::real_normed_vector"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1509
  shows "connected (cball x e)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1510
  using convex_connected convex_cball by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1511
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1512
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1513
subsection \<open>Convex hull\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1514
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  1515
lemma convex_convex_hull [iff]: "convex (convex hull s)"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1516
  unfolding hull_def
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1517
  using convex_Inter[of "{t. convex t \<and> s \<subseteq> t}"]
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44142
diff changeset
  1518
  by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1519
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  1520
lemma convex_hull_subset:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  1521
    "s \<subseteq> convex hull t \<Longrightarrow> convex hull s \<subseteq> convex hull t"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  1522
  by (simp add: convex_convex_hull subset_hull)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  1523
34064
eee04bbbae7e avoid dependency on implicit dest rule predicate1D in proofs
haftmann
parents: 33758
diff changeset
  1524
lemma convex_hull_eq: "convex hull s = s \<longleftrightarrow> convex s"
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1525
  by (metis convex_convex_hull hull_same)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1526
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1527
lemma bounded_convex_hull:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1528
  fixes s :: "'a::real_normed_vector set"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1529
  assumes "bounded s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1530
  shows "bounded (convex hull s)"
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1531
proof -
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1532
  from assms obtain B where B: "\<forall>x\<in>s. norm x \<le> B"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1533
    unfolding bounded_iff by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1534
  show ?thesis
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1535
    apply (rule bounded_subset[OF bounded_cball, of _ 0 B])
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44142
diff changeset
  1536
    unfolding subset_hull[of convex, OF convex_cball]
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1537
    unfolding subset_eq mem_cball dist_norm using B
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1538
    apply auto
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1539
    done
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1540
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1541
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1542
lemma finite_imp_bounded_convex_hull:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1543
  fixes s :: "'a::real_normed_vector set"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1544
  shows "finite s \<Longrightarrow> bounded (convex hull s)"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1545
  using bounded_convex_hull finite_imp_bounded
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1546
  by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1547
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1548
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1549
subsubsection \<open>Convex hull is "preserved" by a linear function\<close>
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1550
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1551
lemma convex_hull_linear_image:
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1552
  assumes f: "linear f"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1553
  shows "f ` (convex hull s) = convex hull (f ` s)"
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1554
proof
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1555
  show "convex hull (f ` s) \<subseteq> f ` (convex hull s)"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1556
    by (intro hull_minimal image_mono hull_subset convex_linear_image assms convex_convex_hull)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1557
  show "f ` (convex hull s) \<subseteq> convex hull (f ` s)"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1558
  proof (unfold image_subset_iff_subset_vimage, rule hull_minimal)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1559
    show "s \<subseteq> f -` (convex hull (f ` s))"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1560
      by (fast intro: hull_inc)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1561
    show "convex (f -` (convex hull (f ` s)))"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1562
      by (intro convex_linear_vimage [OF f] convex_convex_hull)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1563
  qed
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1564
qed
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1565
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1566
lemma in_convex_hull_linear_image:
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1567
  assumes "linear f"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1568
    and "x \<in> convex hull s"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1569
  shows "f x \<in> convex hull (f ` s)"
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1570
  using convex_hull_linear_image[OF assms(1)] assms(2) by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1571
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1572
lemma convex_hull_Times:
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1573
  "convex hull (s \<times> t) = (convex hull s) \<times> (convex hull t)"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1574
proof
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1575
  show "convex hull (s \<times> t) \<subseteq> (convex hull s) \<times> (convex hull t)"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1576
    by (intro hull_minimal Sigma_mono hull_subset convex_Times convex_convex_hull)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1577
  have "\<forall>x\<in>convex hull s. \<forall>y\<in>convex hull t. (x, y) \<in> convex hull (s \<times> t)"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1578
  proof (intro hull_induct)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1579
    fix x y assume "x \<in> s" and "y \<in> t"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1580
    then show "(x, y) \<in> convex hull (s \<times> t)"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1581
      by (simp add: hull_inc)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1582
  next
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1583
    fix x let ?S = "((\<lambda>y. (0, y)) -` (\<lambda>p. (- x, 0) + p) ` (convex hull s \<times> t))"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1584
    have "convex ?S"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1585
      by (intro convex_linear_vimage convex_translation convex_convex_hull,
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1586
        simp add: linear_iff)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1587
    also have "?S = {y. (x, y) \<in> convex hull (s \<times> t)}"
57865
dcfb33c26f50 tuned proofs -- fewer warnings;
wenzelm
parents: 57512
diff changeset
  1588
      by (auto simp add: image_def Bex_def)
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1589
    finally show "convex {y. (x, y) \<in> convex hull (s \<times> t)}" .
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1590
  next
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1591
    show "convex {x. \<forall>y\<in>convex hull t. (x, y) \<in> convex hull (s \<times> t)}"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1592
    proof (unfold Collect_ball_eq, rule convex_INT [rule_format])
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1593
      fix y let ?S = "((\<lambda>x. (x, 0)) -` (\<lambda>p. (0, - y) + p) ` (convex hull s \<times> t))"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1594
      have "convex ?S"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1595
      by (intro convex_linear_vimage convex_translation convex_convex_hull,
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1596
        simp add: linear_iff)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1597
      also have "?S = {x. (x, y) \<in> convex hull (s \<times> t)}"
57865
dcfb33c26f50 tuned proofs -- fewer warnings;
wenzelm
parents: 57512
diff changeset
  1598
        by (auto simp add: image_def Bex_def)
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1599
      finally show "convex {x. (x, y) \<in> convex hull (s \<times> t)}" .
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1600
    qed
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1601
  qed
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1602
  then show "(convex hull s) \<times> (convex hull t) \<subseteq> convex hull (s \<times> t)"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1603
    unfolding subset_eq split_paired_Ball_Sigma .
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1604
qed
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  1605
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  1606
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1607
subsubsection \<open>Stepping theorems for convex hulls of finite sets\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1608
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1609
lemma convex_hull_empty[simp]: "convex hull {} = {}"
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1610
  by (rule hull_unique) auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1611
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1612
lemma convex_hull_singleton[simp]: "convex hull {a} = {a}"
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1613
  by (rule hull_unique) auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1614
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1615
lemma convex_hull_insert:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1616
  fixes s :: "'a::real_vector set"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1617
  assumes "s \<noteq> {}"
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1618
  shows "convex hull (insert a s) =
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1619
    {x. \<exists>u\<ge>0. \<exists>v\<ge>0. \<exists>b. (u + v = 1) \<and> b \<in> (convex hull s) \<and> (x = u *\<^sub>R a + v *\<^sub>R b)}"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1620
  (is "_ = ?hull")
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1621
  apply (rule, rule hull_minimal, rule)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1622
  unfolding insert_iff
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1623
  prefer 3
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1624
  apply rule
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1625
proof -
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1626
  fix x
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1627
  assume x: "x = a \<or> x \<in> s"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1628
  then show "x \<in> ?hull"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1629
    apply rule
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1630
    unfolding mem_Collect_eq
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1631
    apply (rule_tac x=1 in exI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1632
    defer
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1633
    apply (rule_tac x=0 in exI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1634
    using assms hull_subset[of s convex]
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1635
    apply auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1636
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1637
next
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1638
  fix x
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1639
  assume "x \<in> ?hull"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1640
  then obtain u v b where obt: "u\<ge>0" "v\<ge>0" "u + v = 1" "b \<in> convex hull s" "x = u *\<^sub>R a + v *\<^sub>R b"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1641
    by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1642
  have "a \<in> convex hull insert a s" "b \<in> convex hull insert a s"
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1643
    using hull_mono[of s "insert a s" convex] hull_mono[of "{a}" "insert a s" convex] and obt(4)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1644
    by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1645
  then show "x \<in> convex hull insert a s"
53676
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  1646
    unfolding obt(5) using obt(1-3)
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  1647
    by (rule convexD [OF convex_convex_hull])
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1648
next
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1649
  show "convex ?hull"
53676
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  1650
  proof (rule convexI)
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1651
    fix x y u v
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1652
    assume as: "(0::real) \<le> u" "0 \<le> v" "u + v = 1" "x\<in>?hull" "y\<in>?hull"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1653
    from as(4) obtain u1 v1 b1 where
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1654
      obt1: "u1\<ge>0" "v1\<ge>0" "u1 + v1 = 1" "b1 \<in> convex hull s" "x = u1 *\<^sub>R a + v1 *\<^sub>R b1"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1655
      by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1656
    from as(5) obtain u2 v2 b2 where
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1657
      obt2: "u2\<ge>0" "v2\<ge>0" "u2 + v2 = 1" "b2 \<in> convex hull s" "y = u2 *\<^sub>R a + v2 *\<^sub>R b2"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1658
      by auto
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1659
    have *: "\<And>(x::'a) s1 s2. x - s1 *\<^sub>R x - s2 *\<^sub>R x = ((1::real) - (s1 + s2)) *\<^sub>R x"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1660
      by (auto simp add: algebra_simps)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1661
    have **: "\<exists>b \<in> convex hull s. u *\<^sub>R x + v *\<^sub>R y =
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1662
      (u * u1) *\<^sub>R a + (v * u2) *\<^sub>R a + (b - (u * u1) *\<^sub>R b - (v * u2) *\<^sub>R b)"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1663
    proof (cases "u * v1 + v * v2 = 0")
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1664
      case True
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1665
      have *: "\<And>(x::'a) s1 s2. x - s1 *\<^sub>R x - s2 *\<^sub>R x = ((1::real) - (s1 + s2)) *\<^sub>R x"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1666
        by (auto simp add: algebra_simps)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1667
      from True have ***: "u * v1 = 0" "v * v2 = 0"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1668
        using mult_nonneg_nonneg[OF \<open>u\<ge>0\<close> \<open>v1\<ge>0\<close>] mult_nonneg_nonneg[OF \<open>v\<ge>0\<close> \<open>v2\<ge>0\<close>]
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1669
        by arith+
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1670
      then have "u * u1 + v * u2 = 1"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1671
        using as(3) obt1(3) obt2(3) by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1672
      then show ?thesis
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1673
        unfolding obt1(5) obt2(5) *
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1674
        using assms hull_subset[of s convex]
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1675
        by (auto simp add: *** scaleR_right_distrib)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1676
    next
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1677
      case False
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1678
      have "1 - (u * u1 + v * u2) = (u + v) - (u * u1 + v * u2)"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1679
        using as(3) obt1(3) obt2(3) by (auto simp add: field_simps)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1680
      also have "\<dots> = u * (v1 + u1 - u1) + v * (v2 + u2 - u2)"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1681
        using as(3) obt1(3) obt2(3) by (auto simp add: field_simps)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1682
      also have "\<dots> = u * v1 + v * v2"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1683
        by simp
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1684
      finally have **:"1 - (u * u1 + v * u2) = u * v1 + v * v2" by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1685
      have "0 \<le> u * v1 + v * v2" "0 \<le> u * v1" "0 \<le> u * v1 + v * v2" "0 \<le> v * v2"
56536
aefb4a8da31f made mult_nonneg_nonneg a simp rule
nipkow
parents: 56480
diff changeset
  1686
        using as(1,2) obt1(1,2) obt2(1,2) by auto
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1687
      then show ?thesis
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1688
        unfolding obt1(5) obt2(5)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1689
        unfolding * and **
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1690
        using False
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1691
        apply (rule_tac
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1692
          x = "((u * v1) / (u * v1 + v * v2)) *\<^sub>R b1 + ((v * v2) / (u * v1 + v * v2)) *\<^sub>R b2" in bexI)
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1693
        defer
53676
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  1694
        apply (rule convexD [OF convex_convex_hull])
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1695
        using obt1(4) obt2(4)
49530
wenzelm
parents: 49529
diff changeset
  1696
        unfolding add_divide_distrib[symmetric] and zero_le_divide_iff
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1697
        apply (auto simp add: scaleR_left_distrib scaleR_right_distrib)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1698
        done
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1699
    qed
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1700
    have u1: "u1 \<le> 1"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1701
      unfolding obt1(3)[symmetric] and not_le using obt1(2) by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1702
    have u2: "u2 \<le> 1"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1703
      unfolding obt2(3)[symmetric] and not_le using obt2(2) by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1704
    have "u1 * u + u2 * v \<le> max u1 u2 * u + max u1 u2 * v"
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1705
      apply (rule add_mono)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1706
      apply (rule_tac [!] mult_right_mono)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1707
      using as(1,2) obt1(1,2) obt2(1,2)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1708
      apply auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1709
      done
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1710
    also have "\<dots> \<le> 1"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1711
      unfolding distrib_left[symmetric] and as(3) using u1 u2 by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1712
    finally show "u *\<^sub>R x + v *\<^sub>R y \<in> ?hull"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1713
      unfolding mem_Collect_eq
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1714
      apply (rule_tac x="u * u1 + v * u2" in exI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1715
      apply (rule conjI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1716
      defer
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1717
      apply (rule_tac x="1 - u * u1 - v * u2" in exI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1718
      unfolding Bex_def
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1719
      using as(1,2) obt1(1,2) obt2(1,2) **
56536
aefb4a8da31f made mult_nonneg_nonneg a simp rule
nipkow
parents: 56480
diff changeset
  1720
      apply (auto simp add: algebra_simps)
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1721
      done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1722
  qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1723
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1724
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1725
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1726
subsubsection \<open>Explicit expression for convex hull\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1727
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1728
lemma convex_hull_indexed:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1729
  fixes s :: "'a::real_vector set"
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1730
  shows "convex hull s =
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1731
    {y. \<exists>k u x.
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1732
      (\<forall>i\<in>{1::nat .. k}. 0 \<le> u i \<and> x i \<in> s) \<and>
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1733
      (setsum u {1..k} = 1) \<and> (setsum (\<lambda>i. u i *\<^sub>R x i) {1..k} = y)}"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1734
  (is "?xyz = ?hull")
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1735
  apply (rule hull_unique)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1736
  apply rule
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1737
  defer
53676
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  1738
  apply (rule convexI)
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1739
proof -
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1740
  fix x
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1741
  assume "x\<in>s"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1742
  then show "x \<in> ?hull"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1743
    unfolding mem_Collect_eq
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1744
    apply (rule_tac x=1 in exI, rule_tac x="\<lambda>x. 1" in exI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1745
    apply auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1746
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1747
next
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1748
  fix t
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1749
  assume as: "s \<subseteq> t" "convex t"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1750
  show "?hull \<subseteq> t"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1751
    apply rule
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1752
    unfolding mem_Collect_eq
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1753
    apply (elim exE conjE)
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1754
  proof -
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1755
    fix x k u y
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1756
    assume assm:
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1757
      "\<forall>i\<in>{1::nat..k}. 0 \<le> u i \<and> y i \<in> s"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1758
      "setsum u {1..k} = 1" "(\<Sum>i = 1..k. u i *\<^sub>R y i) = x"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1759
    show "x\<in>t"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1760
      unfolding assm(3) [symmetric]
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1761
      apply (rule as(2)[unfolded convex, rule_format])
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1762
      using assm(1,2) as(1) apply auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1763
      done
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1764
  qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1765
next
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1766
  fix x y u v
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1767
  assume uv: "0 \<le> u" "0 \<le> v" "u + v = (1::real)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1768
  assume xy: "x \<in> ?hull" "y \<in> ?hull"
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1769
  from xy obtain k1 u1 x1 where
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1770
    x: "\<forall>i\<in>{1::nat..k1}. 0\<le>u1 i \<and> x1 i \<in> s" "setsum u1 {Suc 0..k1} = 1" "(\<Sum>i = Suc 0..k1. u1 i *\<^sub>R x1 i) = x"
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1771
    by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1772
  from xy obtain k2 u2 x2 where
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1773
    y: "\<forall>i\<in>{1::nat..k2}. 0\<le>u2 i \<and> x2 i \<in> s" "setsum u2 {Suc 0..k2} = 1" "(\<Sum>i = Suc 0..k2. u2 i *\<^sub>R x2 i) = y"
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1774
    by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1775
  have *: "\<And>P (x1::'a) x2 s1 s2 i.
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1776
    (if P i then s1 else s2) *\<^sub>R (if P i then x1 else x2) = (if P i then s1 *\<^sub>R x1 else s2 *\<^sub>R x2)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1777
    "{1..k1 + k2} \<inter> {1..k1} = {1..k1}" "{1..k1 + k2} \<inter> - {1..k1} = (\<lambda>i. i + k1) ` {1..k2}"
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1778
    prefer 3
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1779
    apply (rule, rule)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1780
    unfolding image_iff
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1781
    apply (rule_tac x = "x - k1" in bexI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1782
    apply (auto simp add: not_le)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1783
    done
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1784
  have inj: "inj_on (\<lambda>i. i + k1) {1..k2}"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1785
    unfolding inj_on_def by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1786
  show "u *\<^sub>R x + v *\<^sub>R y \<in> ?hull"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1787
    apply rule
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1788
    apply (rule_tac x="k1 + k2" in exI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1789
    apply (rule_tac x="\<lambda>i. if i \<in> {1..k1} then u * u1 i else v * u2 (i - k1)" in exI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1790
    apply (rule_tac x="\<lambda>i. if i \<in> {1..k1} then x1 i else x2 (i - k1)" in exI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1791
    apply (rule, rule)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1792
    defer
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1793
    apply rule
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  1794
    unfolding * and setsum.If_cases[OF finite_atLeastAtMost[of 1 "k1 + k2"]] and
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  1795
      setsum.reindex[OF inj] and o_def Collect_mem_eq
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1796
    unfolding scaleR_scaleR[symmetric] scaleR_right.setsum [symmetric] setsum_right_distrib[symmetric]
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1797
  proof -
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1798
    fix i
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1799
    assume i: "i \<in> {1..k1+k2}"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1800
    show "0 \<le> (if i \<in> {1..k1} then u * u1 i else v * u2 (i - k1)) \<and>
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1801
      (if i \<in> {1..k1} then x1 i else x2 (i - k1)) \<in> s"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1802
    proof (cases "i\<in>{1..k1}")
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1803
      case True
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1804
      then show ?thesis
56536
aefb4a8da31f made mult_nonneg_nonneg a simp rule
nipkow
parents: 56480
diff changeset
  1805
        using uv(1) x(1)[THEN bspec[where x=i]] by auto
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1806
    next
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1807
      case False
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  1808
      define j where "j = i - k1"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1809
      from i False have "j \<in> {1..k2}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1810
        unfolding j_def by auto
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1811
      then show ?thesis
56536
aefb4a8da31f made mult_nonneg_nonneg a simp rule
nipkow
parents: 56480
diff changeset
  1812
        using False uv(2) y(1)[THEN bspec[where x=j]]
aefb4a8da31f made mult_nonneg_nonneg a simp rule
nipkow
parents: 56480
diff changeset
  1813
        by (auto simp: j_def[symmetric])
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1814
    qed
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1815
  qed (auto simp add: not_le x(2,3) y(2,3) uv(3))
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1816
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1817
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1818
lemma convex_hull_finite:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1819
  fixes s :: "'a::real_vector set"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1820
  assumes "finite s"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1821
  shows "convex hull s = {y. \<exists>u. (\<forall>x\<in>s. 0 \<le> u x) \<and>
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1822
    setsum u s = 1 \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y}"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1823
  (is "?HULL = ?set")
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1824
proof (rule hull_unique, auto simp add: convex_def[of ?set])
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1825
  fix x
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1826
  assume "x \<in> s"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1827
  then show "\<exists>u. (\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s = 1 \<and> (\<Sum>x\<in>s. u x *\<^sub>R x) = x"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1828
    apply (rule_tac x="\<lambda>y. if x=y then 1 else 0" in exI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1829
    apply auto
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  1830
    unfolding setsum.delta'[OF assms] and setsum_delta''[OF assms]
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1831
    apply auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1832
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1833
next
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1834
  fix u v :: real
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1835
  assume uv: "0 \<le> u" "0 \<le> v" "u + v = 1"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1836
  fix ux assume ux: "\<forall>x\<in>s. 0 \<le> ux x" "setsum ux s = (1::real)"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1837
  fix uy assume uy: "\<forall>x\<in>s. 0 \<le> uy x" "setsum uy s = (1::real)"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1838
  {
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1839
    fix x
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1840
    assume "x\<in>s"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1841
    then have "0 \<le> u * ux x + v * uy x"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1842
      using ux(1)[THEN bspec[where x=x]] uy(1)[THEN bspec[where x=x]] and uv(1,2)
56536
aefb4a8da31f made mult_nonneg_nonneg a simp rule
nipkow
parents: 56480
diff changeset
  1843
      by auto
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1844
  }
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1845
  moreover
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1846
  have "(\<Sum>x\<in>s. u * ux x + v * uy x) = 1"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  1847
    unfolding setsum.distrib and setsum_right_distrib[symmetric] and ux(2) uy(2)
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1848
    using uv(3) by auto
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1849
  moreover
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1850
  have "(\<Sum>x\<in>s. (u * ux x + v * uy x) *\<^sub>R x) = u *\<^sub>R (\<Sum>x\<in>s. ux x *\<^sub>R x) + v *\<^sub>R (\<Sum>x\<in>s. uy x *\<^sub>R x)"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  1851
    unfolding scaleR_left_distrib and setsum.distrib and scaleR_scaleR[symmetric]
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1852
      and scaleR_right.setsum [symmetric]
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1853
    by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1854
  ultimately
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1855
  show "\<exists>uc. (\<forall>x\<in>s. 0 \<le> uc x) \<and> setsum uc s = 1 \<and>
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1856
      (\<Sum>x\<in>s. uc x *\<^sub>R x) = u *\<^sub>R (\<Sum>x\<in>s. ux x *\<^sub>R x) + v *\<^sub>R (\<Sum>x\<in>s. uy x *\<^sub>R x)"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1857
    apply (rule_tac x="\<lambda>x. u * ux x + v * uy x" in exI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1858
    apply auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1859
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1860
next
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1861
  fix t
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1862
  assume t: "s \<subseteq> t" "convex t"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1863
  fix u
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1864
  assume u: "\<forall>x\<in>s. 0 \<le> u x" "setsum u s = (1::real)"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1865
  then show "(\<Sum>x\<in>s. u x *\<^sub>R x) \<in> t"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1866
    using t(2)[unfolded convex_explicit, THEN spec[where x=s], THEN spec[where x=u]]
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1867
    using assms and t(1) by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1868
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1869
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1870
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1871
subsubsection \<open>Another formulation from Lars Schewe\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1872
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1873
lemma convex_hull_explicit:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1874
  fixes p :: "'a::real_vector set"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1875
  shows "convex hull p =
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1876
    {y. \<exists>s u. finite s \<and> s \<subseteq> p \<and> (\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s = 1 \<and> setsum (\<lambda>v. u v *\<^sub>R v) s = y}"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1877
  (is "?lhs = ?rhs")
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1878
proof -
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1879
  {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1880
    fix x
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1881
    assume "x\<in>?lhs"
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1882
    then obtain k u y where
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1883
        obt: "\<forall>i\<in>{1::nat..k}. 0 \<le> u i \<and> y i \<in> p" "setsum u {1..k} = 1" "(\<Sum>i = 1..k. u i *\<^sub>R y i) = x"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1884
      unfolding convex_hull_indexed by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1885
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1886
    have fin: "finite {1..k}" by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1887
    have fin': "\<And>v. finite {i \<in> {1..k}. y i = v}" by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1888
    {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1889
      fix j
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1890
      assume "j\<in>{1..k}"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1891
      then have "y j \<in> p" "0 \<le> setsum u {i. Suc 0 \<le> i \<and> i \<le> k \<and> y i = y j}"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1892
        using obt(1)[THEN bspec[where x=j]] and obt(2)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1893
        apply simp
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1894
        apply (rule setsum_nonneg)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1895
        using obt(1)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1896
        apply auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1897
        done
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1898
    }
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1899
    moreover
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  1900
    have "(\<Sum>v\<in>y ` {1..k}. setsum u {i \<in> {1..k}. y i = v}) = 1"
49530
wenzelm
parents: 49529
diff changeset
  1901
      unfolding setsum_image_gen[OF fin, symmetric] using obt(2) by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1902
    moreover have "(\<Sum>v\<in>y ` {1..k}. setsum u {i \<in> {1..k}. y i = v} *\<^sub>R v) = x"
49530
wenzelm
parents: 49529
diff changeset
  1903
      using setsum_image_gen[OF fin, of "\<lambda>i. u i *\<^sub>R y i" y, symmetric]
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1904
      unfolding scaleR_left.setsum using obt(3) by auto
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1905
    ultimately
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1906
    have "\<exists>s u. finite s \<and> s \<subseteq> p \<and> (\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = x"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1907
      apply (rule_tac x="y ` {1..k}" in exI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1908
      apply (rule_tac x="\<lambda>v. setsum u {i\<in>{1..k}. y i = v}" in exI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1909
      apply auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1910
      done
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1911
    then have "x\<in>?rhs" by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1912
  }
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1913
  moreover
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1914
  {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1915
    fix y
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1916
    assume "y\<in>?rhs"
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1917
    then obtain s u where
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1918
      obt: "finite s" "s \<subseteq> p" "\<forall>x\<in>s. 0 \<le> u x" "setsum u s = 1" "(\<Sum>v\<in>s. u v *\<^sub>R v) = y"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1919
      by auto
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1920
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1921
    obtain f where f: "inj_on f {1..card s}" "f ` {1..card s} = s"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1922
      using ex_bij_betw_nat_finite_1[OF obt(1)] unfolding bij_betw_def by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1923
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1924
    {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1925
      fix i :: nat
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1926
      assume "i\<in>{1..card s}"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1927
      then have "f i \<in> s"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1928
        apply (subst f(2)[symmetric])
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1929
        apply auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1930
        done
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1931
      then have "0 \<le> u (f i)" "f i \<in> p" using obt(2,3) by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1932
    }
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  1933
    moreover have *: "finite {1..card s}" by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1934
    {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1935
      fix y
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1936
      assume "y\<in>s"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1937
      then obtain i where "i\<in>{1..card s}" "f i = y"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1938
        using f using image_iff[of y f "{1..card s}"]
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1939
        by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1940
      then have "{x. Suc 0 \<le> x \<and> x \<le> card s \<and> f x = y} = {i}"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1941
        apply auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1942
        using f(1)[unfolded inj_on_def]
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1943
        apply(erule_tac x=x in ballE)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1944
        apply auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1945
        done
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1946
      then have "card {x. Suc 0 \<le> x \<and> x \<le> card s \<and> f x = y} = 1" by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1947
      then have "(\<Sum>x\<in>{x \<in> {1..card s}. f x = y}. u (f x)) = u y"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1948
          "(\<Sum>x\<in>{x \<in> {1..card s}. f x = y}. u (f x) *\<^sub>R f x) = u y *\<^sub>R y"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1949
        by (auto simp add: setsum_constant_scaleR)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1950
    }
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1951
    then have "(\<Sum>x = 1..card s. u (f x)) = 1" "(\<Sum>i = 1..card s. u (f i) *\<^sub>R f i) = y"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1952
      unfolding setsum_image_gen[OF *(1), of "\<lambda>x. u (f x) *\<^sub>R f x" f]
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1953
        and setsum_image_gen[OF *(1), of "\<lambda>x. u (f x)" f]
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1954
      unfolding f
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  1955
      using setsum.cong [of s s "\<lambda>y. (\<Sum>x\<in>{x \<in> {1..card s}. f x = y}. u (f x) *\<^sub>R f x)" "\<lambda>v. u v *\<^sub>R v"]
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  1956
      using setsum.cong [of s s "\<lambda>y. (\<Sum>x\<in>{x \<in> {1..card s}. f x = y}. u (f x))" u]
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1957
      unfolding obt(4,5)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1958
      by auto
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1959
    ultimately
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1960
    have "\<exists>k u x. (\<forall>i\<in>{1..k}. 0 \<le> u i \<and> x i \<in> p) \<and> setsum u {1..k} = 1 \<and>
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1961
        (\<Sum>i::nat = 1..k. u i *\<^sub>R x i) = y"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1962
      apply (rule_tac x="card s" in exI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1963
      apply (rule_tac x="u \<circ> f" in exI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1964
      apply (rule_tac x=f in exI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1965
      apply fastforce
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1966
      done
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1967
    then have "y \<in> ?lhs"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1968
      unfolding convex_hull_indexed by auto
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1969
  }
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1970
  ultimately show ?thesis
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1971
    unfolding set_eq_iff by blast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1972
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1973
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1974
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  1975
subsubsection \<open>A stepping theorem for that expansion\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1976
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1977
lemma convex_hull_finite_step:
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1978
  fixes s :: "'a::real_vector set"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1979
  assumes "finite s"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1980
  shows
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1981
    "(\<exists>u. (\<forall>x\<in>insert a s. 0 \<le> u x) \<and> setsum u (insert a s) = w \<and> setsum (\<lambda>x. u x *\<^sub>R x) (insert a s) = y)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1982
      \<longleftrightarrow> (\<exists>v\<ge>0. \<exists>u. (\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s = w - v \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y - v *\<^sub>R a)"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1983
  (is "?lhs = ?rhs")
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1984
proof (rule, case_tac[!] "a\<in>s")
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1985
  assume "a \<in> s"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  1986
  then have *: "insert a s = s" by auto
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1987
  assume ?lhs
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1988
  then show ?rhs
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1989
    unfolding *
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1990
    apply (rule_tac x=0 in exI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1991
    apply auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1992
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1993
next
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1994
  assume ?lhs
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1995
  then obtain u where
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  1996
      u: "\<forall>x\<in>insert a s. 0 \<le> u x" "setsum u (insert a s) = w" "(\<Sum>x\<in>insert a s. u x *\<^sub>R x) = y"
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1997
    by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1998
  assume "a \<notin> s"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  1999
  then show ?rhs
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2000
    apply (rule_tac x="u a" in exI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2001
    using u(1)[THEN bspec[where x=a]]
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2002
    apply simp
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2003
    apply (rule_tac x=u in exI)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2004
    using u[unfolded setsum_clauses(2)[OF assms]] and \<open>a\<notin>s\<close>
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2005
    apply auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2006
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2007
next
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2008
  assume "a \<in> s"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2009
  then have *: "insert a s = s" by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2010
  have fin: "finite (insert a s)" using assms by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2011
  assume ?rhs
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2012
  then obtain v u where uv: "v\<ge>0" "\<forall>x\<in>s. 0 \<le> u x" "setsum u s = w - v" "(\<Sum>x\<in>s. u x *\<^sub>R x) = y - v *\<^sub>R a"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2013
    by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2014
  show ?lhs
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2015
    apply (rule_tac x = "\<lambda>x. (if a = x then v else 0) + u x" in exI)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  2016
    unfolding scaleR_left_distrib and setsum.distrib and setsum_delta''[OF fin] and setsum.delta'[OF fin]
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2017
    unfolding setsum_clauses(2)[OF assms]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2018
    using uv and uv(2)[THEN bspec[where x=a]] and \<open>a\<in>s\<close>
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2019
    apply auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2020
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2021
next
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2022
  assume ?rhs
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2023
  then obtain v u where
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2024
    uv: "v\<ge>0" "\<forall>x\<in>s. 0 \<le> u x" "setsum u s = w - v" "(\<Sum>x\<in>s. u x *\<^sub>R x) = y - v *\<^sub>R a"
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2025
    by auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2026
  moreover
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2027
  assume "a \<notin> s"
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2028
  moreover
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2029
  have "(\<Sum>x\<in>s. if a = x then v else u x) = setsum u s"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2030
    and "(\<Sum>x\<in>s. (if a = x then v else u x) *\<^sub>R x) = (\<Sum>x\<in>s. u x *\<^sub>R x)"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  2031
    apply (rule_tac setsum.cong) apply rule
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2032
    defer
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  2033
    apply (rule_tac setsum.cong) apply rule
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2034
    using \<open>a \<notin> s\<close>
50804
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2035
    apply auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2036
    done
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2037
  ultimately show ?lhs
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2038
    apply (rule_tac x="\<lambda>x. if a = x then v else u x" in exI)
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2039
    unfolding setsum_clauses(2)[OF assms]
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2040
    apply auto
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2041
    done
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2042
qed
4156a45aeb63 tuned proofs;
wenzelm
parents: 50526
diff changeset
  2043
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2044
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2045
subsubsection \<open>Hence some special cases\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2046
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2047
lemma convex_hull_2:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2048
  "convex hull {a,b} = {u *\<^sub>R a + v *\<^sub>R b | u v. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1}"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2049
proof -
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2050
  have *: "\<And>u. (\<forall>x\<in>{a, b}. 0 \<le> u x) \<longleftrightarrow> 0 \<le> u a \<and> 0 \<le> u b"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2051
    by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2052
  have **: "finite {b}" by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2053
  show ?thesis
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2054
    apply (simp add: convex_hull_finite)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2055
    unfolding convex_hull_finite_step[OF **, of a 1, unfolded * conj_assoc]
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2056
    apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2057
    apply (rule_tac x=v in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2058
    apply (rule_tac x="1 - v" in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2059
    apply simp
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2060
    apply (rule_tac x=u in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2061
    apply simp
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2062
    apply (rule_tac x="\<lambda>x. v" in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2063
    apply simp
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2064
    done
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2065
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2066
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2067
lemma convex_hull_2_alt: "convex hull {a,b} = {a + u *\<^sub>R (b - a) | u.  0 \<le> u \<and> u \<le> 1}"
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44142
diff changeset
  2068
  unfolding convex_hull_2
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2069
proof (rule Collect_cong)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2070
  have *: "\<And>x y ::real. x + y = 1 \<longleftrightarrow> x = 1 - y"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2071
    by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2072
  fix x
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2073
  show "(\<exists>v u. x = v *\<^sub>R a + u *\<^sub>R b \<and> 0 \<le> v \<and> 0 \<le> u \<and> v + u = 1) \<longleftrightarrow>
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2074
    (\<exists>u. x = a + u *\<^sub>R (b - a) \<and> 0 \<le> u \<and> u \<le> 1)"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2075
    unfolding *
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2076
    apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2077
    apply (rule_tac[!] x=u in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2078
    apply (auto simp add: algebra_simps)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2079
    done
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2080
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2081
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2082
lemma convex_hull_3:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2083
  "convex hull {a,b,c} = { u *\<^sub>R a + v *\<^sub>R b + w *\<^sub>R c | u v w. 0 \<le> u \<and> 0 \<le> v \<and> 0 \<le> w \<and> u + v + w = 1}"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2084
proof -
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2085
  have fin: "finite {a,b,c}" "finite {b,c}" "finite {c}"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2086
    by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2087
  have *: "\<And>x y z ::real. x + y + z = 1 \<longleftrightarrow> x = 1 - y - z"
44361
75ec83d45303 remove unnecessary euclidean_space class constraints
huffman
parents: 44349
diff changeset
  2088
    by (auto simp add: field_simps)
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2089
  show ?thesis
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2090
    unfolding convex_hull_finite[OF fin(1)] and convex_hull_finite_step[OF fin(2)] and *
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2091
    unfolding convex_hull_finite_step[OF fin(3)]
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2092
    apply (rule Collect_cong)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2093
    apply simp
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2094
    apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2095
    apply (rule_tac x=va in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2096
    apply (rule_tac x="u c" in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2097
    apply simp
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2098
    apply (rule_tac x="1 - v - w" in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2099
    apply simp
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2100
    apply (rule_tac x=v in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2101
    apply simp
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2102
    apply (rule_tac x="\<lambda>x. w" in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2103
    apply simp
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2104
    done
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2105
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2106
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2107
lemma convex_hull_3_alt:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2108
  "convex hull {a,b,c} = {a + u *\<^sub>R (b - a) + v *\<^sub>R (c - a) | u v.  0 \<le> u \<and> 0 \<le> v \<and> u + v \<le> 1}"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2109
proof -
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2110
  have *: "\<And>x y z ::real. x + y + z = 1 \<longleftrightarrow> x = 1 - y - z"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2111
    by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2112
  show ?thesis
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2113
    unfolding convex_hull_3
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2114
    apply (auto simp add: *)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2115
    apply (rule_tac x=v in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2116
    apply (rule_tac x=w in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2117
    apply (simp add: algebra_simps)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2118
    apply (rule_tac x=u in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2119
    apply (rule_tac x=v in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2120
    apply (simp add: algebra_simps)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2121
    done
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2122
qed
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2123
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2124
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2125
subsection \<open>Relations among closure notions and corresponding hulls\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2126
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2127
lemma affine_imp_convex: "affine s \<Longrightarrow> convex s"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2128
  unfolding affine_def convex_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2129
44361
75ec83d45303 remove unnecessary euclidean_space class constraints
huffman
parents: 44349
diff changeset
  2130
lemma subspace_imp_convex: "subspace s \<Longrightarrow> convex s"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2131
  using subspace_imp_affine affine_imp_convex by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2132
44361
75ec83d45303 remove unnecessary euclidean_space class constraints
huffman
parents: 44349
diff changeset
  2133
lemma affine_hull_subset_span: "(affine hull s) \<subseteq> (span s)"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2134
  by (metis hull_minimal span_inc subspace_imp_affine subspace_span)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2135
44361
75ec83d45303 remove unnecessary euclidean_space class constraints
huffman
parents: 44349
diff changeset
  2136
lemma convex_hull_subset_span: "(convex hull s) \<subseteq> (span s)"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2137
  by (metis hull_minimal span_inc subspace_imp_convex subspace_span)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2138
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2139
lemma convex_hull_subset_affine_hull: "(convex hull s) \<subseteq> (affine hull s)"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2140
  by (metis affine_affine_hull affine_imp_convex hull_minimal hull_subset)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2141
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2142
lemma affine_dependent_imp_dependent: "affine_dependent s \<Longrightarrow> dependent s"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  2143
  unfolding affine_dependent_def dependent_def
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2144
  using affine_hull_subset_span by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2145
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2146
lemma dependent_imp_affine_dependent:
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2147
  assumes "dependent {x - a| x . x \<in> s}"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2148
    and "a \<notin> s"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2149
  shows "affine_dependent (insert a s)"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2150
proof -
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  2151
  from assms(1)[unfolded dependent_explicit] obtain S u v
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2152
    where obt: "finite S" "S \<subseteq> {x - a |x. x \<in> s}" "v\<in>S" "u v  \<noteq> 0" "(\<Sum>v\<in>S. u v *\<^sub>R v) = 0"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2153
    by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  2154
  define t where "t = (\<lambda>x. x + a) ` S"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2155
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2156
  have inj: "inj_on (\<lambda>x. x + a) S"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2157
    unfolding inj_on_def by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2158
  have "0 \<notin> S"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2159
    using obt(2) assms(2) unfolding subset_eq by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2160
  have fin: "finite t" and "t \<subseteq> s"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2161
    unfolding t_def using obt(1,2) by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2162
  then have "finite (insert a t)" and "insert a t \<subseteq> insert a s"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2163
    by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2164
  moreover have *: "\<And>P Q. (\<Sum>x\<in>t. (if x = a then P x else Q x)) = (\<Sum>x\<in>t. Q x)"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  2165
    apply (rule setsum.cong)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2166
    using \<open>a\<notin>s\<close> \<open>t\<subseteq>s\<close>
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2167
    apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2168
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2169
  have "(\<Sum>x\<in>insert a t. if x = a then - (\<Sum>x\<in>t. u (x - a)) else u (x - a)) = 0"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2170
    unfolding setsum_clauses(2)[OF fin]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2171
    using \<open>a\<notin>s\<close> \<open>t\<subseteq>s\<close>
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2172
    apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2173
    unfolding *
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2174
    apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2175
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2176
  moreover have "\<exists>v\<in>insert a t. (if v = a then - (\<Sum>x\<in>t. u (x - a)) else u (v - a)) \<noteq> 0"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2177
    apply (rule_tac x="v + a" in bexI)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2178
    using obt(3,4) and \<open>0\<notin>S\<close>
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2179
    unfolding t_def
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2180
    apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2181
    done
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2182
  moreover have *: "\<And>P Q. (\<Sum>x\<in>t. (if x = a then P x else Q x) *\<^sub>R x) = (\<Sum>x\<in>t. Q x *\<^sub>R x)"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  2183
    apply (rule setsum.cong)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2184
    using \<open>a\<notin>s\<close> \<open>t\<subseteq>s\<close>
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2185
    apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2186
    done
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  2187
  have "(\<Sum>x\<in>t. u (x - a)) *\<^sub>R a = (\<Sum>v\<in>t. u (v - a) *\<^sub>R v)"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2188
    unfolding scaleR_left.setsum
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  2189
    unfolding t_def and setsum.reindex[OF inj] and o_def
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2190
    using obt(5)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  2191
    by (auto simp add: setsum.distrib scaleR_right_distrib)
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2192
  then have "(\<Sum>v\<in>insert a t. (if v = a then - (\<Sum>x\<in>t. u (x - a)) else u (v - a)) *\<^sub>R v) = 0"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2193
    unfolding setsum_clauses(2)[OF fin]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2194
    using \<open>a\<notin>s\<close> \<open>t\<subseteq>s\<close>
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2195
    by (auto simp add: *)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2196
  ultimately show ?thesis
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2197
    unfolding affine_dependent_explicit
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2198
    apply (rule_tac x="insert a t" in exI)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2199
    apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2200
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2201
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2202
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2203
lemma convex_cone:
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2204
  "convex s \<and> cone s \<longleftrightarrow> (\<forall>x\<in>s. \<forall>y\<in>s. (x + y) \<in> s) \<and> (\<forall>x\<in>s. \<forall>c\<ge>0. (c *\<^sub>R x) \<in> s)"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2205
  (is "?lhs = ?rhs")
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2206
proof -
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2207
  {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2208
    fix x y
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2209
    assume "x\<in>s" "y\<in>s" and ?lhs
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2210
    then have "2 *\<^sub>R x \<in>s" "2 *\<^sub>R y \<in> s"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2211
      unfolding cone_def by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2212
    then have "x + y \<in> s"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2213
      using \<open>?lhs\<close>[unfolded convex_def, THEN conjunct1]
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2214
      apply (erule_tac x="2*\<^sub>R x" in ballE)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2215
      apply (erule_tac x="2*\<^sub>R y" in ballE)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2216
      apply (erule_tac x="1/2" in allE)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2217
      apply simp
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2218
      apply (erule_tac x="1/2" in allE)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2219
      apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2220
      done
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2221
  }
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2222
  then show ?thesis
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2223
    unfolding convex_def cone_def by blast
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2224
qed
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2225
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2226
lemma affine_dependent_biggerset:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2227
  fixes s :: "'a::euclidean_space set"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  2228
  assumes "finite s" "card s \<ge> DIM('a) + 2"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2229
  shows "affine_dependent s"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2230
proof -
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2231
  have "s \<noteq> {}" using assms by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2232
  then obtain a where "a\<in>s" by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2233
  have *: "{x - a |x. x \<in> s - {a}} = (\<lambda>x. x - a) ` (s - {a})"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2234
    by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2235
  have "card {x - a |x. x \<in> s - {a}} = card (s - {a})"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2236
    unfolding *
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2237
    apply (rule card_image)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2238
    unfolding inj_on_def
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2239
    apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2240
    done
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  2241
  also have "\<dots> > DIM('a)" using assms(2)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2242
    unfolding card_Diff_singleton[OF assms(1) \<open>a\<in>s\<close>] by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2243
  finally show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2244
    apply (subst insert_Diff[OF \<open>a\<in>s\<close>, symmetric])
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2245
    apply (rule dependent_imp_affine_dependent)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2246
    apply (rule dependent_biggerset)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2247
    apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2248
    done
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2249
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2250
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2251
lemma affine_dependent_biggerset_general:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2252
  assumes "finite (s :: 'a::euclidean_space set)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2253
    and "card s \<ge> dim s + 2"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2254
  shows "affine_dependent s"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2255
proof -
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2256
  from assms(2) have "s \<noteq> {}" by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2257
  then obtain a where "a\<in>s" by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2258
  have *: "{x - a |x. x \<in> s - {a}} = (\<lambda>x. x - a) ` (s - {a})"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2259
    by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2260
  have **: "card {x - a |x. x \<in> s - {a}} = card (s - {a})"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2261
    unfolding *
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2262
    apply (rule card_image)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2263
    unfolding inj_on_def
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2264
    apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2265
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2266
  have "dim {x - a |x. x \<in> s - {a}} \<le> dim s"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2267
    apply (rule subset_le_dim)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2268
    unfolding subset_eq
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2269
    using \<open>a\<in>s\<close>
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2270
    apply (auto simp add:span_superset span_sub)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2271
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2272
  also have "\<dots> < dim s + 1" by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2273
  also have "\<dots> \<le> card (s - {a})"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2274
    using assms
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2275
    using card_Diff_singleton[OF assms(1) \<open>a\<in>s\<close>]
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2276
    by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2277
  finally show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2278
    apply (subst insert_Diff[OF \<open>a\<in>s\<close>, symmetric])
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2279
    apply (rule dependent_imp_affine_dependent)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2280
    apply (rule dependent_biggerset_general)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2281
    unfolding **
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2282
    apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2283
    done
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2284
qed
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2285
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2286
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2287
subsection \<open>Some Properties of Affine Dependent Sets\<close>
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2288
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  2289
lemma affine_independent_0: "\<not> affine_dependent {}"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2290
  by (simp add: affine_dependent_def)
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2291
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  2292
lemma affine_independent_1: "\<not> affine_dependent {a}"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2293
  by (simp add: affine_dependent_def)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2294
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  2295
lemma affine_independent_2: "\<not> affine_dependent {a,b}"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  2296
  by (simp add: affine_dependent_def insert_Diff_if hull_same)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  2297
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2298
lemma affine_hull_translation: "affine hull ((\<lambda>x. a + x) `  S) = (\<lambda>x. a + x) ` (affine hull S)"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2299
proof -
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2300
  have "affine ((\<lambda>x. a + x) ` (affine hull S))"
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 60176
diff changeset
  2301
    using affine_translation affine_affine_hull by blast
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2302
  moreover have "(\<lambda>x. a + x) `  S \<subseteq> (\<lambda>x. a + x) ` (affine hull S)"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2303
    using hull_subset[of S] by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2304
  ultimately have h1: "affine hull ((\<lambda>x. a + x) `  S) \<subseteq> (\<lambda>x. a + x) ` (affine hull S)"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2305
    by (metis hull_minimal)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2306
  have "affine((\<lambda>x. -a + x) ` (affine hull ((\<lambda>x. a + x) `  S)))"
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 60176
diff changeset
  2307
    using affine_translation affine_affine_hull by blast
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2308
  moreover have "(\<lambda>x. -a + x) ` (\<lambda>x. a + x) `  S \<subseteq> (\<lambda>x. -a + x) ` (affine hull ((\<lambda>x. a + x) `  S))"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2309
    using hull_subset[of "(\<lambda>x. a + x) `  S"] by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2310
  moreover have "S = (\<lambda>x. -a + x) ` (\<lambda>x. a + x) `  S"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2311
    using translation_assoc[of "-a" a] by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2312
  ultimately have "(\<lambda>x. -a + x) ` (affine hull ((\<lambda>x. a + x) `  S)) >= (affine hull S)"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2313
    by (metis hull_minimal)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2314
  then have "affine hull ((\<lambda>x. a + x) ` S) >= (\<lambda>x. a + x) ` (affine hull S)"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2315
    by auto
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2316
  then show ?thesis using h1 by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2317
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2318
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2319
lemma affine_dependent_translation:
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2320
  assumes "affine_dependent S"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2321
  shows "affine_dependent ((\<lambda>x. a + x) ` S)"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2322
proof -
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2323
  obtain x where x: "x \<in> S \<and> x \<in> affine hull (S - {x})"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2324
    using assms affine_dependent_def by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2325
  have "op + a ` (S - {x}) = op + a ` S - {a + x}"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2326
    by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2327
  then have "a + x \<in> affine hull ((\<lambda>x. a + x) ` S - {a + x})"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2328
    using affine_hull_translation[of a "S - {x}"] x by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2329
  moreover have "a + x \<in> (\<lambda>x. a + x) ` S"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2330
    using x by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2331
  ultimately show ?thesis
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2332
    unfolding affine_dependent_def by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2333
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2334
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2335
lemma affine_dependent_translation_eq:
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2336
  "affine_dependent S \<longleftrightarrow> affine_dependent ((\<lambda>x. a + x) ` S)"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2337
proof -
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2338
  {
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2339
    assume "affine_dependent ((\<lambda>x. a + x) ` S)"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2340
    then have "affine_dependent S"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2341
      using affine_dependent_translation[of "((\<lambda>x. a + x) ` S)" "-a"] translation_assoc[of "-a" a]
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2342
      by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2343
  }
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2344
  then show ?thesis
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2345
    using affine_dependent_translation by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2346
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2347
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2348
lemma affine_hull_0_dependent:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2349
  assumes "0 \<in> affine hull S"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2350
  shows "dependent S"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2351
proof -
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2352
  obtain s u where s_u: "finite s \<and> s \<noteq> {} \<and> s \<subseteq> S \<and> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = 0"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2353
    using assms affine_hull_explicit[of S] by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2354
  then have "\<exists>v\<in>s. u v \<noteq> 0"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2355
    using setsum_not_0[of "u" "s"] by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2356
  then have "finite s \<and> s \<subseteq> S \<and> (\<exists>v\<in>s. u v \<noteq> 0 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = 0)"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2357
    using s_u by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2358
  then show ?thesis
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2359
    unfolding dependent_explicit[of S] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2360
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2361
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2362
lemma affine_dependent_imp_dependent2:
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2363
  assumes "affine_dependent (insert 0 S)"
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2364
  shows "dependent S"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2365
proof -
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2366
  obtain x where x: "x \<in> insert 0 S \<and> x \<in> affine hull (insert 0 S - {x})"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2367
    using affine_dependent_def[of "(insert 0 S)"] assms by blast
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2368
  then have "x \<in> span (insert 0 S - {x})"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2369
    using affine_hull_subset_span by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2370
  moreover have "span (insert 0 S - {x}) = span (S - {x})"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2371
    using insert_Diff_if[of "0" S "{x}"] span_insert_0[of "S-{x}"] by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2372
  ultimately have "x \<in> span (S - {x})" by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2373
  then have "x \<noteq> 0 \<Longrightarrow> dependent S"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2374
    using x dependent_def by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2375
  moreover
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2376
  {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2377
    assume "x = 0"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2378
    then have "0 \<in> affine hull S"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2379
      using x hull_mono[of "S - {0}" S] by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2380
    then have "dependent S"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2381
      using affine_hull_0_dependent by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2382
  }
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2383
  ultimately show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2384
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2385
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2386
lemma affine_dependent_iff_dependent:
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2387
  assumes "a \<notin> S"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2388
  shows "affine_dependent (insert a S) \<longleftrightarrow> dependent ((\<lambda>x. -a + x) ` S)"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2389
proof -
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2390
  have "(op + (- a) ` S) = {x - a| x . x : S}" by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2391
  then show ?thesis
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2392
    using affine_dependent_translation_eq[of "(insert a S)" "-a"]
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  2393
      affine_dependent_imp_dependent2 assms
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2394
      dependent_imp_affine_dependent[of a S]
54230
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 53676
diff changeset
  2395
    by (auto simp del: uminus_add_conv_diff)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2396
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2397
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2398
lemma affine_dependent_iff_dependent2:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2399
  assumes "a \<in> S"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2400
  shows "affine_dependent S \<longleftrightarrow> dependent ((\<lambda>x. -a + x) ` (S-{a}))"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2401
proof -
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2402
  have "insert a (S - {a}) = S"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2403
    using assms by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2404
  then show ?thesis
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2405
    using assms affine_dependent_iff_dependent[of a "S-{a}"] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2406
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2407
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2408
lemma affine_hull_insert_span_gen:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2409
  "affine hull (insert a s) = (\<lambda>x. a + x) ` span ((\<lambda>x. - a + x) ` s)"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2410
proof -
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2411
  have h1: "{x - a |x. x \<in> s} = ((\<lambda>x. -a+x) ` s)"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2412
    by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2413
  {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2414
    assume "a \<notin> s"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2415
    then have ?thesis
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2416
      using affine_hull_insert_span[of a s] h1 by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2417
  }
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2418
  moreover
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2419
  {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2420
    assume a1: "a \<in> s"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2421
    have "\<exists>x. x \<in> s \<and> -a+x=0"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2422
      apply (rule exI[of _ a])
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2423
      using a1
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2424
      apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2425
      done
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2426
    then have "insert 0 ((\<lambda>x. -a+x) ` (s - {a})) = (\<lambda>x. -a+x) ` s"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2427
      by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2428
    then have "span ((\<lambda>x. -a+x) ` (s - {a}))=span ((\<lambda>x. -a+x) ` s)"
54230
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 53676
diff changeset
  2429
      using span_insert_0[of "op + (- a) ` (s - {a})"] by (auto simp del: uminus_add_conv_diff)
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2430
    moreover have "{x - a |x. x \<in> (s - {a})} = ((\<lambda>x. -a+x) ` (s - {a}))"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2431
      by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2432
    moreover have "insert a (s - {a}) = insert a s"
63092
a949b2a5f51d eliminated use of empty "assms";
wenzelm
parents: 63077
diff changeset
  2433
      by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2434
    ultimately have ?thesis
63092
a949b2a5f51d eliminated use of empty "assms";
wenzelm
parents: 63077
diff changeset
  2435
      using affine_hull_insert_span[of "a" "s-{a}"] by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2436
  }
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2437
  ultimately show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2438
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2439
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2440
lemma affine_hull_span2:
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2441
  assumes "a \<in> s"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2442
  shows "affine hull s = (\<lambda>x. a+x) ` span ((\<lambda>x. -a+x) ` (s-{a}))"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2443
  using affine_hull_insert_span_gen[of a "s - {a}", unfolded insert_Diff[OF assms]]
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2444
  by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2445
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2446
lemma affine_hull_span_gen:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2447
  assumes "a \<in> affine hull s"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2448
  shows "affine hull s = (\<lambda>x. a+x) ` span ((\<lambda>x. -a+x) ` s)"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2449
proof -
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2450
  have "affine hull (insert a s) = affine hull s"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2451
    using hull_redundant[of a affine s] assms by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2452
  then show ?thesis
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2453
    using affine_hull_insert_span_gen[of a "s"] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2454
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2455
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2456
lemma affine_hull_span_0:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2457
  assumes "0 \<in> affine hull S"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2458
  shows "affine hull S = span S"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2459
  using affine_hull_span_gen[of "0" S] assms by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2460
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2461
lemma extend_to_affine_basis_nonempty:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2462
  fixes S V :: "'n::euclidean_space set"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2463
  assumes "\<not> affine_dependent S" "S \<subseteq> V" "S \<noteq> {}"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2464
  shows "\<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2465
proof -
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2466
  obtain a where a: "a \<in> S"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2467
    using assms by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2468
  then have h0: "independent  ((\<lambda>x. -a + x) ` (S-{a}))"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2469
    using affine_dependent_iff_dependent2 assms by auto
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2470
  then obtain B where B:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2471
    "(\<lambda>x. -a+x) ` (S - {a}) \<subseteq> B \<and> B \<subseteq> (\<lambda>x. -a+x) ` V \<and> independent B \<and> (\<lambda>x. -a+x) ` V \<subseteq> span B"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2472
     using maximal_independent_subset_extend[of "(\<lambda>x. -a+x) ` (S-{a})" "(\<lambda>x. -a + x) ` V"] assms
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2473
     by blast
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  2474
  define T where "T = (\<lambda>x. a+x) ` insert 0 B"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2475
  then have "T = insert a ((\<lambda>x. a+x) ` B)"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2476
    by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2477
  then have "affine hull T = (\<lambda>x. a+x) ` span B"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2478
    using affine_hull_insert_span_gen[of a "((\<lambda>x. a+x) ` B)"] translation_assoc[of "-a" a B]
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2479
    by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2480
  then have "V \<subseteq> affine hull T"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2481
    using B assms translation_inverse_subset[of a V "span B"]
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2482
    by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2483
  moreover have "T \<subseteq> V"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2484
    using T_def B a assms by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2485
  ultimately have "affine hull T = affine hull V"
44457
d366fa5551ef declare euclidean_simps [simp] at the point they are proved;
huffman
parents: 44365
diff changeset
  2486
    by (metis Int_absorb1 Int_absorb2 hull_hull hull_mono)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2487
  moreover have "S \<subseteq> T"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2488
    using T_def B translation_inverse_subset[of a "S-{a}" B]
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2489
    by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2490
  moreover have "\<not> affine_dependent T"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2491
    using T_def affine_dependent_translation_eq[of "insert 0 B"]
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2492
      affine_dependent_imp_dependent2 B
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2493
    by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2494
  ultimately show ?thesis using \<open>T \<subseteq> V\<close> by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2495
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2496
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  2497
lemma affine_basis_exists:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2498
  fixes V :: "'n::euclidean_space set"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2499
  shows "\<exists>B. B \<subseteq> V \<and> \<not> affine_dependent B \<and> affine hull V = affine hull B"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2500
proof (cases "V = {}")
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2501
  case True
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2502
  then show ?thesis
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  2503
    using affine_independent_0 by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2504
next
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2505
  case False
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2506
  then obtain x where "x \<in> V" by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2507
  then show ?thesis
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2508
    using affine_dependent_def[of "{x}"] extend_to_affine_basis_nonempty[of "{x}" V]
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2509
    by auto
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2510
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2511
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2512
proposition extend_to_affine_basis:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2513
  fixes S V :: "'n::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2514
  assumes "\<not> affine_dependent S" "S \<subseteq> V"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2515
  obtains T where "\<not> affine_dependent T" "S \<subseteq> T" "T \<subseteq> V" "affine hull T = affine hull V"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2516
proof (cases "S = {}")
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2517
  case True then show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2518
    using affine_basis_exists by (metis empty_subsetI that)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2519
next
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2520
  case False
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2521
  then show ?thesis by (metis assms extend_to_affine_basis_nonempty that)
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2522
qed
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2523
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2524
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2525
subsection \<open>Affine Dimension of a Set\<close>
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2526
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  2527
definition aff_dim :: "('a::euclidean_space) set \<Rightarrow> int"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  2528
  where "aff_dim V =
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2529
  (SOME d :: int.
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2530
    \<exists>B. affine hull B = affine hull V \<and> \<not> affine_dependent B \<and> of_nat (card B) = d + 1)"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2531
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2532
lemma aff_dim_basis_exists:
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  2533
  fixes V :: "('n::euclidean_space) set"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2534
  shows "\<exists>B. affine hull B = affine hull V \<and> \<not> affine_dependent B \<and> of_nat (card B) = aff_dim V + 1"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2535
proof -
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2536
  obtain B where "\<not> affine_dependent B \<and> affine hull B = affine hull V"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2537
    using affine_basis_exists[of V] by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2538
  then show ?thesis
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2539
    unfolding aff_dim_def
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2540
      some_eq_ex[of "\<lambda>d. \<exists>B. affine hull B = affine hull V \<and> \<not> affine_dependent B \<and> of_nat (card B) = d + 1"]
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2541
    apply auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2542
    apply (rule exI[of _ "int (card B) - (1 :: int)"])
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2543
    apply (rule exI[of _ "B"])
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2544
    apply auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2545
    done
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2546
qed
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2547
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2548
lemma affine_hull_nonempty: "S \<noteq> {} \<longleftrightarrow> affine hull S \<noteq> {}"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2549
proof -
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2550
  have "S = {} \<Longrightarrow> affine hull S = {}"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2551
    using affine_hull_empty by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2552
  moreover have "affine hull S = {} \<Longrightarrow> S = {}"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2553
    unfolding hull_def by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2554
  ultimately show ?thesis by blast
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2555
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2556
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2557
lemma aff_dim_parallel_subspace_aux:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2558
  fixes B :: "'n::euclidean_space set"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2559
  assumes "\<not> affine_dependent B" "a \<in> B"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2560
  shows "finite B \<and> ((card B) - 1 = dim (span ((\<lambda>x. -a+x) ` (B-{a}))))"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2561
proof -
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2562
  have "independent ((\<lambda>x. -a + x) ` (B-{a}))"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2563
    using affine_dependent_iff_dependent2 assms by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2564
  then have fin: "dim (span ((\<lambda>x. -a+x) ` (B-{a}))) = card ((\<lambda>x. -a + x) ` (B-{a}))"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2565
    "finite ((\<lambda>x. -a + x) ` (B - {a}))"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2566
    using indep_card_eq_dim_span[of "(\<lambda>x. -a+x) ` (B-{a})"] by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2567
  show ?thesis
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2568
  proof (cases "(\<lambda>x. -a + x) ` (B - {a}) = {}")
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2569
    case True
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2570
    have "B = insert a ((\<lambda>x. a + x) ` (\<lambda>x. -a + x) ` (B - {a}))"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2571
      using translation_assoc[of "a" "-a" "(B - {a})"] assms by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2572
    then have "B = {a}" using True by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2573
    then show ?thesis using assms fin by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2574
  next
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2575
    case False
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2576
    then have "card ((\<lambda>x. -a + x) ` (B - {a})) > 0"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2577
      using fin by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2578
    moreover have h1: "card ((\<lambda>x. -a + x) ` (B-{a})) = card (B-{a})"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2579
       apply (rule card_image)
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2580
       using translate_inj_on
54230
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 53676
diff changeset
  2581
       apply (auto simp del: uminus_add_conv_diff)
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2582
       done
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2583
    ultimately have "card (B-{a}) > 0" by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2584
    then have *: "finite (B - {a})"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2585
      using card_gt_0_iff[of "(B - {a})"] by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2586
    then have "card (B - {a}) = card B - 1"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2587
      using card_Diff_singleton assms by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2588
    with * show ?thesis using fin h1 by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2589
  qed
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2590
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2591
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2592
lemma aff_dim_parallel_subspace:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2593
  fixes V L :: "'n::euclidean_space set"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2594
  assumes "V \<noteq> {}"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2595
    and "subspace L"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2596
    and "affine_parallel (affine hull V) L"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2597
  shows "aff_dim V = int (dim L)"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2598
proof -
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2599
  obtain B where
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2600
    B: "affine hull B = affine hull V \<and> \<not> affine_dependent B \<and> int (card B) = aff_dim V + 1"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2601
    using aff_dim_basis_exists by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2602
  then have "B \<noteq> {}"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2603
    using assms B affine_hull_nonempty[of V] affine_hull_nonempty[of B]
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2604
    by auto
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2605
  then obtain a where a: "a \<in> B" by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  2606
  define Lb where "Lb = span ((\<lambda>x. -a+x) ` (B-{a}))"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2607
  moreover have "affine_parallel (affine hull B) Lb"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2608
    using Lb_def B assms affine_hull_span2[of a B] a
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2609
      affine_parallel_commut[of "Lb" "(affine hull B)"]
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2610
    unfolding affine_parallel_def
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2611
    by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2612
  moreover have "subspace Lb"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2613
    using Lb_def subspace_span by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2614
  moreover have "affine hull B \<noteq> {}"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2615
    using assms B affine_hull_nonempty[of V] by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2616
  ultimately have "L = Lb"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2617
    using assms affine_parallel_subspace[of "affine hull B"] affine_affine_hull[of B] B
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2618
    by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2619
  then have "dim L = dim Lb"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2620
    by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2621
  moreover have "card B - 1 = dim Lb" and "finite B"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2622
    using Lb_def aff_dim_parallel_subspace_aux a B by auto
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2623
  ultimately show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2624
    using B \<open>B \<noteq> {}\<close> card_gt_0_iff[of B] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2625
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2626
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2627
lemma aff_independent_finite:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2628
  fixes B :: "'n::euclidean_space set"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2629
  assumes "\<not> affine_dependent B"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2630
  shows "finite B"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2631
proof -
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2632
  {
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2633
    assume "B \<noteq> {}"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2634
    then obtain a where "a \<in> B" by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2635
    then have ?thesis
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2636
      using aff_dim_parallel_subspace_aux assms by auto
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2637
  }
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2638
  then show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2639
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2640
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2641
lemma independent_finite:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2642
  fixes B :: "'n::euclidean_space set"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2643
  assumes "independent B"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2644
  shows "finite B"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2645
  using affine_dependent_imp_dependent[of B] aff_independent_finite[of B] assms
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2646
  by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2647
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2648
lemma subspace_dim_equal:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2649
  assumes "subspace (S :: ('n::euclidean_space) set)"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2650
    and "subspace T"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2651
    and "S \<subseteq> T"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2652
    and "dim S \<ge> dim T"
53302
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2653
  shows "S = T"
98fdf6c34142 tuned proofs;
wenzelm
parents: 53077
diff changeset
  2654
proof -
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2655
  obtain B where B: "B \<le> S" "independent B \<and> S \<subseteq> span B" "card B = dim S"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2656
    using basis_exists[of S] by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2657
  then have "span B \<subseteq> S"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2658
    using span_mono[of B S] span_eq[of S] assms by metis
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2659
  then have "span B = S"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2660
    using B by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2661
  have "dim S = dim T"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2662
    using assms dim_subset[of S T] by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2663
  then have "T \<subseteq> span B"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2664
    using card_eq_dim[of B T] B independent_finite assms by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2665
  then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2666
    using assms \<open>span B = S\<close> by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2667
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2668
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2669
corollary dim_eq_span:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2670
  fixes S :: "'a::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2671
  shows "\<lbrakk>S \<subseteq> T; dim T \<le> dim S\<rbrakk> \<Longrightarrow> span S = span T"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2672
by (simp add: span_mono subspace_dim_equal subspace_span)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2673
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
  2674
lemma dim_eq_full:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
  2675
    fixes S :: "'a :: euclidean_space set"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
  2676
    shows "dim S = DIM('a) \<longleftrightarrow> span S = UNIV"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
  2677
apply (rule iffI)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
  2678
 apply (metis dim_eq_span dim_subset_UNIV span_Basis span_span subset_UNIV)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
  2679
by (metis dim_UNIV dim_span)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
  2680
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  2681
lemma span_substd_basis:
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  2682
  assumes d: "d \<subseteq> Basis"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2683
  shows "span d = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2684
  (is "_ = ?B")
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2685
proof -
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2686
  have "d \<subseteq> ?B"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2687
    using d by (auto simp: inner_Basis)
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2688
  moreover have s: "subspace ?B"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2689
    using subspace_substandard[of "\<lambda>i. i \<notin> d"] .
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2690
  ultimately have "span d \<subseteq> ?B"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2691
    using span_mono[of d "?B"] span_eq[of "?B"] by blast
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53348
diff changeset
  2692
  moreover have *: "card d \<le> dim (span d)"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2693
    using independent_card_le_dim[of d "span d"] independent_substdbasis[OF assms] span_inc[of d]
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2694
    by auto
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53348
diff changeset
  2695
  moreover from * have "dim ?B \<le> dim (span d)"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2696
    using dim_substandard[OF assms] by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2697
  ultimately show ?thesis
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2698
    using s subspace_dim_equal[of "span d" "?B"] subspace_span[of d] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2699
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2700
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2701
lemma basis_to_substdbasis_subspace_isomorphism:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2702
  fixes B :: "'a::euclidean_space set"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2703
  assumes "independent B"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2704
  shows "\<exists>f d::'a set. card d = card B \<and> linear f \<and> f ` B = d \<and>
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2705
    f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} \<and> inj_on f (span B) \<and> d \<subseteq> Basis"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2706
proof -
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2707
  have B: "card B = dim B"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2708
    using dim_unique[of B B "card B"] assms span_inc[of B] by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2709
  have "dim B \<le> card (Basis :: 'a set)"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2710
    using dim_subset_UNIV[of B] by simp
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2711
  from ex_card[OF this] obtain d :: "'a set" where d: "d \<subseteq> Basis" and t: "card d = dim B"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2712
    by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2713
  let ?t = "{x::'a::euclidean_space. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0}"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2714
  have "\<exists>f. linear f \<and> f ` B = d \<and> f ` span B = ?t \<and> inj_on f (span B)"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  2715
    apply (rule basis_to_basis_subspace_isomorphism[of "span B" ?t B "d"])
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2716
    apply (rule subspace_span)
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2717
    apply (rule subspace_substandard)
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2718
    defer
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2719
    apply (rule span_inc)
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2720
    apply (rule assms)
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2721
    defer
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2722
    unfolding dim_span[of B]
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2723
    apply(rule B)
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2724
    unfolding span_substd_basis[OF d, symmetric]
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2725
    apply (rule span_inc)
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2726
    apply (rule independent_substdbasis[OF d])
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2727
    apply rule
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2728
    apply assumption
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2729
    unfolding t[symmetric] span_substd_basis[OF d] dim_substandard[OF d]
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2730
    apply auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2731
    done
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2732
  with t \<open>card B = dim B\<close> d show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2733
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2734
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2735
lemma aff_dim_empty:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2736
  fixes S :: "'n::euclidean_space set"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2737
  shows "S = {} \<longleftrightarrow> aff_dim S = -1"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2738
proof -
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2739
  obtain B where *: "affine hull B = affine hull S"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2740
    and "\<not> affine_dependent B"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2741
    and "int (card B) = aff_dim S + 1"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2742
    using aff_dim_basis_exists by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2743
  moreover
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2744
  from * have "S = {} \<longleftrightarrow> B = {}"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2745
    using affine_hull_nonempty[of B] affine_hull_nonempty[of S] by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2746
  ultimately show ?thesis
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2747
    using aff_independent_finite[of B] card_gt_0_iff[of B] by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2748
qed
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2749
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  2750
lemma aff_dim_empty_eq [simp]: "aff_dim ({}::'a::euclidean_space set) = -1"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  2751
  by (simp add: aff_dim_empty [symmetric])
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  2752
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
  2753
lemma aff_dim_affine_hull [simp]: "aff_dim (affine hull S) = aff_dim S"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2754
  unfolding aff_dim_def using hull_hull[of _ S] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2755
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2756
lemma aff_dim_affine_hull2:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2757
  assumes "affine hull S = affine hull T"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2758
  shows "aff_dim S = aff_dim T"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2759
  unfolding aff_dim_def using assms by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2760
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  2761
lemma aff_dim_unique:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2762
  fixes B V :: "'n::euclidean_space set"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2763
  assumes "affine hull B = affine hull V \<and> \<not> affine_dependent B"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2764
  shows "of_nat (card B) = aff_dim V + 1"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2765
proof (cases "B = {}")
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2766
  case True
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2767
  then have "V = {}"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2768
    using affine_hull_nonempty[of V] affine_hull_nonempty[of B] assms
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2769
    by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2770
  then have "aff_dim V = (-1::int)"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2771
    using aff_dim_empty by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2772
  then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2773
    using \<open>B = {}\<close> by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2774
next
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2775
  case False
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2776
  then obtain a where a: "a \<in> B" by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  2777
  define Lb where "Lb = span ((\<lambda>x. -a+x) ` (B-{a}))"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2778
  have "affine_parallel (affine hull B) Lb"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2779
    using Lb_def affine_hull_span2[of a B] a
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2780
      affine_parallel_commut[of "Lb" "(affine hull B)"]
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2781
    unfolding affine_parallel_def by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2782
  moreover have "subspace Lb"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2783
    using Lb_def subspace_span by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2784
  ultimately have "aff_dim B = int(dim Lb)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2785
    using aff_dim_parallel_subspace[of B Lb] \<open>B \<noteq> {}\<close> by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2786
  moreover have "(card B) - 1 = dim Lb" "finite B"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  2787
    using Lb_def aff_dim_parallel_subspace_aux a assms by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2788
  ultimately have "of_nat (card B) = aff_dim B + 1"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2789
    using \<open>B \<noteq> {}\<close> card_gt_0_iff[of B] by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2790
  then show ?thesis
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2791
    using aff_dim_affine_hull2 assms by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2792
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2793
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  2794
lemma aff_dim_affine_independent:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2795
  fixes B :: "'n::euclidean_space set"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2796
  assumes "\<not> affine_dependent B"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2797
  shows "of_nat (card B) = aff_dim B + 1"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2798
  using aff_dim_unique[of B B] assms by auto
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2799
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  2800
lemma affine_independent_iff_card:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  2801
    fixes s :: "'a::euclidean_space set"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  2802
    shows "~ affine_dependent s \<longleftrightarrow> finite s \<and> aff_dim s = int(card s) - 1"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  2803
  apply (rule iffI)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  2804
  apply (simp add: aff_dim_affine_independent aff_independent_finite)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  2805
  by (metis affine_basis_exists [of s] aff_dim_unique card_subset_eq diff_add_cancel of_nat_eq_iff)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  2806
62948
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
  2807
lemma aff_dim_sing [simp]:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2808
  fixes a :: "'n::euclidean_space"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2809
  shows "aff_dim {a} = 0"
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  2810
  using aff_dim_affine_independent[of "{a}"] affine_independent_1 by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2811
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2812
lemma aff_dim_inner_basis_exists:
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  2813
  fixes V :: "('n::euclidean_space) set"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2814
  shows "\<exists>B. B \<subseteq> V \<and> affine hull B = affine hull V \<and>
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2815
    \<not> affine_dependent B \<and> of_nat (card B) = aff_dim V + 1"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2816
proof -
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2817
  obtain B where B: "\<not> affine_dependent B" "B \<subseteq> V" "affine hull B = affine hull V"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2818
    using affine_basis_exists[of V] by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2819
  then have "of_nat(card B) = aff_dim V+1" using aff_dim_unique by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2820
  with B show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2821
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2822
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2823
lemma aff_dim_le_card:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2824
  fixes V :: "'n::euclidean_space set"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2825
  assumes "finite V"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2826
  shows "aff_dim V \<le> of_nat (card V) - 1"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2827
proof -
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2828
  obtain B where B: "B \<subseteq> V" "of_nat (card B) = aff_dim V + 1"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2829
    using aff_dim_inner_basis_exists[of V] by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2830
  then have "card B \<le> card V"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2831
    using assms card_mono by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2832
  with B show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2833
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2834
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2835
lemma aff_dim_parallel_eq:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2836
  fixes S T :: "'n::euclidean_space set"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2837
  assumes "affine_parallel (affine hull S) (affine hull T)"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2838
  shows "aff_dim S = aff_dim T"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2839
proof -
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2840
  {
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2841
    assume "T \<noteq> {}" "S \<noteq> {}"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2842
    then obtain L where L: "subspace L \<and> affine_parallel (affine hull T) L"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2843
      using affine_parallel_subspace[of "affine hull T"]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2844
        affine_affine_hull[of T] affine_hull_nonempty
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2845
      by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2846
    then have "aff_dim T = int (dim L)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2847
      using aff_dim_parallel_subspace \<open>T \<noteq> {}\<close> by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2848
    moreover have *: "subspace L \<and> affine_parallel (affine hull S) L"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2849
       using L affine_parallel_assoc[of "affine hull S" "affine hull T" L] assms by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2850
    moreover from * have "aff_dim S = int (dim L)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  2851
      using aff_dim_parallel_subspace \<open>S \<noteq> {}\<close> by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2852
    ultimately have ?thesis by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2853
  }
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2854
  moreover
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2855
  {
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2856
    assume "S = {}"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2857
    then have "S = {}" and "T = {}"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2858
      using assms affine_hull_nonempty
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2859
      unfolding affine_parallel_def
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2860
      by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2861
    then have ?thesis using aff_dim_empty by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2862
  }
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2863
  moreover
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2864
  {
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2865
    assume "T = {}"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2866
    then have "S = {}" and "T = {}"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2867
      using assms affine_hull_nonempty
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2868
      unfolding affine_parallel_def
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2869
      by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2870
    then have ?thesis
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2871
      using aff_dim_empty by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2872
  }
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2873
  ultimately show ?thesis by blast
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2874
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2875
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2876
lemma aff_dim_translation_eq:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2877
  fixes a :: "'n::euclidean_space"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2878
  shows "aff_dim ((\<lambda>x. a + x) ` S) = aff_dim S"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2879
proof -
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2880
  have "affine_parallel (affine hull S) (affine hull ((\<lambda>x. a + x) ` S))"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2881
    unfolding affine_parallel_def
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2882
    apply (rule exI[of _ "a"])
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2883
    using affine_hull_translation[of a S]
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2884
    apply auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2885
    done
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2886
  then show ?thesis
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2887
    using aff_dim_parallel_eq[of S "(\<lambda>x. a + x) ` S"] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2888
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2889
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2890
lemma aff_dim_affine:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2891
  fixes S L :: "'n::euclidean_space set"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2892
  assumes "S \<noteq> {}"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2893
    and "affine S"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2894
    and "subspace L"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2895
    and "affine_parallel S L"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2896
  shows "aff_dim S = int (dim L)"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2897
proof -
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2898
  have *: "affine hull S = S"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2899
    using assms affine_hull_eq[of S] by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2900
  then have "affine_parallel (affine hull S) L"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2901
    using assms by (simp add: *)
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2902
  then show ?thesis
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2903
    using assms aff_dim_parallel_subspace[of S L] by blast
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2904
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2905
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2906
lemma dim_affine_hull:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2907
  fixes S :: "'n::euclidean_space set"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2908
  shows "dim (affine hull S) = dim S"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2909
proof -
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2910
  have "dim (affine hull S) \<ge> dim S"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2911
    using dim_subset by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2912
  moreover have "dim (span S) \<ge> dim (affine hull S)"
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 60176
diff changeset
  2913
    using dim_subset affine_hull_subset_span by blast
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2914
  moreover have "dim (span S) = dim S"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2915
    using dim_span by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2916
  ultimately show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2917
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2918
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2919
lemma aff_dim_subspace:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2920
  fixes S :: "'n::euclidean_space set"
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2921
  assumes "subspace S"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2922
  shows "aff_dim S = int (dim S)"
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2923
proof (cases "S={}")
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2924
  case True with assms show ?thesis
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2925
    by (simp add: subspace_affine)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2926
next
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2927
  case False
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2928
  with aff_dim_affine[of S S] assms subspace_imp_affine[of S] affine_parallel_reflex[of S] subspace_affine
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2929
  show ?thesis by auto
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2930
qed
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2931
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2932
lemma aff_dim_zero:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2933
  fixes S :: "'n::euclidean_space set"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2934
  assumes "0 \<in> affine hull S"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2935
  shows "aff_dim S = int (dim S)"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2936
proof -
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2937
  have "subspace (affine hull S)"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2938
    using subspace_affine[of "affine hull S"] affine_affine_hull assms
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2939
    by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2940
  then have "aff_dim (affine hull S) = int (dim (affine hull S))"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2941
    using assms aff_dim_subspace[of "affine hull S"] by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2942
  then show ?thesis
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2943
    using aff_dim_affine_hull[of S] dim_affine_hull[of S]
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2944
    by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2945
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2946
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2947
lemma aff_dim_eq_dim:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2948
  fixes S :: "'n::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2949
  assumes "a \<in> affine hull S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2950
  shows "aff_dim S = int (dim ((\<lambda>x. -a+x) ` S))"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2951
proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2952
  have "0 \<in> affine hull ((\<lambda>x. -a+x) ` S)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2953
    unfolding Convex_Euclidean_Space.affine_hull_translation
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2954
    using assms by (simp add: ab_group_add_class.ab_left_minus image_iff)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2955
  with aff_dim_zero show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2956
    by (metis aff_dim_translation_eq)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2957
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  2958
63072
eb5d493a9e03 renamings and refinements
paulson <lp15@cam.ac.uk>
parents: 63040
diff changeset
  2959
lemma aff_dim_UNIV [simp]: "aff_dim (UNIV :: 'n::euclidean_space set) = int(DIM('n))"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2960
  using aff_dim_subspace[of "(UNIV :: 'n::euclidean_space set)"]
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2961
    dim_UNIV[where 'a="'n::euclidean_space"]
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2962
  by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2963
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2964
lemma aff_dim_geq:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2965
  fixes V :: "'n::euclidean_space set"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2966
  shows "aff_dim V \<ge> -1"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2967
proof -
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2968
  obtain B where "affine hull B = affine hull V"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2969
    and "\<not> affine_dependent B"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  2970
    and "int (card B) = aff_dim V + 1"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2971
    using aff_dim_basis_exists by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  2972
  then show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2973
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  2974
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  2975
lemma aff_dim_negative_iff [simp]:
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  2976
  fixes S :: "'n::euclidean_space set"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  2977
  shows "aff_dim S < 0 \<longleftrightarrow>S = {}"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  2978
by (metis aff_dim_empty aff_dim_geq diff_0 eq_iff zle_diff1_eq)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  2979
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2980
lemma affine_independent_card_dim_diffs:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2981
  fixes S :: "'a :: euclidean_space set"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2982
  assumes "~ affine_dependent S" "a \<in> S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2983
    shows "card S = dim {x - a|x. x \<in> S} + 1"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2984
proof -
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2985
  have 1: "{b - a|b. b \<in> (S - {a})} \<subseteq> {x - a|x. x \<in> S}" by auto
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2986
  have 2: "x - a \<in> span {b - a |b. b \<in> S - {a}}" if "x \<in> S" for x
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2987
  proof (cases "x = a")
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2988
    case True then show ?thesis by simp
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2989
  next
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2990
    case False then show ?thesis
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2991
      using assms by (blast intro: span_superset that)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2992
  qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2993
  have "\<not> affine_dependent (insert a S)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2994
    by (simp add: assms insert_absorb)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2995
  then have 3: "independent {b - a |b. b \<in> S - {a}}"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2996
      using dependent_imp_affine_dependent by fastforce
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2997
  have "{b - a |b. b \<in> S - {a}} = (\<lambda>b. b-a) ` (S - {a})"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2998
    by blast
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  2999
  then have "card {b - a |b. b \<in> S - {a}} = card ((\<lambda>b. b-a) ` (S - {a}))"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3000
    by simp
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3001
  also have "... = card (S - {a})"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3002
    by (metis (no_types, lifting) card_image diff_add_cancel inj_onI)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3003
  also have "... = card S - 1"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3004
    by (simp add: aff_independent_finite assms)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3005
  finally have 4: "card {b - a |b. b \<in> S - {a}} = card S - 1" .
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3006
  have "finite S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3007
    by (meson assms aff_independent_finite)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3008
  with \<open>a \<in> S\<close> have "card S \<noteq> 0" by auto
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3009
  moreover have "dim {x - a |x. x \<in> S} = card S - 1"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3010
    using 2 by (blast intro: dim_unique [OF 1 _ 3 4])
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3011
  ultimately show ?thesis
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3012
    by auto
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3013
qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3014
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  3015
lemma independent_card_le_aff_dim:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3016
  fixes B :: "'n::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3017
  assumes "B \<subseteq> V"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  3018
  assumes "\<not> affine_dependent B"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  3019
  shows "int (card B) \<le> aff_dim V + 1"
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  3020
proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  3021
  obtain T where T: "\<not> affine_dependent T \<and> B \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  3022
    by (metis assms extend_to_affine_basis[of B V])
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  3023
  then have "of_nat (card T) = aff_dim V + 1"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  3024
    using aff_dim_unique by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  3025
  then show ?thesis
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3026
    using T card_mono[of T B] aff_independent_finite[of T] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3027
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3028
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3029
lemma aff_dim_subset:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3030
  fixes S T :: "'n::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3031
  assumes "S \<subseteq> T"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3032
  shows "aff_dim S \<le> aff_dim T"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  3033
proof -
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3034
  obtain B where B: "\<not> affine_dependent B" "B \<subseteq> S" "affine hull B = affine hull S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3035
    "of_nat (card B) = aff_dim S + 1"
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  3036
    using aff_dim_inner_basis_exists[of S] by auto
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  3037
  then have "int (card B) \<le> aff_dim T + 1"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  3038
    using assms independent_card_le_aff_dim[of B T] by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3039
  with B show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3040
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3041
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3042
lemma aff_dim_le_DIM:
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  3043
  fixes S :: "'n::euclidean_space set"
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  3044
  shows "aff_dim S \<le> int (DIM('n))"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  3045
proof -
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  3046
  have "aff_dim (UNIV :: 'n::euclidean_space set) = int(DIM('n))"
63072
eb5d493a9e03 renamings and refinements
paulson <lp15@cam.ac.uk>
parents: 63040
diff changeset
  3047
    using aff_dim_UNIV by auto
53339
0dc28fd72c7d tuned proofs;
wenzelm
parents: 53333
diff changeset
  3048
  then show "aff_dim (S:: 'n::euclidean_space set) \<le> int(DIM('n))"
63092
a949b2a5f51d eliminated use of empty "assms";
wenzelm
parents: 63077
diff changeset
  3049
    using aff_dim_subset[of S "(UNIV :: ('n::euclidean_space) set)"] subset_UNIV by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3050
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3051
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3052
lemma affine_dim_equal:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3053
  fixes S :: "'n::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3054
  assumes "affine S" "affine T" "S \<noteq> {}" "S \<subseteq> T" "aff_dim S = aff_dim T"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3055
  shows "S = T"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3056
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3057
  obtain a where "a \<in> S" using assms by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3058
  then have "a \<in> T" using assms by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  3059
  define LS where "LS = {y. \<exists>x \<in> S. (-a) + x = y}"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3060
  then have ls: "subspace LS" "affine_parallel S LS"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3061
    using assms parallel_subspace_explicit[of S a LS] \<open>a \<in> S\<close> by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3062
  then have h1: "int(dim LS) = aff_dim S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3063
    using assms aff_dim_affine[of S LS] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3064
  have "T \<noteq> {}" using assms by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  3065
  define LT where "LT = {y. \<exists>x \<in> T. (-a) + x = y}"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3066
  then have lt: "subspace LT \<and> affine_parallel T LT"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3067
    using assms parallel_subspace_explicit[of T a LT] \<open>a \<in> T\<close> by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3068
  then have "int(dim LT) = aff_dim T"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3069
    using assms aff_dim_affine[of T LT] \<open>T \<noteq> {}\<close> by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3070
  then have "dim LS = dim LT"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3071
    using h1 assms by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3072
  moreover have "LS \<le> LT"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3073
    using LS_def LT_def assms by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3074
  ultimately have "LS = LT"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3075
    using subspace_dim_equal[of LS LT] ls lt by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3076
  moreover have "S = {x. \<exists>y \<in> LS. a+y=x}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3077
    using LS_def by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3078
  moreover have "T = {x. \<exists>y \<in> LT. a+y=x}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3079
    using LT_def by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3080
  ultimately show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3081
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3082
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3083
lemma affine_hull_UNIV:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3084
  fixes S :: "'n::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3085
  assumes "aff_dim S = int(DIM('n))"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3086
  shows "affine hull S = (UNIV :: ('n::euclidean_space) set)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3087
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3088
  have "S \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3089
    using assms aff_dim_empty[of S] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3090
  have h0: "S \<subseteq> affine hull S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3091
    using hull_subset[of S _] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3092
  have h1: "aff_dim (UNIV :: ('n::euclidean_space) set) = aff_dim S"
63072
eb5d493a9e03 renamings and refinements
paulson <lp15@cam.ac.uk>
parents: 63040
diff changeset
  3093
    using aff_dim_UNIV assms by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3094
  then have h2: "aff_dim (affine hull S) \<le> aff_dim (UNIV :: ('n::euclidean_space) set)"
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3095
    using aff_dim_le_DIM[of "affine hull S"] assms h0 by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3096
  have h3: "aff_dim S \<le> aff_dim (affine hull S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3097
    using h0 aff_dim_subset[of S "affine hull S"] assms by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3098
  then have h4: "aff_dim (affine hull S) = aff_dim (UNIV :: ('n::euclidean_space) set)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3099
    using h0 h1 h2 by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3100
  then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3101
    using affine_dim_equal[of "affine hull S" "(UNIV :: ('n::euclidean_space) set)"]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3102
      affine_affine_hull[of S] affine_UNIV assms h4 h0 \<open>S \<noteq> {}\<close>
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3103
    by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3104
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3105
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3106
lemma disjoint_affine_hull:
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3107
  fixes s :: "'n::euclidean_space set"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3108
  assumes "~ affine_dependent s" "t \<subseteq> s" "u \<subseteq> s" "t \<inter> u = {}"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3109
    shows "(affine hull t) \<inter> (affine hull u) = {}"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3110
proof -
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3111
  have "finite s" using assms by (simp add: aff_independent_finite)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3112
  then have "finite t" "finite u" using assms finite_subset by blast+
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3113
  { fix y
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3114
    assume yt: "y \<in> affine hull t" and yu: "y \<in> affine hull u"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3115
    then obtain a b
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3116
           where a1 [simp]: "setsum a t = 1" and [simp]: "setsum (\<lambda>v. a v *\<^sub>R v) t = y"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3117
             and [simp]: "setsum b u = 1" "setsum (\<lambda>v. b v *\<^sub>R v) u = y"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3118
      by (auto simp: affine_hull_finite \<open>finite t\<close> \<open>finite u\<close>)
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  3119
    define c where "c x = (if x \<in> t then a x else if x \<in> u then -(b x) else 0)" for x
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3120
    have [simp]: "s \<inter> t = t" "s \<inter> - t \<inter> u = u" using assms by auto
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3121
    have "setsum c s = 0"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3122
      by (simp add: c_def comm_monoid_add_class.setsum.If_cases \<open>finite s\<close> setsum_negf)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3123
    moreover have "~ (\<forall>v\<in>s. c v = 0)"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3124
      by (metis (no_types) IntD1 \<open>s \<inter> t = t\<close> a1 c_def setsum_not_0 zero_neq_one)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3125
    moreover have "(\<Sum>v\<in>s. c v *\<^sub>R v) = 0"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3126
      by (simp add: c_def if_smult setsum_negf
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3127
             comm_monoid_add_class.setsum.If_cases \<open>finite s\<close>)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3128
    ultimately have False
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3129
      using assms \<open>finite s\<close> by (auto simp: affine_dependent_explicit)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3130
  }
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3131
  then show ?thesis by blast
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3132
qed
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3133
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3134
lemma aff_dim_convex_hull:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3135
  fixes S :: "'n::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3136
  shows "aff_dim (convex hull S) = aff_dim S"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  3137
  using aff_dim_affine_hull[of S] convex_hull_subset_affine_hull[of S]
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3138
    hull_subset[of S "convex"] aff_dim_subset[of S "convex hull S"]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3139
    aff_dim_subset[of "convex hull S" "affine hull S"]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3140
  by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3141
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3142
lemma aff_dim_cball:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3143
  fixes a :: "'n::euclidean_space"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3144
  assumes "e > 0"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3145
  shows "aff_dim (cball a e) = int (DIM('n))"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3146
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3147
  have "(\<lambda>x. a + x) ` (cball 0 e) \<subseteq> cball a e"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3148
    unfolding cball_def dist_norm by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3149
  then have "aff_dim (cball (0 :: 'n::euclidean_space) e) \<le> aff_dim (cball a e)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3150
    using aff_dim_translation_eq[of a "cball 0 e"]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3151
          aff_dim_subset[of "op + a ` cball 0 e" "cball a e"]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3152
    by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3153
  moreover have "aff_dim (cball (0 :: 'n::euclidean_space) e) = int (DIM('n))"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3154
    using hull_inc[of "(0 :: 'n::euclidean_space)" "cball 0 e"]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3155
      centre_in_cball[of "(0 :: 'n::euclidean_space)"] assms
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3156
    by (simp add: dim_cball[of e] aff_dim_zero[of "cball 0 e"])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3157
  ultimately show ?thesis
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3158
    using aff_dim_le_DIM[of "cball a e"] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3159
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3160
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3161
lemma aff_dim_open:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3162
  fixes S :: "'n::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3163
  assumes "open S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3164
    and "S \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3165
  shows "aff_dim S = int (DIM('n))"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3166
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3167
  obtain x where "x \<in> S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3168
    using assms by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3169
  then obtain e where e: "e > 0" "cball x e \<subseteq> S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3170
    using open_contains_cball[of S] assms by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3171
  then have "aff_dim (cball x e) \<le> aff_dim S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3172
    using aff_dim_subset by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3173
  with e show ?thesis
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3174
    using aff_dim_cball[of e x] aff_dim_le_DIM[of S] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3175
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3176
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3177
lemma low_dim_interior:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3178
  fixes S :: "'n::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3179
  assumes "\<not> aff_dim S = int (DIM('n))"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3180
  shows "interior S = {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3181
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3182
  have "aff_dim(interior S) \<le> aff_dim S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3183
    using interior_subset aff_dim_subset[of "interior S" S] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3184
  then show ?thesis
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3185
    using aff_dim_open[of "interior S"] aff_dim_le_DIM[of S] assms by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3186
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3187
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  3188
corollary empty_interior_lowdim:
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  3189
  fixes S :: "'n::euclidean_space set"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  3190
  shows "dim S < DIM ('n) \<Longrightarrow> interior S = {}"
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3191
by (metis low_dim_interior affine_hull_UNIV dim_affine_hull less_not_refl dim_UNIV)
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  3192
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  3193
corollary aff_dim_nonempty_interior:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  3194
  fixes S :: "'a::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  3195
  shows "interior S \<noteq> {} \<Longrightarrow> aff_dim S = DIM('a)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  3196
by (metis low_dim_interior)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  3197
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3198
subsection \<open>Caratheodory's theorem.\<close>
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3199
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3200
lemma convex_hull_caratheodory_aff_dim:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3201
  fixes p :: "('a::euclidean_space) set"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3202
  shows "convex hull p =
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3203
    {y. \<exists>s u. finite s \<and> s \<subseteq> p \<and> card s \<le> aff_dim p + 1 \<and>
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3204
      (\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s = 1 \<and> setsum (\<lambda>v. u v *\<^sub>R v) s = y}"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3205
  unfolding convex_hull_explicit set_eq_iff mem_Collect_eq
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3206
proof (intro allI iffI)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3207
  fix y
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3208
  let ?P = "\<lambda>n. \<exists>s u. finite s \<and> card s = n \<and> s \<subseteq> p \<and> (\<forall>x\<in>s. 0 \<le> u x) \<and>
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3209
    setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = y"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3210
  assume "\<exists>s u. finite s \<and> s \<subseteq> p \<and> (\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = y"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3211
  then obtain N where "?P N" by auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3212
  then have "\<exists>n\<le>N. (\<forall>k<n. \<not> ?P k) \<and> ?P n"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3213
    apply (rule_tac ex_least_nat_le)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3214
    apply auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3215
    done
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3216
  then obtain n where "?P n" and smallest: "\<forall>k<n. \<not> ?P k"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3217
    by blast
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3218
  then obtain s u where obt: "finite s" "card s = n" "s\<subseteq>p" "\<forall>x\<in>s. 0 \<le> u x"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3219
    "setsum u s = 1"  "(\<Sum>v\<in>s. u v *\<^sub>R v) = y" by auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3220
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3221
  have "card s \<le> aff_dim p + 1"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3222
  proof (rule ccontr, simp only: not_le)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3223
    assume "aff_dim p + 1 < card s"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3224
    then have "affine_dependent s"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3225
      using affine_dependent_biggerset[OF obt(1)] independent_card_le_aff_dim not_less obt(3)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3226
      by blast
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3227
    then obtain w v where wv: "setsum w s = 0" "v\<in>s" "w v \<noteq> 0" "(\<Sum>v\<in>s. w v *\<^sub>R v) = 0"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3228
      using affine_dependent_explicit_finite[OF obt(1)] by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  3229
    define i where "i = (\<lambda>v. (u v) / (- w v)) ` {v\<in>s. w v < 0}"
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  3230
    define t where "t = Min i"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3231
    have "\<exists>x\<in>s. w x < 0"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3232
    proof (rule ccontr, simp add: not_less)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3233
      assume as:"\<forall>x\<in>s. 0 \<le> w x"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3234
      then have "setsum w (s - {v}) \<ge> 0"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3235
        apply (rule_tac setsum_nonneg)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3236
        apply auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3237
        done
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3238
      then have "setsum w s > 0"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3239
        unfolding setsum.remove[OF obt(1) \<open>v\<in>s\<close>]
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3240
        using as[THEN bspec[where x=v]]  \<open>v\<in>s\<close>  \<open>w v \<noteq> 0\<close> by auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3241
      then show False using wv(1) by auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3242
    qed
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3243
    then have "i \<noteq> {}" unfolding i_def by auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3244
    then have "t \<ge> 0"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3245
      using Min_ge_iff[of i 0 ] and obt(1)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3246
      unfolding t_def i_def
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3247
      using obt(4)[unfolded le_less]
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3248
      by (auto simp: divide_le_0_iff)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3249
    have t: "\<forall>v\<in>s. u v + t * w v \<ge> 0"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3250
    proof
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3251
      fix v
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3252
      assume "v \<in> s"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3253
      then have v: "0 \<le> u v"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3254
        using obt(4)[THEN bspec[where x=v]] by auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3255
      show "0 \<le> u v + t * w v"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3256
      proof (cases "w v < 0")
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3257
        case False
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3258
        thus ?thesis using v \<open>t\<ge>0\<close> by auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3259
      next
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3260
        case True
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3261
        then have "t \<le> u v / (- w v)"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3262
          using \<open>v\<in>s\<close> unfolding t_def i_def
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3263
          apply (rule_tac Min_le)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3264
          using obt(1) apply auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3265
          done
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3266
        then show ?thesis
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3267
          unfolding real_0_le_add_iff
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3268
          using pos_le_divide_eq[OF True[unfolded neg_0_less_iff_less[symmetric]]]
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3269
          by auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3270
      qed
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3271
    qed
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3272
    obtain a where "a \<in> s" and "t = (\<lambda>v. (u v) / (- w v)) a" and "w a < 0"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3273
      using Min_in[OF _ \<open>i\<noteq>{}\<close>] and obt(1) unfolding i_def t_def by auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3274
    then have a: "a \<in> s" "u a + t * w a = 0" by auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3275
    have *: "\<And>f. setsum f (s - {a}) = setsum f s - ((f a)::'b::ab_group_add)"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3276
      unfolding setsum.remove[OF obt(1) \<open>a\<in>s\<close>] by auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3277
    have "(\<Sum>v\<in>s. u v + t * w v) = 1"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3278
      unfolding setsum.distrib wv(1) setsum_right_distrib[symmetric] obt(5) by auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3279
    moreover have "(\<Sum>v\<in>s. u v *\<^sub>R v + (t * w v) *\<^sub>R v) - (u a *\<^sub>R a + (t * w a) *\<^sub>R a) = y"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3280
      unfolding setsum.distrib obt(6) scaleR_scaleR[symmetric] scaleR_right.setsum [symmetric] wv(4)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3281
      using a(2) [THEN eq_neg_iff_add_eq_0 [THEN iffD2]] by simp
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3282
    ultimately have "?P (n - 1)"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3283
      apply (rule_tac x="(s - {a})" in exI)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3284
      apply (rule_tac x="\<lambda>v. u v + t * w v" in exI)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3285
      using obt(1-3) and t and a
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3286
      apply (auto simp add: * scaleR_left_distrib)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3287
      done
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3288
    then show False
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3289
      using smallest[THEN spec[where x="n - 1"]] by auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3290
  qed
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3291
  then show "\<exists>s u. finite s \<and> s \<subseteq> p \<and> card s \<le> aff_dim p + 1 \<and>
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3292
      (\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = y"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3293
    using obt by auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3294
qed auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3295
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3296
lemma caratheodory_aff_dim:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3297
  fixes p :: "('a::euclidean_space) set"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3298
  shows "convex hull p = {x. \<exists>s. finite s \<and> s \<subseteq> p \<and> card s \<le> aff_dim p + 1 \<and> x \<in> convex hull s}"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3299
        (is "?lhs = ?rhs")
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3300
proof
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3301
  show "?lhs \<subseteq> ?rhs"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3302
    apply (subst convex_hull_caratheodory_aff_dim)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3303
    apply clarify
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3304
    apply (rule_tac x="s" in exI)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3305
    apply (simp add: hull_subset convex_explicit [THEN iffD1, OF convex_convex_hull])
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3306
    done
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3307
next
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3308
  show "?rhs \<subseteq> ?lhs"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3309
    using hull_mono by blast
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3310
qed
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3311
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3312
lemma convex_hull_caratheodory:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3313
  fixes p :: "('a::euclidean_space) set"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3314
  shows "convex hull p =
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3315
            {y. \<exists>s u. finite s \<and> s \<subseteq> p \<and> card s \<le> DIM('a) + 1 \<and>
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3316
              (\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s = 1 \<and> setsum (\<lambda>v. u v *\<^sub>R v) s = y}"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3317
        (is "?lhs = ?rhs")
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3318
proof (intro set_eqI iffI)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3319
  fix x
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3320
  assume "x \<in> ?lhs" then show "x \<in> ?rhs"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3321
    apply (simp only: convex_hull_caratheodory_aff_dim Set.mem_Collect_eq)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3322
    apply (erule ex_forward)+
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3323
    using aff_dim_le_DIM [of p]
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3324
    apply simp
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3325
    done
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3326
next
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3327
  fix x
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3328
  assume "x \<in> ?rhs" then show "x \<in> ?lhs"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3329
    by (auto simp add: convex_hull_explicit)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3330
qed
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3331
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3332
theorem caratheodory:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3333
  "convex hull p =
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3334
    {x::'a::euclidean_space. \<exists>s. finite s \<and> s \<subseteq> p \<and>
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3335
      card s \<le> DIM('a) + 1 \<and> x \<in> convex hull s}"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3336
proof safe
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3337
  fix x
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3338
  assume "x \<in> convex hull p"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3339
  then obtain s u where "finite s" "s \<subseteq> p" "card s \<le> DIM('a) + 1"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3340
    "\<forall>x\<in>s. 0 \<le> u x" "setsum u s = 1" "(\<Sum>v\<in>s. u v *\<^sub>R v) = x"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3341
    unfolding convex_hull_caratheodory by auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3342
  then show "\<exists>s. finite s \<and> s \<subseteq> p \<and> card s \<le> DIM('a) + 1 \<and> x \<in> convex hull s"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3343
    apply (rule_tac x=s in exI)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3344
    using hull_subset[of s convex]
63170
eae6549dbea2 tuned proofs, to allow unfold_abs_def;
wenzelm
parents: 63148
diff changeset
  3345
    using convex_convex_hull[simplified convex_explicit, of s,
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3346
      THEN spec[where x=s], THEN spec[where x=u]]
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3347
    apply auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3348
    done
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3349
next
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3350
  fix x s
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3351
  assume  "finite s" "s \<subseteq> p" "card s \<le> DIM('a) + 1" "x \<in> convex hull s"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3352
  then show "x \<in> convex hull p"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3353
    using hull_mono[OF \<open>s\<subseteq>p\<close>] by auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3354
qed
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3355
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  3356
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3357
subsection \<open>Relative interior of a set\<close>
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3358
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3359
definition "rel_interior S =
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3360
  {x. \<exists>T. openin (subtopology euclidean (affine hull S)) T \<and> x \<in> T \<and> T \<subseteq> S}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3361
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3362
lemma rel_interior:
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3363
  "rel_interior S = {x \<in> S. \<exists>T. open T \<and> x \<in> T \<and> T \<inter> affine hull S \<subseteq> S}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3364
  unfolding rel_interior_def[of S] openin_open[of "affine hull S"]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3365
  apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3366
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3367
  fix x T
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3368
  assume *: "x \<in> S" "open T" "x \<in> T" "T \<inter> affine hull S \<subseteq> S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3369
  then have **: "x \<in> T \<inter> affine hull S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3370
    using hull_inc by auto
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  3371
  show "\<exists>Tb. (\<exists>Ta. open Ta \<and> Tb = affine hull S \<inter> Ta) \<and> x \<in> Tb \<and> Tb \<subseteq> S"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  3372
    apply (rule_tac x = "T \<inter> (affine hull S)" in exI)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3373
    using * **
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3374
    apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3375
    done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3376
qed
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3377
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3378
lemma mem_rel_interior: "x \<in> rel_interior S \<longleftrightarrow> (\<exists>T. open T \<and> x \<in> T \<inter> S \<and> T \<inter> affine hull S \<subseteq> S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3379
  by (auto simp add: rel_interior)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3380
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3381
lemma mem_rel_interior_ball:
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3382
  "x \<in> rel_interior S \<longleftrightarrow> x \<in> S \<and> (\<exists>e. e > 0 \<and> ball x e \<inter> affine hull S \<subseteq> S)"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3383
  apply (simp add: rel_interior, safe)
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3384
  apply (force simp add: open_contains_ball)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3385
  apply (rule_tac x = "ball x e" in exI)
44457
d366fa5551ef declare euclidean_simps [simp] at the point they are proved;
huffman
parents: 44365
diff changeset
  3386
  apply simp
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3387
  done
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3388
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  3389
lemma rel_interior_ball:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3390
  "rel_interior S = {x \<in> S. \<exists>e. e > 0 \<and> ball x e \<inter> affine hull S \<subseteq> S}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3391
  using mem_rel_interior_ball [of _ S] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3392
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3393
lemma mem_rel_interior_cball:
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3394
  "x \<in> rel_interior S \<longleftrightarrow> x \<in> S \<and> (\<exists>e. e > 0 \<and> cball x e \<inter> affine hull S \<subseteq> S)"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  3395
  apply (simp add: rel_interior, safe)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3396
  apply (force simp add: open_contains_cball)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3397
  apply (rule_tac x = "ball x e" in exI)
44457
d366fa5551ef declare euclidean_simps [simp] at the point they are proved;
huffman
parents: 44365
diff changeset
  3398
  apply (simp add: subset_trans [OF ball_subset_cball])
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3399
  apply auto
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3400
  done
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3401
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3402
lemma rel_interior_cball:
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3403
  "rel_interior S = {x \<in> S. \<exists>e. e > 0 \<and> cball x e \<inter> affine hull S \<subseteq> S}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3404
  using mem_rel_interior_cball [of _ S] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3405
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 60176
diff changeset
  3406
lemma rel_interior_empty [simp]: "rel_interior {} = {}"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  3407
   by (auto simp add: rel_interior_def)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3408
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 60176
diff changeset
  3409
lemma affine_hull_sing [simp]: "affine hull {a :: 'n::euclidean_space} = {a}"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3410
  by (metis affine_hull_eq affine_sing)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3411
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3412
lemma rel_interior_sing [simp]:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3413
    fixes a :: "'n::euclidean_space"  shows "rel_interior {a} = {a}"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3414
  apply (auto simp: rel_interior_ball)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3415
  apply (rule_tac x=1 in exI)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3416
  apply force
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3417
  done
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3418
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3419
lemma subset_rel_interior:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3420
  fixes S T :: "'n::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3421
  assumes "S \<subseteq> T"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3422
    and "affine hull S = affine hull T"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3423
  shows "rel_interior S \<subseteq> rel_interior T"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  3424
  using assms by (auto simp add: rel_interior_def)
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  3425
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3426
lemma rel_interior_subset: "rel_interior S \<subseteq> S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3427
  by (auto simp add: rel_interior_def)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3428
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3429
lemma rel_interior_subset_closure: "rel_interior S \<subseteq> closure S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3430
  using rel_interior_subset by (auto simp add: closure_def)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3431
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3432
lemma interior_subset_rel_interior: "interior S \<subseteq> rel_interior S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3433
  by (auto simp add: rel_interior interior_def)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3434
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3435
lemma interior_rel_interior:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3436
  fixes S :: "'n::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3437
  assumes "aff_dim S = int(DIM('n))"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3438
  shows "rel_interior S = interior S"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3439
proof -
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3440
  have "affine hull S = UNIV"
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3441
    using assms affine_hull_UNIV[of S] by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3442
  then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3443
    unfolding rel_interior interior_def by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3444
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3445
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 60176
diff changeset
  3446
lemma rel_interior_interior:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 60176
diff changeset
  3447
  fixes S :: "'n::euclidean_space set"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 60176
diff changeset
  3448
  assumes "affine hull S = UNIV"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 60176
diff changeset
  3449
  shows "rel_interior S = interior S"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 60176
diff changeset
  3450
  using assms unfolding rel_interior interior_def by auto
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 60176
diff changeset
  3451
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3452
lemma rel_interior_open:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3453
  fixes S :: "'n::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3454
  assumes "open S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3455
  shows "rel_interior S = S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3456
  by (metis assms interior_eq interior_subset_rel_interior rel_interior_subset set_eq_subset)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3457
60800
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  3458
lemma interior_ball [simp]: "interior (ball x e) = ball x e"
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  3459
  by (simp add: interior_open)
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  3460
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3461
lemma interior_rel_interior_gen:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3462
  fixes S :: "'n::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3463
  shows "interior S = (if aff_dim S = int(DIM('n)) then rel_interior S else {})"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3464
  by (metis interior_rel_interior low_dim_interior)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3465
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3466
lemma rel_interior_nonempty_interior:
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3467
  fixes S :: "'n::euclidean_space set"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3468
  shows "interior S \<noteq> {} \<Longrightarrow> rel_interior S = interior S"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3469
by (metis interior_rel_interior_gen)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3470
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3471
lemma affine_hull_nonempty_interior:
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3472
  fixes S :: "'n::euclidean_space set"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3473
  shows "interior S \<noteq> {} \<Longrightarrow> affine hull S = UNIV"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3474
by (metis affine_hull_UNIV interior_rel_interior_gen)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3475
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3476
lemma rel_interior_affine_hull [simp]:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3477
  fixes S :: "'n::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3478
  shows "rel_interior (affine hull S) = affine hull S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3479
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3480
  have *: "rel_interior (affine hull S) \<subseteq> affine hull S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3481
    using rel_interior_subset by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3482
  {
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3483
    fix x
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3484
    assume x: "x \<in> affine hull S"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  3485
    define e :: real where "e = 1"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3486
    then have "e > 0" "ball x e \<inter> affine hull (affine hull S) \<subseteq> affine hull S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3487
      using hull_hull[of _ S] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3488
    then have "x \<in> rel_interior (affine hull S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3489
      using x rel_interior_ball[of "affine hull S"] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3490
  }
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3491
  then show ?thesis using * by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3492
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3493
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3494
lemma rel_interior_UNIV [simp]: "rel_interior (UNIV :: ('n::euclidean_space) set) = UNIV"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3495
  by (metis open_UNIV rel_interior_open)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3496
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3497
lemma rel_interior_convex_shrink:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3498
  fixes S :: "'a::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3499
  assumes "convex S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3500
    and "c \<in> rel_interior S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3501
    and "x \<in> S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3502
    and "0 < e"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3503
    and "e \<le> 1"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3504
  shows "x - e *\<^sub>R (x - c) \<in> rel_interior S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3505
proof -
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  3506
  obtain d where "d > 0" and d: "ball c d \<inter> affine hull S \<subseteq> S"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3507
    using assms(2) unfolding  mem_rel_interior_ball by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3508
  {
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3509
    fix y
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3510
    assume as: "dist (x - e *\<^sub>R (x - c)) y < e * d" "y \<in> affine hull S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3511
    have *: "y = (1 - (1 - e)) *\<^sub>R ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) + (1 - e) *\<^sub>R x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3512
      using \<open>e > 0\<close> by (auto simp add: scaleR_left_diff_distrib scaleR_right_diff_distrib)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3513
    have "x \<in> affine hull S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3514
      using assms hull_subset[of S] by auto
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  3515
    moreover have "1 / e + - ((1 - e) / e) = 1"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3516
      using \<open>e > 0\<close> left_diff_distrib[of "1" "(1-e)" "1/e"] by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3517
    ultimately have **: "(1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x \<in> affine hull S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3518
      using as affine_affine_hull[of S] mem_affine[of "affine hull S" y x "(1 / e)" "-((1 - e) / e)"]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3519
      by (simp add: algebra_simps)
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61880
diff changeset
  3520
    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)"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3521
      unfolding dist_norm norm_scaleR[symmetric]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3522
      apply (rule arg_cong[where f=norm])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3523
      using \<open>e > 0\<close>
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3524
      apply (auto simp add: euclidean_eq_iff[where 'a='a] field_simps inner_simps)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3525
      done
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61880
diff changeset
  3526
    also have "\<dots> = \<bar>1/e\<bar> * norm (x - e *\<^sub>R (x - c) - y)"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3527
      by (auto intro!:arg_cong[where f=norm] simp add: algebra_simps)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3528
    also have "\<dots> < d"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3529
      using as[unfolded dist_norm] and \<open>e > 0\<close>
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3530
      by (auto simp add:pos_divide_less_eq[OF \<open>e > 0\<close>] mult.commute)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3531
    finally have "y \<in> S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3532
      apply (subst *)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3533
      apply (rule assms(1)[unfolded convex_alt,rule_format])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3534
      apply (rule d[unfolded subset_eq,rule_format])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3535
      unfolding mem_ball
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3536
      using assms(3-5) **
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3537
      apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3538
      done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3539
  }
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3540
  then have "ball (x - e *\<^sub>R (x - c)) (e*d) \<inter> affine hull S \<subseteq> S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3541
    by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3542
  moreover have "e * d > 0"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3543
    using \<open>e > 0\<close> \<open>d > 0\<close> by simp
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3544
  moreover have c: "c \<in> S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3545
    using assms rel_interior_subset by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3546
  moreover from c have "x - e *\<^sub>R (x - c) \<in> S"
61426
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61222
diff changeset
  3547
    using convexD_alt[of S x c e]
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3548
    apply (simp add: algebra_simps)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3549
    using assms
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3550
    apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3551
    done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3552
  ultimately show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3553
    using mem_rel_interior_ball[of "x - e *\<^sub>R (x - c)" S] \<open>e > 0\<close> by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3554
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3555
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3556
lemma interior_real_semiline:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3557
  fixes a :: real
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3558
  shows "interior {a..} = {a<..}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3559
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3560
  {
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3561
    fix y
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3562
    assume "a < y"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3563
    then have "y \<in> interior {a..}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3564
      apply (simp add: mem_interior)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3565
      apply (rule_tac x="(y-a)" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3566
      apply (auto simp add: dist_norm)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3567
      done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3568
  }
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3569
  moreover
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3570
  {
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3571
    fix y
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3572
    assume "y \<in> interior {a..}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3573
    then obtain e where e: "e > 0" "cball y e \<subseteq> {a..}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3574
      using mem_interior_cball[of y "{a..}"] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3575
    moreover from e have "y - e \<in> cball y e"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3576
      by (auto simp add: cball_def dist_norm)
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  3577
    ultimately have "a \<le> y - e" by blast
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3578
    then have "a < y" using e by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3579
  }
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3580
  ultimately show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3581
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3582
61880
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3583
lemma continuous_ge_on_Ioo:
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3584
  assumes "continuous_on {c..d} g" "\<And>x. x \<in> {c<..<d} \<Longrightarrow> g x \<ge> a" "c < d" "x \<in> {c..d}"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3585
  shows "g (x::real) \<ge> (a::real)"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3586
proof-
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3587
  from assms(3) have "{c..d} = closure {c<..<d}" by (rule closure_greaterThanLessThan[symmetric])
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3588
  also from assms(2) have "{c<..<d} \<subseteq> (g -` {a..} \<inter> {c..d})" by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3589
  hence "closure {c<..<d} \<subseteq> closure (g -` {a..} \<inter> {c..d})" by (rule closure_mono)
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3590
  also from assms(1) have "closed (g -` {a..} \<inter> {c..d})"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3591
    by (auto simp: continuous_on_closed_vimage)
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3592
  hence "closure (g -` {a..} \<inter> {c..d}) = g -` {a..} \<inter> {c..d}" by simp
62087
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 61952
diff changeset
  3593
  finally show ?thesis using \<open>x \<in> {c..d}\<close> by auto
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 61952
diff changeset
  3594
qed
61880
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3595
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3596
lemma interior_real_semiline':
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3597
  fixes a :: real
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3598
  shows "interior {..a} = {..<a}"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3599
proof -
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3600
  {
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3601
    fix y
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3602
    assume "a > y"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3603
    then have "y \<in> interior {..a}"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3604
      apply (simp add: mem_interior)
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3605
      apply (rule_tac x="(a-y)" in exI)
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3606
      apply (auto simp add: dist_norm)
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3607
      done
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3608
  }
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3609
  moreover
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3610
  {
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3611
    fix y
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3612
    assume "y \<in> interior {..a}"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3613
    then obtain e where e: "e > 0" "cball y e \<subseteq> {..a}"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3614
      using mem_interior_cball[of y "{..a}"] by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3615
    moreover from e have "y + e \<in> cball y e"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3616
      by (auto simp add: cball_def dist_norm)
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3617
    ultimately have "a \<ge> y + e" by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3618
    then have "a > y" using e by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3619
  }
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3620
  ultimately show ?thesis by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3621
qed
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3622
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3623
lemma interior_atLeastAtMost_real: "interior {a..b} = {a<..<b :: real}"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3624
proof-
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3625
  have "{a..b} = {a..} \<inter> {..b}" by auto
62087
44841d07ef1d revisions to limits and derivatives, plus new lemmas
paulson
parents: 61952
diff changeset
  3626
  also have "interior ... = {a<..} \<inter> {..<b}"
61880
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3627
    by (simp add: interior_real_semiline interior_real_semiline')
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3628
  also have "... = {a<..<b}" by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3629
  finally show ?thesis .
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3630
qed
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3631
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3632
lemma frontier_real_Iic:
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3633
  fixes a :: real
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3634
  shows "frontier {..a} = {a}"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3635
  unfolding frontier_def by (auto simp add: interior_real_semiline')
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  3636
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  3637
lemma rel_interior_real_box:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3638
  fixes a b :: real
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3639
  assumes "a < b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  3640
  shows "rel_interior {a .. b} = {a <..< b}"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3641
proof -
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54465
diff changeset
  3642
  have "box a b \<noteq> {}"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3643
    using assms
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3644
    unfolding set_eq_iff
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  3645
    by (auto intro!: exI[of _ "(a + b) / 2"] simp: box_def)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3646
  then show ?thesis
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  3647
    using interior_rel_interior_gen[of "cbox a b", symmetric]
62390
842917225d56 more canonical names
nipkow
parents: 62131
diff changeset
  3648
    by (simp split: if_split_asm del: box_real add: box_real[symmetric] interior_cbox)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3649
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3650
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3651
lemma rel_interior_real_semiline:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3652
  fixes a :: real
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3653
  shows "rel_interior {a..} = {a<..}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3654
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3655
  have *: "{a<..} \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3656
    unfolding set_eq_iff by (auto intro!: exI[of _ "a + 1"])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3657
  then show ?thesis using interior_real_semiline interior_rel_interior_gen[of "{a..}"]
62390
842917225d56 more canonical names
nipkow
parents: 62131
diff changeset
  3658
    by (auto split: if_split_asm)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3659
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3660
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3661
subsubsection \<open>Relative open sets\<close>
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3662
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3663
definition "rel_open S \<longleftrightarrow> rel_interior S = S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3664
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3665
lemma rel_open: "rel_open S \<longleftrightarrow> openin (subtopology euclidean (affine hull S)) S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3666
  unfolding rel_open_def rel_interior_def
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3667
  apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3668
  using openin_subopen[of "subtopology euclidean (affine hull S)" S]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3669
  apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3670
  done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3671
63072
eb5d493a9e03 renamings and refinements
paulson <lp15@cam.ac.uk>
parents: 63040
diff changeset
  3672
lemma openin_rel_interior: "openin (subtopology euclidean (affine hull S)) (rel_interior S)"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3673
  apply (simp add: rel_interior_def)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3674
  apply (subst openin_subopen)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3675
  apply blast
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3676
  done
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3677
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3678
lemma openin_set_rel_interior:
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3679
   "openin (subtopology euclidean S) (rel_interior S)"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3680
by (rule openin_subset_trans [OF openin_rel_interior rel_interior_subset hull_subset])
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3681
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  3682
lemma affine_rel_open:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3683
  fixes S :: "'n::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3684
  assumes "affine S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3685
  shows "rel_open S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3686
  unfolding rel_open_def
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  3687
  using assms rel_interior_affine_hull[of S] affine_hull_eq[of S]
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3688
  by metis
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3689
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  3690
lemma affine_closed:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3691
  fixes S :: "'n::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3692
  assumes "affine S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3693
  shows "closed S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3694
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3695
  {
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3696
    assume "S \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3697
    then obtain L where L: "subspace L" "affine_parallel S L"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3698
      using assms affine_parallel_subspace[of S] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3699
    then obtain a where a: "S = (op + a ` L)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3700
      using affine_parallel_def[of L S] affine_parallel_commut by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3701
    from L have "closed L" using closed_subspace by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3702
    then have "closed S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3703
      using closed_translation a by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3704
  }
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3705
  then show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3706
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3707
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3708
lemma closure_affine_hull:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3709
  fixes S :: "'n::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3710
  shows "closure S \<subseteq> affine hull S"
44524
04ad69081646 generalize some lemmas
huffman
parents: 44523
diff changeset
  3711
  by (intro closure_minimal hull_subset affine_closed affine_affine_hull)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3712
62948
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
  3713
lemma closure_same_affine_hull [simp]:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3714
  fixes S :: "'n::euclidean_space set"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3715
  shows "affine hull (closure S) = affine hull S"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3716
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3717
  have "affine hull (closure S) \<subseteq> affine hull S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3718
    using hull_mono[of "closure S" "affine hull S" "affine"]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3719
      closure_affine_hull[of S] hull_hull[of "affine" S]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3720
    by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3721
  moreover have "affine hull (closure S) \<supseteq> affine hull S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3722
    using hull_mono[of "S" "closure S" "affine"] closure_subset by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3723
  ultimately show ?thesis by auto
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  3724
qed
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  3725
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  3726
lemma closure_aff_dim [simp]:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3727
  fixes S :: "'n::euclidean_space set"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3728
  shows "aff_dim (closure S) = aff_dim S"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3729
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3730
  have "aff_dim S \<le> aff_dim (closure S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3731
    using aff_dim_subset closure_subset by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3732
  moreover have "aff_dim (closure S) \<le> aff_dim (affine hull S)"
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
  3733
    using aff_dim_subset closure_affine_hull by blast
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3734
  moreover have "aff_dim (affine hull S) = aff_dim S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3735
    using aff_dim_affine_hull by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3736
  ultimately show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3737
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3738
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3739
lemma rel_interior_closure_convex_shrink:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3740
  fixes S :: "_::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3741
  assumes "convex S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3742
    and "c \<in> rel_interior S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3743
    and "x \<in> closure S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3744
    and "e > 0"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3745
    and "e \<le> 1"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3746
  shows "x - e *\<^sub>R (x - c) \<in> rel_interior S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3747
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3748
  obtain d where "d > 0" and d: "ball c d \<inter> affine hull S \<subseteq> S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3749
    using assms(2) unfolding mem_rel_interior_ball by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3750
  have "\<exists>y \<in> S. norm (y - x) * (1 - e) < e * d"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3751
  proof (cases "x \<in> S")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3752
    case True
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3753
    then show ?thesis using \<open>e > 0\<close> \<open>d > 0\<close>
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3754
      apply (rule_tac bexI[where x=x])
56544
b60d5d119489 made mult_pos_pos a simp rule
nipkow
parents: 56541
diff changeset
  3755
      apply (auto)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3756
      done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3757
  next
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3758
    case False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3759
    then have x: "x islimpt S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3760
      using assms(3)[unfolded closure_def] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3761
    show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3762
    proof (cases "e = 1")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3763
      case True
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3764
      obtain y where "y \<in> S" "y \<noteq> x" "dist y x < 1"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3765
        using x[unfolded islimpt_approachable,THEN spec[where x=1]] by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3766
      then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3767
        apply (rule_tac x=y in bexI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3768
        unfolding True
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3769
        using \<open>d > 0\<close>
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3770
        apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3771
        done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3772
    next
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3773
      case False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3774
      then have "0 < e * d / (1 - e)" and *: "1 - e > 0"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3775
        using \<open>e \<le> 1\<close> \<open>e > 0\<close> \<open>d > 0\<close> by (auto)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3776
      then obtain y where "y \<in> S" "y \<noteq> x" "dist y x < e * d / (1 - e)"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3777
        using x[unfolded islimpt_approachable,THEN spec[where x="e*d / (1 - e)"]] by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3778
      then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3779
        apply (rule_tac x=y in bexI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3780
        unfolding dist_norm
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3781
        using pos_less_divide_eq[OF *]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3782
        apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3783
        done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3784
    qed
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3785
  qed
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3786
  then obtain y where "y \<in> S" and y: "norm (y - x) * (1 - e) < e * d"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3787
    by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  3788
  define z where "z = c + ((1 - e) / e) *\<^sub>R (x - y)"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3789
  have *: "x - e *\<^sub>R (x - c) = y - e *\<^sub>R (y - z)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3790
    unfolding z_def using \<open>e > 0\<close>
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3791
    by (auto simp add: scaleR_right_diff_distrib scaleR_right_distrib scaleR_left_diff_distrib)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3792
  have zball: "z \<in> ball c d"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3793
    using mem_ball z_def dist_norm[of c]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3794
    using y and assms(4,5)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3795
    by (auto simp add:field_simps norm_minus_commute)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3796
  have "x \<in> affine hull S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3797
    using closure_affine_hull assms by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3798
  moreover have "y \<in> affine hull S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3799
    using \<open>y \<in> S\<close> hull_subset[of S] by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3800
  moreover have "c \<in> affine hull S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3801
    using assms rel_interior_subset hull_subset[of S] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3802
  ultimately have "z \<in> affine hull S"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  3803
    using z_def affine_affine_hull[of S]
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3804
      mem_affine_3_minus [of "affine hull S" c x y "(1 - e) / e"]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3805
      assms
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3806
    by (auto simp add: field_simps)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3807
  then have "z \<in> S" using d zball by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3808
  obtain d1 where "d1 > 0" and d1: "ball z d1 \<le> ball c d"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3809
    using zball open_ball[of c d] openE[of "ball c d" z] by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3810
  then have "ball z d1 \<inter> affine hull S \<subseteq> ball c d \<inter> affine hull S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3811
    by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3812
  then have "ball z d1 \<inter> affine hull S \<subseteq> S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3813
    using d by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3814
  then have "z \<in> rel_interior S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3815
    using mem_rel_interior_ball using \<open>d1 > 0\<close> \<open>z \<in> S\<close> by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3816
  then have "y - e *\<^sub>R (y - z) \<in> rel_interior S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3817
    using rel_interior_convex_shrink[of S z y e] assms \<open>y \<in> S\<close> by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3818
  then show ?thesis using * by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3819
qed
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3820
62620
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  3821
lemma rel_interior_eq:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  3822
   "rel_interior s = s \<longleftrightarrow> openin(subtopology euclidean (affine hull s)) s"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  3823
using rel_open rel_open_def by blast
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  3824
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  3825
lemma rel_interior_openin:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  3826
   "openin(subtopology euclidean (affine hull s)) s \<Longrightarrow> rel_interior s = s"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  3827
by (simp add: rel_interior_eq)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  3828
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3829
lemma rel_interior_affine:
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3830
  fixes S :: "'n::euclidean_space set"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3831
  shows  "affine S \<Longrightarrow> rel_interior S = S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3832
using affine_rel_open rel_open_def by auto
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3833
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3834
lemma rel_interior_eq_closure:
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3835
  fixes S :: "'n::euclidean_space set"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3836
  shows "rel_interior S = closure S \<longleftrightarrow> affine S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3837
proof (cases "S = {}")
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3838
  case True
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3839
 then show ?thesis
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3840
    by auto
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3841
next
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3842
  case False show ?thesis
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3843
  proof
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3844
    assume eq: "rel_interior S = closure S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3845
    have "S = {} \<or> S = affine hull S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3846
      apply (rule connected_clopen [THEN iffD1, rule_format])
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3847
       apply (simp add: affine_imp_convex convex_connected)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3848
      apply (rule conjI)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3849
       apply (metis eq closure_subset openin_rel_interior rel_interior_subset subset_antisym)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3850
      apply (metis closed_subset closure_subset_eq eq hull_subset rel_interior_subset)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3851
      done
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3852
    with False have "affine hull S = S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3853
      by auto
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3854
    then show "affine S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3855
      by (metis affine_hull_eq)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3856
  next
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3857
    assume "affine S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3858
    then show "rel_interior S = closure S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3859
      by (simp add: rel_interior_affine affine_closed)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3860
  qed
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3861
qed
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3862
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3863
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3864
subsubsection\<open>Relative interior preserves under linear transformations\<close>
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3865
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3866
lemma rel_interior_translation_aux:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3867
  fixes a :: "'n::euclidean_space"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3868
  shows "((\<lambda>x. a + x) ` rel_interior S) \<subseteq> rel_interior ((\<lambda>x. a + x) ` S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3869
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3870
  {
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3871
    fix x
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3872
    assume x: "x \<in> rel_interior S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3873
    then obtain T where "open T" "x \<in> T \<inter> S" "T \<inter> affine hull S \<subseteq> S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3874
      using mem_rel_interior[of x S] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3875
    then have "open ((\<lambda>x. a + x) ` T)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3876
      and "a + x \<in> ((\<lambda>x. a + x) ` T) \<inter> ((\<lambda>x. a + x) ` S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3877
      and "((\<lambda>x. a + x) ` T) \<inter> affine hull ((\<lambda>x. a + x) ` S) \<subseteq> (\<lambda>x. a + x) ` S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3878
      using affine_hull_translation[of a S] open_translation[of T a] x by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3879
    then have "a + x \<in> rel_interior ((\<lambda>x. a + x) ` S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3880
      using mem_rel_interior[of "a+x" "((\<lambda>x. a + x) ` S)"] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3881
  }
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3882
  then show ?thesis by auto
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  3883
qed
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3884
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3885
lemma rel_interior_translation:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3886
  fixes a :: "'n::euclidean_space"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3887
  shows "rel_interior ((\<lambda>x. a + x) ` S) = (\<lambda>x. a + x) ` rel_interior S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3888
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3889
  have "(\<lambda>x. (-a) + x) ` rel_interior ((\<lambda>x. a + x) ` S) \<subseteq> rel_interior S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3890
    using rel_interior_translation_aux[of "-a" "(\<lambda>x. a + x) ` S"]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3891
      translation_assoc[of "-a" "a"]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3892
    by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3893
  then have "((\<lambda>x. a + x) ` rel_interior S) \<supseteq> rel_interior ((\<lambda>x. a + x) ` S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3894
    using translation_inverse_subset[of a "rel_interior (op + a ` S)" "rel_interior S"]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3895
    by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3896
  then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3897
    using rel_interior_translation_aux[of a S] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3898
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3899
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3900
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3901
lemma affine_hull_linear_image:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3902
  assumes "bounded_linear f"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3903
  shows "f ` (affine hull s) = affine hull f ` s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3904
  apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3905
  unfolding subset_eq ball_simps
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3906
  apply (rule_tac[!] hull_induct, rule hull_inc)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3907
  prefer 3
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3908
  apply (erule imageE)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3909
  apply (rule_tac x=xa in image_eqI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3910
  apply assumption
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3911
  apply (rule hull_subset[unfolded subset_eq, rule_format])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3912
  apply assumption
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3913
proof -
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3914
  interpret f: bounded_linear f by fact
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3915
  show "affine {x. f x \<in> affine hull f ` s}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3916
    unfolding affine_def
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3917
    by (auto simp add: f.scaleR f.add affine_affine_hull[unfolded affine_def, rule_format])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3918
  show "affine {x. x \<in> f ` (affine hull s)}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3919
    using affine_affine_hull[unfolded affine_def, of s]
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3920
    unfolding affine_def by (auto simp add: f.scaleR [symmetric] f.add [symmetric])
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3921
qed auto
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3922
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3923
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  3924
lemma rel_interior_injective_on_span_linear_image:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3925
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3926
    and S :: "'m::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3927
  assumes "bounded_linear f"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3928
    and "inj_on f (span S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3929
  shows "rel_interior (f ` S) = f ` (rel_interior S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3930
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3931
  {
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3932
    fix z
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3933
    assume z: "z \<in> rel_interior (f ` S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3934
    then have "z \<in> f ` S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3935
      using rel_interior_subset[of "f ` S"] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3936
    then obtain x where x: "x \<in> S" "f x = z" by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3937
    obtain e2 where e2: "e2 > 0" "cball z e2 \<inter> affine hull (f ` S) \<subseteq> (f ` S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3938
      using z rel_interior_cball[of "f ` S"] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3939
    obtain K where K: "K > 0" "\<And>x. norm (f x) \<le> norm x * K"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3940
     using assms Real_Vector_Spaces.bounded_linear.pos_bounded[of f] by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  3941
    define e1 where "e1 = 1 / K"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3942
    then have e1: "e1 > 0" "\<And>x. e1 * norm (f x) \<le> norm x"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3943
      using K pos_le_divide_eq[of e1] by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  3944
    define e where "e = e1 * e2"
56544
b60d5d119489 made mult_pos_pos a simp rule
nipkow
parents: 56541
diff changeset
  3945
    then have "e > 0" using e1 e2 by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3946
    {
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3947
      fix y
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3948
      assume y: "y \<in> cball x e \<inter> affine hull S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3949
      then have h1: "f y \<in> affine hull (f ` S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3950
        using affine_hull_linear_image[of f S] assms by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3951
      from y have "norm (x-y) \<le> e1 * e2"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3952
        using cball_def[of x e] dist_norm[of x y] e_def by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3953
      moreover have "f x - f y = f (x - y)"
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3954
        using assms linear_diff[of f x y] linear_conv_bounded_linear[of f] by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3955
      moreover have "e1 * norm (f (x-y)) \<le> norm (x - y)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3956
        using e1 by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3957
      ultimately have "e1 * norm ((f x)-(f y)) \<le> e1 * e2"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3958
        by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3959
      then have "f y \<in> cball z e2"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3960
        using cball_def[of "f x" e2] dist_norm[of "f x" "f y"] e1 x by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3961
      then have "f y \<in> f ` S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3962
        using y e2 h1 by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3963
      then have "y \<in> S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3964
        using assms y hull_subset[of S] affine_hull_subset_span
61520
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  3965
          inj_on_image_mem_iff [OF \<open>inj_on f (span S)\<close>]
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  3966
        by (metis Int_iff span_inc subsetCE)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3967
    }
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3968
    then have "z \<in> f ` (rel_interior S)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  3969
      using mem_rel_interior_cball[of x S] \<open>e > 0\<close> x by auto
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  3970
  }
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3971
  moreover
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3972
  {
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3973
    fix x
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3974
    assume x: "x \<in> rel_interior S"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  3975
    then obtain e2 where e2: "e2 > 0" "cball x e2 \<inter> affine hull S \<subseteq> S"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3976
      using rel_interior_cball[of S] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3977
    have "x \<in> S" using x rel_interior_subset by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3978
    then have *: "f x \<in> f ` S" by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3979
    have "\<forall>x\<in>span S. f x = 0 \<longrightarrow> x = 0"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3980
      using assms subspace_span linear_conv_bounded_linear[of f]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3981
        linear_injective_on_subspace_0[of f "span S"]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3982
      by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3983
    then obtain e1 where e1: "e1 > 0" "\<forall>x \<in> span S. e1 * norm x \<le> norm (f x)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3984
      using assms injective_imp_isometric[of "span S" f]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3985
        subspace_span[of S] closed_subspace[of "span S"]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3986
      by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  3987
    define e where "e = e1 * e2"
56544
b60d5d119489 made mult_pos_pos a simp rule
nipkow
parents: 56541
diff changeset
  3988
    hence "e > 0" using e1 e2 by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3989
    {
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3990
      fix y
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3991
      assume y: "y \<in> cball (f x) e \<inter> affine hull (f ` S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3992
      then have "y \<in> f ` (affine hull S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3993
        using affine_hull_linear_image[of f S] assms by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3994
      then obtain xy where xy: "xy \<in> affine hull S" "f xy = y" by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3995
      with y have "norm (f x - f xy) \<le> e1 * e2"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3996
        using cball_def[of "f x" e] dist_norm[of "f x" y] e_def by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3997
      moreover have "f x - f xy = f (x - xy)"
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  3998
        using assms linear_diff[of f x xy] linear_conv_bounded_linear[of f] by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  3999
      moreover have *: "x - xy \<in> span S"
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  4000
        using subspace_diff[of "span S" x xy] subspace_span \<open>x \<in> S\<close> xy
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4001
          affine_hull_subset_span[of S] span_inc
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4002
        by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4003
      moreover from * have "e1 * norm (x - xy) \<le> norm (f (x - xy))"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4004
        using e1 by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4005
      ultimately have "e1 * norm (x - xy) \<le> e1 * e2"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4006
        by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4007
      then have "xy \<in> cball x e2"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4008
        using cball_def[of x e2] dist_norm[of x xy] e1 by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4009
      then have "y \<in> f ` S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4010
        using xy e2 by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4011
    }
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4012
    then have "f x \<in> rel_interior (f ` S)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4013
      using mem_rel_interior_cball[of "(f x)" "(f ` S)"] * \<open>e > 0\<close> by auto
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  4014
  }
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4015
  ultimately show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  4016
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  4017
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  4018
lemma rel_interior_injective_linear_image:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4019
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4020
  assumes "bounded_linear f"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4021
    and "inj f"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4022
  shows "rel_interior (f ` S) = f ` (rel_interior S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4023
  using assms rel_interior_injective_on_span_linear_image[of f S]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4024
    subset_inj_on[of f "UNIV" "span S"]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4025
  by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4026
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  4027
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4028
subsection\<open>Some Properties of subset of standard basis\<close>
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  4029
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4030
lemma affine_hull_substd_basis:
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4031
  assumes "d \<subseteq> Basis"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4032
  shows "affine hull (insert 0 d) = {x::'a::euclidean_space. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4033
  (is "affine hull (insert 0 ?A) = ?B")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4034
proof -
61076
bdc1e2f0a86a eliminated \<Colon>;
wenzelm
parents: 60974
diff changeset
  4035
  have *: "\<And>A. op + (0::'a) ` A = A" "\<And>A. op + (- (0::'a)) ` A = A"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4036
    by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4037
  show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4038
    unfolding affine_hull_insert_span_gen span_substd_basis[OF assms,symmetric] * ..
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  4039
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  4040
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 60176
diff changeset
  4041
lemma affine_hull_convex_hull [simp]: "affine hull (convex hull S) = affine hull S"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4042
  by (metis Int_absorb1 Int_absorb2 convex_hull_subset_affine_hull hull_hull hull_mono hull_subset)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4043
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  4044
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4045
subsection \<open>Openness and compactness are preserved by convex hull operation.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4046
34964
4e8be3c04d37 Replaced vec1 and dest_vec1 by abbreviation.
hoelzl
parents: 34915
diff changeset
  4047
lemma open_convex_hull[intro]:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4048
  fixes s :: "'a::real_normed_vector set"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4049
  assumes "open s"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4050
  shows "open (convex hull s)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4051
  unfolding open_contains_cball convex_hull_explicit
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4052
  unfolding mem_Collect_eq ball_simps(8)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4053
proof (rule, rule)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4054
  fix a
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4055
  assume "\<exists>sa u. finite sa \<and> sa \<subseteq> s \<and> (\<forall>x\<in>sa. 0 \<le> u x) \<and> setsum u sa = 1 \<and> (\<Sum>v\<in>sa. u v *\<^sub>R v) = a"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4056
  then obtain t u where obt: "finite t" "t\<subseteq>s" "\<forall>x\<in>t. 0 \<le> u x" "setsum u t = 1" "(\<Sum>v\<in>t. u v *\<^sub>R v) = a"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4057
    by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4058
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4059
  from assms[unfolded open_contains_cball] obtain b
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4060
    where b: "\<forall>x\<in>s. 0 < b x \<and> cball x (b x) \<subseteq> s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4061
    using bchoice[of s "\<lambda>x e. e > 0 \<and> cball x e \<subseteq> s"] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4062
  have "b ` t \<noteq> {}"
56889
48a745e1bde7 avoid the Complex constructor, use the more natural Re/Im view; moved csqrt to Complex.
hoelzl
parents: 56571
diff changeset
  4063
    using obt by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  4064
  define i where "i = b ` t"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4065
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4066
  show "\<exists>e > 0.
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4067
    cball a e \<subseteq> {y. \<exists>sa u. finite sa \<and> sa \<subseteq> s \<and> (\<forall>x\<in>sa. 0 \<le> u x) \<and> setsum u sa = 1 \<and> (\<Sum>v\<in>sa. u v *\<^sub>R v) = y}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4068
    apply (rule_tac x = "Min i" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4069
    unfolding subset_eq
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4070
    apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4071
    defer
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4072
    apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4073
    unfolding mem_Collect_eq
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4074
  proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4075
    show "0 < Min i"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4076
      unfolding i_def and Min_gr_iff[OF finite_imageI[OF obt(1)] \<open>b ` t\<noteq>{}\<close>]
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4077
      using b
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4078
      apply simp
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4079
      apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4080
      apply (erule_tac x=x in ballE)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4081
      using \<open>t\<subseteq>s\<close>
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4082
      apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4083
      done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4084
  next
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4085
    fix y
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4086
    assume "y \<in> cball a (Min i)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4087
    then have y: "norm (a - y) \<le> Min i"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4088
      unfolding dist_norm[symmetric] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4089
    {
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4090
      fix x
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4091
      assume "x \<in> t"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4092
      then have "Min i \<le> b x"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4093
        unfolding i_def
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4094
        apply (rule_tac Min_le)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4095
        using obt(1)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4096
        apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4097
        done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4098
      then have "x + (y - a) \<in> cball x (b x)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4099
        using y unfolding mem_cball dist_norm by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4100
      moreover from \<open>x\<in>t\<close> have "x \<in> s"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4101
        using obt(2) by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4102
      ultimately have "x + (y - a) \<in> s"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  4103
        using y and b[THEN bspec[where x=x]] unfolding subset_eq by fast
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4104
    }
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4105
    moreover
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4106
    have *: "inj_on (\<lambda>v. v + (y - a)) t"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4107
      unfolding inj_on_def by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4108
    have "(\<Sum>v\<in>(\<lambda>v. v + (y - a)) ` t. u (v - (y - a))) = 1"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  4109
      unfolding setsum.reindex[OF *] o_def using obt(4) by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4110
    moreover have "(\<Sum>v\<in>(\<lambda>v. v + (y - a)) ` t. u (v - (y - a)) *\<^sub>R v) = y"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  4111
      unfolding setsum.reindex[OF *] o_def using obt(4,5)
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  4112
      by (simp add: setsum.distrib setsum_subtractf scaleR_left.setsum[symmetric] scaleR_right_distrib)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4113
    ultimately
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4114
    show "\<exists>sa u. finite sa \<and> (\<forall>x\<in>sa. x \<in> s) \<and> (\<forall>x\<in>sa. 0 \<le> u x) \<and> setsum u sa = 1 \<and> (\<Sum>v\<in>sa. u v *\<^sub>R v) = y"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4115
      apply (rule_tac x="(\<lambda>v. v + (y - a)) ` t" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4116
      apply (rule_tac x="\<lambda>v. u (v - (y - a))" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4117
      using obt(1, 3)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4118
      apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4119
      done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4120
  qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4121
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4122
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4123
lemma compact_convex_combinations:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4124
  fixes s t :: "'a::real_normed_vector set"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4125
  assumes "compact s" "compact t"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4126
  shows "compact { (1 - u) *\<^sub>R x + u *\<^sub>R y | x y u. 0 \<le> u \<and> u \<le> 1 \<and> x \<in> s \<and> y \<in> t}"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4127
proof -
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4128
  let ?X = "{0..1} \<times> s \<times> t"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4129
  let ?h = "(\<lambda>z. (1 - fst z) *\<^sub>R fst (snd z) + fst z *\<^sub>R snd (snd z))"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4130
  have *: "{ (1 - u) *\<^sub>R x + u *\<^sub>R y | x y u. 0 \<le> u \<and> u \<le> 1 \<and> x \<in> s \<and> y \<in> t} = ?h ` ?X"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4131
    apply (rule set_eqI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4132
    unfolding image_iff mem_Collect_eq
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4133
    apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4134
    apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4135
    apply (rule_tac x=u in rev_bexI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4136
    apply simp
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4137
    apply (erule rev_bexI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4138
    apply (erule rev_bexI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4139
    apply simp
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4140
    apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4141
    done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  4142
  have "continuous_on ?X (\<lambda>z. (1 - fst z) *\<^sub>R fst (snd z) + fst z *\<^sub>R snd (snd z))"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4143
    unfolding continuous_on by (rule ballI) (intro tendsto_intros)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4144
  then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4145
    unfolding *
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4146
    apply (rule compact_continuous_image)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  4147
    apply (intro compact_Times compact_Icc assms)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4148
    done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4149
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4150
44525
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4151
lemma finite_imp_compact_convex_hull:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4152
  fixes s :: "'a::real_normed_vector set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4153
  assumes "finite s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4154
  shows "compact (convex hull s)"
44525
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4155
proof (cases "s = {}")
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4156
  case True
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4157
  then show ?thesis by simp
44525
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4158
next
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4159
  case False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4160
  with assms show ?thesis
44525
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4161
  proof (induct rule: finite_ne_induct)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4162
    case (singleton x)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4163
    show ?case by simp
44525
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4164
  next
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4165
    case (insert x A)
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4166
    let ?f = "\<lambda>(u, y::'a). u *\<^sub>R x + (1 - u) *\<^sub>R y"
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4167
    let ?T = "{0..1::real} \<times> (convex hull A)"
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4168
    have "continuous_on ?T ?f"
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4169
      unfolding split_def continuous_on by (intro ballI tendsto_intros)
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4170
    moreover have "compact ?T"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  4171
      by (intro compact_Times compact_Icc insert)
44525
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4172
    ultimately have "compact (?f ` ?T)"
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4173
      by (rule compact_continuous_image)
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4174
    also have "?f ` ?T = convex hull (insert x A)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4175
      unfolding convex_hull_insert [OF \<open>A \<noteq> {}\<close>]
44525
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4176
      apply safe
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4177
      apply (rule_tac x=a in exI, simp)
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4178
      apply (rule_tac x="1 - a" in exI, simp)
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4179
      apply fast
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4180
      apply (rule_tac x="(u, b)" in image_eqI, simp_all)
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4181
      done
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4182
    finally show "compact (convex hull (insert x A))" .
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4183
  qed
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4184
qed
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4185
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4186
lemma compact_convex_hull:
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4187
  fixes s :: "'a::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4188
  assumes "compact s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4189
  shows "compact (convex hull s)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4190
proof (cases "s = {}")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4191
  case True
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4192
  then show ?thesis using compact_empty by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4193
next
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4194
  case False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4195
  then obtain w where "w \<in> s" by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4196
  show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4197
    unfolding caratheodory[of s]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4198
  proof (induct ("DIM('a) + 1"))
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4199
    case 0
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4200
    have *: "{x.\<exists>sa. finite sa \<and> sa \<subseteq> s \<and> card sa \<le> 0 \<and> x \<in> convex hull sa} = {}"
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36341
diff changeset
  4201
      using compact_empty by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4202
    from 0 show ?case unfolding * by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4203
  next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4204
    case (Suc n)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4205
    show ?case
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4206
    proof (cases "n = 0")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4207
      case True
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4208
      have "{x. \<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> Suc n \<and> x \<in> convex hull t} = s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4209
        unfolding set_eq_iff and mem_Collect_eq
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4210
      proof (rule, rule)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4211
        fix x
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4212
        assume "\<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> Suc n \<and> x \<in> convex hull t"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4213
        then obtain t where t: "finite t" "t \<subseteq> s" "card t \<le> Suc n" "x \<in> convex hull t"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4214
          by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4215
        show "x \<in> s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4216
        proof (cases "card t = 0")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4217
          case True
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4218
          then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4219
            using t(4) unfolding card_0_eq[OF t(1)] by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4220
        next
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4221
          case False
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4222
          then have "card t = Suc 0" using t(3) \<open>n=0\<close> by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4223
          then obtain a where "t = {a}" unfolding card_Suc_eq by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4224
          then show ?thesis using t(2,4) by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4225
        qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4226
      next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4227
        fix x assume "x\<in>s"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4228
        then show "\<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> Suc n \<and> x \<in> convex hull t"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4229
          apply (rule_tac x="{x}" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4230
          unfolding convex_hull_singleton
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4231
          apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4232
          done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4233
      qed
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4234
      then show ?thesis using assms by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4235
    next
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4236
      case False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4237
      have "{x. \<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> Suc n \<and> x \<in> convex hull t} =
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4238
        {(1 - u) *\<^sub>R x + u *\<^sub>R y | x y u.
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4239
          0 \<le> u \<and> u \<le> 1 \<and> x \<in> s \<and> y \<in> {x. \<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> n \<and> x \<in> convex hull t}}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4240
        unfolding set_eq_iff and mem_Collect_eq
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4241
      proof (rule, rule)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4242
        fix x
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4243
        assume "\<exists>u v c. x = (1 - c) *\<^sub>R u + c *\<^sub>R v \<and>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4244
          0 \<le> c \<and> c \<le> 1 \<and> u \<in> s \<and> (\<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> n \<and> v \<in> convex hull t)"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4245
        then obtain u v c t where obt: "x = (1 - c) *\<^sub>R u + c *\<^sub>R v"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4246
          "0 \<le> c \<and> c \<le> 1" "u \<in> s" "finite t" "t \<subseteq> s" "card t \<le> n"  "v \<in> convex hull t"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4247
          by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4248
        moreover have "(1 - c) *\<^sub>R u + c *\<^sub>R v \<in> convex hull insert u t"
61426
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61222
diff changeset
  4249
          apply (rule convexD_alt)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4250
          using obt(2) and convex_convex_hull and hull_subset[of "insert u t" convex]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4251
          using obt(7) and hull_mono[of t "insert u t"]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4252
          apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4253
          done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4254
        ultimately show "\<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> Suc n \<and> x \<in> convex hull t"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4255
          apply (rule_tac x="insert u t" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4256
          apply (auto simp add: card_insert_if)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4257
          done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4258
      next
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4259
        fix x
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4260
        assume "\<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> Suc n \<and> x \<in> convex hull t"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4261
        then obtain t where t: "finite t" "t \<subseteq> s" "card t \<le> Suc n" "x \<in> convex hull t"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4262
          by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4263
        show "\<exists>u v c. x = (1 - c) *\<^sub>R u + c *\<^sub>R v \<and>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4264
          0 \<le> c \<and> c \<le> 1 \<and> u \<in> s \<and> (\<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> n \<and> v \<in> convex hull t)"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4265
        proof (cases "card t = Suc n")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4266
          case False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4267
          then have "card t \<le> n" using t(3) by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4268
          then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4269
            apply (rule_tac x=w in exI, rule_tac x=x in exI, rule_tac x=1 in exI)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4270
            using \<open>w\<in>s\<close> and t
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4271
            apply (auto intro!: exI[where x=t])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4272
            done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4273
        next
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4274
          case True
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4275
          then obtain a u where au: "t = insert a u" "a\<notin>u"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4276
            apply (drule_tac card_eq_SucD)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4277
            apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4278
            done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4279
          show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4280
          proof (cases "u = {}")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4281
            case True
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4282
            then have "x = a" using t(4)[unfolded au] by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4283
            show ?thesis unfolding \<open>x = a\<close>
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4284
              apply (rule_tac x=a in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4285
              apply (rule_tac x=a in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4286
              apply (rule_tac x=1 in exI)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4287
              using t and \<open>n \<noteq> 0\<close>
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4288
              unfolding au
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4289
              apply (auto intro!: exI[where x="{a}"])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4290
              done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4291
          next
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4292
            case False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4293
            obtain ux vx b where obt: "ux\<ge>0" "vx\<ge>0" "ux + vx = 1"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4294
              "b \<in> convex hull u" "x = ux *\<^sub>R a + vx *\<^sub>R b"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4295
              using t(4)[unfolded au convex_hull_insert[OF False]]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4296
              by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4297
            have *: "1 - vx = ux" using obt(3) by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4298
            show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4299
              apply (rule_tac x=a in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4300
              apply (rule_tac x=b in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4301
              apply (rule_tac x=vx in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4302
              using obt and t(1-3)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4303
              unfolding au and * using card_insert_disjoint[OF _ au(2)]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4304
              apply (auto intro!: exI[where x=u])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4305
              done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4306
          qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4307
        qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4308
      qed
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4309
      then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4310
        using compact_convex_combinations[OF assms Suc] by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4311
    qed
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36341
diff changeset
  4312
  qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4313
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4314
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4315
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4316
subsection \<open>Extremal points of a simplex are some vertices.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4317
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4318
lemma dist_increases_online:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4319
  fixes a b d :: "'a::real_inner"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4320
  assumes "d \<noteq> 0"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4321
  shows "dist a (b + d) > dist a b \<or> dist a (b - d) > dist a b"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4322
proof (cases "inner a d - inner b d > 0")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4323
  case True
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4324
  then have "0 < inner d d + (inner a d * 2 - inner b d * 2)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4325
    apply (rule_tac add_pos_pos)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4326
    using assms
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4327
    apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4328
    done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4329
  then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4330
    apply (rule_tac disjI2)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4331
    unfolding dist_norm and norm_eq_sqrt_inner and real_sqrt_less_iff
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4332
    apply  (simp add: algebra_simps inner_commute)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4333
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4334
next
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4335
  case False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4336
  then have "0 < inner d d + (inner b d * 2 - inner a d * 2)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4337
    apply (rule_tac add_pos_nonneg)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4338
    using assms
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4339
    apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4340
    done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4341
  then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4342
    apply (rule_tac disjI1)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4343
    unfolding dist_norm and norm_eq_sqrt_inner and real_sqrt_less_iff
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4344
    apply (simp add: algebra_simps inner_commute)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4345
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4346
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4347
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4348
lemma norm_increases_online:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4349
  fixes d :: "'a::real_inner"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4350
  shows "d \<noteq> 0 \<Longrightarrow> norm (a + d) > norm a \<or> norm(a - d) > norm a"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4351
  using dist_increases_online[of d a 0] unfolding dist_norm by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4352
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4353
lemma simplex_furthest_lt:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4354
  fixes s :: "'a::real_inner set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4355
  assumes "finite s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4356
  shows "\<forall>x \<in> convex hull s.  x \<notin> s \<longrightarrow> (\<exists>y \<in> convex hull s. norm (x - a) < norm(y - a))"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4357
  using assms
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4358
proof induct
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4359
  fix x s
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4360
  assume as: "finite s" "x\<notin>s" "\<forall>x\<in>convex hull s. x \<notin> s \<longrightarrow> (\<exists>y\<in>convex hull s. norm (x - a) < norm (y - a))"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4361
  show "\<forall>xa\<in>convex hull insert x s. xa \<notin> insert x s \<longrightarrow>
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4362
    (\<exists>y\<in>convex hull insert x s. norm (xa - a) < norm (y - a))"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4363
  proof (rule, rule, cases "s = {}")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4364
    case False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4365
    fix y
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4366
    assume y: "y \<in> convex hull insert x s" "y \<notin> insert x s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4367
    obtain u v b where obt: "u\<ge>0" "v\<ge>0" "u + v = 1" "b \<in> convex hull s" "y = u *\<^sub>R x + v *\<^sub>R b"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4368
      using y(1)[unfolded convex_hull_insert[OF False]] by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4369
    show "\<exists>z\<in>convex hull insert x s. norm (y - a) < norm (z - a)"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4370
    proof (cases "y \<in> convex hull s")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4371
      case True
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4372
      then obtain z where "z \<in> convex hull s" "norm (y - a) < norm (z - a)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4373
        using as(3)[THEN bspec[where x=y]] and y(2) by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4374
      then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4375
        apply (rule_tac x=z in bexI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4376
        unfolding convex_hull_insert[OF False]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4377
        apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4378
        done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4379
    next
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4380
      case False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4381
      show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4382
        using obt(3)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4383
      proof (cases "u = 0", case_tac[!] "v = 0")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4384
        assume "u = 0" "v \<noteq> 0"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4385
        then have "y = b" using obt by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4386
        then show ?thesis using False and obt(4) by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4387
      next
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4388
        assume "u \<noteq> 0" "v = 0"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4389
        then have "y = x" using obt by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4390
        then show ?thesis using y(2) by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4391
      next
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4392
        assume "u \<noteq> 0" "v \<noteq> 0"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4393
        then obtain w where w: "w>0" "w<u" "w<v"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4394
          using real_lbound_gt_zero[of u v] and obt(1,2) by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4395
        have "x \<noteq> b"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4396
        proof
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4397
          assume "x = b"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4398
          then have "y = b" unfolding obt(5)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4399
            using obt(3) by (auto simp add: scaleR_left_distrib[symmetric])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4400
          then show False using obt(4) and False by simp
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4401
        qed
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4402
        then have *: "w *\<^sub>R (x - b) \<noteq> 0" using w(1) by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4403
        show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4404
          using dist_increases_online[OF *, of a y]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4405
        proof (elim disjE)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4406
          assume "dist a y < dist a (y + w *\<^sub>R (x - b))"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4407
          then have "norm (y - a) < norm ((u + w) *\<^sub>R x + (v - w) *\<^sub>R b - a)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4408
            unfolding dist_commute[of a]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4409
            unfolding dist_norm obt(5)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4410
            by (simp add: algebra_simps)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4411
          moreover have "(u + w) *\<^sub>R x + (v - w) *\<^sub>R b \<in> convex hull insert x s"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4412
            unfolding convex_hull_insert[OF \<open>s\<noteq>{}\<close>] and mem_Collect_eq
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4413
            apply (rule_tac x="u + w" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4414
            apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4415
            defer
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4416
            apply (rule_tac x="v - w" in exI)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4417
            using \<open>u \<ge> 0\<close> and w and obt(3,4)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4418
            apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4419
            done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4420
          ultimately show ?thesis by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4421
        next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4422
          assume "dist a y < dist a (y - w *\<^sub>R (x - b))"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4423
          then have "norm (y - a) < norm ((u - w) *\<^sub>R x + (v + w) *\<^sub>R b - a)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4424
            unfolding dist_commute[of a]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4425
            unfolding dist_norm obt(5)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4426
            by (simp add: algebra_simps)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4427
          moreover have "(u - w) *\<^sub>R x + (v + w) *\<^sub>R b \<in> convex hull insert x s"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4428
            unfolding convex_hull_insert[OF \<open>s\<noteq>{}\<close>] and mem_Collect_eq
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4429
            apply (rule_tac x="u - w" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4430
            apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4431
            defer
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4432
            apply (rule_tac x="v + w" in exI)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4433
            using \<open>u \<ge> 0\<close> and w and obt(3,4)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4434
            apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4435
            done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4436
          ultimately show ?thesis by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4437
        qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4438
      qed auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4439
    qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4440
  qed auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4441
qed (auto simp add: assms)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4442
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4443
lemma simplex_furthest_le:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4444
  fixes s :: "'a::real_inner set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4445
  assumes "finite s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4446
    and "s \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4447
  shows "\<exists>y\<in>s. \<forall>x\<in> convex hull s. norm (x - a) \<le> norm (y - a)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4448
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4449
  have "convex hull s \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4450
    using hull_subset[of s convex] and assms(2) by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4451
  then obtain x where x: "x \<in> convex hull s" "\<forall>y\<in>convex hull s. norm (y - a) \<le> norm (x - a)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4452
    using distance_attains_sup[OF finite_imp_compact_convex_hull[OF assms(1)], of a]
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4453
    unfolding dist_commute[of a]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4454
    unfolding dist_norm
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4455
    by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4456
  show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4457
  proof (cases "x \<in> s")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4458
    case False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4459
    then obtain y where "y \<in> convex hull s" "norm (x - a) < norm (y - a)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4460
      using simplex_furthest_lt[OF assms(1), THEN bspec[where x=x]] and x(1)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4461
      by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4462
    then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4463
      using x(2)[THEN bspec[where x=y]] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4464
  next
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4465
    case True
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4466
    with x show ?thesis by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4467
  qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4468
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4469
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4470
lemma simplex_furthest_le_exists:
44525
fbb777aec0d4 generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents: 44524
diff changeset
  4471
  fixes s :: "('a::real_inner) set"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4472
  shows "finite s \<Longrightarrow> \<forall>x\<in>(convex hull s). \<exists>y\<in>s. norm (x - a) \<le> norm (y - a)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4473
  using simplex_furthest_le[of s] by (cases "s = {}") auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4474
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4475
lemma simplex_extremal_le:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4476
  fixes s :: "'a::real_inner set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4477
  assumes "finite s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4478
    and "s \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4479
  shows "\<exists>u\<in>s. \<exists>v\<in>s. \<forall>x\<in>convex hull s. \<forall>y \<in> convex hull s. norm (x - y) \<le> norm (u - v)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4480
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4481
  have "convex hull s \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4482
    using hull_subset[of s convex] and assms(2) by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4483
  then obtain u v where obt: "u \<in> convex hull s" "v \<in> convex hull s"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4484
    "\<forall>x\<in>convex hull s. \<forall>y\<in>convex hull s. norm (x - y) \<le> norm (u - v)"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4485
    using compact_sup_maxdistance[OF finite_imp_compact_convex_hull[OF assms(1)]]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4486
    by (auto simp: dist_norm)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4487
  then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4488
  proof (cases "u\<notin>s \<or> v\<notin>s", elim disjE)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4489
    assume "u \<notin> s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4490
    then obtain y where "y \<in> convex hull s" "norm (u - v) < norm (y - v)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4491
      using simplex_furthest_lt[OF assms(1), THEN bspec[where x=u]] and obt(1)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4492
      by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4493
    then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4494
      using obt(3)[THEN bspec[where x=y], THEN bspec[where x=v]] and obt(2)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4495
      by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4496
  next
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4497
    assume "v \<notin> s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4498
    then obtain y where "y \<in> convex hull s" "norm (v - u) < norm (y - u)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4499
      using simplex_furthest_lt[OF assms(1), THEN bspec[where x=v]] and obt(2)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4500
      by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4501
    then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4502
      using obt(3)[THEN bspec[where x=u], THEN bspec[where x=y]] and obt(1)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4503
      by (auto simp add: norm_minus_commute)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4504
  qed auto
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  4505
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4506
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4507
lemma simplex_extremal_le_exists:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4508
  fixes s :: "'a::real_inner set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4509
  shows "finite s \<Longrightarrow> x \<in> convex hull s \<Longrightarrow> y \<in> convex hull s \<Longrightarrow>
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4510
    \<exists>u\<in>s. \<exists>v\<in>s. norm (x - y) \<le> norm (u - v)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4511
  using convex_hull_empty simplex_extremal_le[of s]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4512
  by(cases "s = {}") auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4513
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4514
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4515
subsection \<open>Closest point of a convex set is unique, with a continuous projection.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4516
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4517
definition closest_point :: "'a::{real_inner,heine_borel} set \<Rightarrow> 'a \<Rightarrow> 'a"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4518
  where "closest_point s a = (SOME x. x \<in> s \<and> (\<forall>y\<in>s. dist a x \<le> dist a y))"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4519
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4520
lemma closest_point_exists:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4521
  assumes "closed s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4522
    and "s \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4523
  shows "closest_point s a \<in> s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4524
    and "\<forall>y\<in>s. dist a (closest_point s a) \<le> dist a y"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4525
  unfolding closest_point_def
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4526
  apply(rule_tac[!] someI2_ex)
62381
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
  4527
  apply (auto intro: distance_attains_inf[OF assms(1,2), of a])
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4528
  done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4529
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4530
lemma closest_point_in_set: "closed s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> closest_point s a \<in> s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4531
  by (meson closest_point_exists)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4532
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4533
lemma closest_point_le: "closed s \<Longrightarrow> x \<in> s \<Longrightarrow> dist a (closest_point s a) \<le> dist a x"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4534
  using closest_point_exists[of s] by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4535
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4536
lemma closest_point_self:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4537
  assumes "x \<in> s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4538
  shows "closest_point s x = x"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4539
  unfolding closest_point_def
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4540
  apply (rule some1_equality, rule ex1I[of _ x])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4541
  using assms
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4542
  apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4543
  done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4544
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4545
lemma closest_point_refl: "closed s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> closest_point s x = x \<longleftrightarrow> x \<in> s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4546
  using closest_point_in_set[of s x] closest_point_self[of x s]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4547
  by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4548
36337
87b6c83d7ed7 generalize constant closest_point
huffman
parents: 36071
diff changeset
  4549
lemma closer_points_lemma:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4550
  assumes "inner y z > 0"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4551
  shows "\<exists>u>0. \<forall>v>0. v \<le> u \<longrightarrow> norm(v *\<^sub>R z - y) < norm y"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4552
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4553
  have z: "inner z z > 0"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4554
    unfolding inner_gt_zero_iff using assms by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4555
  then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4556
    using assms
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4557
    apply (rule_tac x = "inner y z / inner z z" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4558
    apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4559
    defer
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4560
  proof rule+
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4561
    fix v
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4562
    assume "0 < v" and "v \<le> inner y z / inner z z"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4563
    then show "norm (v *\<^sub>R z - y) < norm y"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4564
      unfolding norm_lt using z and assms
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4565
      by (simp add: field_simps inner_diff inner_commute mult_strict_left_mono[OF _ \<open>0<v\<close>])
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56536
diff changeset
  4566
  qed auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4567
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4568
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4569
lemma closer_point_lemma:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4570
  assumes "inner (y - x) (z - x) > 0"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4571
  shows "\<exists>u>0. u \<le> 1 \<and> dist (x + u *\<^sub>R (z - x)) y < dist x y"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4572
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4573
  obtain u where "u > 0"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4574
    and u: "\<forall>v>0. v \<le> u \<longrightarrow> norm (v *\<^sub>R (z - x) - (y - x)) < norm (y - x)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4575
    using closer_points_lemma[OF assms] by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4576
  show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4577
    apply (rule_tac x="min u 1" in exI)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4578
    using u[THEN spec[where x="min u 1"]] and \<open>u > 0\<close>
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4579
    unfolding dist_norm by (auto simp add: norm_minus_commute field_simps)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4580
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4581
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4582
lemma any_closest_point_dot:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4583
  assumes "convex s" "closed s" "x \<in> s" "y \<in> s" "\<forall>z\<in>s. dist a x \<le> dist a z"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4584
  shows "inner (a - x) (y - x) \<le> 0"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4585
proof (rule ccontr)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4586
  assume "\<not> ?thesis"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4587
  then obtain u where u: "u>0" "u\<le>1" "dist (x + u *\<^sub>R (y - x)) a < dist x a"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4588
    using closer_point_lemma[of a x y] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4589
  let ?z = "(1 - u) *\<^sub>R x + u *\<^sub>R y"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4590
  have "?z \<in> s"
61426
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61222
diff changeset
  4591
    using convexD_alt[OF assms(1,3,4), of u] using u by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4592
  then show False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4593
    using assms(5)[THEN bspec[where x="?z"]] and u(3)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4594
    by (auto simp add: dist_commute algebra_simps)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4595
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4596
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4597
lemma any_closest_point_unique:
36337
87b6c83d7ed7 generalize constant closest_point
huffman
parents: 36071
diff changeset
  4598
  fixes x :: "'a::real_inner"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4599
  assumes "convex s" "closed s" "x \<in> s" "y \<in> s"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4600
    "\<forall>z\<in>s. dist a x \<le> dist a z" "\<forall>z\<in>s. dist a y \<le> dist a z"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4601
  shows "x = y"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4602
  using any_closest_point_dot[OF assms(1-4,5)] and any_closest_point_dot[OF assms(1-2,4,3,6)]
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4603
  unfolding norm_pths(1) and norm_le_square
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4604
  by (auto simp add: algebra_simps)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4605
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4606
lemma closest_point_unique:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4607
  assumes "convex s" "closed s" "x \<in> s" "\<forall>z\<in>s. dist a x \<le> dist a z"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4608
  shows "x = closest_point s a"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  4609
  using any_closest_point_unique[OF assms(1-3) _ assms(4), of "closest_point s a"]
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4610
  using closest_point_exists[OF assms(2)] and assms(3) by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4611
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4612
lemma closest_point_dot:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4613
  assumes "convex s" "closed s" "x \<in> s"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4614
  shows "inner (a - closest_point s a) (x - closest_point s a) \<le> 0"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4615
  apply (rule any_closest_point_dot[OF assms(1,2) _ assms(3)])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4616
  using closest_point_exists[OF assms(2)] and assms(3)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4617
  apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4618
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4619
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4620
lemma closest_point_lt:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4621
  assumes "convex s" "closed s" "x \<in> s" "x \<noteq> closest_point s a"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4622
  shows "dist a (closest_point s a) < dist a x"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4623
  apply (rule ccontr)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4624
  apply (rule_tac notE[OF assms(4)])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4625
  apply (rule closest_point_unique[OF assms(1-3), of a])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4626
  using closest_point_le[OF assms(2), of _ a]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4627
  apply fastforce
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4628
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4629
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4630
lemma closest_point_lipschitz:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4631
  assumes "convex s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4632
    and "closed s" "s \<noteq> {}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4633
  shows "dist (closest_point s x) (closest_point s y) \<le> dist x y"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4634
proof -
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4635
  have "inner (x - closest_point s x) (closest_point s y - closest_point s x) \<le> 0"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4636
    and "inner (y - closest_point s y) (closest_point s x - closest_point s y) \<le> 0"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4637
    apply (rule_tac[!] any_closest_point_dot[OF assms(1-2)])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4638
    using closest_point_exists[OF assms(2-3)]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4639
    apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4640
    done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4641
  then show ?thesis unfolding dist_norm and norm_le
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4642
    using inner_ge_zero[of "(x - closest_point s x) - (y - closest_point s y)"]
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4643
    by (simp add: inner_add inner_diff inner_commute)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4644
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4645
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4646
lemma continuous_at_closest_point:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4647
  assumes "convex s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4648
    and "closed s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4649
    and "s \<noteq> {}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4650
  shows "continuous (at x) (closest_point s)"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  4651
  unfolding continuous_at_eps_delta
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4652
  using le_less_trans[OF closest_point_lipschitz[OF assms]] by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4653
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4654
lemma continuous_on_closest_point:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4655
  assumes "convex s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4656
    and "closed s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4657
    and "s \<noteq> {}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4658
  shows "continuous_on t (closest_point s)"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4659
  by (metis continuous_at_imp_continuous_on continuous_at_closest_point[OF assms])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4660
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4661
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4662
subsubsection \<open>Various point-to-set separating/supporting hyperplane theorems.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4663
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4664
lemma supporting_hyperplane_closed_point:
36337
87b6c83d7ed7 generalize constant closest_point
huffman
parents: 36071
diff changeset
  4665
  fixes z :: "'a::{real_inner,heine_borel}"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4666
  assumes "convex s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4667
    and "closed s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4668
    and "s \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4669
    and "z \<notin> s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4670
  shows "\<exists>a b. \<exists>y\<in>s. inner a z < b \<and> inner a y = b \<and> (\<forall>x\<in>s. inner a x \<ge> b)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4671
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4672
  obtain y where "y \<in> s" and y: "\<forall>x\<in>s. dist z y \<le> dist z x"
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
  4673
    by (metis distance_attains_inf[OF assms(2-3)])
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4674
  show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4675
    apply (rule_tac x="y - z" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4676
    apply (rule_tac x="inner (y - z) y" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4677
    apply (rule_tac x=y in bexI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4678
    apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4679
    defer
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4680
    apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4681
    defer
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4682
    apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4683
    apply (rule ccontr)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4684
    using \<open>y \<in> s\<close>
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4685
  proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4686
    show "inner (y - z) z < inner (y - z) y"
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  4687
      apply (subst diff_gt_0_iff_gt [symmetric])
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4688
      unfolding inner_diff_right[symmetric] and inner_gt_zero_iff
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4689
      using \<open>y\<in>s\<close> \<open>z\<notin>s\<close>
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4690
      apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4691
      done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4692
  next
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4693
    fix x
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4694
    assume "x \<in> s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4695
    have *: "\<forall>u. 0 \<le> u \<and> u \<le> 1 \<longrightarrow> dist z y \<le> dist z ((1 - u) *\<^sub>R y + u *\<^sub>R x)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4696
      using assms(1)[unfolded convex_alt] and y and \<open>x\<in>s\<close> and \<open>y\<in>s\<close> by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4697
    assume "\<not> inner (y - z) y \<le> inner (y - z) x"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4698
    then obtain v where "v > 0" "v \<le> 1" "dist (y + v *\<^sub>R (x - y)) z < dist y z"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4699
      using closer_point_lemma[of z y x] by (auto simp add: inner_diff)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4700
    then show False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4701
      using *[THEN spec[where x=v]] by (auto simp add: dist_commute algebra_simps)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4702
  qed auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4703
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4704
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4705
lemma separating_hyperplane_closed_point:
36337
87b6c83d7ed7 generalize constant closest_point
huffman
parents: 36071
diff changeset
  4706
  fixes z :: "'a::{real_inner,heine_borel}"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4707
  assumes "convex s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4708
    and "closed s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4709
    and "z \<notin> s"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4710
  shows "\<exists>a b. inner a z < b \<and> (\<forall>x\<in>s. inner a x > b)"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4711
proof (cases "s = {}")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4712
  case True
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4713
  then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4714
    apply (rule_tac x="-z" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4715
    apply (rule_tac x=1 in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4716
    using less_le_trans[OF _ inner_ge_zero[of z]]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4717
    apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4718
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4719
next
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4720
  case False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4721
  obtain y where "y \<in> s" and y: "\<forall>x\<in>s. dist z y \<le> dist z x"
62381
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
  4722
    by (metis distance_attains_inf[OF assms(2) False])
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4723
  show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4724
    apply (rule_tac x="y - z" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4725
    apply (rule_tac x="inner (y - z) z + (norm (y - z))\<^sup>2 / 2" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4726
    apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4727
    defer
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4728
    apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4729
  proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4730
    fix x
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4731
    assume "x \<in> s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4732
    have "\<not> 0 < inner (z - y) (x - y)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4733
      apply (rule notI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4734
      apply (drule closer_point_lemma)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4735
    proof -
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4736
      assume "\<exists>u>0. u \<le> 1 \<and> dist (y + u *\<^sub>R (x - y)) z < dist y z"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4737
      then obtain u where "u > 0" "u \<le> 1" "dist (y + u *\<^sub>R (x - y)) z < dist y z"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4738
        by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4739
      then show False using y[THEN bspec[where x="y + u *\<^sub>R (x - y)"]]
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4740
        using assms(1)[unfolded convex_alt, THEN bspec[where x=y]]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4741
        using \<open>x\<in>s\<close> \<open>y\<in>s\<close> by (auto simp add: dist_commute algebra_simps)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4742
    qed
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4743
    moreover have "0 < (norm (y - z))\<^sup>2"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4744
      using \<open>y\<in>s\<close> \<open>z\<notin>s\<close> by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4745
    then have "0 < inner (y - z) (y - z)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4746
      unfolding power2_norm_eq_inner by simp
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51524
diff changeset
  4747
    ultimately show "inner (y - z) z + (norm (y - z))\<^sup>2 / 2 < inner (y - z) x"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4748
      unfolding power2_norm_eq_inner and not_less
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4749
      by (auto simp add: field_simps inner_commute inner_diff)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4750
  qed (insert \<open>y\<in>s\<close> \<open>z\<notin>s\<close>, auto)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4751
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4752
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4753
lemma separating_hyperplane_closed_0:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4754
  assumes "convex (s::('a::euclidean_space) set)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4755
    and "closed s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4756
    and "0 \<notin> s"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4757
  shows "\<exists>a b. a \<noteq> 0 \<and> 0 < b \<and> (\<forall>x\<in>s. inner a x > b)"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4758
proof (cases "s = {}")
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  4759
  case True
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4760
  have "norm ((SOME i. i\<in>Basis)::'a) = 1" "(SOME i. i\<in>Basis) \<noteq> (0::'a)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4761
    defer
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4762
    apply (subst norm_le_zero_iff[symmetric])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4763
    apply (auto simp: SOME_Basis)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4764
    done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4765
  then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4766
    apply (rule_tac x="SOME i. i\<in>Basis" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4767
    apply (rule_tac x=1 in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4768
    using True using DIM_positive[where 'a='a]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4769
    apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4770
    done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4771
next
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4772
  case False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4773
  then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4774
    using False using separating_hyperplane_closed_point[OF assms]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4775
    apply (elim exE)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4776
    unfolding inner_zero_right
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4777
    apply (rule_tac x=a in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4778
    apply (rule_tac x=b in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4779
    apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4780
    done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4781
qed
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4782
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4783
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4784
subsubsection \<open>Now set-to-set for closed/compact sets\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4785
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4786
lemma separating_hyperplane_closed_compact:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4787
  fixes s :: "'a::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4788
  assumes "convex s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4789
    and "closed s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4790
    and "convex t"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4791
    and "compact t"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4792
    and "t \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4793
    and "s \<inter> t = {}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4794
  shows "\<exists>a b. (\<forall>x\<in>s. inner a x < b) \<and> (\<forall>x\<in>t. inner a x > b)"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4795
proof (cases "s = {}")
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4796
  case True
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4797
  obtain b where b: "b > 0" "\<forall>x\<in>t. norm x \<le> b"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4798
    using compact_imp_bounded[OF assms(4)] unfolding bounded_pos by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4799
  obtain z :: 'a where z: "norm z = b + 1"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4800
    using vector_choose_size[of "b + 1"] and b(1) by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4801
  then have "z \<notin> t" using b(2)[THEN bspec[where x=z]] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4802
  then obtain a b where ab: "inner a z < b" "\<forall>x\<in>t. b < inner a x"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4803
    using separating_hyperplane_closed_point[OF assms(3) compact_imp_closed[OF assms(4)], of z]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4804
    by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4805
  then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4806
    using True by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4807
next
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4808
  case False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4809
  then obtain y where "y \<in> s" by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4810
  obtain a b where "0 < b" "\<forall>x\<in>{x - y |x y. x \<in> s \<and> y \<in> t}. b < inner a x"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4811
    using separating_hyperplane_closed_point[OF convex_differences[OF assms(1,3)], of 0]
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4812
    using closed_compact_differences[OF assms(2,4)]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4813
    using assms(6) by auto blast
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4814
  then have ab: "\<forall>x\<in>s. \<forall>y\<in>t. b + inner a y < inner a x"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4815
    apply -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4816
    apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4817
    apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4818
    apply (erule_tac x="x - y" in ballE)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4819
    apply (auto simp add: inner_diff)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4820
    done
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  4821
  define k where "k = (SUP x:t. a \<bullet> x)"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4822
  show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4823
    apply (rule_tac x="-a" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4824
    apply (rule_tac x="-(k + b / 2)" in exI)
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
  4825
    apply (intro conjI ballI)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4826
    unfolding inner_minus_left and neg_less_iff_less
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4827
  proof -
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
  4828
    fix x assume "x \<in> t"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
  4829
    then have "inner a x - b / 2 < k"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4830
      unfolding k_def
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
  4831
    proof (subst less_cSUP_iff)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
  4832
      show "t \<noteq> {}" by fact
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
  4833
      show "bdd_above (op \<bullet> a ` t)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4834
        using ab[rule_format, of y] \<open>y \<in> s\<close>
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
  4835
        by (intro bdd_aboveI2[where M="inner a y - b"]) (auto simp: field_simps intro: less_imp_le)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4836
    qed (auto intro!: bexI[of _ x] \<open>0<b\<close>)
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
  4837
    then show "inner a x < k + b / 2"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
  4838
      by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4839
  next
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4840
    fix x
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4841
    assume "x \<in> s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4842
    then have "k \<le> inner a x - b"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4843
      unfolding k_def
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
  4844
      apply (rule_tac cSUP_least)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4845
      using assms(5)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4846
      using ab[THEN bspec[where x=x]]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4847
      apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4848
      done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4849
    then show "k + b / 2 < inner a x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4850
      using \<open>0 < b\<close> by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4851
  qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4852
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4853
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4854
lemma separating_hyperplane_compact_closed:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4855
  fixes s :: "'a::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4856
  assumes "convex s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4857
    and "compact s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4858
    and "s \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4859
    and "convex t"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4860
    and "closed t"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4861
    and "s \<inter> t = {}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4862
  shows "\<exists>a b. (\<forall>x\<in>s. inner a x < b) \<and> (\<forall>x\<in>t. inner a x > b)"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4863
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4864
  obtain a b where "(\<forall>x\<in>t. inner a x < b) \<and> (\<forall>x\<in>s. b < inner a x)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4865
    using separating_hyperplane_closed_compact[OF assms(4-5,1-2,3)] and assms(6)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4866
    by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4867
  then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4868
    apply (rule_tac x="-a" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4869
    apply (rule_tac x="-b" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4870
    apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4871
    done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4872
qed
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4873
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4874
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4875
subsubsection \<open>General case without assuming closure and getting non-strict separation\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4876
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4877
lemma separating_hyperplane_set_0:
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  4878
  assumes "convex s" "(0::'a::euclidean_space) \<notin> s"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4879
  shows "\<exists>a. a \<noteq> 0 \<and> (\<forall>x\<in>s. 0 \<le> inner a x)"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4880
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4881
  let ?k = "\<lambda>c. {x::'a. 0 \<le> inner c x}"
62381
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
  4882
  have *: "frontier (cball 0 1) \<inter> \<Inter>f \<noteq> {}" if as: "f \<subseteq> ?k ` s" "finite f" for f
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4883
  proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4884
    obtain c where c: "f = ?k ` c" "c \<subseteq> s" "finite c"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4885
      using finite_subset_image[OF as(2,1)] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4886
    then obtain a b where ab: "a \<noteq> 0" "0 < b" "\<forall>x\<in>convex hull c. b < inner a x"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4887
      using separating_hyperplane_closed_0[OF convex_convex_hull, of c]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4888
      using finite_imp_compact_convex_hull[OF c(3), THEN compact_imp_closed] and assms(2)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4889
      using subset_hull[of convex, OF assms(1), symmetric, of c]
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  4890
      by force
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4891
    then have "\<exists>x. norm x = 1 \<and> (\<forall>y\<in>c. 0 \<le> inner y x)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4892
      apply (rule_tac x = "inverse(norm a) *\<^sub>R a" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4893
      using hull_subset[of c convex]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4894
      unfolding subset_eq and inner_scaleR
56536
aefb4a8da31f made mult_nonneg_nonneg a simp rule
nipkow
parents: 56480
diff changeset
  4895
      by (auto simp add: inner_commute del: ballE elim!: ballE)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4896
    then show "frontier (cball 0 1) \<inter> \<Inter>f \<noteq> {}"
62381
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
  4897
      unfolding c(1) frontier_cball sphere_def dist_norm by auto
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
  4898
  qed
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
  4899
  have "frontier (cball 0 1) \<inter> (\<Inter>(?k ` s)) \<noteq> {}"
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
  4900
    apply (rule compact_imp_fip)
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
  4901
    apply (rule compact_frontier[OF compact_cball])
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
  4902
    using * closed_halfspace_ge
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
  4903
    by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4904
  then obtain x where "norm x = 1" "\<forall>y\<in>s. x\<in>?k y"
62381
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
  4905
    unfolding frontier_cball dist_norm sphere_def by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4906
  then show ?thesis
62381
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
  4907
    by (metis inner_commute mem_Collect_eq norm_eq_zero zero_neq_one)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4908
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4909
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4910
lemma separating_hyperplane_sets:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4911
  fixes s t :: "'a::euclidean_space set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4912
  assumes "convex s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4913
    and "convex t"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4914
    and "s \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4915
    and "t \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4916
    and "s \<inter> t = {}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4917
  shows "\<exists>a b. a \<noteq> 0 \<and> (\<forall>x\<in>s. inner a x \<le> b) \<and> (\<forall>x\<in>t. inner a x \<ge> b)"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4918
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4919
  from separating_hyperplane_set_0[OF convex_differences[OF assms(2,1)]]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4920
  obtain a where "a \<noteq> 0" "\<forall>x\<in>{x - y |x y. x \<in> t \<and> y \<in> s}. 0 \<le> inner a x"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  4921
    using assms(3-5) by fastforce
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
  4922
  then have *: "\<And>x y. x \<in> t \<Longrightarrow> y \<in> s \<Longrightarrow> inner a y \<le> inner a x"
33270
paulson
parents: 33175
diff changeset
  4923
    by (force simp add: inner_diff)
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
  4924
  then have bdd: "bdd_above ((op \<bullet> a)`s)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4925
    using \<open>t \<noteq> {}\<close> by (auto intro: bdd_aboveI2[OF *])
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
  4926
  show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4927
    using \<open>a\<noteq>0\<close>
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
  4928
    by (intro exI[of _ a] exI[of _ "SUP x:s. a \<bullet> x"])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4929
       (auto intro!: cSUP_upper bdd cSUP_least \<open>a \<noteq> 0\<close> \<open>s \<noteq> {}\<close> *)
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4930
qed
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4931
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4932
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4933
subsection \<open>More convexity generalities\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4934
62948
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
  4935
lemma convex_closure [intro,simp]:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4936
  fixes s :: "'a::real_normed_vector set"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4937
  assumes "convex s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4938
  shows "convex (closure s)"
53676
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  4939
  apply (rule convexI)
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  4940
  apply (unfold closure_sequential, elim exE)
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  4941
  apply (rule_tac x="\<lambda>n. u *\<^sub>R xa n + v *\<^sub>R xb n" in exI)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4942
  apply (rule,rule)
53676
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  4943
  apply (rule convexD [OF assms])
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4944
  apply (auto del: tendsto_const intro!: tendsto_intros)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4945
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4946
62948
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
  4947
lemma convex_interior [intro,simp]:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4948
  fixes s :: "'a::real_normed_vector set"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4949
  assumes "convex s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4950
  shows "convex (interior s)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4951
  unfolding convex_alt Ball_def mem_interior
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4952
  apply (rule,rule,rule,rule,rule,rule)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4953
  apply (elim exE conjE)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4954
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4955
  fix x y u
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4956
  assume u: "0 \<le> u" "u \<le> (1::real)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4957
  fix e d
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4958
  assume ed: "ball x e \<subseteq> s" "ball y d \<subseteq> s" "0<d" "0<e"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4959
  show "\<exists>e>0. ball ((1 - u) *\<^sub>R x + u *\<^sub>R y) e \<subseteq> s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4960
    apply (rule_tac x="min d e" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4961
    apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4962
    unfolding subset_eq
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4963
    defer
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4964
    apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4965
  proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4966
    fix z
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4967
    assume "z \<in> ball ((1 - u) *\<^sub>R x + u *\<^sub>R y) (min d e)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4968
    then have "(1- u) *\<^sub>R (z - u *\<^sub>R (y - x)) + u *\<^sub>R (z + (1 - u) *\<^sub>R (y - x)) \<in> s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4969
      apply (rule_tac assms[unfolded convex_alt, rule_format])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4970
      using ed(1,2) and u
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4971
      unfolding subset_eq mem_ball Ball_def dist_norm
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4972
      apply (auto simp add: algebra_simps)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4973
      done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4974
    then show "z \<in> s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4975
      using u by (auto simp add: algebra_simps)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4976
  qed(insert u ed(3-4), auto)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4977
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4978
34964
4e8be3c04d37 Replaced vec1 and dest_vec1 by abbreviation.
hoelzl
parents: 34915
diff changeset
  4979
lemma convex_hull_eq_empty[simp]: "convex hull s = {} \<longleftrightarrow> s = {}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4980
  using hull_subset[of s convex] convex_hull_empty by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4981
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  4982
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  4983
subsection \<open>Moving and scaling convex hulls.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4984
53676
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  4985
lemma convex_hull_set_plus:
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  4986
  "convex hull (s + t) = convex hull s + convex hull t"
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  4987
  unfolding set_plus_image
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  4988
  apply (subst convex_hull_linear_image [symmetric])
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  4989
  apply (simp add: linear_iff scaleR_right_distrib)
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  4990
  apply (simp add: convex_hull_Times)
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  4991
  done
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  4992
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  4993
lemma translation_eq_singleton_plus: "(\<lambda>x. a + x) ` t = {a} + t"
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  4994
  unfolding set_plus_def by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4995
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4996
lemma convex_hull_translation:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4997
  "convex hull ((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (convex hull s)"
53676
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  4998
  unfolding translation_eq_singleton_plus
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  4999
  by (simp only: convex_hull_set_plus convex_hull_singleton)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5000
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5001
lemma convex_hull_scaling:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5002
  "convex hull ((\<lambda>x. c *\<^sub>R x) ` s) = (\<lambda>x. c *\<^sub>R x) ` (convex hull s)"
53676
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5003
  using linear_scaleR by (rule convex_hull_linear_image [symmetric])
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5004
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5005
lemma convex_hull_affinity:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5006
  "convex hull ((\<lambda>x. a + c *\<^sub>R x) ` s) = (\<lambda>x. a + c *\<^sub>R x) ` (convex hull s)"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5007
  by(simp only: image_image[symmetric] convex_hull_scaling convex_hull_translation)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5008
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5009
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5010
subsection \<open>Convexity of cone hulls\<close>
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  5011
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  5012
lemma convex_cone_hull:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5013
  assumes "convex S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5014
  shows "convex (cone hull S)"
53676
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5015
proof (rule convexI)
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5016
  fix x y
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5017
  assume xy: "x \<in> cone hull S" "y \<in> cone hull S"
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5018
  then have "S \<noteq> {}"
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5019
    using cone_hull_empty_iff[of S] by auto
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5020
  fix u v :: real
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5021
  assume uv: "u \<ge> 0" "v \<ge> 0" "u + v = 1"
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5022
  then have *: "u *\<^sub>R x \<in> cone hull S" "v *\<^sub>R y \<in> cone hull S"
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5023
    using cone_cone_hull[of S] xy cone_def[of "cone hull S"] by auto
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5024
  from * obtain cx :: real and xx where x: "u *\<^sub>R x = cx *\<^sub>R xx" "cx \<ge> 0" "xx \<in> S"
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5025
    using cone_hull_expl[of S] by auto
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5026
  from * obtain cy :: real and yy where y: "v *\<^sub>R y = cy *\<^sub>R yy" "cy \<ge> 0" "yy \<in> S"
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5027
    using cone_hull_expl[of S] by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5028
  {
53676
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5029
    assume "cx + cy \<le> 0"
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5030
    then have "u *\<^sub>R x = 0" and "v *\<^sub>R y = 0"
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5031
      using x y by auto
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5032
    then have "u *\<^sub>R x + v *\<^sub>R y = 0"
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5033
      by auto
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5034
    then have "u *\<^sub>R x + v *\<^sub>R y \<in> cone hull S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5035
      using cone_hull_contains_0[of S] \<open>S \<noteq> {}\<close> by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  5036
  }
53676
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5037
  moreover
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5038
  {
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5039
    assume "cx + cy > 0"
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5040
    then have "(cx / (cx + cy)) *\<^sub>R xx + (cy / (cx + cy)) *\<^sub>R yy \<in> S"
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5041
      using assms mem_convex_alt[of S xx yy cx cy] x y by auto
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5042
    then have "cx *\<^sub>R xx + cy *\<^sub>R yy \<in> cone hull S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5043
      using mem_cone_hull[of "(cx/(cx+cy)) *\<^sub>R xx + (cy/(cx+cy)) *\<^sub>R yy" S "cx+cy"] \<open>cx+cy>0\<close>
53676
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5044
      by (auto simp add: scaleR_right_distrib)
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5045
    then have "u *\<^sub>R x + v *\<^sub>R y \<in> cone hull S"
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5046
      using x y by auto
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5047
  }
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5048
  moreover have "cx + cy \<le> 0 \<or> cx + cy > 0" by auto
476ef9b468d2 tuned proofs about 'convex'
huffman
parents: 53620
diff changeset
  5049
  ultimately show "u *\<^sub>R x + v *\<^sub>R y \<in> cone hull S" by blast
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  5050
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  5051
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  5052
lemma cone_convex_hull:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5053
  assumes "cone S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5054
  shows "cone (convex hull S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5055
proof (cases "S = {}")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5056
  case True
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5057
  then show ?thesis by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5058
next
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5059
  case False
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5060
  then have *: "0 \<in> S \<and> (\<forall>c. c > 0 \<longrightarrow> op *\<^sub>R c ` S = S)"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5061
    using cone_iff[of S] assms by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5062
  {
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5063
    fix c :: real
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5064
    assume "c > 0"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5065
    then have "op *\<^sub>R c ` (convex hull S) = convex hull (op *\<^sub>R c ` S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5066
      using convex_hull_scaling[of _ S] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5067
    also have "\<dots> = convex hull S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5068
      using * \<open>c > 0\<close> by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5069
    finally have "op *\<^sub>R c ` (convex hull S) = convex hull S"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5070
      by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  5071
  }
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5072
  then have "0 \<in> convex hull S" "\<And>c. c > 0 \<Longrightarrow> (op *\<^sub>R c ` (convex hull S)) = (convex hull S)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5073
    using * hull_subset[of S convex] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5074
  then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5075
    using \<open>S \<noteq> {}\<close> cone_iff[of "convex hull S"] by auto
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5076
qed
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5077
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5078
subsection \<open>Convex set as intersection of halfspaces\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5079
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5080
lemma convex_halfspace_intersection:
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  5081
  fixes s :: "('a::euclidean_space) set"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5082
  assumes "closed s" "convex s"
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60420
diff changeset
  5083
  shows "s = \<Inter>{h. s \<subseteq> h \<and> (\<exists>a b. h = {x. inner a x \<le> b})}"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5084
  apply (rule set_eqI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5085
  apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5086
  unfolding Inter_iff Ball_def mem_Collect_eq
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5087
  apply (rule,rule,erule conjE)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5088
proof -
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5089
  fix x
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5090
  assume "\<forall>xa. s \<subseteq> xa \<and> (\<exists>a b. xa = {x. inner a x \<le> b}) \<longrightarrow> x \<in> xa"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5091
  then have "\<forall>a b. s \<subseteq> {x. inner a x \<le> b} \<longrightarrow> x \<in> {x. inner a x \<le> b}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5092
    by blast
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5093
  then show "x \<in> s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5094
    apply (rule_tac ccontr)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5095
    apply (drule separating_hyperplane_closed_point[OF assms(2,1)])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5096
    apply (erule exE)+
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5097
    apply (erule_tac x="-a" in allE)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5098
    apply (erule_tac x="-b" in allE)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5099
    apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5100
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5101
qed auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5102
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5103
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5104
subsection \<open>Radon's theorem (from Lars Schewe)\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5105
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5106
lemma radon_ex_lemma:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5107
  assumes "finite c" "affine_dependent c"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5108
  shows "\<exists>u. setsum u c = 0 \<and> (\<exists>v\<in>c. u v \<noteq> 0) \<and> setsum (\<lambda>v. u v *\<^sub>R v) c = 0"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5109
proof -
55697
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  5110
  from assms(2)[unfolded affine_dependent_explicit]
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  5111
  obtain s u where
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  5112
      "finite s" "s \<subseteq> c" "setsum u s = 0" "\<exists>v\<in>s. u v \<noteq> 0" "(\<Sum>v\<in>s. u v *\<^sub>R v) = 0"
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  5113
    by blast
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5114
  then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5115
    apply (rule_tac x="\<lambda>v. if v\<in>s then u v else 0" in exI)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  5116
    unfolding if_smult scaleR_zero_left and setsum.inter_restrict[OF assms(1), symmetric]
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5117
    apply (auto simp add: Int_absorb1)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5118
    done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5119
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5120
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5121
lemma radon_s_lemma:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5122
  assumes "finite s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5123
    and "setsum f s = (0::real)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5124
  shows "setsum f {x\<in>s. 0 < f x} = - setsum f {x\<in>s. f x < 0}"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5125
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5126
  have *: "\<And>x. (if f x < 0 then f x else 0) + (if 0 < f x then f x else 0) = f x"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5127
    by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5128
  show ?thesis
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  5129
    unfolding add_eq_0_iff[symmetric] and setsum.inter_filter[OF assms(1)]
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  5130
      and setsum.distrib[symmetric] and *
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5131
    using assms(2)
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  5132
    by assumption
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5133
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5134
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5135
lemma radon_v_lemma:
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5136
  assumes "finite s"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5137
    and "setsum f s = 0"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5138
    and "\<forall>x. g x = (0::real) \<longrightarrow> f x = (0::'a::euclidean_space)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5139
  shows "(setsum f {x\<in>s. 0 < g x}) = - setsum f {x\<in>s. g x < 0}"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5140
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5141
  have *: "\<And>x. (if 0 < g x then f x else 0) + (if g x < 0 then f x else 0) = f x"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5142
    using assms(3) by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5143
  show ?thesis
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  5144
    unfolding eq_neg_iff_add_eq_0 and setsum.inter_filter[OF assms(1)]
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  5145
      and setsum.distrib[symmetric] and *
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5146
    using assms(2)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5147
    apply assumption
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5148
    done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5149
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5150
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5151
lemma radon_partition:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5152
  assumes "finite c" "affine_dependent c"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5153
  shows "\<exists>m p. m \<inter> p = {} \<and> m \<union> p = c \<and> (convex hull m) \<inter> (convex hull p) \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5154
proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5155
  obtain u v where uv: "setsum u c = 0" "v\<in>c" "u v \<noteq> 0"  "(\<Sum>v\<in>c. u v *\<^sub>R v) = 0"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5156
    using radon_ex_lemma[OF assms] by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5157
  have fin: "finite {x \<in> c. 0 < u x}" "finite {x \<in> c. 0 > u x}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5158
    using assms(1) by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  5159
  define z  where "z = inverse (setsum u {x\<in>c. u x > 0}) *\<^sub>R setsum (\<lambda>x. u x *\<^sub>R x) {x\<in>c. u x > 0}"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5160
  have "setsum u {x \<in> c. 0 < u x} \<noteq> 0"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5161
  proof (cases "u v \<ge> 0")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5162
    case False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5163
    then have "u v < 0" by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5164
    then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5165
    proof (cases "\<exists>w\<in>{x \<in> c. 0 < u x}. u w > 0")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5166
      case True
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5167
      then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5168
        using setsum_nonneg_eq_0_iff[of _ u, OF fin(1)] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5169
    next
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5170
      case False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5171
      then have "setsum u c \<le> setsum (\<lambda>x. if x=v then u v else 0) c"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5172
        apply (rule_tac setsum_mono)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5173
        apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5174
        done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5175
      then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5176
        unfolding setsum.delta[OF assms(1)] using uv(2) and \<open>u v < 0\<close> and uv(1) by auto
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5177
    qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5178
  qed (insert setsum_nonneg_eq_0_iff[of _ u, OF fin(1)] uv(2-3), auto)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5179
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5180
  then have *: "setsum u {x\<in>c. u x > 0} > 0"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5181
    unfolding less_le
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5182
    apply (rule_tac conjI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5183
    apply (rule_tac setsum_nonneg)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5184
    apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5185
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5186
  moreover have "setsum u ({x \<in> c. 0 < u x} \<union> {x \<in> c. u x < 0}) = setsum u c"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5187
    "(\<Sum>x\<in>{x \<in> c. 0 < u x} \<union> {x \<in> c. u x < 0}. u x *\<^sub>R x) = (\<Sum>x\<in>c. u x *\<^sub>R x)"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5188
    using assms(1)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  5189
    apply (rule_tac[!] setsum.mono_neutral_left)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5190
    apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5191
    done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5192
  then have "setsum u {x \<in> c. 0 < u x} = - setsum u {x \<in> c. 0 > u x}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5193
    "(\<Sum>x\<in>{x \<in> c. 0 < u x}. u x *\<^sub>R x) = - (\<Sum>x\<in>{x \<in> c. 0 > u x}. u x *\<^sub>R x)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5194
    unfolding eq_neg_iff_add_eq_0
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5195
    using uv(1,4)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  5196
    by (auto simp add: setsum.union_inter_neutral[OF fin, symmetric])
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  5197
  moreover have "\<forall>x\<in>{v \<in> c. u v < 0}. 0 \<le> inverse (setsum u {x \<in> c. 0 < u x}) * - u x"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5198
    apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5199
    apply (rule mult_nonneg_nonneg)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5200
    using *
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5201
    apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5202
    done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5203
  ultimately have "z \<in> convex hull {v \<in> c. u v \<le> 0}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5204
    unfolding convex_hull_explicit mem_Collect_eq
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5205
    apply (rule_tac x="{v \<in> c. u v < 0}" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5206
    apply (rule_tac x="\<lambda>y. inverse (setsum u {x\<in>c. u x > 0}) * - u y" in exI)
49530
wenzelm
parents: 49529
diff changeset
  5207
    using assms(1) unfolding scaleR_scaleR[symmetric] scaleR_right.setsum [symmetric] and z_def
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5208
    apply (auto simp add: setsum_negf setsum_right_distrib[symmetric])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5209
    done
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  5210
  moreover have "\<forall>x\<in>{v \<in> c. 0 < u v}. 0 \<le> inverse (setsum u {x \<in> c. 0 < u x}) * u x"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5211
    apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5212
    apply (rule mult_nonneg_nonneg)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5213
    using *
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5214
    apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5215
    done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5216
  then have "z \<in> convex hull {v \<in> c. u v > 0}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5217
    unfolding convex_hull_explicit mem_Collect_eq
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5218
    apply (rule_tac x="{v \<in> c. 0 < u v}" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5219
    apply (rule_tac x="\<lambda>y. inverse (setsum u {x\<in>c. u x > 0}) * u y" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5220
    using assms(1)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5221
    unfolding scaleR_scaleR[symmetric] scaleR_right.setsum [symmetric] and z_def
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5222
    using *
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5223
    apply (auto simp add: setsum_negf setsum_right_distrib[symmetric])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5224
    done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5225
  ultimately show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5226
    apply (rule_tac x="{v\<in>c. u v \<le> 0}" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5227
    apply (rule_tac x="{v\<in>c. u v > 0}" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5228
    apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5229
    done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5230
qed
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5231
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5232
lemma radon:
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5233
  assumes "affine_dependent c"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5234
  obtains m p where "m \<subseteq> c" "p \<subseteq> c" "m \<inter> p = {}" "(convex hull m) \<inter> (convex hull p) \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5235
proof -
55697
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  5236
  from assms[unfolded affine_dependent_explicit]
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  5237
  obtain s u where
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  5238
      "finite s" "s \<subseteq> c" "setsum u s = 0" "\<exists>v\<in>s. u v \<noteq> 0" "(\<Sum>v\<in>s. u v *\<^sub>R v) = 0"
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  5239
    by blast
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5240
  then have *: "finite s" "affine_dependent s" and s: "s \<subseteq> c"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5241
    unfolding affine_dependent_explicit by auto
55697
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  5242
  from radon_partition[OF *]
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  5243
  obtain m p where "m \<inter> p = {}" "m \<union> p = s" "convex hull m \<inter> convex hull p \<noteq> {}"
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  5244
    by blast
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5245
  then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5246
    apply (rule_tac that[of p m])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5247
    using s
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5248
    apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5249
    done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5250
qed
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5251
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5252
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5253
subsection \<open>Helly's theorem\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5254
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5255
lemma helly_induct:
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5256
  fixes f :: "'a::euclidean_space set set"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5257
  assumes "card f = n"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5258
    and "n \<ge> DIM('a) + 1"
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60420
diff changeset
  5259
    and "\<forall>s\<in>f. convex s" "\<forall>t\<subseteq>f. card t = DIM('a) + 1 \<longrightarrow> \<Inter>t \<noteq> {}"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5260
  shows "\<Inter>f \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5261
  using assms
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5262
proof (induct n arbitrary: f)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5263
  case 0
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5264
  then show ?case by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5265
next
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5266
  case (Suc n)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5267
  have "finite f"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5268
    using \<open>card f = Suc n\<close> by (auto intro: card_ge_0_finite)
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5269
  show "\<Inter>f \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5270
    apply (cases "n = DIM('a)")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5271
    apply (rule Suc(5)[rule_format])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5272
    unfolding \<open>card f = Suc n\<close>
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5273
  proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5274
    assume ng: "n \<noteq> DIM('a)"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5275
    then have "\<exists>X. \<forall>s\<in>f. X s \<in> \<Inter>(f - {s})"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5276
      apply (rule_tac bchoice)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5277
      unfolding ex_in_conv
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5278
      apply (rule, rule Suc(1)[rule_format])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5279
      unfolding card_Diff_singleton_if[OF \<open>finite f\<close>] \<open>card f = Suc n\<close>
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5280
      defer
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5281
      defer
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5282
      apply (rule Suc(4)[rule_format])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5283
      defer
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5284
      apply (rule Suc(5)[rule_format])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5285
      using Suc(3) \<open>finite f\<close>
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5286
      apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5287
      done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5288
    then obtain X where X: "\<forall>s\<in>f. X s \<in> \<Inter>(f - {s})" by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5289
    show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5290
    proof (cases "inj_on X f")
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5291
      case False
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5292
      then obtain s t where st: "s\<noteq>t" "s\<in>f" "t\<in>f" "X s = X t"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5293
        unfolding inj_on_def by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5294
      then have *: "\<Inter>f = \<Inter>(f - {s}) \<inter> \<Inter>(f - {t})" by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5295
      show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5296
        unfolding *
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5297
        unfolding ex_in_conv[symmetric]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5298
        apply (rule_tac x="X s" in exI)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5299
        apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5300
        apply (rule X[rule_format])
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5301
        using X st
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5302
        apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5303
        done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5304
    next
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5305
      case True
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5306
      then obtain m p where mp: "m \<inter> p = {}" "m \<union> p = X ` f" "convex hull m \<inter> convex hull p \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5307
        using radon_partition[of "X ` f"] and affine_dependent_biggerset[of "X ` f"]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5308
        unfolding card_image[OF True] and \<open>card f = Suc n\<close>
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5309
        using Suc(3) \<open>finite f\<close> and ng
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5310
        by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5311
      have "m \<subseteq> X ` f" "p \<subseteq> X ` f"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5312
        using mp(2) by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5313
      then obtain g h where gh:"m = X ` g" "p = X ` h" "g \<subseteq> f" "h \<subseteq> f"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5314
        unfolding subset_image_iff by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5315
      then have "f \<union> (g \<union> h) = f" by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5316
      then have f: "f = g \<union> h"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5317
        using inj_on_Un_image_eq_iff[of X f "g \<union> h"] and True
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5318
        unfolding mp(2)[unfolded image_Un[symmetric] gh]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5319
        by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5320
      have *: "g \<inter> h = {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5321
        using mp(1)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5322
        unfolding gh
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5323
        using inj_on_image_Int[OF True gh(3,4)]
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5324
        by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5325
      have "convex hull (X ` h) \<subseteq> \<Inter>g" "convex hull (X ` g) \<subseteq> \<Inter>h"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5326
        apply (rule_tac [!] hull_minimal)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5327
        using Suc gh(3-4)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5328
        unfolding subset_eq
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5329
        apply (rule_tac [2] convex_Inter, rule_tac [4] convex_Inter)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5330
        apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5331
        prefer 3
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5332
        apply rule
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5333
      proof -
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5334
        fix x
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5335
        assume "x \<in> X ` g"
55697
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  5336
        then obtain y where "y \<in> g" "x = X y"
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  5337
          unfolding image_iff ..
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5338
        then show "x \<in> \<Inter>h"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5339
          using X[THEN bspec[where x=y]] using * f by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5340
      next
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5341
        fix x
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5342
        assume "x \<in> X ` h"
55697
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  5343
        then obtain y where "y \<in> h" "x = X y"
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  5344
          unfolding image_iff ..
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5345
        then show "x \<in> \<Inter>g"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5346
          using X[THEN bspec[where x=y]] using * f by auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5347
      qed auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5348
      then show ?thesis
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5349
        unfolding f using mp(3)[unfolded gh] by blast
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5350
    qed
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5351
  qed auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5352
qed
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5353
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5354
lemma helly:
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5355
  fixes f :: "'a::euclidean_space set set"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  5356
  assumes "card f \<ge> DIM('a) + 1" "\<forall>s\<in>f. convex s"
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60420
diff changeset
  5357
    and "\<forall>t\<subseteq>f. card t = DIM('a) + 1 \<longrightarrow> \<Inter>t \<noteq> {}"
53347
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5358
  shows "\<Inter>f \<noteq> {}"
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5359
  apply (rule helly_induct)
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5360
  using assms
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5361
  apply auto
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5362
  done
547610c26257 tuned proofs;
wenzelm
parents: 53339
diff changeset
  5363
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5364
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5365
subsection \<open>Epigraphs of convex functions\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5366
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5367
definition "epigraph s (f :: _ \<Rightarrow> real) = {xy. fst xy \<in> s \<and> f (fst xy) \<le> snd xy}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5368
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5369
lemma mem_epigraph: "(x, y) \<in> epigraph s f \<longleftrightarrow> x \<in> s \<and> f x \<le> y"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5370
  unfolding epigraph_def by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5371
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5372
lemma convex_epigraph: "convex (epigraph s f) \<longleftrightarrow> convex_on s f \<and> convex s"
36338
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  5373
  unfolding convex_def convex_on_def
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  5374
  unfolding Ball_def split_paired_All epigraph_def
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  5375
  unfolding mem_Collect_eq fst_conv snd_conv fst_add snd_add fst_scaleR snd_scaleR Ball_def[symmetric]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5376
  apply safe
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5377
  defer
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5378
  apply (erule_tac x=x in allE)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5379
  apply (erule_tac x="f x" in allE)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5380
  apply safe
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5381
  apply (erule_tac x=xa in allE)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5382
  apply (erule_tac x="f xa" in allE)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5383
  prefer 3
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5384
  apply (rule_tac y="u * f a + v * f aa" in order_trans)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5385
  defer
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5386
  apply (auto intro!:mult_left_mono add_mono)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5387
  done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5388
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5389
lemma convex_epigraphI: "convex_on s f \<Longrightarrow> convex s \<Longrightarrow> convex (epigraph s f)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5390
  unfolding convex_epigraph by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5391
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5392
lemma convex_epigraph_convex: "convex s \<Longrightarrow> convex_on s f \<longleftrightarrow> convex(epigraph s f)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5393
  by (simp add: convex_epigraph)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5394
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5395
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5396
subsubsection \<open>Use this to derive general bound property of convex function\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5397
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5398
lemma convex_on:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5399
  assumes "convex s"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5400
  shows "convex_on s f \<longleftrightarrow>
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5401
    (\<forall>k u x. (\<forall>i\<in>{1..k::nat}. 0 \<le> u i \<and> x i \<in> s) \<and> setsum u {1..k} = 1 \<longrightarrow>
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5402
      f (setsum (\<lambda>i. u i *\<^sub>R x i) {1..k} ) \<le> setsum (\<lambda>i. u i * f(x i)) {1..k})"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5403
  unfolding convex_epigraph_convex[OF assms] convex epigraph_def Ball_def mem_Collect_eq
36338
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  5404
  unfolding fst_setsum snd_setsum fst_scaleR snd_scaleR
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  5405
  apply safe
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  5406
  apply (drule_tac x=k in spec)
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  5407
  apply (drule_tac x=u in spec)
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  5408
  apply (drule_tac x="\<lambda>i. (x i, f (x i))" in spec)
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  5409
  apply simp
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5410
  using assms[unfolded convex]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5411
  apply simp
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5412
  apply (rule_tac y="\<Sum>i = 1..k. u i * f (fst (x i))" in order_trans)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5413
  defer
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5414
  apply (rule setsum_mono)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5415
  apply (erule_tac x=i in allE)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5416
  unfolding real_scaleR_def
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5417
  apply (rule mult_left_mono)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5418
  using assms[unfolded convex]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5419
  apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5420
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5421
36338
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  5422
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5423
subsection \<open>Convexity of general and special intervals\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5424
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5425
lemma is_interval_convex:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5426
  fixes s :: "'a::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5427
  assumes "is_interval s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5428
  shows "convex s"
37732
6432bf0d7191 generalize type of is_interval to class euclidean_space
huffman
parents: 37673
diff changeset
  5429
proof (rule convexI)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5430
  fix x y and u v :: real
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5431
  assume as: "x \<in> s" "y \<in> s" "0 \<le> u" "0 \<le> v" "u + v = 1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5432
  then have *: "u = 1 - v" "1 - v \<ge> 0" and **: "v = 1 - u" "1 - u \<ge> 0"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5433
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5434
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5435
    fix a b
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5436
    assume "\<not> b \<le> u * a + v * b"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5437
    then have "u * a < (1 - v) * b"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5438
      unfolding not_le using as(4) by (auto simp add: field_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5439
    then have "a < b"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5440
      unfolding * using as(4) *(2)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5441
      apply (rule_tac mult_left_less_imp_less[of "1 - v"])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5442
      apply (auto simp add: field_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5443
      done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5444
    then have "a \<le> u * a + v * b"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5445
      unfolding * using as(4)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5446
      by (auto simp add: field_simps intro!:mult_right_mono)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5447
  }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5448
  moreover
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5449
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5450
    fix a b
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5451
    assume "\<not> u * a + v * b \<le> a"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5452
    then have "v * b > (1 - u) * a"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5453
      unfolding not_le using as(4) by (auto simp add: field_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5454
    then have "a < b"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5455
      unfolding * using as(4)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5456
      apply (rule_tac mult_left_less_imp_less)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5457
      apply (auto simp add: field_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5458
      done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5459
    then have "u * a + v * b \<le> b"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5460
      unfolding **
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5461
      using **(2) as(3)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5462
      by (auto simp add: field_simps intro!:mult_right_mono)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5463
  }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5464
  ultimately show "u *\<^sub>R x + v *\<^sub>R y \<in> s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5465
    apply -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5466
    apply (rule assms[unfolded is_interval_def, rule_format, OF as(1,2)])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5467
    using as(3-) DIM_positive[where 'a='a]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5468
    apply (auto simp: inner_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5469
    done
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  5470
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5471
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5472
lemma is_interval_connected:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5473
  fixes s :: "'a::euclidean_space set"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5474
  shows "is_interval s \<Longrightarrow> connected s"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5475
  using is_interval_convex convex_connected by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5476
62618
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  5477
lemma convex_box [simp]: "convex (cbox a b)" "convex (box a (b::'a::euclidean_space))"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5478
  apply (rule_tac[!] is_interval_convex)+
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  5479
  using is_interval_box is_interval_cbox
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5480
  apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5481
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5482
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61762
diff changeset
  5483
subsection \<open>On \<open>real\<close>, \<open>is_interval\<close>, \<open>convex\<close> and \<open>connected\<close> are all equivalent.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5484
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5485
lemma is_interval_1:
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5486
  "is_interval (s::real set) \<longleftrightarrow> (\<forall>a\<in>s. \<forall>b\<in>s. \<forall> x. a \<le> x \<and> x \<le> b \<longrightarrow> x \<in> s)"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5487
  unfolding is_interval_def by auto
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5488
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5489
lemma is_interval_connected_1:
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5490
  fixes s :: "real set"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5491
  shows "is_interval s \<longleftrightarrow> connected s"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5492
  apply rule
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5493
  apply (rule is_interval_connected, assumption)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5494
  unfolding is_interval_1
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5495
  apply rule
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5496
  apply rule
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5497
  apply rule
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5498
  apply rule
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5499
  apply (erule conjE)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5500
  apply (rule ccontr)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5501
proof -
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5502
  fix a b x
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5503
  assume as: "connected s" "a \<in> s" "b \<in> s" "a \<le> x" "x \<le> b" "x \<notin> s"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5504
  then have *: "a < x" "x < b"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5505
    unfolding not_le [symmetric] by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5506
  let ?halfl = "{..<x} "
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5507
  let ?halfr = "{x<..}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5508
  {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5509
    fix y
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5510
    assume "y \<in> s"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5511
    with \<open>x \<notin> s\<close> have "x \<noteq> y" by auto
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5512
    then have "y \<in> ?halfr \<union> ?halfl" by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5513
  }
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5514
  moreover have "a \<in> ?halfl" "b \<in> ?halfr" using * by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5515
  then have "?halfl \<inter> s \<noteq> {}" "?halfr \<inter> s \<noteq> {}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5516
    using as(2-3) by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5517
  ultimately show False
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5518
    apply (rule_tac notE[OF as(1)[unfolded connected_def]])
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5519
    apply (rule_tac x = ?halfl in exI)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5520
    apply (rule_tac x = ?halfr in exI)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5521
    apply rule
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5522
    apply (rule open_lessThan)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5523
    apply rule
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5524
    apply (rule open_greaterThan)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5525
    apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5526
    done
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5527
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5528
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5529
lemma is_interval_convex_1:
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5530
  fixes s :: "real set"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5531
  shows "is_interval s \<longleftrightarrow> convex s"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5532
  by (metis is_interval_convex convex_connected is_interval_connected_1)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5533
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5534
lemma connected_convex_1:
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5535
  fixes s :: "real set"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5536
  shows "connected s \<longleftrightarrow> convex s"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  5537
  by (metis is_interval_convex convex_connected is_interval_connected_1)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5538
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5539
lemma connected_convex_1_gen:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5540
  fixes s :: "'a :: euclidean_space set"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5541
  assumes "DIM('a) = 1"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5542
  shows "connected s \<longleftrightarrow> convex s"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5543
proof -
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5544
  obtain f:: "'a \<Rightarrow> real" where linf: "linear f" and "inj f"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5545
    using subspace_isomorphism [where 'a = 'a and 'b = real]
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5546
    by (metis DIM_real dim_UNIV subspace_UNIV assms)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5547
  then have "f -` (f ` s) = s"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5548
    by (simp add: inj_vimage_image_eq)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5549
  then show ?thesis
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5550
    by (metis connected_convex_1 convex_linear_vimage linf convex_connected connected_linear_image)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5551
qed
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5552
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5553
subsection \<open>Another intermediate value theorem formulation\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5554
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5555
lemma ivt_increasing_component_on_1:
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  5556
  fixes f :: "real \<Rightarrow> 'a::euclidean_space"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5557
  assumes "a \<le> b"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5558
    and "continuous_on {a..b} f"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5559
    and "(f a)\<bullet>k \<le> y" "y \<le> (f b)\<bullet>k"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5560
  shows "\<exists>x\<in>{a..b}. (f x)\<bullet>k = y"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5561
proof -
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5562
  have "f a \<in> f ` cbox a b" "f b \<in> f ` cbox a b"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5563
    apply (rule_tac[!] imageI)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5564
    using assms(1)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5565
    apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5566
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5567
  then show ?thesis
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5568
    using connected_ivt_component[of "f ` cbox a b" "f a" "f b" k y]
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5569
    by (simp add: Topology_Euclidean_Space.connected_continuous_image assms)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5570
qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5571
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5572
lemma ivt_increasing_component_1:
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5573
  fixes f :: "real \<Rightarrow> 'a::euclidean_space"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5574
  shows "a \<le> b \<Longrightarrow> \<forall>x\<in>{a..b}. continuous (at x) f \<Longrightarrow>
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5575
    f a\<bullet>k \<le> y \<Longrightarrow> y \<le> f b\<bullet>k \<Longrightarrow> \<exists>x\<in>{a..b}. (f x)\<bullet>k = y"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5576
  by (rule ivt_increasing_component_on_1) (auto simp add: continuous_at_imp_continuous_on)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5577
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5578
lemma ivt_decreasing_component_on_1:
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5579
  fixes f :: "real \<Rightarrow> 'a::euclidean_space"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5580
  assumes "a \<le> b"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5581
    and "continuous_on {a..b} f"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5582
    and "(f b)\<bullet>k \<le> y"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5583
    and "y \<le> (f a)\<bullet>k"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5584
  shows "\<exists>x\<in>{a..b}. (f x)\<bullet>k = y"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5585
  apply (subst neg_equal_iff_equal[symmetric])
44531
1d477a2b1572 replace some continuous_on lemmas with more general versions
huffman
parents: 44525
diff changeset
  5586
  using ivt_increasing_component_on_1[of a b "\<lambda>x. - f x" k "- y"]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5587
  using assms using continuous_on_minus
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5588
  apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5589
  done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5590
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5591
lemma ivt_decreasing_component_1:
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5592
  fixes f :: "real \<Rightarrow> 'a::euclidean_space"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5593
  shows "a \<le> b \<Longrightarrow> \<forall>x\<in>{a..b}. continuous (at x) f \<Longrightarrow>
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5594
    f b\<bullet>k \<le> y \<Longrightarrow> y \<le> f a\<bullet>k \<Longrightarrow> \<exists>x\<in>{a..b}. (f x)\<bullet>k = y"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5595
  by (rule ivt_decreasing_component_on_1) (auto simp: continuous_at_imp_continuous_on)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5596
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5597
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5598
subsection \<open>A bound within a convex hull, and so an interval\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5599
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5600
lemma convex_on_convex_hull_bound:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5601
  assumes "convex_on (convex hull s) f"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5602
    and "\<forall>x\<in>s. f x \<le> b"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5603
  shows "\<forall>x\<in> convex hull s. f x \<le> b"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5604
proof
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5605
  fix x
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5606
  assume "x \<in> convex hull s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5607
  then obtain k u v where
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5608
    obt: "\<forall>i\<in>{1..k::nat}. 0 \<le> u i \<and> v i \<in> s" "setsum u {1..k} = 1" "(\<Sum>i = 1..k. u i *\<^sub>R v i) = x"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5609
    unfolding convex_hull_indexed mem_Collect_eq by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5610
  have "(\<Sum>i = 1..k. u i * f (v i)) \<le> b"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5611
    using setsum_mono[of "{1..k}" "\<lambda>i. u i * f (v i)" "\<lambda>i. u i * b"]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5612
    unfolding setsum_left_distrib[symmetric] obt(2) mult_1
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5613
    apply (drule_tac meta_mp)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5614
    apply (rule mult_left_mono)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5615
    using assms(2) obt(1)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5616
    apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5617
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5618
  then show "f x \<le> b"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5619
    using assms(1)[unfolded convex_on[OF convex_convex_hull], rule_format, of k u v]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5620
    unfolding obt(2-3)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5621
    using obt(1) and hull_subset[unfolded subset_eq, rule_format, of _ s]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5622
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5623
qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5624
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5625
lemma inner_setsum_Basis[simp]: "i \<in> Basis \<Longrightarrow> (\<Sum>Basis) \<bullet> i = 1"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  5626
  by (simp add: inner_setsum_left setsum.If_cases inner_Basis)
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5627
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5628
lemma convex_set_plus:
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5629
  assumes "convex s" and "convex t" shows "convex (s + t)"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5630
proof -
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5631
  have "convex {x + y |x y. x \<in> s \<and> y \<in> t}"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5632
    using assms by (rule convex_sums)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5633
  moreover have "{x + y |x y. x \<in> s \<and> y \<in> t} = s + t"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5634
    unfolding set_plus_def by auto
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5635
  finally show "convex (s + t)" .
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5636
qed
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5637
55929
91f245c23bc5 remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents: 55928
diff changeset
  5638
lemma convex_set_setsum:
91f245c23bc5 remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents: 55928
diff changeset
  5639
  assumes "\<And>i. i \<in> A \<Longrightarrow> convex (B i)"
91f245c23bc5 remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents: 55928
diff changeset
  5640
  shows "convex (\<Sum>i\<in>A. B i)"
91f245c23bc5 remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents: 55928
diff changeset
  5641
proof (cases "finite A")
91f245c23bc5 remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents: 55928
diff changeset
  5642
  case True then show ?thesis using assms
91f245c23bc5 remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents: 55928
diff changeset
  5643
    by induct (auto simp: convex_set_plus)
91f245c23bc5 remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents: 55928
diff changeset
  5644
qed auto
91f245c23bc5 remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents: 55928
diff changeset
  5645
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5646
lemma finite_set_setsum:
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5647
  assumes "finite A" and "\<forall>i\<in>A. finite (B i)" shows "finite (\<Sum>i\<in>A. B i)"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5648
  using assms by (induct set: finite, simp, simp add: finite_set_plus)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5649
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5650
lemma set_setsum_eq:
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5651
  "finite A \<Longrightarrow> (\<Sum>i\<in>A. B i) = {\<Sum>i\<in>A. f i |f. \<forall>i\<in>A. f i \<in> B i}"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5652
  apply (induct set: finite)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5653
  apply simp
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5654
  apply simp
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5655
  apply (safe elim!: set_plus_elim)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5656
  apply (rule_tac x="fun_upd f x a" in exI)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5657
  apply simp
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5658
  apply (rule_tac f="\<lambda>x. a + x" in arg_cong)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  5659
  apply (rule setsum.cong [OF refl])
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5660
  apply clarsimp
57865
dcfb33c26f50 tuned proofs -- fewer warnings;
wenzelm
parents: 57512
diff changeset
  5661
  apply fast
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5662
  done
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5663
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5664
lemma box_eq_set_setsum_Basis:
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5665
  shows "{x. \<forall>i\<in>Basis. x\<bullet>i \<in> B i} = (\<Sum>i\<in>Basis. image (\<lambda>x. x *\<^sub>R i) (B i))"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5666
  apply (subst set_setsum_eq [OF finite_Basis])
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5667
  apply safe
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5668
  apply (fast intro: euclidean_representation [symmetric])
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5669
  apply (subst inner_setsum_left)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5670
  apply (subgoal_tac "(\<Sum>x\<in>Basis. f x \<bullet> i) = f i \<bullet> i")
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5671
  apply (drule (1) bspec)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5672
  apply clarsimp
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  5673
  apply (frule setsum.remove [OF finite_Basis])
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5674
  apply (erule trans)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5675
  apply simp
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  5676
  apply (rule setsum.neutral)
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5677
  apply clarsimp
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5678
  apply (frule_tac x=i in bspec, assumption)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5679
  apply (drule_tac x=x in bspec, assumption)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5680
  apply clarsimp
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5681
  apply (cut_tac u=x and v=i in inner_Basis, assumption+)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5682
  apply (rule ccontr)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5683
  apply simp
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5684
  done
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5685
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5686
lemma convex_hull_set_setsum:
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5687
  "convex hull (\<Sum>i\<in>A. B i) = (\<Sum>i\<in>A. convex hull (B i))"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5688
proof (cases "finite A")
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5689
  assume "finite A" then show ?thesis
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5690
    by (induct set: finite, simp, simp add: convex_hull_set_plus)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5691
qed simp
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5692
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5693
lemma convex_hull_eq_real_cbox:
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5694
  fixes x y :: real assumes "x \<le> y"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5695
  shows "convex hull {x, y} = cbox x y"
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5696
proof (rule hull_unique)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5697
  show "{x, y} \<subseteq> cbox x y" using \<open>x \<le> y\<close> by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5698
  show "convex (cbox x y)"
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5699
    by (rule convex_box)
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5700
next
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5701
  fix s assume "{x, y} \<subseteq> s" and "convex s"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5702
  then show "cbox x y \<subseteq> s"
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5703
    unfolding is_interval_convex_1 [symmetric] is_interval_def Basis_real_def
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5704
    by - (clarify, simp (no_asm_use), fast)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5705
qed
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  5706
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5707
lemma unit_interval_convex_hull:
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  5708
  "cbox (0::'a::euclidean_space) One = convex hull {x. \<forall>i\<in>Basis. (x\<bullet>i = 0) \<or> (x\<bullet>i = 1)}"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  5709
  (is "?int = convex hull ?points")
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  5710
proof -
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  5711
  have One[simp]: "\<And>i. i \<in> Basis \<Longrightarrow> One \<bullet> i = 1"
62091
wenzelm
parents: 61952
diff changeset
  5712
    by (simp add: inner_setsum_left setsum.If_cases inner_Basis)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5713
  have "?int = {x. \<forall>i\<in>Basis. x \<bullet> i \<in> cbox 0 1}"
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5714
    by (auto simp: cbox_def)
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5715
  also have "\<dots> = (\<Sum>i\<in>Basis. (\<lambda>x. x *\<^sub>R i) ` cbox 0 1)"
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5716
    by (simp only: box_eq_set_setsum_Basis)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5717
  also have "\<dots> = (\<Sum>i\<in>Basis. (\<lambda>x. x *\<^sub>R i) ` (convex hull {0, 1}))"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5718
    by (simp only: convex_hull_eq_real_cbox zero_le_one)
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5719
  also have "\<dots> = (\<Sum>i\<in>Basis. convex hull ((\<lambda>x. x *\<^sub>R i) ` {0, 1}))"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5720
    by (simp only: convex_hull_linear_image linear_scaleR_left)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5721
  also have "\<dots> = convex hull (\<Sum>i\<in>Basis. (\<lambda>x. x *\<^sub>R i) ` {0, 1})"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5722
    by (simp only: convex_hull_set_setsum)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5723
  also have "\<dots> = convex hull {x. \<forall>i\<in>Basis. x\<bullet>i \<in> {0, 1}}"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5724
    by (simp only: box_eq_set_setsum_Basis)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5725
  also have "convex hull {x. \<forall>i\<in>Basis. x\<bullet>i \<in> {0, 1}} = convex hull ?points"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5726
    by simp
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  5727
  finally show ?thesis .
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  5728
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5729
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5730
text \<open>And this is a finite set of vertices.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5731
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  5732
lemma unit_cube_convex_hull:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5733
  obtains s :: "'a::euclidean_space set"
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5734
    where "finite s" and "cbox 0 (\<Sum>Basis) = convex hull s"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5735
  apply (rule that[of "{x::'a. \<forall>i\<in>Basis. x\<bullet>i=0 \<or> x\<bullet>i=1}"])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5736
  apply (rule finite_subset[of _ "(\<lambda>s. (\<Sum>i\<in>Basis. (if i\<in>s then 1 else 0) *\<^sub>R i)::'a) ` Pow Basis"])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5737
  prefer 3
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5738
  apply (rule unit_interval_convex_hull)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5739
  apply rule
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5740
  unfolding mem_Collect_eq
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5741
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5742
  fix x :: 'a
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5743
  assume as: "\<forall>i\<in>Basis. x \<bullet> i = 0 \<or> x \<bullet> i = 1"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  5744
  show "x \<in> (\<lambda>s. \<Sum>i\<in>Basis. (if i\<in>s then 1 else 0) *\<^sub>R i) ` Pow Basis"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5745
    apply (rule image_eqI[where x="{i. i\<in>Basis \<and> x\<bullet>i = 1}"])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5746
    using as
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5747
    apply (subst euclidean_eq_iff)
57865
dcfb33c26f50 tuned proofs -- fewer warnings;
wenzelm
parents: 57512
diff changeset
  5748
    apply auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5749
    done
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  5750
qed auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5751
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5752
text \<open>Hence any cube (could do any nonempty interval).\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5753
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5754
lemma cube_convex_hull:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5755
  assumes "d > 0"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5756
  obtains s :: "'a::euclidean_space set" where
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5757
    "finite s" and "cbox (x - (\<Sum>i\<in>Basis. d*\<^sub>Ri)) (x + (\<Sum>i\<in>Basis. d*\<^sub>Ri)) = convex hull s"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5758
proof -
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  5759
  let ?d = "(\<Sum>i\<in>Basis. d*\<^sub>Ri)::'a"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5760
  have *: "cbox (x - ?d) (x + ?d) = (\<lambda>y. x - ?d + (2 * d) *\<^sub>R y) ` cbox 0 (\<Sum>Basis)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5761
    apply (rule set_eqI, rule)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5762
    unfolding image_iff
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5763
    defer
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5764
    apply (erule bexE)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5765
  proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5766
    fix y
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5767
    assume as: "y\<in>cbox (x - ?d) (x + ?d)"
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5768
    then have "inverse (2 * d) *\<^sub>R (y - (x - ?d)) \<in> cbox 0 (\<Sum>Basis)"
58776
95e58e04e534 use NO_MATCH-simproc for distribution rules in field_simps, otherwise field_simps on '(a / (c + d)) * (e + f)' can be non-terminating
hoelzl
parents: 57865
diff changeset
  5769
      using assms by (simp add: mem_box field_simps inner_simps)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5770
    with \<open>0 < d\<close> show "\<exists>z\<in>cbox 0 (\<Sum>Basis). y = x - ?d + (2 * d) *\<^sub>R z"
58776
95e58e04e534 use NO_MATCH-simproc for distribution rules in field_simps, otherwise field_simps on '(a / (c + d)) * (e + f)' can be non-terminating
hoelzl
parents: 57865
diff changeset
  5771
      by (intro bexI[of _ "inverse (2 * d) *\<^sub>R (y - (x - ?d))"]) auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5772
  next
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5773
    fix y z
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5774
    assume as: "z\<in>cbox 0 (\<Sum>Basis)" "y = x - ?d + (2*d) *\<^sub>R z"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  5775
    have "\<And>i. i\<in>Basis \<Longrightarrow> 0 \<le> d * (z \<bullet> i) \<and> d * (z \<bullet> i) \<le> d"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5776
      using assms as(1)[unfolded mem_box]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5777
      apply (erule_tac x=i in ballE)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5778
      apply rule
56536
aefb4a8da31f made mult_nonneg_nonneg a simp rule
nipkow
parents: 56480
diff changeset
  5779
      prefer 2
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5780
      apply (rule mult_right_le_one_le)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5781
      using assms
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5782
      apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5783
      done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5784
    then show "y \<in> cbox (x - ?d) (x + ?d)"
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5785
      unfolding as(2) mem_box
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5786
      apply -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5787
      apply rule
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5788
      using as(1)[unfolded mem_box]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5789
      apply (erule_tac x=i in ballE)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5790
      using assms
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5791
      apply (auto simp: inner_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5792
      done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5793
  qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  5794
  obtain s where "finite s" "cbox 0 (\<Sum>Basis::'a) = convex hull s"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5795
    using unit_cube_convex_hull by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5796
  then show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5797
    apply (rule_tac that[of "(\<lambda>y. x - ?d + (2 * d) *\<^sub>R y)` s"])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5798
    unfolding * and convex_hull_affinity
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5799
    apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5800
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5801
qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5802
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5803
subsubsection\<open>Representation of any interval as a finite convex hull\<close>
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5804
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5805
lemma image_stretch_interval:
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5806
  "(\<lambda>x. \<Sum>k\<in>Basis. (m k * (x\<bullet>k)) *\<^sub>R k) ` cbox a (b::'a::euclidean_space) =
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5807
  (if (cbox a b) = {} then {} else
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5808
    cbox (\<Sum>k\<in>Basis. (min (m k * (a\<bullet>k)) (m k * (b\<bullet>k))) *\<^sub>R k::'a)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5809
     (\<Sum>k\<in>Basis. (max (m k * (a\<bullet>k)) (m k * (b\<bullet>k))) *\<^sub>R k))"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5810
proof cases
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5811
  assume *: "cbox a b \<noteq> {}"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5812
  show ?thesis
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5813
    unfolding box_ne_empty if_not_P[OF *]
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5814
    apply (simp add: cbox_def image_Collect set_eq_iff euclidean_eq_iff[where 'a='a] ball_conj_distrib[symmetric])
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5815
    apply (subst choice_Basis_iff[symmetric])
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5816
  proof (intro allI ball_cong refl)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5817
    fix x i :: 'a assume "i \<in> Basis"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5818
    with * have a_le_b: "a \<bullet> i \<le> b \<bullet> i"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5819
      unfolding box_ne_empty by auto
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5820
    show "(\<exists>xa. x \<bullet> i = m i * xa \<and> a \<bullet> i \<le> xa \<and> xa \<le> b \<bullet> i) \<longleftrightarrow>
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5821
        min (m i * (a \<bullet> i)) (m i * (b \<bullet> i)) \<le> x \<bullet> i \<and> x \<bullet> i \<le> max (m i * (a \<bullet> i)) (m i * (b \<bullet> i))"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5822
    proof (cases "m i = 0")
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5823
      case True
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5824
      with a_le_b show ?thesis by auto
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5825
    next
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5826
      case False
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5827
      then have *: "\<And>a b. a = m i * b \<longleftrightarrow> b = a / m i"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5828
        by (auto simp add: field_simps)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5829
      from False have
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5830
          "min (m i * (a \<bullet> i)) (m i * (b \<bullet> i)) = (if 0 < m i then m i * (a \<bullet> i) else m i * (b \<bullet> i))"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5831
          "max (m i * (a \<bullet> i)) (m i * (b \<bullet> i)) = (if 0 < m i then m i * (b \<bullet> i) else m i * (a \<bullet> i))"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5832
        using a_le_b by (auto simp: min_def max_def mult_le_cancel_left)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5833
      with False show ?thesis using a_le_b
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5834
        unfolding * by (auto simp add: le_divide_eq divide_le_eq ac_simps)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5835
    qed
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5836
  qed
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5837
qed simp
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5838
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5839
lemma interval_image_stretch_interval:
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5840
  "\<exists>u v. (\<lambda>x. \<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k) ` cbox a (b::'a::euclidean_space) = cbox u (v::'a::euclidean_space)"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5841
  unfolding image_stretch_interval by auto
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5842
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5843
lemma cbox_translation: "cbox (c + a) (c + b) = image (\<lambda>x. c + x) (cbox a b)"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5844
  using image_affinity_cbox [of 1 c a b]
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5845
  using box_ne_empty [of "a+c" "b+c"]  box_ne_empty [of a b]
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5846
  by (auto simp add: inner_left_distrib add.commute)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5847
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5848
lemma cbox_image_unit_interval:
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5849
  fixes a :: "'a::euclidean_space"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5850
  assumes "cbox a b \<noteq> {}"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5851
    shows "cbox a b =
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5852
           op + a ` (\<lambda>x. \<Sum>k\<in>Basis. ((b \<bullet> k - a \<bullet> k) * (x \<bullet> k)) *\<^sub>R k) ` cbox 0 One"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5853
using assms
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5854
apply (simp add: box_ne_empty image_stretch_interval cbox_translation [symmetric])
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5855
apply (simp add: min_def max_def algebra_simps setsum_subtractf euclidean_representation)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5856
done
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5857
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5858
lemma closed_interval_as_convex_hull:
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5859
  fixes a :: "'a::euclidean_space"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5860
  obtains s where "finite s" "cbox a b = convex hull s"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5861
proof (cases "cbox a b = {}")
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5862
  case True with convex_hull_empty that show ?thesis
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5863
    by blast
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5864
next
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5865
  case False
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5866
  obtain s::"'a set" where "finite s" and eq: "cbox 0 One = convex hull s"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5867
    by (blast intro: unit_cube_convex_hull)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5868
  have lin: "linear (\<lambda>x. \<Sum>k\<in>Basis. ((b \<bullet> k - a \<bullet> k) * (x \<bullet> k)) *\<^sub>R k)"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5869
    by (rule linear_compose_setsum) (auto simp: algebra_simps linearI)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5870
  have "finite (op + a ` (\<lambda>x. \<Sum>k\<in>Basis. ((b \<bullet> k - a \<bullet> k) * (x \<bullet> k)) *\<^sub>R k) ` s)"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5871
    by (rule finite_imageI \<open>finite s\<close>)+
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5872
  then show ?thesis
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5873
    apply (rule that)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5874
    apply (simp add: convex_hull_translation convex_hull_linear_image [OF lin, symmetric])
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5875
    apply (simp add: eq [symmetric] cbox_image_unit_interval [OF False])
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5876
    done
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5877
qed
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  5878
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5879
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5880
subsection \<open>Bounded convex function on open set is continuous\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5881
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5882
lemma convex_on_bounded_continuous:
36338
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  5883
  fixes s :: "('a::real_normed_vector) set"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5884
  assumes "open s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5885
    and "convex_on s f"
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61880
diff changeset
  5886
    and "\<forall>x\<in>s. \<bar>f x\<bar> \<le> b"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5887
  shows "continuous_on s f"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5888
  apply (rule continuous_at_imp_continuous_on)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5889
  unfolding continuous_at_real_range
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5890
proof (rule,rule,rule)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5891
  fix x and e :: real
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5892
  assume "x \<in> s" "e > 0"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  5893
  define B where "B = \<bar>b\<bar> + 1"
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61880
diff changeset
  5894
  have B: "0 < B" "\<And>x. x\<in>s \<Longrightarrow> \<bar>f x\<bar> \<le> B"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5895
    unfolding B_def
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5896
    defer
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5897
    apply (drule assms(3)[rule_format])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5898
    apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5899
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5900
  obtain k where "k > 0" and k: "cball x k \<subseteq> s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5901
    using assms(1)[unfolded open_contains_cball, THEN bspec[where x=x]]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5902
    using \<open>x\<in>s\<close> by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5903
  show "\<exists>d>0. \<forall>x'. norm (x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5904
    apply (rule_tac x="min (k / 2) (e / (2 * B) * k)" in exI)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5905
    apply rule
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5906
    defer
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5907
  proof (rule, rule)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5908
    fix y
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5909
    assume as: "norm (y - x) < min (k / 2) (e / (2 * B) * k)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5910
    show "\<bar>f y - f x\<bar> < e"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5911
    proof (cases "y = x")
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5912
      case False
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  5913
      define t where "t = k / norm (y - x)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5914
      have "2 < t" "0<t"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5915
        unfolding t_def using as False and \<open>k>0\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5916
        by (auto simp add:field_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5917
      have "y \<in> s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5918
        apply (rule k[unfolded subset_eq,rule_format])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5919
        unfolding mem_cball dist_norm
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5920
        apply (rule order_trans[of _ "2 * norm (x - y)"])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5921
        using as
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5922
        by (auto simp add: field_simps norm_minus_commute)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5923
      {
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  5924
        define w where "w = x + t *\<^sub>R (y - x)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5925
        have "w \<in> s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5926
          unfolding w_def
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5927
          apply (rule k[unfolded subset_eq,rule_format])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5928
          unfolding mem_cball dist_norm
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5929
          unfolding t_def
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5930
          using \<open>k>0\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5931
          apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5932
          done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5933
        have "(1 / t) *\<^sub>R x + - x + ((t - 1) / t) *\<^sub>R x = (1 / t - 1 + (t - 1) / t) *\<^sub>R x"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5934
          by (auto simp add: algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5935
        also have "\<dots> = 0"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5936
          using \<open>t > 0\<close> by (auto simp add:field_simps)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5937
        finally have w: "(1 / t) *\<^sub>R w + ((t - 1) / t) *\<^sub>R x = y"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5938
          unfolding w_def using False and \<open>t > 0\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5939
          by (auto simp add: algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5940
        have  "2 * B < e * t"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5941
          unfolding t_def using \<open>0 < e\<close> \<open>0 < k\<close> \<open>B > 0\<close> and as and False
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5942
          by (auto simp add:field_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5943
        then have "(f w - f x) / t < e"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5944
          using B(2)[OF \<open>w\<in>s\<close>] and B(2)[OF \<open>x\<in>s\<close>]
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5945
          using \<open>t > 0\<close> by (auto simp add:field_simps)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5946
        then have th1: "f y - f x < e"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5947
          apply -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5948
          apply (rule le_less_trans)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5949
          defer
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5950
          apply assumption
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5951
          using assms(2)[unfolded convex_on_def,rule_format,of w x "1/t" "(t - 1)/t", unfolded w]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5952
          using \<open>0 < t\<close> \<open>2 < t\<close> and \<open>x \<in> s\<close> \<open>w \<in> s\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5953
          by (auto simp add:field_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5954
      }
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  5955
      moreover
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5956
      {
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  5957
        define w where "w = x - t *\<^sub>R (y - x)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5958
        have "w \<in> s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5959
          unfolding w_def
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5960
          apply (rule k[unfolded subset_eq,rule_format])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5961
          unfolding mem_cball dist_norm
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5962
          unfolding t_def
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5963
          using \<open>k > 0\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5964
          apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5965
          done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5966
        have "(1 / (1 + t)) *\<^sub>R x + (t / (1 + t)) *\<^sub>R x = (1 / (1 + t) + t / (1 + t)) *\<^sub>R x"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5967
          by (auto simp add: algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5968
        also have "\<dots> = x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5969
          using \<open>t > 0\<close> by (auto simp add:field_simps)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5970
        finally have w: "(1 / (1+t)) *\<^sub>R w + (t / (1 + t)) *\<^sub>R y = x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5971
          unfolding w_def using False and \<open>t > 0\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5972
          by (auto simp add: algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5973
        have "2 * B < e * t"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5974
          unfolding t_def
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5975
          using \<open>0 < e\<close> \<open>0 < k\<close> \<open>B > 0\<close> and as and False
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5976
          by (auto simp add:field_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5977
        then have *: "(f w - f y) / t < e"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5978
          using B(2)[OF \<open>w\<in>s\<close>] and B(2)[OF \<open>y\<in>s\<close>]
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5979
          using \<open>t > 0\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5980
          by (auto simp add:field_simps)
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  5981
        have "f x \<le> 1 / (1 + t) * f w + (t / (1 + t)) * f y"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5982
          using assms(2)[unfolded convex_on_def,rule_format,of w y "1/(1+t)" "t / (1+t)",unfolded w]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5983
          using \<open>0 < t\<close> \<open>2 < t\<close> and \<open>y \<in> s\<close> \<open>w \<in> s\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5984
          by (auto simp add:field_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5985
        also have "\<dots> = (f w + t * f y) / (1 + t)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5986
          using \<open>t > 0\<close> by (auto simp add: divide_simps)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5987
        also have "\<dots> < e + f y"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5988
          using \<open>t > 0\<close> * \<open>e > 0\<close> by (auto simp add: field_simps)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5989
        finally have "f x - f y < e" by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  5990
      }
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  5991
      ultimately show ?thesis by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5992
    qed (insert \<open>0<e\<close>, auto)
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5993
  qed (insert \<open>0<e\<close> \<open>0<k\<close> \<open>0<B\<close>, auto simp: field_simps)
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5994
qed
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5995
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5996
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  5997
subsection \<open>Upper bound on a ball implies upper and lower bounds\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5998
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5999
lemma convex_bounds_lemma:
36338
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  6000
  fixes x :: "'a::real_normed_vector"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6001
  assumes "convex_on (cball x e) f"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6002
    and "\<forall>y \<in> cball x e. f y \<le> b"
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61880
diff changeset
  6003
  shows "\<forall>y \<in> cball x e. \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6004
  apply rule
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6005
proof (cases "0 \<le> e")
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6006
  case True
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6007
  fix y
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6008
  assume y: "y \<in> cball x e"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  6009
  define z where "z = 2 *\<^sub>R x - y"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6010
  have *: "x - (2 *\<^sub>R x - y) = y - x"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6011
    by (simp add: scaleR_2)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6012
  have z: "z \<in> cball x e"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6013
    using y unfolding z_def mem_cball dist_norm * by (auto simp add: norm_minus_commute)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6014
  have "(1 / 2) *\<^sub>R y + (1 / 2) *\<^sub>R z = x"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6015
    unfolding z_def by (auto simp add: algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6016
  then show "\<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6017
    using assms(1)[unfolded convex_on_def,rule_format, OF y z, of "1/2" "1/2"]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6018
    using assms(2)[rule_format,OF y] assms(2)[rule_format,OF z]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6019
    by (auto simp add:field_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6020
next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6021
  case False
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6022
  fix y
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6023
  assume "y \<in> cball x e"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6024
  then have "dist x y < 0"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6025
    using False unfolding mem_cball not_le by (auto simp del: dist_not_less_zero)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6026
  then show "\<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6027
    using zero_le_dist[of x y] by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6028
qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6029
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6030
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  6031
subsubsection \<open>Hence a convex function on an open set is continuous\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6032
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  6033
lemma real_of_nat_ge_one_iff: "1 \<le> real (n::nat) \<longleftrightarrow> 1 \<le> n"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  6034
  by auto
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  6035
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6036
lemma convex_on_continuous:
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6037
  assumes "open (s::('a::euclidean_space) set)" "convex_on s f"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6038
  shows "continuous_on s f"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6039
  unfolding continuous_on_eq_continuous_at[OF assms(1)]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6040
proof
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  6041
  note dimge1 = DIM_positive[where 'a='a]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6042
  fix x
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6043
  assume "x \<in> s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6044
  then obtain e where e: "cball x e \<subseteq> s" "e > 0"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6045
    using assms(1) unfolding open_contains_cball by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  6046
  define d where "d = e / real DIM('a)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6047
  have "0 < d"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  6048
    unfolding d_def using \<open>e > 0\<close> dimge1 by auto
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  6049
  let ?d = "(\<Sum>i\<in>Basis. d *\<^sub>R i)::'a"
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6050
  obtain c
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6051
    where c: "finite c"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6052
    and c1: "convex hull c \<subseteq> cball x e"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6053
    and c2: "cball x d \<subseteq> convex hull c"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6054
  proof
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  6055
    define c where "c = (\<Sum>i\<in>Basis. (\<lambda>a. a *\<^sub>R i) ` {x\<bullet>i - d, x\<bullet>i + d})"
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6056
    show "finite c"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6057
      unfolding c_def by (simp add: finite_set_setsum)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  6058
    have 1: "convex hull c = {a. \<forall>i\<in>Basis. a \<bullet> i \<in> cbox (x \<bullet> i - d) (x \<bullet> i + d)}"
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6059
      unfolding box_eq_set_setsum_Basis
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6060
      unfolding c_def convex_hull_set_setsum
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6061
      apply (subst convex_hull_linear_image [symmetric])
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6062
      apply (simp add: linear_iff scaleR_add_left)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  6063
      apply (rule setsum.cong [OF refl])
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6064
      apply (rule image_cong [OF _ refl])
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  6065
      apply (rule convex_hull_eq_real_cbox)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  6066
      apply (cut_tac \<open>0 < d\<close>, simp)
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6067
      done
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6068
    then have 2: "convex hull c = {a. \<forall>i\<in>Basis. a \<bullet> i \<in> cball (x \<bullet> i) d}"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6069
      by (simp add: dist_norm abs_le_iff algebra_simps)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6070
    show "cball x d \<subseteq> convex hull c"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6071
      unfolding 2
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6072
      apply clarsimp
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6073
      apply (simp only: dist_norm)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6074
      apply (subst inner_diff_left [symmetric])
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6075
      apply simp
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6076
      apply (erule (1) order_trans [OF Basis_le_norm])
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6077
      done
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6078
    have e': "e = (\<Sum>(i::'a)\<in>Basis. d)"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  6079
      by (simp add: d_def DIM_positive)
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6080
    show "convex hull c \<subseteq> cball x e"
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6081
      unfolding 2
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6082
      apply clarsimp
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6083
      apply (subst euclidean_dist_l2)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6084
      apply (rule order_trans [OF setL2_le_setsum])
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6085
      apply (rule zero_le_dist)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6086
      unfolding e'
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6087
      apply (rule setsum_mono)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6088
      apply simp
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6089
      done
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6090
  qed
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  6091
  define k where "k = Max (f ` c)"
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6092
  have "convex_on (convex hull c) f"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  6093
    apply(rule convex_on_subset[OF assms(2)])
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  6094
    apply(rule subset_trans[OF _ e(1)])
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6095
    apply(rule c1)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6096
    done
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6097
  then have k: "\<forall>y\<in>convex hull c. f y \<le> k"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6098
    apply (rule_tac convex_on_convex_hull_bound)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6099
    apply assumption
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6100
    unfolding k_def
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6101
    apply (rule, rule Max_ge)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6102
    using c(1)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6103
    apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6104
    done
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  6105
  have "d \<le> e"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  6106
    unfolding d_def
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6107
    apply (rule mult_imp_div_pos_le)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  6108
    using \<open>e > 0\<close>
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  6109
    unfolding mult_le_cancel_left1
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  6110
    apply (auto simp: real_of_nat_ge_one_iff Suc_le_eq DIM_positive)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  6111
    done
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6112
  then have dsube: "cball x d \<subseteq> cball x e"
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6113
    by (rule subset_cball)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6114
  have conv: "convex_on (cball x d) f"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6115
    apply (rule convex_on_subset)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6116
    apply (rule convex_on_subset[OF assms(2)])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6117
    apply (rule e(1))
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6118
    apply (rule dsube)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6119
    done
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61880
diff changeset
  6120
  then have "\<forall>y\<in>cball x d. \<bar>f y\<bar> \<le> k + 2 * \<bar>f x\<bar>"
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6121
    apply (rule convex_bounds_lemma)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6122
    apply (rule ballI)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6123
    apply (rule k [rule_format])
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6124
    apply (erule rev_subsetD)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6125
    apply (rule c2)
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  6126
    done
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6127
  then have "continuous_on (ball x d) f"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6128
    apply (rule_tac convex_on_bounded_continuous)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6129
    apply (rule open_ball, rule convex_on_subset[OF conv])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6130
    apply (rule ball_subset_cball)
33270
paulson
parents: 33175
diff changeset
  6131
    apply force
paulson
parents: 33175
diff changeset
  6132
    done
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6133
  then show "continuous (at x) f"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6134
    unfolding continuous_on_eq_continuous_at[OF open_ball]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  6135
    using \<open>d > 0\<close> by auto
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  6136
qed
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  6137
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  6138
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  6139
subsection \<open>Line segments, Starlike Sets, etc.\<close>
33270
paulson
parents: 33175
diff changeset
  6140
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6141
definition midpoint :: "'a::real_vector \<Rightarrow> 'a \<Rightarrow> 'a"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6142
  where "midpoint a b = (inverse (2::real)) *\<^sub>R (a + b)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6143
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6144
definition closed_segment :: "'a::real_vector \<Rightarrow> 'a \<Rightarrow> 'a set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6145
  where "closed_segment a b = {(1 - u) *\<^sub>R a + u *\<^sub>R b | u::real. 0 \<le> u \<and> u \<le> 1}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6146
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6147
definition open_segment :: "'a::real_vector \<Rightarrow> 'a \<Rightarrow> 'a set" where
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6148
  "open_segment a b \<equiv> closed_segment a b - {a,b}"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6149
62626
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  6150
lemmas segment = open_segment_def closed_segment_def
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  6151
62948
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
  6152
lemma in_segment:
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
  6153
    "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)"
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
  6154
    "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)"
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
  6155
  using less_eq_real_def by (auto simp: segment algebra_simps)
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
  6156
63077
844725394a37 two new lemmas about segments
paulson <lp15@cam.ac.uk>
parents: 63075
diff changeset
  6157
lemma closed_segment_linear_image:
844725394a37 two new lemmas about segments
paulson <lp15@cam.ac.uk>
parents: 63075
diff changeset
  6158
    "linear f \<Longrightarrow> closed_segment (f a) (f b) = f ` (closed_segment a b)"
844725394a37 two new lemmas about segments
paulson <lp15@cam.ac.uk>
parents: 63075
diff changeset
  6159
  by (force simp add: in_segment linear_add_cmul)
844725394a37 two new lemmas about segments
paulson <lp15@cam.ac.uk>
parents: 63075
diff changeset
  6160
844725394a37 two new lemmas about segments
paulson <lp15@cam.ac.uk>
parents: 63075
diff changeset
  6161
lemma open_segment_linear_image:
844725394a37 two new lemmas about segments
paulson <lp15@cam.ac.uk>
parents: 63075
diff changeset
  6162
    "\<lbrakk>linear f; inj f\<rbrakk> \<Longrightarrow> open_segment (f a) (f b) = f ` (open_segment a b)"
844725394a37 two new lemmas about segments
paulson <lp15@cam.ac.uk>
parents: 63075
diff changeset
  6163
  by (force simp: open_segment_def closed_segment_linear_image inj_on_def)
844725394a37 two new lemmas about segments
paulson <lp15@cam.ac.uk>
parents: 63075
diff changeset
  6164
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6165
lemma closed_segment_translation:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6166
    "closed_segment (c + a) (c + b) = image (\<lambda>x. c + x) (closed_segment a b)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6167
apply safe
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6168
apply (rule_tac x="x-c" in image_eqI)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6169
apply (auto simp: in_segment algebra_simps)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6170
done
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6171
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6172
lemma open_segment_translation:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6173
    "open_segment (c + a) (c + b) = image (\<lambda>x. c + x) (open_segment a b)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6174
by (simp add: open_segment_def closed_segment_translation translation_diff)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6175
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6176
lemma open_segment_PairD:
63077
844725394a37 two new lemmas about segments
paulson <lp15@cam.ac.uk>
parents: 63075
diff changeset
  6177
    "(x, x') \<in> open_segment (a, a') (b, b')
844725394a37 two new lemmas about segments
paulson <lp15@cam.ac.uk>
parents: 63075
diff changeset
  6178
     \<Longrightarrow> (x \<in> open_segment a b \<or> a = b) \<and> (x' \<in> open_segment a' b' \<or> a' = b')"
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6179
  by (auto simp: in_segment)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6180
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6181
lemma closed_segment_PairD:
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6182
  "(x, x') \<in> closed_segment (a, a') (b, b') \<Longrightarrow> x \<in> closed_segment a b \<and> x' \<in> closed_segment a' b'"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6183
  by (auto simp: closed_segment_def)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6184
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6185
lemma closed_segment_translation_eq [simp]:
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6186
    "d + x \<in> closed_segment (d + a) (d + b) \<longleftrightarrow> x \<in> closed_segment a b"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6187
proof -
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6188
  have *: "\<And>d x a b. x \<in> closed_segment a b \<Longrightarrow> d + x \<in> closed_segment (d + a) (d + b)"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6189
    apply (simp add: closed_segment_def)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6190
    apply (erule ex_forward)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6191
    apply (simp add: algebra_simps)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6192
    done
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6193
  show ?thesis
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6194
  using * [where d = "-d"] *
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6195
  by (fastforce simp add:)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6196
qed
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6197
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6198
lemma open_segment_translation_eq [simp]:
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6199
    "d + x \<in> open_segment (d + a) (d + b) \<longleftrightarrow> x \<in> open_segment a b"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6200
  by (simp add: open_segment_def)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  6201
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6202
definition "between = (\<lambda>(a,b) x. x \<in> closed_segment a b)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6203
61520
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  6204
definition "starlike s \<longleftrightarrow> (\<exists>a\<in>s. \<forall>x\<in>s. closed_segment a x \<subseteq> s)"
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  6205
62626
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  6206
lemma starlike_UNIV [simp]: "starlike UNIV"
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  6207
  by (simp add: starlike_def)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6208
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6209
lemma midpoint_refl: "midpoint x x = x"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6210
  unfolding midpoint_def
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6211
  unfolding scaleR_right_distrib
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6212
  unfolding scaleR_left_distrib[symmetric]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6213
  by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6214
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6215
lemma midpoint_sym: "midpoint a b = midpoint b a"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6216
  unfolding midpoint_def by (auto simp add: scaleR_right_distrib)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6217
36338
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  6218
lemma midpoint_eq_iff: "midpoint a b = c \<longleftrightarrow> a + b = c + c"
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  6219
proof -
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  6220
  have "midpoint a b = c \<longleftrightarrow> scaleR 2 (midpoint a b) = scaleR 2 c"
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  6221
    by simp
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6222
  then show ?thesis
36338
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  6223
    unfolding midpoint_def scaleR_2 [symmetric] by simp
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  6224
qed
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  6225
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6226
lemma dist_midpoint:
36338
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  6227
  fixes a b :: "'a::real_normed_vector" shows
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6228
  "dist a (midpoint a b) = (dist a b) / 2" (is ?t1)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6229
  "dist b (midpoint a b) = (dist a b) / 2" (is ?t2)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6230
  "dist (midpoint a b) a = (dist a b) / 2" (is ?t3)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6231
  "dist (midpoint a b) b = (dist a b) / 2" (is ?t4)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6232
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6233
  have *: "\<And>x y::'a. 2 *\<^sub>R x = - y \<Longrightarrow> norm x = (norm y) / 2"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6234
    unfolding equation_minus_iff by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6235
  have **: "\<And>x y::'a. 2 *\<^sub>R x =   y \<Longrightarrow> norm x = (norm y) / 2"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6236
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6237
  note scaleR_right_distrib [simp]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6238
  show ?t1
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6239
    unfolding midpoint_def dist_norm
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6240
    apply (rule **)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6241
    apply (simp add: scaleR_right_diff_distrib)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6242
    apply (simp add: scaleR_2)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6243
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6244
  show ?t2
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6245
    unfolding midpoint_def dist_norm
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6246
    apply (rule *)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6247
    apply (simp add: scaleR_right_diff_distrib)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6248
    apply (simp add: scaleR_2)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6249
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6250
  show ?t3
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  6251
    unfolding midpoint_def dist_norm
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6252
    apply (rule *)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6253
    apply (simp add: scaleR_right_diff_distrib)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6254
    apply (simp add: scaleR_2)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6255
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6256
  show ?t4
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6257
    unfolding midpoint_def dist_norm
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6258
    apply (rule **)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6259
    apply (simp add: scaleR_right_diff_distrib)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6260
    apply (simp add: scaleR_2)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6261
    done
36338
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  6262
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6263
63301
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
  6264
lemma midpoint_eq_endpoint [simp]:
36338
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  6265
  "midpoint a b = a \<longleftrightarrow> a = b"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6266
  "midpoint a b = b \<longleftrightarrow> a = b"
36338
7808fbc9c3b4 generalize more constants and lemmas
huffman
parents: 36337
diff changeset
  6267
  unfolding midpoint_eq_iff by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6268
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6269
lemma convex_contains_segment:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6270
  "convex s \<longleftrightarrow> (\<forall>a\<in>s. \<forall>b\<in>s. closed_segment a b \<subseteq> s)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6271
  unfolding convex_alt closed_segment_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6272
61848
9250e546ab23 New complex analysis material
paulson <lp15@cam.ac.uk>
parents: 61808
diff changeset
  6273
lemma closed_segment_subset: "\<lbrakk>x \<in> s; y \<in> s; convex s\<rbrakk> \<Longrightarrow> closed_segment x y \<subseteq> s"
9250e546ab23 New complex analysis material
paulson <lp15@cam.ac.uk>
parents: 61808
diff changeset
  6274
  by (simp add: convex_contains_segment)
9250e546ab23 New complex analysis material
paulson <lp15@cam.ac.uk>
parents: 61808
diff changeset
  6275
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  6276
lemma closed_segment_subset_convex_hull:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  6277
    "\<lbrakk>x \<in> convex hull s; y \<in> convex hull s\<rbrakk> \<Longrightarrow> closed_segment x y \<subseteq> convex hull s"
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  6278
  using convex_contains_segment by blast
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  6279
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6280
lemma convex_imp_starlike:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6281
  "convex s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> starlike s"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6282
  unfolding convex_contains_segment starlike_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6283
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6284
lemma segment_convex_hull:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6285
  "closed_segment a b = convex hull {a,b}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6286
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6287
  have *: "\<And>x. {x} \<noteq> {}" by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6288
  show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6289
    unfolding segment convex_hull_insert[OF *] convex_hull_singleton
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6290
    by (safe; rule_tac x="1 - u" in exI; force)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6291
qed
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6292
61520
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  6293
lemma open_closed_segment: "u \<in> open_segment w z \<Longrightarrow> u \<in> closed_segment w z"
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  6294
  by (auto simp add: closed_segment_def open_segment_def)
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  6295
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6296
lemma segment_open_subset_closed:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6297
   "open_segment a b \<subseteq> closed_segment a b"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6298
  by (auto simp: closed_segment_def open_segment_def)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6299
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6300
lemma bounded_closed_segment:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6301
    fixes a :: "'a::euclidean_space" shows "bounded (closed_segment a b)"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6302
  by (simp add: segment_convex_hull compact_convex_hull compact_imp_bounded)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6303
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6304
lemma bounded_open_segment:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6305
    fixes a :: "'a::euclidean_space" shows "bounded (open_segment a b)"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6306
  by (rule bounded_subset [OF bounded_closed_segment segment_open_subset_closed])
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6307
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6308
lemmas bounded_segment = bounded_closed_segment open_closed_segment
61426
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61222
diff changeset
  6309
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61222
diff changeset
  6310
lemma ends_in_segment [iff]: "a \<in> closed_segment a b" "b \<in> closed_segment a b"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6311
  unfolding segment_convex_hull
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6312
  by (auto intro!: hull_subset[unfolded subset_eq, rule_format])
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6313
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6314
lemma segment_furthest_le:
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36844
diff changeset
  6315
  fixes a b x y :: "'a::euclidean_space"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6316
  assumes "x \<in> closed_segment a b"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6317
  shows "norm (y - x) \<le> norm (y - a) \<or>  norm (y - x) \<le> norm (y - b)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6318
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6319
  obtain z where "z \<in> {a, b}" "norm (x - y) \<le> norm (z - y)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6320
    using simplex_furthest_le[of "{a, b}" y]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6321
    using assms[unfolded segment_convex_hull]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6322
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6323
  then show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6324
    by (auto simp add:norm_minus_commute)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6325
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6326
60176
38b630409aa2 closures of intervals
immler
parents: 59807
diff changeset
  6327
lemma closed_segment_commute: "closed_segment a b = closed_segment b a"
38b630409aa2 closures of intervals
immler
parents: 59807
diff changeset
  6328
proof -
38b630409aa2 closures of intervals
immler
parents: 59807
diff changeset
  6329
  have "{a, b} = {b, a}" by auto
38b630409aa2 closures of intervals
immler
parents: 59807
diff changeset
  6330
  thus ?thesis
38b630409aa2 closures of intervals
immler
parents: 59807
diff changeset
  6331
    by (simp add: segment_convex_hull)
38b630409aa2 closures of intervals
immler
parents: 59807
diff changeset
  6332
qed
38b630409aa2 closures of intervals
immler
parents: 59807
diff changeset
  6333
61738
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6334
lemma segment_bound1:
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6335
  assumes "x \<in> closed_segment a b"
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6336
  shows "norm (x - a) \<le> norm (b - a)"
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6337
proof -
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6338
  obtain u where "x = (1 - u) *\<^sub>R a + u *\<^sub>R b" "0 \<le> u" "u \<le> 1"
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6339
    using assms by (auto simp add: closed_segment_def)
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6340
  then show "norm (x - a) \<le> norm (b - a)"
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6341
    apply clarify
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6342
    apply (auto simp: algebra_simps)
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6343
    apply (simp add: scaleR_diff_right [symmetric] mult_left_le_one_le)
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6344
    done
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6345
qed
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6346
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6347
lemma segment_bound:
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6348
  assumes "x \<in> closed_segment a b"
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6349
  shows "norm (x - a) \<le> norm (b - a)" "norm (x - b) \<le> norm (b - a)"
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6350
apply (simp add: assms segment_bound1)
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6351
by (metis assms closed_segment_commute dist_commute dist_norm segment_bound1)
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6352
61520
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  6353
lemma open_segment_commute: "open_segment a b = open_segment b a"
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  6354
proof -
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  6355
  have "{a, b} = {b, a}" by auto
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  6356
  thus ?thesis
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  6357
    by (simp add: closed_segment_commute open_segment_def)
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  6358
qed
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  6359
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  6360
lemma closed_segment_idem [simp]: "closed_segment a a = {a}"
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  6361
  unfolding segment by (auto simp add: algebra_simps)
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  6362
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  6363
lemma open_segment_idem [simp]: "open_segment a a = {}"
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  6364
  by (simp add: open_segment_def)
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61518
diff changeset
  6365
62626
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  6366
lemma closed_segment_eq_open: "closed_segment a b = open_segment a b \<union> {a,b}"
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  6367
  using open_segment_def by auto
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
  6368
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
  6369
lemma convex_contains_open_segment:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
  6370
  "convex s \<longleftrightarrow> (\<forall>a\<in>s. \<forall>b\<in>s. open_segment a b \<subseteq> s)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
  6371
  by (simp add: convex_contains_segment closed_segment_eq_open)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
  6372
60176
38b630409aa2 closures of intervals
immler
parents: 59807
diff changeset
  6373
lemma closed_segment_eq_real_ivl:
38b630409aa2 closures of intervals
immler
parents: 59807
diff changeset
  6374
  fixes a b::real
38b630409aa2 closures of intervals
immler
parents: 59807
diff changeset
  6375
  shows "closed_segment a b = (if a \<le> b then {a .. b} else {b .. a})"
38b630409aa2 closures of intervals
immler
parents: 59807
diff changeset
  6376
proof -
38b630409aa2 closures of intervals
immler
parents: 59807
diff changeset
  6377
  have "b \<le> a \<Longrightarrow> closed_segment b a = {b .. a}"
38b630409aa2 closures of intervals
immler
parents: 59807
diff changeset
  6378
    and "a \<le> b \<Longrightarrow> closed_segment a b = {a .. b}"
38b630409aa2 closures of intervals
immler
parents: 59807
diff changeset
  6379
    by (auto simp: convex_hull_eq_real_cbox segment_convex_hull)
38b630409aa2 closures of intervals
immler
parents: 59807
diff changeset
  6380
  thus ?thesis
38b630409aa2 closures of intervals
immler
parents: 59807
diff changeset
  6381
    by (auto simp: closed_segment_commute)
38b630409aa2 closures of intervals
immler
parents: 59807
diff changeset
  6382
qed
38b630409aa2 closures of intervals
immler
parents: 59807
diff changeset
  6383
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  6384
lemma closed_segment_real_eq:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  6385
  fixes u::real shows "closed_segment u v = (\<lambda>x. (v - u) * x + u) ` {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  6386
  by (simp add: add.commute [of u] image_affinity_atLeastAtMost [where c=u] closed_segment_eq_real_ivl)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  6387
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6388
lemma dist_in_closed_segment:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6389
  fixes a :: "'a :: euclidean_space"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6390
  assumes "x \<in> closed_segment a b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6391
    shows "dist x a \<le> dist a b \<and> dist x b \<le> dist a b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6392
proof (intro conjI)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6393
  obtain u where u: "0 \<le> u" "u \<le> 1" and x: "x = (1 - u) *\<^sub>R a + u *\<^sub>R b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6394
    using assms by (force simp: in_segment algebra_simps)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6395
  have "dist x a = u * dist a b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6396
    apply (simp add: dist_norm algebra_simps x)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6397
    by (metis \<open>0 \<le> u\<close> abs_of_nonneg norm_minus_commute norm_scaleR real_vector.scale_right_diff_distrib)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6398
  also have "...  \<le> dist a b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6399
    by (simp add: mult_left_le_one_le u)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6400
  finally show "dist x a \<le> dist a b" .
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6401
  have "dist x b = norm ((1-u) *\<^sub>R a - (1-u) *\<^sub>R b)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6402
    by (simp add: dist_norm algebra_simps x)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6403
  also have "... = (1-u) * dist a b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6404
  proof -
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6405
    have "norm ((1 - 1 * u) *\<^sub>R (a - b)) = (1 - 1 * u) * norm (a - b)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6406
      using \<open>u \<le> 1\<close> by force
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6407
    then show ?thesis
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6408
      by (simp add: dist_norm real_vector.scale_right_diff_distrib)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6409
  qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6410
  also have "... \<le> dist a b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6411
    by (simp add: mult_left_le_one_le u)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6412
  finally show "dist x b \<le> dist a b" .
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6413
qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6414
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6415
lemma dist_in_open_segment:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6416
  fixes a :: "'a :: euclidean_space"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6417
  assumes "x \<in> open_segment a b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6418
    shows "dist x a < dist a b \<and> dist x b < dist a b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6419
proof (intro conjI)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6420
  obtain u where u: "0 < u" "u < 1" and x: "x = (1 - u) *\<^sub>R a + u *\<^sub>R b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6421
    using assms by (force simp: in_segment algebra_simps)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6422
  have "dist x a = u * dist a b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6423
    apply (simp add: dist_norm algebra_simps x)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6424
    by (metis abs_of_nonneg less_eq_real_def norm_minus_commute norm_scaleR real_vector.scale_right_diff_distrib \<open>0 < u\<close>)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6425
  also have *: "...  < dist a b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6426
    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>)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6427
  finally show "dist x a < dist a b" .
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6428
  have ab_ne0: "dist a b \<noteq> 0"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6429
    using * by fastforce
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6430
  have "dist x b = norm ((1-u) *\<^sub>R a - (1-u) *\<^sub>R b)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6431
    by (simp add: dist_norm algebra_simps x)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6432
  also have "... = (1-u) * dist a b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6433
  proof -
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6434
    have "norm ((1 - 1 * u) *\<^sub>R (a - b)) = (1 - 1 * u) * norm (a - b)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6435
      using \<open>u < 1\<close> by force
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6436
    then show ?thesis
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6437
      by (simp add: dist_norm real_vector.scale_right_diff_distrib)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6438
  qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6439
  also have "... < dist a b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6440
    using ab_ne0 \<open>0 < u\<close> by simp
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6441
  finally show "dist x b < dist a b" .
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6442
qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6443
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6444
lemma dist_decreases_open_segment_0:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6445
  fixes x :: "'a :: euclidean_space"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6446
  assumes "x \<in> open_segment 0 b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6447
    shows "dist c x < dist c 0 \<or> dist c x < dist c b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6448
proof (rule ccontr, clarsimp simp: not_less)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6449
  obtain u where u: "0 \<noteq> b" "0 < u" "u < 1" and x: "x = u *\<^sub>R b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6450
    using assms by (auto simp: in_segment)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6451
  have xb: "x \<bullet> b < b \<bullet> b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6452
    using u x by auto
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6453
  assume "norm c \<le> dist c x"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6454
  then have "c \<bullet> c \<le> (c - x) \<bullet> (c - x)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6455
    by (simp add: dist_norm norm_le)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6456
  moreover have "0 < x \<bullet> b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6457
    using u x by auto
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6458
  ultimately have less: "c \<bullet> b < x \<bullet> b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6459
    by (simp add: x algebra_simps inner_commute u)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6460
  assume "dist c b \<le> dist c x"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6461
  then have "(c - b) \<bullet> (c - b) \<le> (c - x) \<bullet> (c - x)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6462
    by (simp add: dist_norm norm_le)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6463
  then have "(b \<bullet> b) * (1 - u*u) \<le> 2 * (b \<bullet> c) * (1-u)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6464
    by (simp add: x algebra_simps inner_commute)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6465
  then have "(1+u) * (b \<bullet> b) * (1-u) \<le> 2 * (b \<bullet> c) * (1-u)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6466
    by (simp add: algebra_simps)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6467
  then have "(1+u) * (b \<bullet> b) \<le> 2 * (b \<bullet> c)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6468
    using \<open>u < 1\<close> by auto
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6469
  with xb have "c \<bullet> b \<ge> x \<bullet> b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6470
    by (auto simp: x algebra_simps inner_commute)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6471
  with less show False by auto
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6472
qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6473
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6474
proposition dist_decreases_open_segment:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6475
  fixes a :: "'a :: euclidean_space"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6476
  assumes "x \<in> open_segment a b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6477
    shows "dist c x < dist c a \<or> dist c x < dist c b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6478
proof -
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6479
  have *: "x - a \<in> open_segment 0 (b - a)" using assms
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6480
    by (metis diff_self open_segment_translation_eq uminus_add_conv_diff)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6481
  show ?thesis
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6482
    using dist_decreases_open_segment_0 [OF *, of "c-a"] assms
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6483
    by (simp add: dist_norm)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6484
qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6485
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6486
lemma dist_decreases_closed_segment:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6487
  fixes a :: "'a :: euclidean_space"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6488
  assumes "x \<in> closed_segment a b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6489
    shows "dist c x \<le> dist c a \<or> dist c x \<le> dist c b"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6490
apply (cases "x \<in> open_segment a b")
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6491
 using dist_decreases_open_segment less_eq_real_def apply blast
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6492
by (metis DiffI assms empty_iff insertE open_segment_def order_refl)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6493
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6494
lemma convex_intermediate_ball:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6495
  fixes a :: "'a :: euclidean_space"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6496
  shows "\<lbrakk>ball a r \<subseteq> T; T \<subseteq> cball a r\<rbrakk> \<Longrightarrow> convex T"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6497
apply (simp add: convex_contains_open_segment, clarify)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6498
by (metis (no_types, hide_lams) less_le_trans mem_ball mem_cball subsetCE dist_decreases_open_segment)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  6499
63301
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
  6500
lemma csegment_midpoint_subset: "closed_segment (midpoint a b) b \<subseteq> closed_segment a b"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
  6501
  apply (clarsimp simp: midpoint_def in_segment)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
  6502
  apply (rule_tac x="(1 + u) / 2" in exI)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
  6503
  apply (auto simp: algebra_simps add_divide_distrib diff_divide_distrib)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
  6504
  by (metis real_sum_of_halves scaleR_left.add)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
  6505
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
  6506
lemma notin_segment_midpoint:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
  6507
  fixes a :: "'a :: euclidean_space"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
  6508
  shows "a \<noteq> b \<Longrightarrow> a \<notin> closed_segment (midpoint a b) b"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
  6509
by (auto simp: dist_midpoint dest!: dist_in_closed_segment)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
  6510
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6511
subsubsection\<open>More lemmas, especially for working with the underlying formula\<close>
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6512
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6513
lemma segment_eq_compose:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6514
  fixes a :: "'a :: real_vector"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6515
  shows "(\<lambda>u. (1 - u) *\<^sub>R a + u *\<^sub>R b) = (\<lambda>x. a + x) o (\<lambda>u. u *\<^sub>R (b - a))"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6516
    by (simp add: o_def algebra_simps)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6517
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6518
lemma segment_degen_1:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6519
  fixes a :: "'a :: real_vector"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6520
  shows "(1 - u) *\<^sub>R a + u *\<^sub>R b = b \<longleftrightarrow> a=b \<or> u=1"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6521
proof -
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6522
  { assume "(1 - u) *\<^sub>R a + u *\<^sub>R b = b"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6523
    then have "(1 - u) *\<^sub>R a = (1 - u) *\<^sub>R b"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6524
      by (simp add: algebra_simps)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6525
    then have "a=b \<or> u=1"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6526
      by simp
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6527
  } then show ?thesis
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6528
      by (auto simp: algebra_simps)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6529
qed
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6530
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6531
lemma segment_degen_0:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6532
    fixes a :: "'a :: real_vector"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6533
    shows "(1 - u) *\<^sub>R a + u *\<^sub>R b = a \<longleftrightarrow> a=b \<or> u=0"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6534
  using segment_degen_1 [of "1-u" b a]
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6535
  by (auto simp: algebra_simps)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6536
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6537
lemma closed_segment_image_interval:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6538
     "closed_segment a b = (\<lambda>u. (1 - u) *\<^sub>R a + u *\<^sub>R b) ` {0..1}"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6539
  by (auto simp: set_eq_iff image_iff closed_segment_def)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6540
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6541
lemma open_segment_image_interval:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6542
     "open_segment a b = (if a=b then {} else (\<lambda>u. (1 - u) *\<^sub>R a + u *\<^sub>R b) ` {0<..<1})"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6543
  by (auto simp:  open_segment_def closed_segment_def segment_degen_0 segment_degen_1)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6544
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6545
lemmas segment_image_interval = closed_segment_image_interval open_segment_image_interval
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6546
61738
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6547
lemma open_segment_bound1:
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6548
  assumes "x \<in> open_segment a b"
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6549
  shows "norm (x - a) < norm (b - a)"
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6550
proof -
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6551
  obtain u where "x = (1 - u) *\<^sub>R a + u *\<^sub>R b" "0 < u" "u < 1" "a \<noteq> b"
62618
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  6552
    using assms by (auto simp add: open_segment_image_interval split: if_split_asm)
61738
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6553
  then show "norm (x - a) < norm (b - a)"
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6554
    apply clarify
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6555
    apply (auto simp: algebra_simps)
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6556
    apply (simp add: scaleR_diff_right [symmetric])
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6557
    done
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6558
qed
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6559
62950
c355b3223cbd generalized
immler
parents: 62948
diff changeset
  6560
lemma compact_segment [simp]:
c355b3223cbd generalized
immler
parents: 62948
diff changeset
  6561
  fixes a :: "'a::real_normed_vector"
c355b3223cbd generalized
immler
parents: 62948
diff changeset
  6562
  shows "compact (closed_segment a b)"
c355b3223cbd generalized
immler
parents: 62948
diff changeset
  6563
  by (auto simp: segment_image_interval intro!: compact_continuous_image continuous_intros)
c355b3223cbd generalized
immler
parents: 62948
diff changeset
  6564
c355b3223cbd generalized
immler
parents: 62948
diff changeset
  6565
lemma closed_segment [simp]:
c355b3223cbd generalized
immler
parents: 62948
diff changeset
  6566
  fixes a :: "'a::real_normed_vector"
c355b3223cbd generalized
immler
parents: 62948
diff changeset
  6567
  shows "closed (closed_segment a b)"
c355b3223cbd generalized
immler
parents: 62948
diff changeset
  6568
  by (simp add: compact_imp_closed)
c355b3223cbd generalized
immler
parents: 62948
diff changeset
  6569
c355b3223cbd generalized
immler
parents: 62948
diff changeset
  6570
lemma closure_closed_segment [simp]:
c355b3223cbd generalized
immler
parents: 62948
diff changeset
  6571
  fixes a :: "'a::real_normed_vector"
c355b3223cbd generalized
immler
parents: 62948
diff changeset
  6572
  shows "closure(closed_segment a b) = closed_segment a b"
c355b3223cbd generalized
immler
parents: 62948
diff changeset
  6573
  by simp
c355b3223cbd generalized
immler
parents: 62948
diff changeset
  6574
61738
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6575
lemma open_segment_bound:
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6576
  assumes "x \<in> open_segment a b"
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6577
  shows "norm (x - a) < norm (b - a)" "norm (x - b) < norm (b - a)"
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6578
apply (simp add: assms open_segment_bound1)
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6579
by (metis assms norm_minus_commute open_segment_bound1 open_segment_commute)
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61694
diff changeset
  6580
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6581
lemma closure_open_segment [simp]:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6582
    fixes a :: "'a::euclidean_space"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6583
    shows "closure(open_segment a b) = (if a = b then {} else closed_segment a b)"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6584
proof -
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6585
  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"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6586
    apply (rule closure_injective_linear_image [symmetric])
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6587
    apply (simp add:)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6588
    using that by (simp add: inj_on_def)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6589
  then show ?thesis
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6590
    by (simp add: segment_image_interval segment_eq_compose closure_greaterThanLessThan [symmetric]
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6591
         closure_translation image_comp [symmetric] del: closure_greaterThanLessThan)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6592
qed
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6593
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6594
lemma closed_open_segment_iff [simp]:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6595
    fixes a :: "'a::euclidean_space"  shows "closed(open_segment a b) \<longleftrightarrow> a = b"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6596
  by (metis open_segment_def DiffE closure_eq closure_open_segment ends_in_segment(1) insert_iff segment_image_interval(2))
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6597
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6598
lemma compact_open_segment_iff [simp]:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6599
    fixes a :: "'a::euclidean_space"  shows "compact(open_segment a b) \<longleftrightarrow> a = b"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6600
  by (simp add: bounded_open_segment compact_eq_bounded_closed)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6601
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6602
lemma convex_closed_segment [iff]: "convex (closed_segment a b)"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6603
  unfolding segment_convex_hull by(rule convex_convex_hull)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6604
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6605
lemma convex_open_segment [iff]: "convex(open_segment a b)"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6606
proof -
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6607
  have "convex ((\<lambda>u. u *\<^sub>R (b-a)) ` {0<..<1})"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6608
    by (rule convex_linear_image) auto
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6609
  then show ?thesis
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6610
    apply (simp add: open_segment_image_interval segment_eq_compose)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6611
    by (metis image_comp convex_translation)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6612
qed
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6613
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6614
lemmas convex_segment = convex_closed_segment convex_open_segment
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6615
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6616
lemma connected_segment [iff]:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6617
  fixes x :: "'a :: real_normed_vector"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6618
  shows "connected (closed_segment x y)"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6619
  by (simp add: convex_connected)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6620
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6621
lemma affine_hull_closed_segment [simp]:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6622
     "affine hull (closed_segment a b) = affine hull {a,b}"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6623
  by (simp add: segment_convex_hull)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6624
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6625
lemma affine_hull_open_segment [simp]:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6626
    fixes a :: "'a::euclidean_space"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6627
    shows "affine hull (open_segment a b) = (if a = b then {} else affine hull {a,b})"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6628
by (metis affine_hull_convex_hull affine_hull_empty closure_open_segment closure_same_affine_hull segment_convex_hull)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6629
62618
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  6630
lemma rel_interior_closure_convex_segment:
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  6631
  fixes S :: "_::euclidean_space set"
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  6632
  assumes "convex S" "a \<in> rel_interior S" "b \<in> closure S"
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  6633
    shows "open_segment a b \<subseteq> rel_interior S"
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  6634
proof
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  6635
  fix x
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  6636
  have [simp]: "(1 - u) *\<^sub>R a + u *\<^sub>R b = b - (1 - u) *\<^sub>R (b - a)" for u
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  6637
    by (simp add: algebra_simps)
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  6638
  assume "x \<in> open_segment a b"
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  6639
  then show "x \<in> rel_interior S"
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  6640
    unfolding closed_segment_def open_segment_def  using assms
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  6641
    by (auto intro: rel_interior_closure_convex_shrink)
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  6642
qed
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  6643
62620
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6644
subsection\<open>More results about segments\<close>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6645
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6646
lemma dist_half_times2:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6647
  fixes a :: "'a :: real_normed_vector"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6648
  shows "dist ((1 / 2) *\<^sub>R (a + b)) x * 2 = dist (a+b) (2 *\<^sub>R x)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6649
proof -
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6650
  have "norm ((1 / 2) *\<^sub>R (a + b) - x) * 2 = norm (2 *\<^sub>R ((1 / 2) *\<^sub>R (a + b) - x))"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6651
    by simp
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6652
  also have "... = norm ((a + b) - 2 *\<^sub>R x)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6653
    by (simp add: real_vector.scale_right_diff_distrib)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6654
  finally show ?thesis
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6655
    by (simp only: dist_norm)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6656
qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6657
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6658
lemma closed_segment_as_ball:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6659
    "closed_segment a b = affine hull {a,b} \<inter> cball(inverse 2 *\<^sub>R (a + b))(norm(b - a) / 2)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6660
proof (cases "b = a")
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6661
  case True then show ?thesis by (auto simp: hull_inc)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6662
next
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6663
  case False
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6664
  then have *: "((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6665
                  dist ((1 / 2) *\<^sub>R (a + b)) x * 2 \<le> norm (b - a)) =
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6666
                 (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 \<le> u \<and> u \<le> 1)" for x
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6667
  proof -
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6668
    have "((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6669
                  dist ((1 / 2) *\<^sub>R (a + b)) x * 2 \<le> norm (b - a)) =
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6670
          ((\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b) \<and>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6671
                  dist ((1 / 2) *\<^sub>R (a + b)) x * 2 \<le> norm (b - a))"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6672
      unfolding eq_diff_eq [symmetric] by simp
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6673
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6674
                          norm ((a+b) - (2 *\<^sub>R x)) \<le> norm (b - a))"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6675
      by (simp add: dist_half_times2) (simp add: dist_norm)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6676
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6677
            norm ((a+b) - (2 *\<^sub>R ((1 - u) *\<^sub>R a + u *\<^sub>R b))) \<le> norm (b - a))"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6678
      by auto
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6679
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6680
                norm ((1 - u * 2) *\<^sub>R (b - a)) \<le> norm (b - a))"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6681
      by (simp add: algebra_simps scaleR_2)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6682
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6683
                          \<bar>1 - u * 2\<bar> * norm (b - a) \<le> norm (b - a))"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6684
      by simp
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6685
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> \<bar>1 - u * 2\<bar> \<le> 1)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6686
      by (simp add: mult_le_cancel_right2 False)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6687
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 \<le> u \<and> u \<le> 1)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6688
      by auto
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6689
    finally show ?thesis .
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6690
  qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6691
  show ?thesis
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6692
    by (simp add: affine_hull_2 Set.set_eq_iff closed_segment_def *)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6693
qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6694
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6695
lemma open_segment_as_ball:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6696
    "open_segment a b =
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6697
     affine hull {a,b} \<inter> ball(inverse 2 *\<^sub>R (a + b))(norm(b - a) / 2)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6698
proof (cases "b = a")
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6699
  case True then show ?thesis by (auto simp: hull_inc)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6700
next
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6701
  case False
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6702
  then have *: "((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6703
                  dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) =
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6704
                 (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)" for x
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6705
  proof -
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6706
    have "((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6707
                  dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) =
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6708
          ((\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b) \<and>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6709
                  dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a))"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6710
      unfolding eq_diff_eq [symmetric] by simp
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6711
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6712
                          norm ((a+b) - (2 *\<^sub>R x)) < norm (b - a))"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6713
      by (simp add: dist_half_times2) (simp add: dist_norm)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6714
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6715
            norm ((a+b) - (2 *\<^sub>R ((1 - u) *\<^sub>R a + u *\<^sub>R b))) < norm (b - a))"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6716
      by auto
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6717
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6718
                norm ((1 - u * 2) *\<^sub>R (b - a)) < norm (b - a))"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6719
      by (simp add: algebra_simps scaleR_2)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6720
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6721
                          \<bar>1 - u * 2\<bar> * norm (b - a) < norm (b - a))"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6722
      by simp
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6723
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> \<bar>1 - u * 2\<bar> < 1)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6724
      by (simp add: mult_le_cancel_right2 False)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6725
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6726
      by auto
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6727
    finally show ?thesis .
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6728
  qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6729
  show ?thesis
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6730
    using False by (force simp: affine_hull_2 Set.set_eq_iff open_segment_image_interval *)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6731
qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6732
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6733
lemmas segment_as_ball = closed_segment_as_ball open_segment_as_ball
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6734
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6735
lemma closed_segment_neq_empty [simp]: "closed_segment a b \<noteq> {}"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6736
  by auto
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6737
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6738
lemma open_segment_eq_empty [simp]: "open_segment a b = {} \<longleftrightarrow> a = b"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6739
proof -
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6740
  { assume a1: "open_segment a b = {}"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6741
    have "{} \<noteq> {0::real<..<1}"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6742
      by simp
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6743
    then have "a = b"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6744
      using a1 open_segment_image_interval by fastforce
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6745
  } then show ?thesis by auto
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6746
qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6747
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6748
lemma open_segment_eq_empty' [simp]: "{} = open_segment a b \<longleftrightarrow> a = b"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6749
  using open_segment_eq_empty by blast
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6750
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6751
lemmas segment_eq_empty = closed_segment_neq_empty open_segment_eq_empty
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6752
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6753
lemma inj_segment:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6754
  fixes a :: "'a :: real_vector"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6755
  assumes "a \<noteq> b"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6756
    shows "inj_on (\<lambda>u. (1 - u) *\<^sub>R a + u *\<^sub>R b) I"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6757
proof
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6758
  fix x y
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6759
  assume "(1 - x) *\<^sub>R a + x *\<^sub>R b = (1 - y) *\<^sub>R a + y *\<^sub>R b"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6760
  then have "x *\<^sub>R (b - a) = y *\<^sub>R (b - a)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6761
    by (simp add: algebra_simps)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6762
  with assms show "x = y"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6763
    by (simp add: real_vector.scale_right_imp_eq)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6764
qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6765
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6766
lemma finite_closed_segment [simp]: "finite(closed_segment a b) \<longleftrightarrow> a = b"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6767
  apply auto
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6768
  apply (rule ccontr)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6769
  apply (simp add: segment_image_interval)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6770
  using infinite_Icc [OF zero_less_one] finite_imageD [OF _ inj_segment] apply blast
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6771
  done
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6772
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6773
lemma finite_open_segment [simp]: "finite(open_segment a b) \<longleftrightarrow> a = b"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6774
  by (auto simp: open_segment_def)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6775
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6776
lemmas finite_segment = finite_closed_segment finite_open_segment
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6777
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6778
lemma closed_segment_eq_sing: "closed_segment a b = {c} \<longleftrightarrow> a = c \<and> b = c"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6779
  by auto
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6780
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6781
lemma open_segment_eq_sing: "open_segment a b \<noteq> {c}"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6782
  by (metis finite_insert finite_open_segment insert_not_empty open_segment_image_interval)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6783
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6784
lemmas segment_eq_sing = closed_segment_eq_sing open_segment_eq_sing
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6785
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6786
lemma subset_closed_segment:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6787
    "closed_segment a b \<subseteq> closed_segment c d \<longleftrightarrow>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6788
     a \<in> closed_segment c d \<and> b \<in> closed_segment c d"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6789
  by auto (meson contra_subsetD convex_closed_segment convex_contains_segment)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6790
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6791
lemma subset_co_segment:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6792
    "closed_segment a b \<subseteq> open_segment c d \<longleftrightarrow>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6793
     a \<in> open_segment c d \<and> b \<in> open_segment c d"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6794
using closed_segment_subset by blast
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6795
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6796
lemma subset_open_segment:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6797
  fixes a :: "'a::euclidean_space"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6798
  shows "open_segment a b \<subseteq> open_segment c d \<longleftrightarrow>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6799
         a = b \<or> a \<in> closed_segment c d \<and> b \<in> closed_segment c d"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6800
        (is "?lhs = ?rhs")
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6801
proof (cases "a = b")
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6802
  case True then show ?thesis by simp
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6803
next
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6804
  case False show ?thesis
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6805
  proof
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6806
    assume rhs: ?rhs
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6807
    with \<open>a \<noteq> b\<close> have "c \<noteq> d"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6808
      using closed_segment_idem singleton_iff by auto
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6809
    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) =
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6810
               (1 - uc) *\<^sub>R c + uc *\<^sub>R d \<and> 0 < uc \<and> uc < 1"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6811
        if neq: "(1 - ua) *\<^sub>R c + ua *\<^sub>R d \<noteq> (1 - ub) *\<^sub>R c + ub *\<^sub>R d" "c \<noteq> d"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6812
           and "a = (1 - ua) *\<^sub>R c + ua *\<^sub>R d" "b = (1 - ub) *\<^sub>R c + ub *\<^sub>R d"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6813
           and u: "0 < u" "u < 1" and uab: "0 \<le> ua" "ua \<le> 1" "0 \<le> ub" "ub \<le> 1"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6814
        for u ua ub
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6815
    proof -
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6816
      have "ua \<noteq> ub"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6817
        using neq by auto
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6818
      moreover have "(u - 1) * ua \<le> 0" using u uab
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6819
        by (simp add: mult_nonpos_nonneg)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6820
      ultimately have lt: "(u - 1) * ua < u * ub" using u uab
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6821
        by (metis antisym_conv diff_ge_0_iff_ge le_less_trans mult_eq_0_iff mult_le_0_iff not_less)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6822
      have "p * ua + q * ub < p+q" if p: "0 < p" and  q: "0 < q" for p q
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6823
      proof -
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6824
        have "\<not> p \<le> 0" "\<not> q \<le> 0"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6825
          using p q not_less by blast+
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6826
        then show ?thesis
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6827
          by (metis \<open>ua \<noteq> ub\<close> add_less_cancel_left add_less_cancel_right add_mono_thms_linordered_field(5)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6828
                    less_eq_real_def mult_cancel_left1 mult_less_cancel_left2 uab(2) uab(4))
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6829
      qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6830
      then have "(1 - u) * ua + u * ub < 1" using u \<open>ua \<noteq> ub\<close>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6831
        by (metis diff_add_cancel diff_gt_0_iff_gt)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6832
      with lt show ?thesis
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6833
        by (rule_tac x="ua + u*(ub-ua)" in exI) (simp add: algebra_simps)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6834
    qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6835
    with rhs \<open>a \<noteq> b\<close> \<open>c \<noteq> d\<close> show ?lhs
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6836
      unfolding open_segment_image_interval closed_segment_def
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6837
      by (fastforce simp add:)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6838
  next
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6839
    assume lhs: ?lhs
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6840
    with \<open>a \<noteq> b\<close> have "c \<noteq> d"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6841
      by (meson finite_open_segment rev_finite_subset)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6842
    have "closure (open_segment a b) \<subseteq> closure (open_segment c d)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6843
      using lhs closure_mono by blast
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6844
    then have "closed_segment a b \<subseteq> closed_segment c d"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6845
      by (simp add: \<open>a \<noteq> b\<close> \<open>c \<noteq> d\<close>)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6846
    then show ?rhs
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6847
      by (force simp: \<open>a \<noteq> b\<close>)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6848
  qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6849
qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6850
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6851
lemma subset_oc_segment:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6852
  fixes a :: "'a::euclidean_space"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6853
  shows "open_segment a b \<subseteq> closed_segment c d \<longleftrightarrow>
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6854
         a = b \<or> a \<in> closed_segment c d \<and> b \<in> closed_segment c d"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6855
apply (simp add: subset_open_segment [symmetric])
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6856
apply (rule iffI)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6857
 apply (metis closure_closed_segment closure_mono closure_open_segment subset_closed_segment subset_open_segment)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6858
apply (meson dual_order.trans segment_open_subset_closed)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6859
done
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6860
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6861
lemmas subset_segment = subset_closed_segment subset_co_segment subset_oc_segment subset_open_segment
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6862
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  6863
62618
f7f2467ab854 Refactoring (moving theorems into better locations), plus a bit of new material
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  6864
subsection\<open>Betweenness\<close>
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6865
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6866
lemma between_mem_segment: "between (a,b) x \<longleftrightarrow> x \<in> closed_segment a b"
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44142
diff changeset
  6867
  unfolding between_def by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6868
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6869
lemma between: "between (a, b) (x::'a::euclidean_space) \<longleftrightarrow> dist a b = (dist a x) + (dist x b)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6870
proof (cases "a = b")
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6871
  case True
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6872
  then show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6873
    unfolding between_def split_conv
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6874
    by (auto simp add: dist_commute)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6875
next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6876
  case False
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6877
  then have Fal: "norm (a - b) \<noteq> 0" and Fal2: "norm (a - b) > 0"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6878
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6879
  have *: "\<And>u. a - ((1 - u) *\<^sub>R a + u *\<^sub>R b) = u *\<^sub>R (a - b)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6880
    by (auto simp add: algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6881
  show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6882
    unfolding between_def split_conv closed_segment_def mem_Collect_eq
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6883
    apply rule
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6884
    apply (elim exE conjE)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6885
    apply (subst dist_triangle_eq)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6886
  proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6887
    fix u
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6888
    assume as: "x = (1 - u) *\<^sub>R a + u *\<^sub>R b" "0 \<le> u" "u \<le> 1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6889
    then have *: "a - x = u *\<^sub>R (a - b)" "x - b = (1 - u) *\<^sub>R (a - b)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6890
      unfolding as(1) by (auto simp add:algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6891
    show "norm (a - x) *\<^sub>R (x - b) = norm (x - b) *\<^sub>R (a - x)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6892
      unfolding norm_minus_commute[of x a] * using as(2,3)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6893
      by (auto simp add: field_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6894
  next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6895
    assume as: "dist a b = dist a x + dist x b"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6896
    have "norm (a - x) / norm (a - b) \<le> 1"
56571
f4635657d66f added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents: 56544
diff changeset
  6897
      using Fal2 unfolding as[unfolded dist_norm] norm_ge_zero by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6898
    then show "\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 \<le> u \<and> u \<le> 1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6899
      apply (rule_tac x="dist a x / dist a b" in exI)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6900
      unfolding dist_norm
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6901
      apply (subst euclidean_eq_iff)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6902
      apply rule
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6903
      defer
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6904
      apply rule
56571
f4635657d66f added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents: 56544
diff changeset
  6905
      prefer 3
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6906
      apply rule
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6907
    proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6908
      fix i :: 'a
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6909
      assume i: "i \<in> Basis"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6910
      have "((1 - norm (a - x) / norm (a - b)) *\<^sub>R a + (norm (a - x) / norm (a - b)) *\<^sub>R b) \<bullet> i =
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6911
        ((norm (a - b) - norm (a - x)) * (a \<bullet> i) + norm (a - x) * (b \<bullet> i)) / norm (a - b)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6912
        using Fal by (auto simp add: field_simps inner_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6913
      also have "\<dots> = x\<bullet>i"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6914
        apply (rule divide_eq_imp[OF Fal])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6915
        unfolding as[unfolded dist_norm]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6916
        using as[unfolded dist_triangle_eq]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6917
        apply -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6918
        apply (subst (asm) euclidean_eq_iff)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6919
        using i
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6920
        apply (erule_tac x=i in ballE)
57865
dcfb33c26f50 tuned proofs -- fewer warnings;
wenzelm
parents: 57512
diff changeset
  6921
        apply (auto simp add: field_simps inner_simps)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6922
        done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6923
      finally show "x \<bullet> i =
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6924
        ((1 - norm (a - x) / norm (a - b)) *\<^sub>R a + (norm (a - x) / norm (a - b)) *\<^sub>R b) \<bullet> i"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6925
        by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6926
    qed (insert Fal2, auto)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6927
  qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6928
qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6929
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6930
lemma between_midpoint:
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6931
  fixes a :: "'a::euclidean_space"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6932
  shows "between (a,b) (midpoint a b)" (is ?t1)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6933
    and "between (b,a) (midpoint a b)" (is ?t2)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6934
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6935
  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"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6936
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6937
  show ?t1 ?t2
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6938
    unfolding between midpoint_def dist_norm
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6939
    apply(rule_tac[!] *)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  6940
    unfolding euclidean_eq_iff[where 'a='a]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6941
    apply (auto simp add: field_simps inner_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6942
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6943
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6944
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6945
lemma between_mem_convex_hull:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6946
  "between (a,b) x \<longleftrightarrow> x \<in> convex hull {a,b}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6947
  unfolding between_mem_segment segment_convex_hull ..
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6948
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6949
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  6950
subsection \<open>Shrinking towards the interior of a convex set\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6951
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6952
lemma mem_interior_convex_shrink:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6953
  fixes s :: "'a::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6954
  assumes "convex s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6955
    and "c \<in> interior s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6956
    and "x \<in> s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6957
    and "0 < e"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6958
    and "e \<le> 1"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6959
  shows "x - e *\<^sub>R (x - c) \<in> interior s"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6960
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6961
  obtain d where "d > 0" and d: "ball c d \<subseteq> s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6962
    using assms(2) unfolding mem_interior by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6963
  show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6964
    unfolding mem_interior
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6965
    apply (rule_tac x="e*d" in exI)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6966
    apply rule
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6967
    defer
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6968
    unfolding subset_eq Ball_def mem_ball
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6969
  proof (rule, rule)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6970
    fix y
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6971
    assume as: "dist (x - e *\<^sub>R (x - c)) y < e * d"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6972
    have *: "y = (1 - (1 - e)) *\<^sub>R ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) + (1 - e) *\<^sub>R x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  6973
      using \<open>e > 0\<close> by (auto simp add: scaleR_left_diff_distrib scaleR_right_diff_distrib)
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61880
diff changeset
  6974
    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)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6975
      unfolding dist_norm
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6976
      unfolding norm_scaleR[symmetric]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6977
      apply (rule arg_cong[where f=norm])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  6978
      using \<open>e > 0\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6979
      by (auto simp add: euclidean_eq_iff[where 'a='a] field_simps inner_simps)
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61880
diff changeset
  6980
    also have "\<dots> = \<bar>1/e\<bar> * norm (x - e *\<^sub>R (x - c) - y)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6981
      by (auto intro!:arg_cong[where f=norm] simp add: algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6982
    also have "\<dots> < d"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  6983
      using as[unfolded dist_norm] and \<open>e > 0\<close>
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  6984
      by (auto simp add:pos_divide_less_eq[OF \<open>e > 0\<close>] mult.commute)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6985
    finally show "y \<in> s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6986
      apply (subst *)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6987
      apply (rule assms(1)[unfolded convex_alt,rule_format])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6988
      apply (rule d[unfolded subset_eq,rule_format])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6989
      unfolding mem_ball
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6990
      using assms(3-5)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6991
      apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6992
      done
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  6993
  qed (insert \<open>e>0\<close> \<open>d>0\<close>, auto)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6994
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6995
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6996
lemma mem_interior_closure_convex_shrink:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6997
  fixes s :: "'a::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6998
  assumes "convex s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  6999
    and "c \<in> interior s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7000
    and "x \<in> closure s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7001
    and "0 < e"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7002
    and "e \<le> 1"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7003
  shows "x - e *\<^sub>R (x - c) \<in> interior s"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7004
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7005
  obtain d where "d > 0" and d: "ball c d \<subseteq> s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7006
    using assms(2) unfolding mem_interior by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7007
  have "\<exists>y\<in>s. norm (y - x) * (1 - e) < e * d"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7008
  proof (cases "x \<in> s")
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7009
    case True
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7010
    then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7011
      using \<open>e > 0\<close> \<open>d > 0\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7012
      apply (rule_tac bexI[where x=x])
56544
b60d5d119489 made mult_pos_pos a simp rule
nipkow
parents: 56541
diff changeset
  7013
      apply (auto)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7014
      done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7015
  next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7016
    case False
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7017
    then have x: "x islimpt s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7018
      using assms(3)[unfolded closure_def] by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7019
    show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7020
    proof (cases "e = 1")
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7021
      case True
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7022
      obtain y where "y \<in> s" "y \<noteq> x" "dist y x < 1"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7023
        using x[unfolded islimpt_approachable,THEN spec[where x=1]] by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7024
      then show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7025
        apply (rule_tac x=y in bexI)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7026
        unfolding True
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7027
        using \<open>d > 0\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7028
        apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7029
        done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7030
    next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7031
      case False
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7032
      then have "0 < e * d / (1 - e)" and *: "1 - e > 0"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7033
        using \<open>e \<le> 1\<close> \<open>e > 0\<close> \<open>d > 0\<close> by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7034
      then obtain y where "y \<in> s" "y \<noteq> x" "dist y x < e * d / (1 - e)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7035
        using x[unfolded islimpt_approachable,THEN spec[where x="e*d / (1 - e)"]] by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7036
      then show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7037
        apply (rule_tac x=y in bexI)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7038
        unfolding dist_norm
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7039
        using pos_less_divide_eq[OF *]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7040
        apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7041
        done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7042
    qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7043
  qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7044
  then obtain y where "y \<in> s" and y: "norm (y - x) * (1 - e) < e * d"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7045
    by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  7046
  define z where "z = c + ((1 - e) / e) *\<^sub>R (x - y)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7047
  have *: "x - e *\<^sub>R (x - c) = y - e *\<^sub>R (y - z)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7048
    unfolding z_def using \<open>e > 0\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7049
    by (auto simp add: scaleR_right_diff_distrib scaleR_right_distrib scaleR_left_diff_distrib)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7050
  have "z \<in> interior s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7051
    apply (rule interior_mono[OF d,unfolded subset_eq,rule_format])
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7052
    unfolding interior_open[OF open_ball] mem_ball z_def dist_norm using y and assms(4,5)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7053
    apply (auto simp add:field_simps norm_minus_commute)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7054
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7055
  then show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7056
    unfolding *
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7057
    apply -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7058
    apply (rule mem_interior_convex_shrink)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7059
    using assms(1,4-5) \<open>y\<in>s\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7060
    apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7061
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7062
qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7063
63128
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  7064
lemma in_interior_closure_convex_segment:
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  7065
  fixes S :: "'a::euclidean_space set"
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  7066
  assumes "convex S" and a: "a \<in> interior S" and b: "b \<in> closure S"
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  7067
    shows "open_segment a b \<subseteq> interior S"
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  7068
proof (clarsimp simp: in_segment)
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  7069
  fix u::real
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  7070
  assume u: "0 < u" "u < 1"
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  7071
  have "(1 - u) *\<^sub>R a + u *\<^sub>R b = b - (1 - u) *\<^sub>R (b - a)"
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  7072
    by (simp add: algebra_simps)
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  7073
  also have "... \<in> interior S" using mem_interior_closure_convex_shrink [OF assms] u
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  7074
    by simp
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  7075
  finally show "(1 - u) *\<^sub>R a + u *\<^sub>R b \<in> interior S" .
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  7076
qed
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  7077
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7078
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7079
subsection \<open>Some obvious but surprisingly hard simplex lemmas\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7080
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7081
lemma simplex:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7082
  assumes "finite s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7083
    and "0 \<notin> s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7084
  shows "convex hull (insert 0 s) =
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7085
    {y. (\<exists>u. (\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s \<le> 1 \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y)}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7086
  unfolding convex_hull_finite[OF finite.insertI[OF assms(1)]]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7087
  apply (rule set_eqI, rule)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7088
  unfolding mem_Collect_eq
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7089
  apply (erule_tac[!] exE)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7090
  apply (erule_tac[!] conjE)+
63128
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  7091
  unfolding setsum_clauses(2)[OF \<open>finite s\<close>]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7092
  apply (rule_tac x=u in exI)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7093
  defer
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7094
  apply (rule_tac x="\<lambda>x. if x = 0 then 1 - setsum u s else u x" in exI)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7095
  using assms(2)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7096
  unfolding if_smult and setsum_delta_notmem[OF assms(2)]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7097
  apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7098
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7099
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7100
lemma substd_simplex:
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7101
  assumes d: "d \<subseteq> Basis"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7102
  shows "convex hull (insert 0 d) =
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  7103
    {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)}"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7104
  (is "convex hull (insert 0 ?p) = ?s")
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7105
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7106
  let ?D = d
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7107
  have "0 \<notin> ?p"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7108
    using assms by (auto simp: image_def)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7109
  from d have "finite d"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7110
    by (blast intro: finite_subset finite_Basis)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7111
  show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7112
    unfolding simplex[OF \<open>finite d\<close> \<open>0 \<notin> ?p\<close>]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7113
    apply (rule set_eqI)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7114
    unfolding mem_Collect_eq
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7115
    apply rule
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7116
    apply (elim exE conjE)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7117
    apply (erule_tac[2] conjE)+
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7118
  proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7119
    fix x :: "'a::euclidean_space"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7120
    fix u
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7121
    assume as: "\<forall>x\<in>?D. 0 \<le> u x" "setsum u ?D \<le> 1" "(\<Sum>x\<in>?D. u x *\<^sub>R x) = x"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7122
    have *: "\<forall>i\<in>Basis. i:d \<longrightarrow> u i = x\<bullet>i"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  7123
      and "(\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7124
      using as(3)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7125
      unfolding substdbasis_expansion_unique[OF assms]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7126
      by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7127
    then have **: "setsum u ?D = setsum (op \<bullet> x) ?D"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7128
      apply -
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  7129
      apply (rule setsum.cong)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7130
      using assms
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7131
      apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7132
      done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7133
    have "(\<forall>i\<in>Basis. 0 \<le> x\<bullet>i) \<and> setsum (op \<bullet> x) ?D \<le> 1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7134
    proof (rule,rule)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7135
      fix i :: 'a
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7136
      assume i: "i \<in> Basis"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7137
      have "i \<in> d \<Longrightarrow> 0 \<le> x\<bullet>i"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7138
        unfolding *[rule_format,OF i,symmetric]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7139
         apply (rule_tac as(1)[rule_format])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7140
         apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7141
         done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7142
      moreover have "i \<notin> d \<Longrightarrow> 0 \<le> x\<bullet>i"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7143
        using \<open>(\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0)\<close>[rule_format, OF i] by auto
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7144
      ultimately show "0 \<le> x\<bullet>i" by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7145
    qed (insert as(2)[unfolded **], auto)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7146
    then show "(\<forall>i\<in>Basis. 0 \<le> x\<bullet>i) \<and> setsum (op \<bullet> x) ?D \<le> 1 \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7147
      using \<open>(\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0)\<close> by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7148
  next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7149
    fix x :: "'a::euclidean_space"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7150
    assume as: "\<forall>i\<in>Basis. 0 \<le> x \<bullet> i" "setsum (op \<bullet> x) ?D \<le> 1" "(\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0)"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7151
    show "\<exists>u. (\<forall>x\<in>?D. 0 \<le> u x) \<and> setsum u ?D \<le> 1 \<and> (\<Sum>x\<in>?D. u x *\<^sub>R x) = x"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7152
      using as d
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7153
      unfolding substdbasis_expansion_unique[OF assms]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7154
      apply (rule_tac x="inner x" in exI)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7155
      apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7156
      done
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7157
  qed
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7158
qed
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7159
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7160
lemma std_simplex:
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7161
  "convex hull (insert 0 Basis) =
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7162
    {x::'a::euclidean_space. (\<forall>i\<in>Basis. 0 \<le> x\<bullet>i) \<and> setsum (\<lambda>i. x\<bullet>i) Basis \<le> 1}"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7163
  using substd_simplex[of Basis] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7164
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7165
lemma interior_std_simplex:
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7166
  "interior (convex hull (insert 0 Basis)) =
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7167
    {x::'a::euclidean_space. (\<forall>i\<in>Basis. 0 < x\<bullet>i) \<and> setsum (\<lambda>i. x\<bullet>i) Basis < 1}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7168
  apply (rule set_eqI)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7169
  unfolding mem_interior std_simplex
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7170
  unfolding subset_eq mem_Collect_eq Ball_def mem_ball
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7171
  unfolding Ball_def[symmetric]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7172
  apply rule
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7173
  apply (elim exE conjE)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7174
  defer
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7175
  apply (erule conjE)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7176
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7177
  fix x :: 'a
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7178
  fix e
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7179
  assume "e > 0" and as: "\<forall>xa. dist x xa < e \<longrightarrow> (\<forall>x\<in>Basis. 0 \<le> xa \<bullet> x) \<and> setsum (op \<bullet> xa) Basis \<le> 1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7180
  show "(\<forall>xa\<in>Basis. 0 < x \<bullet> xa) \<and> setsum (op \<bullet> x) Basis < 1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7181
    apply safe
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7182
  proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7183
    fix i :: 'a
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7184
    assume i: "i \<in> Basis"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7185
    then show "0 < x \<bullet> i"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7186
      using as[THEN spec[where x="x - (e / 2) *\<^sub>R i"]] and \<open>e > 0\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7187
      unfolding dist_norm
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7188
      by (auto elim!: ballE[where x=i] simp: inner_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7189
  next
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7190
    have **: "dist x (x + (e / 2) *\<^sub>R (SOME i. i\<in>Basis)) < e" using \<open>e > 0\<close>
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7191
      unfolding dist_norm
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7192
      by (auto intro!: mult_strict_left_mono simp: SOME_Basis)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7193
    have "\<And>i. i \<in> Basis \<Longrightarrow> (x + (e / 2) *\<^sub>R (SOME i. i\<in>Basis)) \<bullet> i =
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7194
      x\<bullet>i + (if i = (SOME i. i\<in>Basis) then e/2 else 0)"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7195
      by (auto simp: SOME_Basis inner_Basis inner_simps)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7196
    then have *: "setsum (op \<bullet> (x + (e / 2) *\<^sub>R (SOME i. i\<in>Basis))) Basis =
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7197
      setsum (\<lambda>i. x\<bullet>i + (if (SOME i. i\<in>Basis) = i then e/2 else 0)) Basis"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  7198
      apply (rule_tac setsum.cong)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7199
      apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7200
      done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7201
    have "setsum (op \<bullet> x) Basis < setsum (op \<bullet> (x + (e / 2) *\<^sub>R (SOME i. i\<in>Basis))) Basis"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  7202
      unfolding * setsum.distrib
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7203
      using \<open>e > 0\<close> DIM_positive[where 'a='a]
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  7204
      apply (subst setsum.delta')
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7205
      apply (auto simp: SOME_Basis)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7206
      done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7207
    also have "\<dots> \<le> 1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7208
      using **
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7209
      apply (drule_tac as[rule_format])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7210
      apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7211
      done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7212
    finally show "setsum (op \<bullet> x) Basis < 1" by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7213
  qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7214
next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7215
  fix x :: 'a
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7216
  assume as: "\<forall>i\<in>Basis. 0 < x \<bullet> i" "setsum (op \<bullet> x) Basis < 1"
55697
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  7217
  obtain a :: 'b where "a \<in> UNIV" using UNIV_witness ..
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7218
  let ?d = "(1 - setsum (op \<bullet> x) Basis) / real (DIM('a))"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7219
  have "Min ((op \<bullet> x) ` Basis) > 0"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7220
    apply (rule Min_grI)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7221
    using as(1)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7222
    apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7223
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7224
  moreover have "?d > 0"
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56536
diff changeset
  7225
    using as(2) by (auto simp: Suc_le_eq DIM_positive)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7226
  ultimately show "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> (\<forall>i\<in>Basis. 0 \<le> y \<bullet> i) \<and> setsum (op \<bullet> y) Basis \<le> 1"
59807
22bc39064290 prefer local fixes;
wenzelm
parents: 58877
diff changeset
  7227
    apply (rule_tac x="min (Min ((op \<bullet> x) ` Basis)) D" for D in exI)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7228
    apply rule
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7229
    defer
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7230
    apply (rule, rule)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7231
  proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7232
    fix y
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7233
    assume y: "dist x y < min (Min (op \<bullet> x ` Basis)) ?d"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7234
    have "setsum (op \<bullet> y) Basis \<le> setsum (\<lambda>i. x\<bullet>i + ?d) Basis"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7235
    proof (rule setsum_mono)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7236
      fix i :: 'a
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7237
      assume i: "i \<in> Basis"
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61880
diff changeset
  7238
      then have "\<bar>y\<bullet>i - x\<bullet>i\<bar> < ?d"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7239
        apply -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7240
        apply (rule le_less_trans)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7241
        using Basis_le_norm[OF i, of "y - x"]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7242
        using y[unfolded min_less_iff_conj dist_norm, THEN conjunct2]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7243
        apply (auto simp add: norm_minus_commute inner_diff_left)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7244
        done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7245
      then show "y \<bullet> i \<le> x \<bullet> i + ?d" by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7246
    qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7247
    also have "\<dots> \<le> 1"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  7248
      unfolding setsum.distrib setsum_constant
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7249
      by (auto simp add: Suc_le_eq)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7250
    finally show "(\<forall>i\<in>Basis. 0 \<le> y \<bullet> i) \<and> setsum (op \<bullet> y) Basis \<le> 1"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7251
    proof safe
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7252
      fix i :: 'a
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7253
      assume i: "i \<in> Basis"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7254
      have "norm (x - y) < x\<bullet>i"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7255
        apply (rule less_le_trans)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7256
        apply (rule y[unfolded min_less_iff_conj dist_norm, THEN conjunct1])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7257
        using i
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7258
        apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7259
        done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7260
      then show "0 \<le> y\<bullet>i"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7261
        using Basis_le_norm[OF i, of "x - y"] and as(1)[rule_format, OF i]
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7262
        by (auto simp: inner_simps)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7263
    qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7264
  qed auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7265
qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7266
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7267
lemma interior_std_simplex_nonempty:
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7268
  obtains a :: "'a::euclidean_space" where
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7269
    "a \<in> interior(convex hull (insert 0 Basis))"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7270
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7271
  let ?D = "Basis :: 'a set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7272
  let ?a = "setsum (\<lambda>b::'a. inverse (2 * real DIM('a)) *\<^sub>R b) Basis"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7273
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7274
    fix i :: 'a
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7275
    assume i: "i \<in> Basis"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7276
    have "?a \<bullet> i = inverse (2 * real DIM('a))"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7277
      by (rule trans[of _ "setsum (\<lambda>j. if i = j then inverse (2 * real DIM('a)) else 0) ?D"])
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  7278
         (simp_all add: setsum.If_cases i) }
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7279
  note ** = this
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7280
  show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7281
    apply (rule that[of ?a])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7282
    unfolding interior_std_simplex mem_Collect_eq
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7283
  proof safe
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7284
    fix i :: 'a
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7285
    assume i: "i \<in> Basis"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7286
    show "0 < ?a \<bullet> i"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7287
      unfolding **[OF i] by (auto simp add: Suc_le_eq DIM_positive)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7288
  next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7289
    have "setsum (op \<bullet> ?a) ?D = setsum (\<lambda>i. inverse (2 * real DIM('a))) ?D"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  7290
      apply (rule setsum.cong)
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  7291
      apply rule
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7292
      apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7293
      done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7294
    also have "\<dots> < 1"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  7295
      unfolding setsum_constant divide_inverse[symmetric]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7296
      by (auto simp add: field_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7297
    finally show "setsum (op \<bullet> ?a) ?D < 1" by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7298
  qed
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7299
qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7300
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7301
lemma rel_interior_substd_simplex:
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7302
  assumes d: "d \<subseteq> Basis"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7303
  shows "rel_interior (convex hull (insert 0 d)) =
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7304
    {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)}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7305
  (is "rel_interior (convex hull (insert 0 ?p)) = ?s")
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7306
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7307
  have "finite d"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7308
    apply (rule finite_subset)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7309
    using assms
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7310
    apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7311
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7312
  show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7313
  proof (cases "d = {}")
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7314
    case True
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7315
    then show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7316
      using rel_interior_sing using euclidean_eq_iff[of _ 0] by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7317
  next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7318
    case False
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7319
    have h0: "affine hull (convex hull (insert 0 ?p)) =
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7320
      {x::'a::euclidean_space. (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0)}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7321
      using affine_hull_convex_hull affine_hull_substd_basis assms by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7322
    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"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7323
      by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7324
    {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7325
      fix x :: "'a::euclidean_space"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7326
      assume x: "x \<in> rel_interior (convex hull (insert 0 ?p))"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7327
      then obtain e where e0: "e > 0" and
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7328
        "ball x e \<inter> {xa. (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> xa\<bullet>i = 0)} \<subseteq> convex hull (insert 0 ?p)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7329
        using mem_rel_interior_ball[of x "convex hull (insert 0 ?p)"] h0 by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7330
      then have as: "\<forall>xa. dist x xa < e \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> xa\<bullet>i = 0) \<longrightarrow>
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7331
        (\<forall>i\<in>d. 0 \<le> xa \<bullet> i) \<and> setsum (op \<bullet> xa) d \<le> 1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7332
        unfolding ball_def unfolding substd_simplex[OF assms] using assms by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7333
      have x0: "(\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7334
        using x rel_interior_subset  substd_simplex[OF assms] by auto
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  7335
      have "(\<forall>i\<in>d. 0 < x \<bullet> i) \<and> setsum (op \<bullet> x) d < 1 \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0)"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  7336
        apply rule
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  7337
        apply rule
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7338
      proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7339
        fix i :: 'a
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7340
        assume "i \<in> d"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7341
        then have "\<forall>ia\<in>d. 0 \<le> (x - (e / 2) *\<^sub>R i) \<bullet> ia"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7342
          apply -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7343
          apply (rule as[rule_format,THEN conjunct1])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7344
          unfolding dist_norm
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7345
          using d \<open>e > 0\<close> x0
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7346
          apply (auto simp: inner_simps inner_Basis)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7347
          done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7348
        then show "0 < x \<bullet> i"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7349
          apply (erule_tac x=i in ballE)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7350
          using \<open>e > 0\<close> \<open>i \<in> d\<close> d
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7351
          apply (auto simp: inner_simps inner_Basis)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7352
          done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7353
      next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7354
        obtain a where a: "a \<in> d"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7355
          using \<open>d \<noteq> {}\<close> by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7356
        then have **: "dist x (x + (e / 2) *\<^sub>R a) < e"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7357
          using \<open>e > 0\<close> norm_Basis[of a] d
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7358
          unfolding dist_norm
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7359
          by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7360
        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)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7361
          using a d by (auto simp: inner_simps inner_Basis)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7362
        then have *: "setsum (op \<bullet> (x + (e / 2) *\<^sub>R a)) d =
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7363
          setsum (\<lambda>i. x\<bullet>i + (if a = i then e/2 else 0)) d"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  7364
          using d by (intro setsum.cong) auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7365
        have "a \<in> Basis"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7366
          using \<open>a \<in> d\<close> d by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7367
        then have h1: "(\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> (x + (e / 2) *\<^sub>R a) \<bullet> i = 0)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7368
          using x0 d \<open>a\<in>d\<close> by (auto simp add: inner_add_left inner_Basis)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7369
        have "setsum (op \<bullet> x) d < setsum (op \<bullet> (x + (e / 2) *\<^sub>R a)) d"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  7370
          unfolding * setsum.distrib
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7371
          using \<open>e > 0\<close> \<open>a \<in> d\<close>
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7372
          using \<open>finite d\<close>
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  7373
          by (auto simp add: setsum.delta')
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7374
        also have "\<dots> \<le> 1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7375
          using ** h1 as[rule_format, of "x + (e / 2) *\<^sub>R a"]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7376
          by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7377
        finally show "setsum (op \<bullet> x) d < 1 \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7378
          using x0 by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7379
      qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7380
    }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7381
    moreover
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7382
    {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7383
      fix x :: "'a::euclidean_space"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7384
      assume as: "x \<in> ?s"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7385
      have "\<forall>i. 0 < x\<bullet>i \<or> 0 = x\<bullet>i \<longrightarrow> 0 \<le> x\<bullet>i"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7386
        by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7387
      moreover have "\<forall>i. i \<in> d \<or> i \<notin> d" by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7388
      ultimately
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  7389
      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"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7390
        by metis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7391
      then have h2: "x \<in> convex hull (insert 0 ?p)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7392
        using as assms
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7393
        unfolding substd_simplex[OF assms] by fastforce
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7394
      obtain a where a: "a \<in> d"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7395
        using \<open>d \<noteq> {}\<close> by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7396
      let ?d = "(1 - setsum (op \<bullet> x) d) / real (card d)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7397
      have "0 < card d" using \<open>d \<noteq> {}\<close> \<open>finite d\<close>
44466
0e5c27f07529 remove unnecessary lemma card_ge1
huffman
parents: 44465
diff changeset
  7398
        by (simp add: card_gt_0_iff)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7399
      have "Min ((op \<bullet> x) ` d) > 0"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7400
        using as \<open>d \<noteq> {}\<close> \<open>finite d\<close> by (simp add: Min_grI)
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7401
      moreover have "?d > 0" using as using \<open>0 < card d\<close> by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7402
      ultimately have h3: "min (Min ((op \<bullet> x) ` d)) ?d > 0"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7403
        by auto
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  7404
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7405
      have "x \<in> rel_interior (convex hull (insert 0 ?p))"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7406
        unfolding rel_interior_ball mem_Collect_eq h0
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7407
        apply (rule,rule h2)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7408
        unfolding substd_simplex[OF assms]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7409
        apply (rule_tac x="min (Min ((op \<bullet> x) ` d)) ?d" in exI)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7410
        apply (rule, rule h3)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7411
        apply safe
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7412
        unfolding mem_ball
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7413
      proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7414
        fix y :: 'a
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7415
        assume y: "dist x y < min (Min (op \<bullet> x ` d)) ?d"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7416
        assume y2: "\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> y\<bullet>i = 0"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7417
        have "setsum (op \<bullet> y) d \<le> setsum (\<lambda>i. x\<bullet>i + ?d) d"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7418
        proof (rule setsum_mono)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7419
          fix i
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7420
          assume "i \<in> d"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7421
          with d have i: "i \<in> Basis"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7422
            by auto
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61880
diff changeset
  7423
          have "\<bar>y\<bullet>i - x\<bullet>i\<bar> < ?d"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7424
            apply (rule le_less_trans)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7425
            using Basis_le_norm[OF i, of "y - x"]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7426
            using y[unfolded min_less_iff_conj dist_norm, THEN conjunct2]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7427
            apply (auto simp add: norm_minus_commute inner_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7428
            done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7429
          then show "y \<bullet> i \<le> x \<bullet> i + ?d" by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7430
        qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7431
        also have "\<dots> \<le> 1"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  7432
          unfolding setsum.distrib setsum_constant  using \<open>0 < card d\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7433
          by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7434
        finally show "setsum (op \<bullet> y) d \<le> 1" .
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  7435
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7436
        fix i :: 'a
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7437
        assume i: "i \<in> Basis"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7438
        then show "0 \<le> y\<bullet>i"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7439
        proof (cases "i\<in>d")
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7440
          case True
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7441
          have "norm (x - y) < x\<bullet>i"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7442
            using y[unfolded min_less_iff_conj dist_norm, THEN conjunct1]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7443
            using Min_gr_iff[of "op \<bullet> x ` d" "norm (x - y)"] \<open>0 < card d\<close> \<open>i:d\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7444
            by (simp add: card_gt_0_iff)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7445
          then show "0 \<le> y\<bullet>i"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7446
            using Basis_le_norm[OF i, of "x - y"] and as(1)[rule_format]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7447
            by (auto simp: inner_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7448
        qed (insert y2, auto)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7449
      qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7450
    }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7451
    ultimately have
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7452
      "\<And>x. x \<in> rel_interior (convex hull insert 0 d) \<longleftrightarrow>
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7453
        x \<in> {x. (\<forall>i\<in>d. 0 < x \<bullet> i) \<and> setsum (op \<bullet> x) d < 1 \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0)}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7454
      by blast
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7455
    then show ?thesis by (rule set_eqI)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7456
  qed
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7457
qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7458
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7459
lemma rel_interior_substd_simplex_nonempty:
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7460
  assumes "d \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7461
    and "d \<subseteq> Basis"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7462
  obtains a :: "'a::euclidean_space"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7463
    where "a \<in> rel_interior (convex hull (insert 0 d))"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7464
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7465
  let ?D = d
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7466
  let ?a = "setsum (\<lambda>b::'a::euclidean_space. inverse (2 * real (card d)) *\<^sub>R b) ?D"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7467
  have "finite d"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7468
    apply (rule finite_subset)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7469
    using assms(2)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7470
    apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7471
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7472
  then have d1: "0 < real (card d)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7473
    using \<open>d \<noteq> {}\<close> by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7474
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7475
    fix i
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7476
    assume "i \<in> d"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7477
    have "?a \<bullet> i = inverse (2 * real (card d))"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7478
      apply (rule trans[of _ "setsum (\<lambda>j. if i = j then inverse (2 * real (card d)) else 0) ?D"])
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7479
      unfolding inner_setsum_left
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  7480
      apply (rule setsum.cong)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7481
      using \<open>i \<in> d\<close> \<open>finite d\<close> setsum.delta'[of d i "(\<lambda>k. inverse (2 * real (card d)))"]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7482
        d1 assms(2)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  7483
      by (auto simp: inner_Basis set_rev_mp[OF _ assms(2)])
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7484
  }
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7485
  note ** = this
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7486
  show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7487
    apply (rule that[of ?a])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7488
    unfolding rel_interior_substd_simplex[OF assms(2)] mem_Collect_eq
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7489
  proof safe
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7490
    fix i
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7491
    assume "i \<in> d"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7492
    have "0 < inverse (2 * real (card d))"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7493
      using d1 by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7494
    also have "\<dots> = ?a \<bullet> i" using **[of i] \<open>i \<in> d\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7495
      by auto
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7496
    finally show "0 < ?a \<bullet> i" by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7497
  next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7498
    have "setsum (op \<bullet> ?a) ?D = setsum (\<lambda>i. inverse (2 * real (card d))) ?D"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  7499
      by (rule setsum.cong) (rule refl, rule **)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7500
    also have "\<dots> < 1"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  7501
      unfolding setsum_constant divide_real_def[symmetric]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7502
      by (auto simp add: field_simps)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7503
    finally show "setsum (op \<bullet> ?a) ?D < 1" by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7504
  next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7505
    fix i
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7506
    assume "i \<in> Basis" and "i \<notin> d"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7507
    have "?a \<in> span d"
56196
32b7eafc5a52 remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents: 56189
diff changeset
  7508
    proof (rule span_setsum[of d "(\<lambda>b. b /\<^sub>R (2 * real (card d)))" d])
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7509
      {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7510
        fix x :: "'a::euclidean_space"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7511
        assume "x \<in> d"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7512
        then have "x \<in> span d"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7513
          using span_superset[of _ "d"] by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7514
        then have "x /\<^sub>R (2 * real (card d)) \<in> span d"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50104
diff changeset
  7515
          using span_mul[of x "d" "(inverse (real (card d)) / 2)"] by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7516
      }
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
  7517
      then show "\<And>x. x\<in>d \<Longrightarrow> x /\<^sub>R (2 * real (card d)) \<in> span d"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7518
        by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7519
    qed
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7520
    then show "?a \<bullet> i = 0 "
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7521
      using \<open>i \<notin> d\<close> unfolding span_substd_basis[OF assms(2)] using \<open>i \<in> Basis\<close> by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7522
  qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7523
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7524
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7525
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7526
subsection \<open>Relative interior of convex set\<close>
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7527
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  7528
lemma rel_interior_convex_nonempty_aux:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7529
  fixes S :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7530
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7531
    and "0 \<in> S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7532
  shows "rel_interior S \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7533
proof (cases "S = {0}")
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7534
  case True
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7535
  then show ?thesis using rel_interior_sing by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7536
next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7537
  case False
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7538
  obtain B where B: "independent B \<and> B \<le> S \<and> S \<le> span B \<and> card B = dim S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7539
    using basis_exists[of S] by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7540
  then have "B \<noteq> {}"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7541
    using B assms \<open>S \<noteq> {0}\<close> span_empty by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7542
  have "insert 0 B \<le> span B"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7543
    using subspace_span[of B] subspace_0[of "span B"] span_inc by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7544
  then have "span (insert 0 B) \<le> span B"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7545
    using span_span[of B] span_mono[of "insert 0 B" "span B"] by blast
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7546
  then have "convex hull insert 0 B \<le> span B"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7547
    using convex_hull_subset_span[of "insert 0 B"] by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7548
  then have "span (convex hull insert 0 B) \<le> span B"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7549
    using span_span[of B] span_mono[of "convex hull insert 0 B" "span B"] by blast
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7550
  then have *: "span (convex hull insert 0 B) = span B"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7551
    using span_mono[of B "convex hull insert 0 B"] hull_subset[of "insert 0 B"] by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7552
  then have "span (convex hull insert 0 B) = span S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7553
    using B span_mono[of B S] span_mono[of S "span B"] span_span[of B] by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7554
  moreover have "0 \<in> affine hull (convex hull insert 0 B)"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7555
    using hull_subset[of "convex hull insert 0 B"] hull_subset[of "insert 0 B"] by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7556
  ultimately have **: "affine hull (convex hull insert 0 B) = affine hull S"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  7557
    using affine_hull_span_0[of "convex hull insert 0 B"] affine_hull_span_0[of "S"]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7558
      assms hull_subset[of S]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7559
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7560
  obtain d and f :: "'n \<Rightarrow> 'n" where
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7561
    fd: "card d = card B" "linear f" "f ` B = d"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7562
      "f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = (0::real)} \<and> inj_on f (span B)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7563
    and d: "d \<subseteq> Basis"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7564
    using basis_to_substdbasis_subspace_isomorphism[of B,OF _ ] B by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7565
  then have "bounded_linear f"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7566
    using linear_conv_bounded_linear by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7567
  have "d \<noteq> {}"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7568
    using fd B \<open>B \<noteq> {}\<close> by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7569
  have "insert 0 d = f ` (insert 0 B)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7570
    using fd linear_0 by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7571
  then have "(convex hull (insert 0 d)) = f ` (convex hull (insert 0 B))"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7572
    using convex_hull_linear_image[of f "(insert 0 d)"]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7573
      convex_hull_linear_image[of f "(insert 0 B)"] \<open>linear f\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7574
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7575
  moreover have "rel_interior (f ` (convex hull insert 0 B)) =
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7576
    f ` rel_interior (convex hull insert 0 B)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7577
    apply (rule  rel_interior_injective_on_span_linear_image[of f "(convex hull insert 0 B)"])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7578
    using \<open>bounded_linear f\<close> fd *
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7579
    apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7580
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7581
  ultimately have "rel_interior (convex hull insert 0 B) \<noteq> {}"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7582
    using rel_interior_substd_simplex_nonempty[OF \<open>d \<noteq> {}\<close> d]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7583
    apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7584
    apply blast
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7585
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7586
  moreover have "convex hull (insert 0 B) \<subseteq> S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7587
    using B assms hull_mono[of "insert 0 B" "S" "convex"] convex_hull_eq
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7588
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7589
  ultimately show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7590
    using subset_rel_interior[of "convex hull insert 0 B" S] ** by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7591
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7592
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  7593
lemma rel_interior_eq_empty:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7594
  fixes S :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7595
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7596
  shows "rel_interior S = {} \<longleftrightarrow> S = {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7597
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7598
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7599
    assume "S \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7600
    then obtain a where "a \<in> S" by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7601
    then have "0 \<in> op + (-a) ` S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7602
      using assms exI[of "(\<lambda>x. x \<in> S \<and> - a + x = 0)" a] by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7603
    then have "rel_interior (op + (-a) ` S) \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7604
      using rel_interior_convex_nonempty_aux[of "op + (-a) ` S"]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7605
        convex_translation[of S "-a"] assms
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7606
      by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7607
    then have "rel_interior S \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7608
      using rel_interior_translation by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7609
  }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7610
  then show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7611
    using rel_interior_empty by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7612
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7613
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7614
lemma convex_rel_interior:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7615
  fixes S :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7616
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7617
  shows "convex (rel_interior S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7618
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7619
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7620
    fix x y and u :: real
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7621
    assume assm: "x \<in> rel_interior S" "y \<in> rel_interior S" "0 \<le> u" "u \<le> 1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7622
    then have "x \<in> S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7623
      using rel_interior_subset by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7624
    have "x - u *\<^sub>R (x-y) \<in> rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7625
    proof (cases "0 = u")
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7626
      case False
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7627
      then have "0 < u" using assm by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7628
      then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7629
        using assm rel_interior_convex_shrink[of S y x u] assms \<open>x \<in> S\<close> by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7630
    next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7631
      case True
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7632
      then show ?thesis using assm by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7633
    qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7634
    then have "(1 - u) *\<^sub>R x + u *\<^sub>R y \<in> rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7635
      by (simp add: algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7636
  }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7637
  then show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7638
    unfolding convex_alt by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7639
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7640
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  7641
lemma convex_closure_rel_interior:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7642
  fixes S :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7643
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7644
  shows "closure (rel_interior S) = closure S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7645
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7646
  have h1: "closure (rel_interior S) \<le> closure S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7647
    using closure_mono[of "rel_interior S" S] rel_interior_subset[of S] by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7648
  show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7649
  proof (cases "S = {}")
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7650
    case False
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7651
    then obtain a where a: "a \<in> rel_interior S"
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  7652
      using rel_interior_eq_empty assms by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7653
    { fix x
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7654
      assume x: "x \<in> closure S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7655
      {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7656
        assume "x = a"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7657
        then have "x \<in> closure (rel_interior S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7658
          using a unfolding closure_def by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7659
      }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7660
      moreover
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7661
      {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7662
        assume "x \<noteq> a"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7663
         {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7664
           fix e :: real
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7665
           assume "e > 0"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  7666
           define e1 where "e1 = min 1 (e/norm (x - a))"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7667
           then have e1: "e1 > 0" "e1 \<le> 1" "e1 * norm (x - a) \<le> e"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7668
             using \<open>x \<noteq> a\<close> \<open>e > 0\<close> le_divide_eq[of e1 e "norm (x - a)"]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7669
             by simp_all
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7670
           then have *: "x - e1 *\<^sub>R (x - a) : rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7671
             using rel_interior_closure_convex_shrink[of S a x e1] assms x a e1_def
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7672
             by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7673
           have "\<exists>y. y \<in> rel_interior S \<and> y \<noteq> x \<and> dist y x \<le> e"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7674
              apply (rule_tac x="x - e1 *\<^sub>R (x - a)" in exI)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7675
              using * e1 dist_norm[of "x - e1 *\<^sub>R (x - a)" x] \<open>x \<noteq> a\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7676
              apply simp
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7677
              done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7678
        }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7679
        then have "x islimpt rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7680
          unfolding islimpt_approachable_le by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7681
        then have "x \<in> closure(rel_interior S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7682
          unfolding closure_def by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7683
      }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7684
      ultimately have "x \<in> closure(rel_interior S)" by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7685
    }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7686
    then show ?thesis using h1 by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7687
  next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7688
    case True
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7689
    then have "rel_interior S = {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7690
      using rel_interior_empty by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7691
    then have "closure (rel_interior S) = {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7692
      using closure_empty by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7693
    with True show ?thesis by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7694
  qed
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7695
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7696
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7697
lemma rel_interior_same_affine_hull:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7698
  fixes S :: "'n::euclidean_space set"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7699
  assumes "convex S"
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7700
  shows "affine hull (rel_interior S) = affine hull S"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7701
  by (metis assms closure_same_affine_hull convex_closure_rel_interior)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7702
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  7703
lemma rel_interior_aff_dim:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7704
  fixes S :: "'n::euclidean_space set"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7705
  assumes "convex S"
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7706
  shows "aff_dim (rel_interior S) = aff_dim S"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7707
  by (metis aff_dim_affine_hull2 assms rel_interior_same_affine_hull)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7708
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7709
lemma rel_interior_rel_interior:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7710
  fixes S :: "'n::euclidean_space set"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7711
  assumes "convex S"
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7712
  shows "rel_interior (rel_interior S) = rel_interior S"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7713
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7714
  have "openin (subtopology euclidean (affine hull (rel_interior S))) (rel_interior S)"
63072
eb5d493a9e03 renamings and refinements
paulson <lp15@cam.ac.uk>
parents: 63040
diff changeset
  7715
    using openin_rel_interior[of S] rel_interior_same_affine_hull[of S] assms by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7716
  then show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7717
    using rel_interior_def by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7718
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7719
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7720
lemma rel_interior_rel_open:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7721
  fixes S :: "'n::euclidean_space set"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7722
  assumes "convex S"
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7723
  shows "rel_open (rel_interior S)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7724
  unfolding rel_open_def using rel_interior_rel_interior assms by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7725
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7726
lemma convex_rel_interior_closure_aux:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7727
  fixes x y z :: "'n::euclidean_space"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7728
  assumes "0 < a" "0 < b" "(a + b) *\<^sub>R z = a *\<^sub>R x + b *\<^sub>R y"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7729
  obtains e where "0 < e" "e \<le> 1" "z = y - e *\<^sub>R (y - x)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7730
proof -
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  7731
  define e where "e = a / (a + b)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7732
  have "z = (1 / (a + b)) *\<^sub>R ((a + b) *\<^sub>R z)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7733
    apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7734
    using assms
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7735
    apply simp
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7736
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7737
  also have "\<dots> = (1 / (a + b)) *\<^sub>R (a *\<^sub>R x + b *\<^sub>R y)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7738
    using assms scaleR_cancel_left[of "1/(a+b)" "(a + b) *\<^sub>R z" "a *\<^sub>R x + b *\<^sub>R y"]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7739
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7740
  also have "\<dots> = y - e *\<^sub>R (y-x)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7741
    using e_def
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7742
    apply (simp add: algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7743
    using scaleR_left_distrib[of "a/(a+b)" "b/(a+b)" y] assms add_divide_distrib[of a b "a+b"]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7744
    apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7745
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7746
  finally have "z = y - e *\<^sub>R (y-x)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7747
    by auto
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56536
diff changeset
  7748
  moreover have "e > 0" using e_def assms by auto
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56536
diff changeset
  7749
  moreover have "e \<le> 1" using e_def assms by auto
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56536
diff changeset
  7750
  ultimately show ?thesis using that[of e] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7751
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7752
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  7753
lemma convex_rel_interior_closure:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7754
  fixes S :: "'n::euclidean_space set"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7755
  assumes "convex S"
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7756
  shows "rel_interior (closure S) = rel_interior S"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7757
proof (cases "S = {}")
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7758
  case True
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7759
  then show ?thesis
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  7760
    using assms rel_interior_eq_empty by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7761
next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7762
  case False
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7763
  have "rel_interior (closure S) \<supseteq> rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7764
    using subset_rel_interior[of S "closure S"] closure_same_affine_hull closure_subset
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7765
    by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7766
  moreover
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7767
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7768
    fix z
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  7769
    assume z: "z \<in> rel_interior (closure S)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7770
    obtain x where x: "x \<in> rel_interior S"
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  7771
      using \<open>S \<noteq> {}\<close> assms rel_interior_eq_empty by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7772
    have "z \<in> rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7773
    proof (cases "x = z")
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7774
      case True
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7775
      then show ?thesis using x by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7776
    next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7777
      case False
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  7778
      obtain e where e: "e > 0" "cball z e \<inter> affine hull closure S \<le> closure S"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7779
        using z rel_interior_cball[of "closure S"] by auto
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56536
diff changeset
  7780
      hence *: "0 < e/norm(z-x)" using e False by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  7781
      define y where "y = z + (e/norm(z-x)) *\<^sub>R (z-x)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7782
      have yball: "y \<in> cball z e"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7783
        using mem_cball y_def dist_norm[of z y] e by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7784
      have "x \<in> affine hull closure S"
62948
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
  7785
        using x rel_interior_subset_closure hull_inc[of x "closure S"] by blast
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7786
      moreover have "z \<in> affine hull closure S"
62948
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
  7787
        using z rel_interior_subset hull_subset[of "closure S"] by blast
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7788
      ultimately have "y \<in> affine hull closure S"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  7789
        using y_def affine_affine_hull[of "closure S"]
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7790
          mem_affine_3_minus [of "affine hull closure S" z z x "e/norm(z-x)"] by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7791
      then have "y \<in> closure S" using e yball by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7792
      have "(1 + (e/norm(z-x))) *\<^sub>R z = (e/norm(z-x)) *\<^sub>R x + y"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  7793
        using y_def by (simp add: algebra_simps)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7794
      then obtain e1 where "0 < e1" "e1 \<le> 1" "z = y - e1 *\<^sub>R (y - x)"
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  7795
        using * convex_rel_interior_closure_aux[of "e / norm (z - x)" 1 z x y]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7796
        by (auto simp add: algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7797
      then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7798
        using rel_interior_closure_convex_shrink assms x \<open>y \<in> closure S\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7799
        by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7800
    qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7801
  }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7802
  ultimately show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7803
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7804
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  7805
lemma convex_interior_closure:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7806
  fixes S :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7807
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7808
  shows "interior (closure S) = interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7809
  using closure_aff_dim[of S] interior_rel_interior_gen[of S]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7810
    interior_rel_interior_gen[of "closure S"]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7811
    convex_rel_interior_closure[of S] assms
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7812
  by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7813
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7814
lemma closure_eq_rel_interior_eq:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7815
  fixes S1 S2 :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7816
  assumes "convex S1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7817
    and "convex S2"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7818
  shows "closure S1 = closure S2 \<longleftrightarrow> rel_interior S1 = rel_interior S2"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7819
  by (metis convex_rel_interior_closure convex_closure_rel_interior assms)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7820
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7821
lemma closure_eq_between:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7822
  fixes S1 S2 :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7823
  assumes "convex S1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7824
    and "convex S2"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7825
  shows "closure S1 = closure S2 \<longleftrightarrow> rel_interior S1 \<le> S2 \<and> S2 \<subseteq> closure S1"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  7826
  (is "?A \<longleftrightarrow> ?B")
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7827
proof
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7828
  assume ?A
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7829
  then show ?B
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7830
    by (metis assms closure_subset convex_rel_interior_closure rel_interior_subset)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7831
next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7832
  assume ?B
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7833
  then have "closure S1 \<subseteq> closure S2"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7834
    by (metis assms(1) convex_closure_rel_interior closure_mono)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  7835
  moreover from \<open>?B\<close> have "closure S1 \<supseteq> closure S2"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7836
    by (metis closed_closure closure_minimal)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7837
  ultimately show ?A ..
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7838
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7839
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7840
lemma open_inter_closure_rel_interior:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7841
  fixes S A :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7842
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7843
    and "open A"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7844
  shows "A \<inter> closure S = {} \<longleftrightarrow> A \<inter> rel_interior S = {}"
62843
313d3b697c9a Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
paulson <lp15@cam.ac.uk>
parents: 62626
diff changeset
  7845
  by (metis assms convex_closure_rel_interior open_Int_closure_eq_empty)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7846
62620
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7847
lemma rel_interior_open_segment:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7848
  fixes a :: "'a :: euclidean_space"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7849
  shows "rel_interior(open_segment a b) = open_segment a b"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7850
proof (cases "a = b")
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7851
  case True then show ?thesis by auto
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7852
next
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7853
  case False then show ?thesis
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7854
    apply (simp add: rel_interior_eq openin_open)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7855
    apply (rule_tac x="ball (inverse 2 *\<^sub>R (a + b)) (norm(b - a) / 2)" in exI)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7856
    apply (simp add: open_segment_as_ball)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7857
    done
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7858
qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7859
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7860
lemma rel_interior_closed_segment:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7861
  fixes a :: "'a :: euclidean_space"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7862
  shows "rel_interior(closed_segment a b) =
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7863
         (if a = b then {a} else open_segment a b)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7864
proof (cases "a = b")
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7865
  case True then show ?thesis by auto
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7866
next
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7867
  case False then show ?thesis
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7868
    by simp
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7869
       (metis closure_open_segment convex_open_segment convex_rel_interior_closure
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7870
              rel_interior_open_segment)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7871
qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7872
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7873
lemmas rel_interior_segment = rel_interior_closed_segment rel_interior_open_segment
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7874
62626
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7875
lemma starlike_convex_tweak_boundary_points:
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7876
  fixes S :: "'a::euclidean_space set"
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7877
  assumes "convex S" "S \<noteq> {}" and ST: "rel_interior S \<subseteq> T" and TS: "T \<subseteq> closure S"
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7878
  shows "starlike T"
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7879
proof -
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7880
  have "rel_interior S \<noteq> {}"
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7881
    by (simp add: assms rel_interior_eq_empty)
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
  7882
  then obtain a where a: "a \<in> rel_interior S"  by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
  7883
  with ST have "a \<in> T"  by blast
62626
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7884
  have *: "\<And>x. x \<in> T \<Longrightarrow> open_segment a x \<subseteq> rel_interior S"
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7885
    apply (rule rel_interior_closure_convex_segment [OF \<open>convex S\<close> a])
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7886
    using assms by blast
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7887
  show ?thesis
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7888
    unfolding starlike_def
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7889
    apply (rule bexI [OF _ \<open>a \<in> T\<close>])
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7890
    apply (simp add: closed_segment_eq_open)
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7891
    apply (intro conjI ballI a \<open>a \<in> T\<close> rel_interior_closure_convex_segment [OF \<open>convex S\<close> a])
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7892
    apply (simp add: order_trans [OF * ST])
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7893
    done
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7894
qed
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7895
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62620
diff changeset
  7896
subsection\<open>The relative frontier of a set\<close>
62620
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  7897
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7898
definition "rel_frontier S = closure S - rel_interior S"
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  7899
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7900
lemma rel_frontier_empty [simp]: "rel_frontier {} = {}"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7901
  by (simp add: rel_frontier_def)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7902
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  7903
lemma rel_frontier_eq_empty:
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  7904
    fixes S :: "'n::euclidean_space set"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  7905
    shows "rel_frontier S = {} \<longleftrightarrow> affine S"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  7906
  apply (simp add: rel_frontier_def)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  7907
  apply (simp add: rel_interior_eq_closure [symmetric])
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  7908
  using rel_interior_subset_closure by blast
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  7909
  
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7910
lemma rel_frontier_sing [simp]:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7911
    fixes a :: "'n::euclidean_space"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7912
    shows "rel_frontier {a} = {}"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7913
  by (simp add: rel_frontier_def)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7914
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  7915
lemma rel_frontier_affine_hull:
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  7916
  fixes S :: "'a::euclidean_space set"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  7917
  shows "rel_frontier S \<subseteq> affine hull S"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  7918
using closure_affine_hull rel_frontier_def by fastforce
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  7919
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7920
lemma rel_frontier_cball [simp]:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7921
    fixes a :: "'n::euclidean_space"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7922
    shows "rel_frontier(cball a r) = (if r = 0 then {} else sphere a r)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7923
proof (cases rule: linorder_cases [of r 0])
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7924
  case less then show ?thesis
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7925
    by (force simp: sphere_def)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7926
next
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7927
  case equal then show ?thesis by simp
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7928
next
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7929
  case greater then show ?thesis
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7930
    apply simp
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7931
    by (metis centre_in_ball empty_iff frontier_cball frontier_def interior_cball interior_rel_interior_gen rel_frontier_def)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7932
qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7933
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  7934
lemma rel_frontier_translation:
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  7935
  fixes a :: "'a::euclidean_space"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  7936
  shows "rel_frontier((\<lambda>x. a + x) ` S) = (\<lambda>x. a + x) ` (rel_frontier S)"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  7937
by (simp add: rel_frontier_def translation_diff rel_interior_translation closure_translation)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  7938
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  7939
lemma closed_affine_hull [iff]:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7940
  fixes S :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7941
  shows "closed (affine hull S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7942
  by (metis affine_affine_hull affine_closed)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7943
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  7944
lemma rel_frontier_nonempty_interior:
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  7945
  fixes S :: "'n::euclidean_space set"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  7946
  shows "interior S \<noteq> {} \<Longrightarrow> rel_frontier S = frontier S"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  7947
by (metis frontier_def interior_rel_interior_gen rel_frontier_def)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  7948
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  7949
lemma rel_frontier_frontier:
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  7950
  fixes S :: "'n::euclidean_space set"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  7951
  shows "affine hull S = UNIV \<Longrightarrow> rel_frontier S = frontier S"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  7952
by (simp add: frontier_def rel_frontier_def rel_interior_interior)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  7953
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
  7954
lemma closed_rel_frontier [iff]:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7955
  fixes S :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7956
  shows "closed (rel_frontier S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7957
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7958
  have *: "closedin (subtopology euclidean (affine hull S)) (closure S - rel_interior S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7959
    apply (rule closedin_diff[of "subtopology euclidean (affine hull S)""closure S" "rel_interior S"])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7960
    using closed_closedin_trans[of "affine hull S" "closure S"] closed_affine_hull[of S]
63072
eb5d493a9e03 renamings and refinements
paulson <lp15@cam.ac.uk>
parents: 63040
diff changeset
  7961
      closure_affine_hull[of S] openin_rel_interior[of S]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7962
    apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7963
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7964
  show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7965
    apply (rule closedin_closed_trans[of "affine hull S" "rel_frontier S"])
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7966
    unfolding rel_frontier_def
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7967
    using * closed_affine_hull
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7968
    apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  7969
    done
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  7970
qed
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  7971
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7972
lemma closed_rel_boundary:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7973
  fixes S :: "'n::euclidean_space set"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7974
  shows "closed S \<Longrightarrow> closed(S - rel_interior S)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7975
by (metis closed_rel_frontier closure_closed rel_frontier_def)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7976
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7977
lemma compact_rel_boundary:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7978
  fixes S :: "'n::euclidean_space set"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7979
  shows "compact S \<Longrightarrow> compact(S - rel_interior S)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7980
by (metis bounded_diff closed_rel_boundary closure_eq compact_closure compact_imp_closed)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7981
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7982
lemma bounded_rel_frontier:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7983
  fixes S :: "'n::euclidean_space set"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7984
  shows "bounded S \<Longrightarrow> bounded(rel_frontier S)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7985
by (simp add: bounded_closure bounded_diff rel_frontier_def)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7986
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7987
lemma compact_rel_frontier_bounded:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7988
  fixes S :: "'n::euclidean_space set"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7989
  shows "bounded S \<Longrightarrow> compact(rel_frontier S)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7990
using bounded_rel_frontier closed_rel_frontier compact_eq_bounded_closed by blast
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7991
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7992
lemma compact_rel_frontier:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7993
  fixes S :: "'n::euclidean_space set"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7994
  shows "compact S \<Longrightarrow> compact(rel_frontier S)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7995
by (meson compact_eq_bounded_closed compact_rel_frontier_bounded)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7996
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7997
lemma convex_same_rel_interior_closure:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7998
  fixes S :: "'n::euclidean_space set"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  7999
  shows "\<lbrakk>convex S; convex T\<rbrakk>
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  8000
         \<Longrightarrow> rel_interior S = rel_interior T \<longleftrightarrow> closure S = closure T"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  8001
by (simp add: closure_eq_rel_interior_eq)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  8002
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  8003
lemma convex_same_rel_interior_closure_straddle:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  8004
  fixes S :: "'n::euclidean_space set"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  8005
  shows "\<lbrakk>convex S; convex T\<rbrakk>
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  8006
         \<Longrightarrow> rel_interior S = rel_interior T \<longleftrightarrow>
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  8007
             rel_interior S \<subseteq> T \<and> T \<subseteq> closure S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
  8008
by (simp add: closure_eq_between convex_same_rel_interior_closure)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8009
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8010
lemma convex_rel_frontier_aff_dim:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8011
  fixes S1 S2 :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8012
  assumes "convex S1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8013
    and "convex S2"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8014
    and "S2 \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8015
    and "S1 \<le> rel_frontier S2"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8016
  shows "aff_dim S1 < aff_dim S2"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8017
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8018
  have "S1 \<subseteq> closure S2"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8019
    using assms unfolding rel_frontier_def by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8020
  then have *: "affine hull S1 \<subseteq> affine hull S2"
62948
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
  8021
    using hull_mono[of "S1" "closure S2"] closure_same_affine_hull[of S2] by blast
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8022
  then have "aff_dim S1 \<le> aff_dim S2"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8023
    using * aff_dim_affine_hull[of S1] aff_dim_affine_hull[of S2]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8024
      aff_dim_subset[of "affine hull S1" "affine hull S2"]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8025
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8026
  moreover
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8027
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8028
    assume eq: "aff_dim S1 = aff_dim S2"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8029
    then have "S1 \<noteq> {}"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8030
      using aff_dim_empty[of S1] aff_dim_empty[of S2] \<open>S2 \<noteq> {}\<close> by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8031
    have **: "affine hull S1 = affine hull S2"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8032
       apply (rule affine_dim_equal)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8033
       using * affine_affine_hull
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8034
       apply auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8035
       using \<open>S1 \<noteq> {}\<close> hull_subset[of S1]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8036
       apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8037
       using eq aff_dim_affine_hull[of S1] aff_dim_affine_hull[of S2]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8038
       apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8039
       done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8040
    obtain a where a: "a \<in> rel_interior S1"
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8041
      using \<open>S1 \<noteq> {}\<close> rel_interior_eq_empty assms by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8042
    obtain T where T: "open T" "a \<in> T \<inter> S1" "T \<inter> affine hull S1 \<subseteq> S1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8043
       using mem_rel_interior[of a S1] a by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8044
    then have "a \<in> T \<inter> closure S2"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8045
      using a assms unfolding rel_frontier_def by auto
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8046
    then obtain b where b: "b \<in> T \<inter> rel_interior S2"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8047
      using open_inter_closure_rel_interior[of S2 T] assms T by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8048
    then have "b \<in> affine hull S1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8049
      using rel_interior_subset hull_subset[of S2] ** by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8050
    then have "b \<in> S1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8051
      using T b by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8052
    then have False
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8053
      using b assms unfolding rel_frontier_def by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8054
  }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8055
  ultimately show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8056
    using less_le by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8057
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8058
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8059
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8060
lemma convex_rel_interior_if:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8061
  fixes S ::  "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8062
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8063
    and "z \<in> rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8064
  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)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8065
proof -
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8066
  obtain e1 where e1: "e1 > 0 \<and> cball z e1 \<inter> affine hull S \<subseteq> S"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8067
    using mem_rel_interior_cball[of z S] assms by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8068
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8069
    fix x
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8070
    assume x: "x \<in> affine hull S"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8071
    {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8072
      assume "x \<noteq> z"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  8073
      define m where "m = 1 + e1/norm(x-z)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8074
      hence "m > 1" using e1 \<open>x \<noteq> z\<close> by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8075
      {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8076
        fix e
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8077
        assume e: "e > 1 \<and> e \<le> m"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8078
        have "z \<in> affine hull S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8079
          using assms rel_interior_subset hull_subset[of S] by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8080
        then have *: "(1 - e)*\<^sub>R x + e *\<^sub>R z \<in> affine hull S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8081
          using mem_affine[of "affine hull S" x z "(1-e)" e] affine_affine_hull[of S] x
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8082
          by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8083
        have "norm (z + e *\<^sub>R x - (x + e *\<^sub>R z)) = norm ((e - 1) *\<^sub>R (x - z))"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8084
          by (simp add: algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8085
        also have "\<dots> = (e - 1) * norm (x-z)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8086
          using norm_scaleR e by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8087
        also have "\<dots> \<le> (m - 1) * norm (x - z)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8088
          using e mult_right_mono[of _ _ "norm(x-z)"] by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8089
        also have "\<dots> = (e1 / norm (x - z)) * norm (x - z)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8090
          using m_def by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8091
        also have "\<dots> = e1"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8092
          using \<open>x \<noteq> z\<close> e1 by simp
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8093
        finally have **: "norm (z + e *\<^sub>R x - (x + e *\<^sub>R z)) \<le> e1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8094
          by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8095
        have "(1 - e)*\<^sub>R x+ e *\<^sub>R z \<in> cball z e1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8096
          using m_def **
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8097
          unfolding cball_def dist_norm
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8098
          by (auto simp add: algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8099
        then have "(1 - e) *\<^sub>R x+ e *\<^sub>R z \<in> S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8100
          using e * e1 by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8101
      }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8102
      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 )"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8103
        using \<open>m> 1 \<close> by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8104
    }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8105
    moreover
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8106
    {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8107
      assume "x = z"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  8108
      define m where "m = 1 + e1"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8109
      then have "m > 1"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8110
        using e1 by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8111
      {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8112
        fix e
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8113
        assume e: "e > 1 \<and> e \<le> m"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8114
        then have "(1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8115
          using e1 x \<open>x = z\<close> by (auto simp add: algebra_simps)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8116
        then have "(1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8117
          using e by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8118
      }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8119
      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)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8120
        using \<open>m > 1\<close> by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8121
    }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8122
    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 )"
62948
7700f467892b lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 62843
diff changeset
  8123
      by blast
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8124
  }
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8125
  then show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8126
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8127
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8128
lemma convex_rel_interior_if2:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8129
  fixes S :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8130
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8131
  assumes "z \<in> rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8132
  shows "\<forall>x\<in>affine hull S. \<exists>e. e > 1 \<and> (1 - e)*\<^sub>R x + e *\<^sub>R z \<in> S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8133
  using convex_rel_interior_if[of S z] assms by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8134
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8135
lemma convex_rel_interior_only_if:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8136
  fixes S :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8137
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8138
    and "S \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8139
  assumes "\<forall>x\<in>S. \<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8140
  shows "z \<in> rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8141
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8142
  obtain x where x: "x \<in> rel_interior S"
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8143
    using rel_interior_eq_empty assms by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8144
  then have "x \<in> S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8145
    using rel_interior_subset by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8146
  then obtain e where e: "e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8147
    using assms by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  8148
  define y where [abs_def]: "y = (1 - e) *\<^sub>R x + e *\<^sub>R z"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8149
  then have "y \<in> S" using e by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  8150
  define e1 where "e1 = 1/e"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8151
  then have "0 < e1 \<and> e1 < 1" using e by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8152
  then have "z  =y - (1 - e1) *\<^sub>R (y - x)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8153
    using e1_def y_def by (auto simp add: algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8154
  then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8155
    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
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8156
    by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8157
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8158
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8159
lemma convex_rel_interior_iff:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8160
  fixes S :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8161
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8162
    and "S \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8163
  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)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8164
  using assms hull_subset[of S "affine"]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8165
    convex_rel_interior_if[of S z] convex_rel_interior_only_if[of S z]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8166
  by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8167
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8168
lemma convex_rel_interior_iff2:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8169
  fixes S :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8170
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8171
    and "S \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8172
  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)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8173
  using assms hull_subset[of S] convex_rel_interior_if2[of S z] convex_rel_interior_only_if[of S z]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8174
  by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8175
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8176
lemma convex_interior_iff:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8177
  fixes S :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8178
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8179
  shows "z \<in> interior S \<longleftrightarrow> (\<forall>x. \<exists>e. e > 0 \<and> z + e *\<^sub>R x \<in> S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8180
proof (cases "aff_dim S = int DIM('n)")
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8181
  case False
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8182
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8183
    assume "z \<in> interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8184
    then have False
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8185
      using False interior_rel_interior_gen[of S] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8186
  }
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8187
  moreover
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8188
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8189
    assume r: "\<forall>x. \<exists>e. e > 0 \<and> z + e *\<^sub>R x \<in> S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8190
    {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8191
      fix x
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8192
      obtain e1 where e1: "e1 > 0 \<and> z + e1 *\<^sub>R (x - z) \<in> S"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8193
        using r by auto
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8194
      obtain e2 where e2: "e2 > 0 \<and> z + e2 *\<^sub>R (z - x) \<in> S"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8195
        using r by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  8196
      define x1 where [abs_def]: "x1 = z + e1 *\<^sub>R (x - z)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8197
      then have x1: "x1 \<in> affine hull S"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8198
        using e1 hull_subset[of S] by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  8199
      define x2 where [abs_def]: "x2 = z + e2 *\<^sub>R (z - x)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8200
      then have x2: "x2 \<in> affine hull S"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8201
        using e2 hull_subset[of S] by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8202
      have *: "e1/(e1+e2) + e2/(e1+e2) = 1"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8203
        using add_divide_distrib[of e1 e2 "e1+e2"] e1 e2 by simp
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8204
      then have "z = (e2/(e1+e2)) *\<^sub>R x1 + (e1/(e1+e2)) *\<^sub>R x2"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8205
        using x1_def x2_def
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8206
        apply (auto simp add: algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8207
        using scaleR_left_distrib[of "e1/(e1+e2)" "e2/(e1+e2)" z]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8208
        apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8209
        done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8210
      then have z: "z \<in> affine hull S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8211
        using mem_affine[of "affine hull S" x1 x2 "e2/(e1+e2)" "e1/(e1+e2)"]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8212
          x1 x2 affine_affine_hull[of S] *
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8213
        by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8214
      have "x1 - x2 = (e1 + e2) *\<^sub>R (x - z)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8215
        using x1_def x2_def by (auto simp add: algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8216
      then have "x = z+(1/(e1+e2)) *\<^sub>R (x1-x2)"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8217
        using e1 e2 by simp
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8218
      then have "x \<in> affine hull S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8219
        using mem_affine_3_minus[of "affine hull S" z x1 x2 "1/(e1+e2)"]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8220
          x1 x2 z affine_affine_hull[of S]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8221
        by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8222
    }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8223
    then have "affine hull S = UNIV"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8224
      by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8225
    then have "aff_dim S = int DIM('n)"
63072
eb5d493a9e03 renamings and refinements
paulson <lp15@cam.ac.uk>
parents: 63040
diff changeset
  8226
      using aff_dim_affine_hull[of S] by (simp add: aff_dim_UNIV)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8227
    then have False
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8228
      using False by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8229
  }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8230
  ultimately show ?thesis by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8231
next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8232
  case True
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8233
  then have "S \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8234
    using aff_dim_empty[of S] by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8235
  have *: "affine hull S = UNIV"
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  8236
    using True affine_hull_UNIV by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8237
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8238
    assume "z \<in> interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8239
    then have "z \<in> rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8240
      using True interior_rel_interior_gen[of S] by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8241
    then have **: "\<forall>x. \<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8242
      using convex_rel_interior_iff2[of S z] assms \<open>S \<noteq> {}\<close> * by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8243
    fix x
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8244
    obtain e1 where e1: "e1 > 1" "(1 - e1) *\<^sub>R (z - x) + e1 *\<^sub>R z \<in> S"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8245
      using **[rule_format, of "z-x"] by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  8246
    define e where [abs_def]: "e = e1 - 1"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8247
    then have "(1 - e1) *\<^sub>R (z - x) + e1 *\<^sub>R z = z + e *\<^sub>R x"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8248
      by (simp add: algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8249
    then have "e > 0" "z + e *\<^sub>R x \<in> S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8250
      using e1 e_def by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8251
    then have "\<exists>e. e > 0 \<and> z + e *\<^sub>R x \<in> S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8252
      by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8253
  }
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8254
  moreover
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8255
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8256
    assume r: "\<forall>x. \<exists>e. e > 0 \<and> z + e *\<^sub>R x \<in> S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8257
    {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8258
      fix x
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8259
      obtain e1 where e1: "e1 > 0" "z + e1 *\<^sub>R (z - x) \<in> S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8260
        using r[rule_format, of "z-x"] by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  8261
      define e where "e = e1 + 1"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8262
      then have "z + e1 *\<^sub>R (z - x) = (1 - e) *\<^sub>R x + e *\<^sub>R z"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8263
        by (simp add: algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8264
      then have "e > 1" "(1 - e)*\<^sub>R x + e *\<^sub>R z \<in> S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8265
        using e1 e_def by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8266
      then have "\<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S" by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8267
    }
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8268
    then have "z \<in> rel_interior S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8269
      using convex_rel_interior_iff2[of S z] assms \<open>S \<noteq> {}\<close> by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8270
    then have "z \<in> interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8271
      using True interior_rel_interior_gen[of S] by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8272
  }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8273
  ultimately show ?thesis by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8274
qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8275
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8276
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8277
subsubsection \<open>Relative interior and closure under common operations\<close>
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8278
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8279
lemma rel_interior_inter_aux: "\<Inter>{rel_interior S |S. S : I} \<subseteq> \<Inter>I"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8280
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8281
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8282
    fix y
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8283
    assume "y \<in> \<Inter>{rel_interior S |S. S : I}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8284
    then have y: "\<forall>S \<in> I. y \<in> rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8285
      by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8286
    {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8287
      fix S
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8288
      assume "S \<in> I"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8289
      then have "y \<in> S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8290
        using rel_interior_subset y by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8291
    }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8292
    then have "y \<in> \<Inter>I" by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8293
  }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8294
  then show ?thesis by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8295
qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8296
63128
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  8297
lemma closure_Int: "closure (\<Inter>I) \<le> \<Inter>{closure S |S. S \<in> I}"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8298
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8299
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8300
    fix y
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8301
    assume "y \<in> \<Inter>I"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8302
    then have y: "\<forall>S \<in> I. y \<in> S" by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8303
    {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8304
      fix S
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8305
      assume "S \<in> I"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8306
      then have "y \<in> closure S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8307
        using closure_subset y by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8308
    }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8309
    then have "y \<in> \<Inter>{closure S |S. S \<in> I}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8310
      by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8311
  }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8312
  then have "\<Inter>I \<subseteq> \<Inter>{closure S |S. S \<in> I}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8313
    by auto
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8314
  moreover have "closed (\<Inter>{closure S |S. S \<in> I})"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8315
    unfolding closed_Inter closed_closure by auto
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8316
  ultimately show ?thesis using closure_hull[of "\<Inter>I"]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8317
    hull_minimal[of "\<Inter>I" "\<Inter>{closure S |S. S \<in> I}" "closed"] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8318
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8319
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  8320
lemma convex_closure_rel_interior_inter:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8321
  assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8322
    and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8323
  shows "\<Inter>{closure S |S. S \<in> I} \<le> closure (\<Inter>{rel_interior S |S. S \<in> I})"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8324
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8325
  obtain x where x: "\<forall>S\<in>I. x \<in> rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8326
    using assms by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8327
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8328
    fix y
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8329
    assume "y \<in> \<Inter>{closure S |S. S \<in> I}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8330
    then have y: "\<forall>S \<in> I. y \<in> closure S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8331
      by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8332
    {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8333
      assume "y = x"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8334
      then have "y \<in> closure (\<Inter>{rel_interior S |S. S \<in> I})"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8335
        using x closure_subset[of "\<Inter>{rel_interior S |S. S \<in> I}"] by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8336
    }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8337
    moreover
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8338
    {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8339
      assume "y \<noteq> x"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8340
      { fix e :: real
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8341
        assume e: "e > 0"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  8342
        define e1 where "e1 = min 1 (e/norm (y - x))"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8343
        then have e1: "e1 > 0" "e1 \<le> 1" "e1 * norm (y - x) \<le> e"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8344
          using \<open>y \<noteq> x\<close> \<open>e > 0\<close> le_divide_eq[of e1 e "norm (y - x)"]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8345
          by simp_all
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  8346
        define z where "z = y - e1 *\<^sub>R (y - x)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8347
        {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8348
          fix S
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8349
          assume "S \<in> I"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8350
          then have "z \<in> rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8351
            using rel_interior_closure_convex_shrink[of S x y e1] assms x y e1 z_def
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8352
            by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8353
        }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8354
        then have *: "z \<in> \<Inter>{rel_interior S |S. S \<in> I}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8355
          by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8356
        have "\<exists>z. z \<in> \<Inter>{rel_interior S |S. S \<in> I} \<and> z \<noteq> y \<and> dist z y \<le> e"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8357
          apply (rule_tac x="z" in exI)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8358
          using \<open>y \<noteq> x\<close> z_def * e1 e dist_norm[of z y]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8359
          apply simp
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8360
          done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8361
      }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8362
      then have "y islimpt \<Inter>{rel_interior S |S. S \<in> I}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8363
        unfolding islimpt_approachable_le by blast
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8364
      then have "y \<in> closure (\<Inter>{rel_interior S |S. S \<in> I})"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8365
        unfolding closure_def by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8366
    }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8367
    ultimately have "y \<in> closure (\<Inter>{rel_interior S |S. S \<in> I})"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8368
      by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8369
  }
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8370
  then show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8371
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8372
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  8373
lemma convex_closure_inter:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8374
  assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8375
    and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8376
  shows "closure (\<Inter>I) = \<Inter>{closure S |S. S \<in> I}"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8377
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8378
  have "\<Inter>{closure S |S. S \<in> I} \<le> closure (\<Inter>{rel_interior S |S. S \<in> I})"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8379
    using convex_closure_rel_interior_inter assms by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8380
  moreover
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60420
diff changeset
  8381
  have "closure (\<Inter>{rel_interior S |S. S \<in> I}) \<le> closure (\<Inter>I)"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8382
    using rel_interior_inter_aux closure_mono[of "\<Inter>{rel_interior S |S. S \<in> I}" "\<Inter>I"]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8383
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8384
  ultimately show ?thesis
63128
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  8385
    using closure_Int[of I] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8386
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8387
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  8388
lemma convex_inter_rel_interior_same_closure:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8389
  assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8390
    and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8391
  shows "closure (\<Inter>{rel_interior S |S. S \<in> I}) = closure (\<Inter>I)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8392
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8393
  have "\<Inter>{closure S |S. S \<in> I} \<le> closure (\<Inter>{rel_interior S |S. S \<in> I})"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8394
    using convex_closure_rel_interior_inter assms by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8395
  moreover
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8396
  have "closure (\<Inter>{rel_interior S |S. S \<in> I}) \<le> closure (\<Inter>I)"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8397
    using rel_interior_inter_aux closure_mono[of "\<Inter>{rel_interior S |S. S \<in> I}" "\<Inter>I"]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8398
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8399
  ultimately show ?thesis
63128
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  8400
    using closure_Int[of I] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8401
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8402
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  8403
lemma convex_rel_interior_inter:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8404
  assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8405
    and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8406
  shows "rel_interior (\<Inter>I) \<subseteq> \<Inter>{rel_interior S |S. S \<in> I}"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8407
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8408
  have "convex (\<Inter>I)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8409
    using assms convex_Inter by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8410
  moreover
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8411
  have "convex (\<Inter>{rel_interior S |S. S \<in> I})"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8412
    apply (rule convex_Inter)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8413
    using assms convex_rel_interior
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8414
    apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8415
    done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8416
  ultimately
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8417
  have "rel_interior (\<Inter>{rel_interior S |S. S \<in> I}) = rel_interior (\<Inter>I)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8418
    using convex_inter_rel_interior_same_closure assms
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8419
      closure_eq_rel_interior_eq[of "\<Inter>{rel_interior S |S. S \<in> I}" "\<Inter>I"]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8420
    by blast
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8421
  then show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8422
    using rel_interior_subset[of "\<Inter>{rel_interior S |S. S \<in> I}"] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8423
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8424
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  8425
lemma convex_rel_interior_finite_inter:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8426
  assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8427
    and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8428
    and "finite I"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8429
  shows "rel_interior (\<Inter>I) = \<Inter>{rel_interior S |S. S \<in> I}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8430
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8431
  have "\<Inter>I \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8432
    using assms rel_interior_inter_aux[of I] by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8433
  have "convex (\<Inter>I)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8434
    using convex_Inter assms by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8435
  show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8436
  proof (cases "I = {}")
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8437
    case True
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8438
    then show ?thesis
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  8439
      using Inter_empty rel_interior_UNIV by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8440
  next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8441
    case False
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8442
    {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8443
      fix z
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8444
      assume z: "z \<in> \<Inter>{rel_interior S |S. S \<in> I}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8445
      {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8446
        fix x
61952
546958347e05 prefer symbols for "Union", "Inter";
wenzelm
parents: 61945
diff changeset
  8447
        assume x: "x \<in> \<Inter>I"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8448
        {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8449
          fix S
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8450
          assume S: "S \<in> I"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8451
          then have "z \<in> rel_interior S" "x \<in> S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8452
            using z x by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8453
          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)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8454
            using convex_rel_interior_if[of S z] S assms hull_subset[of S] by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8455
        }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8456
        then obtain mS where
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8457
          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
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  8458
        define e where "e = Min (mS ` I)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8459
        then have "e \<in> mS ` I" using assms \<open>I \<noteq> {}\<close> by simp
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8460
        then have "e > 1" using mS by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8461
        moreover have "\<forall>S\<in>I. e \<le> mS S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8462
          using e_def assms by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8463
        ultimately have "\<exists>e > 1. (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> \<Inter>I"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8464
          using mS by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8465
      }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8466
      then have "z \<in> rel_interior (\<Inter>I)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8467
        using convex_rel_interior_iff[of "\<Inter>I" z] \<open>\<Inter>I \<noteq> {}\<close> \<open>convex (\<Inter>I)\<close> by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8468
    }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8469
    then show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8470
      using convex_rel_interior_inter[of I] assms by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8471
  qed
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8472
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8473
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  8474
lemma convex_closure_inter_two:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8475
  fixes S T :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8476
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8477
    and "convex T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8478
  assumes "rel_interior S \<inter> rel_interior T \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8479
  shows "closure (S \<inter> T) = closure S \<inter> closure T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8480
  using convex_closure_inter[of "{S,T}"] assms by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8481
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  8482
lemma convex_rel_interior_inter_two:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8483
  fixes S T :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8484
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8485
    and "convex T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8486
    and "rel_interior S \<inter> rel_interior T \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8487
  shows "rel_interior (S \<inter> T) = rel_interior S \<inter> rel_interior T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8488
  using convex_rel_interior_finite_inter[of "{S,T}"] assms by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8489
63128
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  8490
lemma convex_affine_closure_Int:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8491
  fixes S T :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8492
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8493
    and "affine T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8494
    and "rel_interior S \<inter> T \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8495
  shows "closure (S \<inter> T) = closure S \<inter> T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8496
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8497
  have "affine hull T = T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8498
    using assms by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8499
  then have "rel_interior T = T"
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  8500
    using rel_interior_affine_hull[of T] by metis
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8501
  moreover have "closure T = T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8502
    using assms affine_closed[of T] by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8503
  ultimately show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8504
    using convex_closure_inter_two[of S T] assms affine_imp_convex by auto
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  8505
qed
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  8506
62620
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  8507
lemma connected_component_1_gen:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  8508
  fixes S :: "'a :: euclidean_space set"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  8509
  assumes "DIM('a) = 1"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  8510
  shows "connected_component S a b \<longleftrightarrow> closed_segment a b \<subseteq> S"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  8511
unfolding connected_component_def
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  8512
by (metis (no_types, lifting) assms subsetD subsetI convex_contains_segment convex_segment(1)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  8513
            ends_in_segment connected_convex_1_gen)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  8514
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  8515
lemma connected_component_1:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  8516
  fixes S :: "real set"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  8517
  shows "connected_component S a b \<longleftrightarrow> closed_segment a b \<subseteq> S"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  8518
by (simp add: connected_component_1_gen)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  8519
63128
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  8520
lemma convex_affine_rel_interior_Int:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8521
  fixes S T :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8522
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8523
    and "affine T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8524
    and "rel_interior S \<inter> T \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8525
  shows "rel_interior (S \<inter> T) = rel_interior S \<inter> T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8526
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8527
  have "affine hull T = T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8528
    using assms by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8529
  then have "rel_interior T = T"
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  8530
    using rel_interior_affine_hull[of T] by metis
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8531
  moreover have "closure T = T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8532
    using assms affine_closed[of T] by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8533
  ultimately show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8534
    using convex_rel_interior_inter_two[of S T] assms affine_imp_convex by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8535
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8536
63128
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  8537
lemma convex_affine_rel_frontier_Int:
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  8538
   fixes S T :: "'n::euclidean_space set"
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  8539
  assumes "convex S"
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  8540
    and "affine T"
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  8541
    and "interior S \<inter> T \<noteq> {}"
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  8542
  shows "rel_frontier(S \<inter> T) = frontier S \<inter> T"
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  8543
using assms
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  8544
apply (simp add: rel_frontier_def convex_affine_closure_Int frontier_def)
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  8545
by (metis Diff_Int_distrib2 Int_emptyI convex_affine_closure_Int convex_affine_rel_interior_Int empty_iff interior_rel_interior_gen)
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  8546
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8547
lemma subset_rel_interior_convex:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8548
  fixes S T :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8549
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8550
    and "convex T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8551
    and "S \<le> closure T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8552
    and "\<not> S \<subseteq> rel_frontier T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8553
  shows "rel_interior S \<subseteq> rel_interior T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8554
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8555
  have *: "S \<inter> closure T = S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8556
    using assms by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8557
  have "\<not> rel_interior S \<subseteq> rel_frontier T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8558
    using closure_mono[of "rel_interior S" "rel_frontier T"] closed_rel_frontier[of T]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8559
      closure_closed[of S] convex_closure_rel_interior[of S] closure_subset[of S] assms
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8560
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8561
  then have "rel_interior S \<inter> rel_interior (closure T) \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8562
    using assms rel_frontier_def[of T] rel_interior_subset convex_rel_interior_closure[of T]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8563
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8564
  then have "rel_interior S \<inter> rel_interior T = rel_interior (S \<inter> closure T)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8565
    using assms convex_closure convex_rel_interior_inter_two[of S "closure T"]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8566
      convex_rel_interior_closure[of T]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8567
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8568
  also have "\<dots> = rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8569
    using * by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8570
  finally show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8571
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8572
qed
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8573
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8574
lemma rel_interior_convex_linear_image:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8575
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8576
  assumes "linear f"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8577
    and "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8578
  shows "f ` (rel_interior S) = rel_interior (f ` S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8579
proof (cases "S = {}")
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8580
  case True
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8581
  then show ?thesis
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8582
    using assms rel_interior_empty rel_interior_eq_empty by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8583
next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8584
  case False
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8585
  have *: "f ` (rel_interior S) \<subseteq> f ` S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8586
    unfolding image_mono using rel_interior_subset by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8587
  have "f ` S \<subseteq> f ` (closure S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8588
    unfolding image_mono using closure_subset by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8589
  also have "\<dots> = f ` (closure (rel_interior S))"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8590
    using convex_closure_rel_interior assms by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8591
  also have "\<dots> \<subseteq> closure (f ` (rel_interior S))"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  8592
    using closure_linear_image_subset assms by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8593
  finally have "closure (f ` S) = closure (f ` rel_interior S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8594
    using closure_mono[of "f ` S" "closure (f ` rel_interior S)"] closure_closure
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8595
      closure_mono[of "f ` rel_interior S" "f ` S"] *
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8596
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8597
  then have "rel_interior (f ` S) = rel_interior (f ` rel_interior S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8598
    using assms convex_rel_interior
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  8599
      linear_conv_bounded_linear[of f] convex_linear_image[of _ S]
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  8600
      convex_linear_image[of _ "rel_interior S"]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8601
      closure_eq_rel_interior_eq[of "f ` S" "f ` rel_interior S"]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8602
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8603
  then have "rel_interior (f ` S) \<subseteq> f ` rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8604
    using rel_interior_subset by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8605
  moreover
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8606
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8607
    fix z
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8608
    assume "z \<in> f ` rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8609
    then obtain z1 where z1: "z1 \<in> rel_interior S" "f z1 = z" by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8610
    {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8611
      fix x
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8612
      assume "x \<in> f ` S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8613
      then obtain x1 where x1: "x1 \<in> S" "f x1 = x" by auto
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8614
      then obtain e where e: "e > 1" "(1 - e) *\<^sub>R x1 + e *\<^sub>R z1 : S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8615
        using convex_rel_interior_iff[of S z1] \<open>convex S\<close> x1 z1 by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8616
      moreover have "f ((1 - e) *\<^sub>R x1 + e *\<^sub>R z1) = (1 - e) *\<^sub>R x + e *\<^sub>R z"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8617
        using x1 z1 \<open>linear f\<close> by (simp add: linear_add_cmul)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8618
      ultimately have "(1 - e) *\<^sub>R x + e *\<^sub>R z : f ` S"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8619
        using imageI[of "(1 - e) *\<^sub>R x1 + e *\<^sub>R z1" S f] by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8620
      then have "\<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z : f ` S"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8621
        using e by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8622
    }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8623
    then have "z \<in> rel_interior (f ` S)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8624
      using convex_rel_interior_iff[of "f ` S" z] \<open>convex S\<close>
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8625
        \<open>linear f\<close> \<open>S \<noteq> {}\<close> convex_linear_image[of f S]  linear_conv_bounded_linear[of f]
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8626
      by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8627
  }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8628
  ultimately show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8629
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8630
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8631
lemma rel_interior_convex_linear_preimage:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8632
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8633
  assumes "linear f"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8634
    and "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8635
    and "f -` (rel_interior S) \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8636
  shows "rel_interior (f -` S) = f -` (rel_interior S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8637
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8638
  have "S \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8639
    using assms rel_interior_empty by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8640
  have nonemp: "f -` S \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8641
    by (metis assms(3) rel_interior_subset subset_empty vimage_mono)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8642
  then have "S \<inter> (range f) \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8643
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8644
  have conv: "convex (f -` S)"
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  8645
    using convex_linear_vimage assms by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8646
  then have "convex (S \<inter> range f)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8647
    by (metis assms(1) assms(2) convex_Int subspace_UNIV subspace_imp_convex subspace_linear_image)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8648
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8649
    fix z
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8650
    assume "z \<in> f -` (rel_interior S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8651
    then have z: "f z : rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8652
      by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8653
    {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8654
      fix x
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8655
      assume "x \<in> f -` S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8656
      then have "f x \<in> S" by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8657
      then obtain e where e: "e > 1" "(1 - e) *\<^sub>R f x + e *\<^sub>R f z \<in> S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8658
        using convex_rel_interior_iff[of S "f z"] z assms \<open>S \<noteq> {}\<close> by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8659
      moreover have "(1 - e) *\<^sub>R f x + e *\<^sub>R f z = f ((1 - e) *\<^sub>R x + e *\<^sub>R z)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8660
        using \<open>linear f\<close> by (simp add: linear_iff)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8661
      ultimately have "\<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> f -` S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8662
        using e by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8663
    }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8664
    then have "z \<in> rel_interior (f -` S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8665
      using convex_rel_interior_iff[of "f -` S" z] conv nonemp by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8666
  }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8667
  moreover
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8668
  {
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8669
    fix z
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8670
    assume z: "z \<in> rel_interior (f -` S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8671
    {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8672
      fix x
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8673
      assume "x \<in> S \<inter> range f"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8674
      then obtain y where y: "f y = x" "y \<in> f -` S" by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8675
      then obtain e where e: "e > 1" "(1 - e) *\<^sub>R y + e *\<^sub>R z \<in> f -` S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8676
        using convex_rel_interior_iff[of "f -` S" z] z conv by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8677
      moreover have "(1 - e) *\<^sub>R x + e *\<^sub>R f z = f ((1 - e) *\<^sub>R y + e *\<^sub>R z)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8678
        using \<open>linear f\<close> y by (simp add: linear_iff)
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8679
      ultimately have "\<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R f z \<in> S \<inter> range f"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8680
        using e by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8681
    }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8682
    then have "f z \<in> rel_interior (S \<inter> range f)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8683
      using \<open>convex (S \<inter> (range f))\<close> \<open>S \<inter> range f \<noteq> {}\<close>
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8684
        convex_rel_interior_iff[of "S \<inter> (range f)" "f z"]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8685
      by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8686
    moreover have "affine (range f)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8687
      by (metis assms(1) subspace_UNIV subspace_imp_affine subspace_linear_image)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8688
    ultimately have "f z \<in> rel_interior S"
63128
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  8689
      using convex_affine_rel_interior_Int[of S "range f"] assms by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8690
    then have "z \<in> f -` (rel_interior S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8691
      by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8692
  }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8693
  ultimately show ?thesis by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8694
qed
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  8695
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  8696
lemma rel_interior_Times:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8697
  fixes S :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8698
    and T :: "'m::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8699
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8700
    and "convex T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8701
  shows "rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8702
proof -
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 60176
diff changeset
  8703
  { assume "S = {}"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8704
    then have ?thesis
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 60176
diff changeset
  8705
      by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8706
  }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8707
  moreover
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 60176
diff changeset
  8708
  { assume "T = {}"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8709
    then have ?thesis
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 60176
diff changeset
  8710
       by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8711
  }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8712
  moreover
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8713
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8714
    assume "S \<noteq> {}" "T \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8715
    then have ri: "rel_interior S \<noteq> {}" "rel_interior T \<noteq> {}"
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8716
      using rel_interior_eq_empty assms by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8717
    then have "fst -` rel_interior S \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8718
      using fst_vimage_eq_Times[of "rel_interior S"] by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8719
    then have "rel_interior ((fst :: 'n * 'm \<Rightarrow> 'n) -` S) = fst -` rel_interior S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8720
      using fst_linear \<open>convex S\<close> rel_interior_convex_linear_preimage[of fst S] by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8721
    then have s: "rel_interior (S \<times> (UNIV :: 'm set)) = rel_interior S \<times> UNIV"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8722
      by (simp add: fst_vimage_eq_Times)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8723
    from ri have "snd -` rel_interior T \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8724
      using snd_vimage_eq_Times[of "rel_interior T"] by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8725
    then have "rel_interior ((snd :: 'n * 'm \<Rightarrow> 'm) -` T) = snd -` rel_interior T"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8726
      using snd_linear \<open>convex T\<close> rel_interior_convex_linear_preimage[of snd T] by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8727
    then have t: "rel_interior ((UNIV :: 'n set) \<times> T) = UNIV \<times> rel_interior T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8728
      by (simp add: snd_vimage_eq_Times)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8729
    from s t have *: "rel_interior (S \<times> (UNIV :: 'm set)) \<inter> rel_interior ((UNIV :: 'n set) \<times> T) =
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8730
      rel_interior S \<times> rel_interior T" by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8731
    have "S \<times> T = S \<times> (UNIV :: 'm set) \<inter> (UNIV :: 'n set) \<times> T"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8732
      by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8733
    then have "rel_interior (S \<times> T) = rel_interior ((S \<times> (UNIV :: 'm set)) \<inter> ((UNIV :: 'n set) \<times> T))"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8734
      by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8735
    also have "\<dots> = rel_interior (S \<times> (UNIV :: 'm set)) \<inter> rel_interior ((UNIV :: 'n set) \<times> T)"
55787
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  8736
       apply (subst convex_rel_interior_inter_two[of "S \<times> (UNIV :: 'm set)" "(UNIV :: 'n set) \<times> T"])
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  8737
       using * ri assms convex_Times
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8738
       apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8739
       done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8740
    finally have ?thesis using * by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8741
  }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8742
  ultimately show ?thesis by blast
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8743
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8744
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  8745
lemma rel_interior_scaleR:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8746
  fixes S :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8747
  assumes "c \<noteq> 0"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8748
  shows "(op *\<^sub>R c) ` (rel_interior S) = rel_interior ((op *\<^sub>R c) ` S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8749
  using rel_interior_injective_linear_image[of "(op *\<^sub>R c)" S]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8750
    linear_conv_bounded_linear[of "op *\<^sub>R c"] linear_scaleR injective_scaleR[of c] assms
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8751
  by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8752
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  8753
lemma rel_interior_convex_scaleR:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8754
  fixes S :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8755
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8756
  shows "(op *\<^sub>R c) ` (rel_interior S) = rel_interior ((op *\<^sub>R c) ` S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8757
  by (metis assms linear_scaleR rel_interior_convex_linear_image)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8758
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  8759
lemma convex_rel_open_scaleR:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8760
  fixes S :: "'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8761
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8762
    and "rel_open S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8763
  shows "convex ((op *\<^sub>R c) ` S) \<and> rel_open ((op *\<^sub>R c) ` S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8764
  by (metis assms convex_scaling rel_interior_convex_scaleR rel_open_def)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8765
49531
8d68162b7826 tuned whitespace;
wenzelm
parents: 49530
diff changeset
  8766
lemma convex_rel_open_finite_inter:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8767
  assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set) \<and> rel_open S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8768
    and "finite I"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8769
  shows "convex (\<Inter>I) \<and> rel_open (\<Inter>I)"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8770
proof (cases "\<Inter>{rel_interior S |S. S \<in> I} = {}")
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8771
  case True
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8772
  then have "\<Inter>I = {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8773
    using assms unfolding rel_open_def by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8774
  then show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8775
    unfolding rel_open_def using rel_interior_empty by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8776
next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8777
  case False
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8778
  then have "rel_open (\<Inter>I)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8779
    using assms unfolding rel_open_def
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8780
    using convex_rel_interior_finite_inter[of I]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8781
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8782
  then show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8783
    using convex_Inter assms by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8784
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8785
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8786
lemma convex_rel_open_linear_image:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8787
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8788
  assumes "linear f"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8789
    and "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8790
    and "rel_open S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8791
  shows "convex (f ` S) \<and> rel_open (f ` S)"
57865
dcfb33c26f50 tuned proofs -- fewer warnings;
wenzelm
parents: 57512
diff changeset
  8792
  by (metis assms convex_linear_image rel_interior_convex_linear_image rel_open_def)
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8793
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8794
lemma convex_rel_open_linear_preimage:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8795
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8796
  assumes "linear f"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8797
    and "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8798
    and "rel_open S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8799
  shows "convex (f -` S) \<and> rel_open (f -` S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8800
proof (cases "f -` (rel_interior S) = {}")
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8801
  case True
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8802
  then have "f -` S = {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8803
    using assms unfolding rel_open_def by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8804
  then show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8805
    unfolding rel_open_def using rel_interior_empty by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8806
next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8807
  case False
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8808
  then have "rel_open (f -` S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8809
    using assms unfolding rel_open_def
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8810
    using rel_interior_convex_linear_preimage[of f S]
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8811
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8812
  then show ?thesis
53620
3c7f5e7926dc generalized and simplified proofs of several theorems about convex sets
huffman
parents: 53600
diff changeset
  8813
    using convex_linear_vimage assms
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8814
    by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8815
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8816
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8817
lemma rel_interior_projection:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8818
  fixes S :: "('m::euclidean_space \<times> 'n::euclidean_space) set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8819
    and f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8820
  assumes "convex S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8821
    and "f = (\<lambda>y. {z. (y, z) \<in> S})"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8822
  shows "(y, z) \<in> rel_interior S \<longleftrightarrow> (y \<in> rel_interior {y. (f y \<noteq> {})} \<and> z \<in> rel_interior (f y))"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8823
proof -
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8824
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8825
    fix y
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8826
    assume "y \<in> {y. f y \<noteq> {}}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8827
    then obtain z where "(y, z) \<in> S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8828
      using assms by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8829
    then have "\<exists>x. x \<in> S \<and> y = fst x"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8830
      apply (rule_tac x="(y, z)" in exI)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8831
      apply auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8832
      done
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8833
    then obtain x where "x \<in> S" "y = fst x"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8834
      by blast
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8835
    then have "y \<in> fst ` S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8836
      unfolding image_def by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8837
  }
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8838
  then have "fst ` S = {y. f y \<noteq> {}}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8839
    unfolding fst_def using assms by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8840
  then have h1: "fst ` rel_interior S = rel_interior {y. f y \<noteq> {}}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8841
    using rel_interior_convex_linear_image[of fst S] assms fst_linear by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8842
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8843
    fix y
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8844
    assume "y \<in> rel_interior {y. f y \<noteq> {}}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8845
    then have "y \<in> fst ` rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8846
      using h1 by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8847
    then have *: "rel_interior S \<inter> fst -` {y} \<noteq> {}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8848
      by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8849
    moreover have aff: "affine (fst -` {y})"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8850
      unfolding affine_alt by (simp add: algebra_simps)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8851
    ultimately have **: "rel_interior (S \<inter> fst -` {y}) = rel_interior S \<inter> fst -` {y}"
63128
24708cf4ba61 renamings and new material
paulson <lp15@cam.ac.uk>
parents: 63114
diff changeset
  8852
      using convex_affine_rel_interior_Int[of S "fst -` {y}"] assms by auto
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8853
    have conv: "convex (S \<inter> fst -` {y})"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8854
      using convex_Int assms aff affine_imp_convex by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8855
    {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8856
      fix x
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8857
      assume "x \<in> f y"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8858
      then have "(y, x) \<in> S \<inter> (fst -` {y})"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8859
        using assms by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8860
      moreover have "x = snd (y, x)" by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8861
      ultimately have "x \<in> snd ` (S \<inter> fst -` {y})"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8862
        by blast
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8863
    }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8864
    then have "snd ` (S \<inter> fst -` {y}) = f y"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8865
      using assms by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8866
    then have ***: "rel_interior (f y) = snd ` rel_interior (S \<inter> fst -` {y})"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8867
      using rel_interior_convex_linear_image[of snd "S \<inter> fst -` {y}"] snd_linear conv
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8868
      by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8869
    {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8870
      fix z
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8871
      assume "z \<in> rel_interior (f y)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8872
      then have "z \<in> snd ` rel_interior (S \<inter> fst -` {y})"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8873
        using *** by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8874
      moreover have "{y} = fst ` rel_interior (S \<inter> fst -` {y})"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8875
        using * ** rel_interior_subset by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8876
      ultimately have "(y, z) \<in> rel_interior (S \<inter> fst -` {y})"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8877
        by force
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8878
      then have "(y,z) \<in> rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8879
        using ** by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8880
    }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8881
    moreover
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8882
    {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8883
      fix z
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8884
      assume "(y, z) \<in> rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8885
      then have "(y, z) \<in> rel_interior (S \<inter> fst -` {y})"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8886
        using ** by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8887
      then have "z \<in> snd ` rel_interior (S \<inter> fst -` {y})"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8888
        by (metis Range_iff snd_eq_Range)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8889
      then have "z \<in> rel_interior (f y)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8890
        using *** by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8891
    }
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8892
    ultimately have "\<And>z. (y, z) \<in> rel_interior S \<longleftrightarrow> z \<in> rel_interior (f y)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8893
      by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8894
  }
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8895
  then have h2: "\<And>y z. y \<in> rel_interior {t. f t \<noteq> {}} \<Longrightarrow>
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8896
    (y, z) \<in> rel_interior S \<longleftrightarrow> z \<in> rel_interior (f y)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8897
    by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8898
  {
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8899
    fix y z
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8900
    assume asm: "(y, z) \<in> rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8901
    then have "y \<in> fst ` rel_interior S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8902
      by (metis Domain_iff fst_eq_Domain)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8903
    then have "y \<in> rel_interior {t. f t \<noteq> {}}"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8904
      using h1 by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8905
    then have "y \<in> rel_interior {t. f t \<noteq> {}}" and "(z : rel_interior (f y))"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8906
      using h2 asm by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8907
  }
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8908
  then show ?thesis using h2 by blast
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8909
qed
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8910
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  8911
lemma rel_frontier_Times:
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  8912
  fixes S :: "'n::euclidean_space set"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  8913
    and T :: "'m::euclidean_space set"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  8914
  assumes "convex S"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  8915
    and "convex T"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  8916
  shows "rel_frontier S \<times> rel_frontier T \<subseteq> rel_frontier (S \<times> T)"
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  8917
    by (force simp: rel_frontier_def rel_interior_Times assms closure_Times)
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  8918
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8919
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8920
subsubsection \<open>Relative interior of convex cone\<close>
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8921
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8922
lemma cone_rel_interior:
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8923
  fixes S :: "'m::euclidean_space set"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8924
  assumes "cone S"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8925
  shows "cone ({0} \<union> rel_interior S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8926
proof (cases "S = {}")
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8927
  case True
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8928
  then show ?thesis
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8929
    by (simp add: rel_interior_empty cone_0)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8930
next
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8931
  case False
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8932
  then have *: "0 \<in> S \<and> (\<forall>c. c > 0 \<longrightarrow> op *\<^sub>R c ` S = S)"
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8933
    using cone_iff[of S] assms by auto
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8934
  then have *: "0 \<in> ({0} \<union> rel_interior S)"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8935
    and "\<forall>c. c > 0 \<longrightarrow> op *\<^sub>R c ` ({0} \<union> rel_interior S) = ({0} \<union> rel_interior S)"
53348
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8936
    by (auto simp add: rel_interior_scaleR)
0b467fc4e597 tuned proofs;
wenzelm
parents: 53347
diff changeset
  8937
  then show ?thesis
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8938
    using cone_iff[of "{0} \<union> rel_interior S"] by auto
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8939
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8940
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8941
lemma rel_interior_convex_cone_aux:
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8942
  fixes S :: "'m::euclidean_space set"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8943
  assumes "convex S"
55787
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  8944
  shows "(c, x) \<in> rel_interior (cone hull ({(1 :: real)} \<times> S)) \<longleftrightarrow>
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8945
    c > 0 \<and> x \<in> ((op *\<^sub>R c) ` (rel_interior S))"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8946
proof (cases "S = {}")
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8947
  case True
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8948
  then show ?thesis
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8949
    by (simp add: rel_interior_empty cone_hull_empty)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8950
next
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8951
  case False
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8952
  then obtain s where "s \<in> S" by auto
55787
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  8953
  have conv: "convex ({(1 :: real)} \<times> S)"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8954
    using convex_Times[of "{(1 :: real)}" S] assms convex_singleton[of "1 :: real"]
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8955
    by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  8956
  define f where "f y = {z. (y, z) \<in> cone hull ({1 :: real} \<times> S)}" for y
55787
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  8957
  then have *: "(c, x) \<in> rel_interior (cone hull ({(1 :: real)} \<times> S)) =
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8958
    (c \<in> rel_interior {y. f y \<noteq> {}} \<and> x \<in> rel_interior (f c))"
55787
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  8959
    apply (subst rel_interior_projection[of "cone hull ({(1 :: real)} \<times> S)" f c x])
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  8960
    using convex_cone_hull[of "{(1 :: real)} \<times> S"] conv
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8961
    apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8962
    done
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8963
  {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8964
    fix y :: real
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8965
    assume "y \<ge> 0"
55787
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  8966
    then have "y *\<^sub>R (1,s) \<in> cone hull ({1 :: real} \<times> S)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8967
      using cone_hull_expl[of "{(1 :: real)} \<times> S"] \<open>s \<in> S\<close> by auto
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8968
    then have "f y \<noteq> {}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8969
      using f_def by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8970
  }
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8971
  then have "{y. f y \<noteq> {}} = {0..}"
55787
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  8972
    using f_def cone_hull_expl[of "{1 :: real} \<times> S"] by auto
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8973
  then have **: "rel_interior {y. f y \<noteq> {}} = {0<..}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8974
    using rel_interior_real_semiline by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8975
  {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8976
    fix c :: real
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8977
    assume "c > 0"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8978
    then have "f c = (op *\<^sub>R c ` S)"
55787
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  8979
      using f_def cone_hull_expl[of "{1 :: real} \<times> S"] by auto
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8980
    then have "rel_interior (f c) = op *\<^sub>R c ` rel_interior S"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8981
      using rel_interior_convex_scaleR[of S c] assms by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8982
  }
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8983
  then show ?thesis using * ** by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8984
qed
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8985
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  8986
lemma rel_interior_convex_cone:
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8987
  fixes S :: "'m::euclidean_space set"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8988
  assumes "convex S"
55787
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  8989
  shows "rel_interior (cone hull ({1 :: real} \<times> S)) =
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8990
    {(c, c *\<^sub>R x) | c x. c > 0 \<and> x \<in> rel_interior S}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8991
  (is "?lhs = ?rhs")
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8992
proof -
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8993
  {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8994
    fix z
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8995
    assume "z \<in> ?lhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8996
    have *: "z = (fst z, snd z)"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8997
      by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  8998
    have "z \<in> ?rhs"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  8999
      using rel_interior_convex_cone_aux[of S "fst z" "snd z"] assms \<open>z \<in> ?lhs\<close>
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9000
      apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9001
      apply (rule_tac x = "fst z" in exI)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9002
      apply (rule_tac x = x in exI)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9003
      using *
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9004
      apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9005
      done
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9006
  }
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9007
  moreover
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9008
  {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9009
    fix z
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9010
    assume "z \<in> ?rhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9011
    then have "z \<in> ?lhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9012
      using rel_interior_convex_cone_aux[of S "fst z" "snd z"] assms
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9013
      by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9014
  }
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9015
  ultimately show ?thesis by blast
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  9016
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  9017
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  9018
lemma convex_hull_finite_union:
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9019
  assumes "finite I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9020
  assumes "\<forall>i\<in>I. convex (S i) \<and> (S i) \<noteq> {}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9021
  shows "convex hull (\<Union>(S ` I)) =
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9022
    {setsum (\<lambda>i. c i *\<^sub>R s i) I | c s. (\<forall>i\<in>I. c i \<ge> 0) \<and> setsum c I = 1 \<and> (\<forall>i\<in>I. s i \<in> S i)}"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  9023
  (is "?lhs = ?rhs")
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9024
proof -
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9025
  have "?lhs \<supseteq> ?rhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9026
  proof
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9027
    fix x
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9028
    assume "x : ?rhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9029
    then obtain c s where *: "setsum (\<lambda>i. c i *\<^sub>R s i) I = x" "setsum c I = 1"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9030
      "(\<forall>i\<in>I. c i \<ge> 0) \<and> (\<forall>i\<in>I. s i \<in> S i)" by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9031
    then have "\<forall>i\<in>I. s i \<in> convex hull (\<Union>(S ` I))"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9032
      using hull_subset[of "\<Union>(S ` I)" convex] by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9033
    then show "x \<in> ?lhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9034
      unfolding *(1)[symmetric]
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9035
      apply (subst convex_setsum[of I "convex hull \<Union>(S ` I)" c s])
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9036
      using * assms convex_convex_hull
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9037
      apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9038
      done
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9039
  qed
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9040
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9041
  {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9042
    fix i
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9043
    assume "i \<in> I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9044
    with assms have "\<exists>p. p \<in> S i" by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9045
  }
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9046
  then obtain p where p: "\<forall>i\<in>I. p i \<in> S i" by metis
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9047
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9048
  {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9049
    fix i
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9050
    assume "i \<in> I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9051
    {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9052
      fix x
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9053
      assume "x \<in> S i"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  9054
      define c where "c j = (if j = i then 1::real else 0)" for j
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9055
      then have *: "setsum c I = 1"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9056
        using \<open>finite I\<close> \<open>i \<in> I\<close> setsum.delta[of I i "\<lambda>j::'a. 1::real"]
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9057
        by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  9058
      define s where "s j = (if j = i then x else p j)" for j
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9059
      then have "\<forall>j. c j *\<^sub>R s j = (if j = i then x else 0)"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9060
        using c_def by (auto simp add: algebra_simps)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9061
      then have "x = setsum (\<lambda>i. c i *\<^sub>R s i) I"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9062
        using s_def c_def \<open>finite I\<close> \<open>i \<in> I\<close> setsum.delta[of I i "\<lambda>j::'a. x"]
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9063
        by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9064
      then have "x \<in> ?rhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9065
        apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9066
        apply (rule_tac x = c in exI)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9067
        apply (rule_tac x = s in exI)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9068
        using * c_def s_def p \<open>x \<in> S i\<close>
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9069
        apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9070
        done
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  9071
    }
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9072
    then have "?rhs \<supseteq> S i" by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9073
  }
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9074
  then have *: "?rhs \<supseteq> \<Union>(S ` I)" by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9075
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9076
  {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9077
    fix u v :: real
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9078
    assume uv: "u \<ge> 0 \<and> v \<ge> 0 \<and> u + v = 1"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9079
    fix x y
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9080
    assume xy: "x \<in> ?rhs \<and> y \<in> ?rhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9081
    from xy obtain c s where
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9082
      xc: "x = setsum (\<lambda>i. c i *\<^sub>R s i) I \<and> (\<forall>i\<in>I. c i \<ge> 0) \<and> setsum c I = 1 \<and> (\<forall>i\<in>I. s i \<in> S i)"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9083
      by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9084
    from xy obtain d t where
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9085
      yc: "y = setsum (\<lambda>i. d i *\<^sub>R t i) I \<and> (\<forall>i\<in>I. d i \<ge> 0) \<and> setsum d I = 1 \<and> (\<forall>i\<in>I. t i \<in> S i)"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9086
      by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  9087
    define e where "e i = u * c i + v * d i" for i
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9088
    have ge0: "\<forall>i\<in>I. e i \<ge> 0"
56536
aefb4a8da31f made mult_nonneg_nonneg a simp rule
nipkow
parents: 56480
diff changeset
  9089
      using e_def xc yc uv by simp
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9090
    have "setsum (\<lambda>i. u * c i) I = u * setsum c I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9091
      by (simp add: setsum_right_distrib)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9092
    moreover have "setsum (\<lambda>i. v * d i) I = v * setsum d I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9093
      by (simp add: setsum_right_distrib)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9094
    ultimately have sum1: "setsum e I = 1"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  9095
      using e_def xc yc uv by (simp add: setsum.distrib)
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  9096
    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)"
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  9097
      for i
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9098
    {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9099
      fix i
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9100
      assume i: "i \<in> I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9101
      have "q i \<in> S i"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9102
      proof (cases "e i = 0")
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9103
        case True
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9104
        then show ?thesis using i p q_def by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9105
      next
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9106
        case False
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9107
        then show ?thesis
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9108
          using mem_convex_alt[of "S i" "s i" "t i" "u * (c i)" "v * (d i)"]
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9109
            mult_nonneg_nonneg[of u "c i"] mult_nonneg_nonneg[of v "d i"]
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9110
            assms q_def e_def i False xc yc uv
56536
aefb4a8da31f made mult_nonneg_nonneg a simp rule
nipkow
parents: 56480
diff changeset
  9111
          by (auto simp del: mult_nonneg_nonneg)
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9112
      qed
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9113
    }
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9114
    then have qs: "\<forall>i\<in>I. q i \<in> S i" by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9115
    {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9116
      fix i
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9117
      assume i: "i \<in> I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9118
      have "(u * c i) *\<^sub>R s i + (v * d i) *\<^sub>R t i = e i *\<^sub>R q i"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9119
      proof (cases "e i = 0")
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9120
        case True
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9121
        have ge: "u * (c i) \<ge> 0 \<and> v * d i \<ge> 0"
56536
aefb4a8da31f made mult_nonneg_nonneg a simp rule
nipkow
parents: 56480
diff changeset
  9122
          using xc yc uv i by simp
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9123
        moreover from ge have "u * c i \<le> 0 \<and> v * d i \<le> 0"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9124
          using True e_def i by simp
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9125
        ultimately have "u * c i = 0 \<and> v * d i = 0" by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9126
        with True show ?thesis by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9127
      next
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9128
        case False
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9129
        then have "(u * (c i)/(e i))*\<^sub>R (s i)+(v * (d i)/(e i))*\<^sub>R (t i) = q i"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9130
          using q_def by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9131
        then have "e i *\<^sub>R ((u * (c i)/(e i))*\<^sub>R (s i)+(v * (d i)/(e i))*\<^sub>R (t i))
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9132
               = (e i) *\<^sub>R (q i)" by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9133
        with False show ?thesis by (simp add: algebra_simps)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9134
      qed
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9135
    }
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9136
    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"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9137
      by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9138
    have "u *\<^sub>R x + v *\<^sub>R y = setsum (\<lambda>i. (u * c i) *\<^sub>R s i + (v * d i) *\<^sub>R t i) I"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 56889
diff changeset
  9139
      using xc yc by (simp add: algebra_simps scaleR_right.setsum setsum.distrib)
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9140
    also have "\<dots> = setsum (\<lambda>i. e i *\<^sub>R q i) I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9141
      using * by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9142
    finally have "u *\<^sub>R x + v *\<^sub>R y = setsum (\<lambda>i. (e i) *\<^sub>R (q i)) I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9143
      by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9144
    then have "u *\<^sub>R x + v *\<^sub>R y \<in> ?rhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9145
      using ge0 sum1 qs by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9146
  }
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9147
  then have "convex ?rhs" unfolding convex_def by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9148
  then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9149
    using \<open>?lhs \<supseteq> ?rhs\<close> * hull_minimal[of "\<Union>(S ` I)" ?rhs convex]
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9150
    by blast
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  9151
qed
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  9152
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  9153
lemma convex_hull_union_two:
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9154
  fixes S T :: "'m::euclidean_space set"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9155
  assumes "convex S"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9156
    and "S \<noteq> {}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9157
    and "convex T"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9158
    and "T \<noteq> {}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9159
  shows "convex hull (S \<union> T) =
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9160
    {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}"
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  9161
  (is "?lhs = ?rhs")
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9162
proof
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  9163
  define I :: "nat set" where "I = {1, 2}"
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  9164
  define s where "s i = (if i = (1::nat) then S else T)" for i
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9165
  have "\<Union>(s ` I) = S \<union> T"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9166
    using s_def I_def by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9167
  then have "convex hull (\<Union>(s ` I)) = convex hull (S \<union> T)"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9168
    by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9169
  moreover have "convex hull \<Union>(s ` I) =
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9170
    {\<Sum> i\<in>I. c i *\<^sub>R sa i | c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> setsum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9171
      apply (subst convex_hull_finite_union[of I s])
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9172
      using assms s_def I_def
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9173
      apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9174
      done
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9175
  moreover have
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9176
    "{\<Sum>i\<in>I. c i *\<^sub>R sa i | c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> setsum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)} \<le> ?rhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9177
    using s_def I_def by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9178
  ultimately show "?lhs \<subseteq> ?rhs" by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9179
  {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9180
    fix x
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9181
    assume "x \<in> ?rhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9182
    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"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9183
      by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9184
    then have "x \<in> convex hull {s, t}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9185
      using convex_hull_2[of s t] by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9186
    then have "x \<in> convex hull (S \<union> T)"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9187
      using * hull_mono[of "{s, t}" "S \<union> T"] by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9188
  }
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9189
  then show "?lhs \<supseteq> ?rhs" by blast
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9190
qed
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9191
40377
0e5d48096f58 Extend convex analysis by Bogdan Grechuk
hoelzl
parents: 39302
diff changeset
  9192
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9193
subsection \<open>Convexity on direct sums\<close>
40887
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9194
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9195
lemma closure_sum:
55928
2d7582309d73 generalize lemma closure_sum
huffman
parents: 55787
diff changeset
  9196
  fixes S T :: "'a::real_normed_vector set"
47445
69e96e5500df Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
krauss
parents: 47444
diff changeset
  9197
  shows "closure S + closure T \<subseteq> closure (S + T)"
55928
2d7582309d73 generalize lemma closure_sum
huffman
parents: 55787
diff changeset
  9198
  unfolding set_plus_image closure_Times [symmetric] split_def
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  9199
  by (intro closure_bounded_linear_image_subset bounded_linear_add
55928
2d7582309d73 generalize lemma closure_sum
huffman
parents: 55787
diff changeset
  9200
    bounded_linear_fst bounded_linear_snd)
40887
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9201
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9202
lemma rel_interior_sum:
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9203
  fixes S T :: "'n::euclidean_space set"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9204
  assumes "convex S"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9205
    and "convex T"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9206
  shows "rel_interior (S + T) = rel_interior S + rel_interior T"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9207
proof -
55787
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  9208
  have "rel_interior S + rel_interior T = (\<lambda>(x,y). x + y) ` (rel_interior S \<times> rel_interior T)"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9209
    by (simp add: set_plus_image)
55787
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  9210
  also have "\<dots> = (\<lambda>(x,y). x + y) ` rel_interior (S \<times> T)"
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  9211
    using rel_interior_Times assms by auto
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9212
  also have "\<dots> = rel_interior (S + T)"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9213
    using fst_snd_linear convex_Times assms
55787
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  9214
      rel_interior_convex_linear_image[of "(\<lambda>(x,y). x + y)" "S \<times> T"]
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9215
    by (auto simp add: set_plus_image)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9216
  finally show ?thesis ..
40887
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9217
qed
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9218
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9219
lemma rel_interior_sum_gen:
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9220
  fixes S :: "'a \<Rightarrow> 'n::euclidean_space set"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9221
  assumes "\<forall>i\<in>I. convex (S i)"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9222
  shows "rel_interior (setsum S I) = setsum (\<lambda>i. rel_interior (S i)) I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9223
  apply (subst setsum_set_cond_linear[of convex])
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9224
  using rel_interior_sum rel_interior_sing[of "0"] assms
55929
91f245c23bc5 remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents: 55928
diff changeset
  9225
  apply (auto simp add: convex_set_plus)
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9226
  done
40887
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9227
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9228
lemma convex_rel_open_direct_sum:
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9229
  fixes S T :: "'n::euclidean_space set"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9230
  assumes "convex S"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9231
    and "rel_open S"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9232
    and "convex T"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9233
    and "rel_open T"
55787
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  9234
  shows "convex (S \<times> T) \<and> rel_open (S \<times> T)"
63007
aa894a49f77d new theorems about convex hulls, etc.; also, renamed some theorems
paulson <lp15@cam.ac.uk>
parents: 62950
diff changeset
  9235
  by (metis assms convex_Times rel_interior_Times rel_open_def)
40887
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9236
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9237
lemma convex_rel_open_sum:
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9238
  fixes S T :: "'n::euclidean_space set"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9239
  assumes "convex S"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9240
    and "rel_open S"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9241
    and "convex T"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9242
    and "rel_open T"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9243
  shows "convex (S + T) \<and> rel_open (S + T)"
55929
91f245c23bc5 remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents: 55928
diff changeset
  9244
  by (metis assms convex_set_plus rel_interior_sum rel_open_def)
40887
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9245
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9246
lemma convex_hull_finite_union_cones:
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9247
  assumes "finite I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9248
    and "I \<noteq> {}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9249
  assumes "\<forall>i\<in>I. convex (S i) \<and> cone (S i) \<and> S i \<noteq> {}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9250
  shows "convex hull (\<Union>(S ` I)) = setsum S I"
40887
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9251
  (is "?lhs = ?rhs")
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9252
proof -
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9253
  {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9254
    fix x
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9255
    assume "x \<in> ?lhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9256
    then obtain c xs where
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9257
      x: "x = setsum (\<lambda>i. c i *\<^sub>R xs i) I \<and> (\<forall>i\<in>I. c i \<ge> 0) \<and> setsum c I = 1 \<and> (\<forall>i\<in>I. xs i \<in> S i)"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9258
      using convex_hull_finite_union[of I S] assms by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  9259
    define s where "s i = c i *\<^sub>R xs i" for i
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9260
    {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9261
      fix i
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9262
      assume "i \<in> I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9263
      then have "s i \<in> S i"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9264
        using s_def x assms mem_cone[of "S i" "xs i" "c i"] by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9265
    }
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9266
    then have "\<forall>i\<in>I. s i \<in> S i" by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9267
    moreover have "x = setsum s I" using x s_def by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9268
    ultimately have "x \<in> ?rhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9269
      using set_setsum_alt[of I S] assms by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9270
  }
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9271
  moreover
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9272
  {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9273
    fix x
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9274
    assume "x \<in> ?rhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9275
    then obtain s where x: "x = setsum s I \<and> (\<forall>i\<in>I. s i \<in> S i)"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9276
      using set_setsum_alt[of I S] assms by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  9277
    define xs where "xs i = of_nat(card I) *\<^sub>R s i" for i
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9278
    then have "x = setsum (\<lambda>i. ((1 :: real) / of_nat(card I)) *\<^sub>R xs i) I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9279
      using x assms by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9280
    moreover have "\<forall>i\<in>I. xs i \<in> S i"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9281
      using x xs_def assms by (simp add: cone_def)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9282
    moreover have "\<forall>i\<in>I. (1 :: real) / of_nat (card I) \<ge> 0"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9283
      by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9284
    moreover have "setsum (\<lambda>i. (1 :: real) / of_nat (card I)) I = 1"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9285
      using assms by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9286
    ultimately have "x \<in> ?lhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9287
      apply (subst convex_hull_finite_union[of I S])
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9288
      using assms
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9289
      apply blast
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9290
      using assms
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9291
      apply blast
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9292
      apply rule
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9293
      apply (rule_tac x = "(\<lambda>i. (1 :: real) / of_nat (card I))" in exI)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9294
      apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9295
      done
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9296
  }
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9297
  ultimately show ?thesis by auto
40887
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9298
qed
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9299
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9300
lemma convex_hull_union_cones_two:
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9301
  fixes S T :: "'m::euclidean_space set"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9302
  assumes "convex S"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9303
    and "cone S"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9304
    and "S \<noteq> {}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9305
  assumes "convex T"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9306
    and "cone T"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9307
    and "T \<noteq> {}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9308
  shows "convex hull (S \<union> T) = S + T"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9309
proof -
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  9310
  define I :: "nat set" where "I = {1, 2}"
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  9311
  define A where "A i = (if i = (1::nat) then S else T)" for i
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9312
  have "\<Union>(A ` I) = S \<union> T"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9313
    using A_def I_def by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9314
  then have "convex hull (\<Union>(A ` I)) = convex hull (S \<union> T)"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9315
    by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9316
  moreover have "convex hull \<Union>(A ` I) = setsum A I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9317
    apply (subst convex_hull_finite_union_cones[of I A])
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9318
    using assms A_def I_def
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9319
    apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9320
    done
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9321
  moreover have "setsum A I = S + T"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9322
    using A_def I_def
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9323
    unfolding set_plus_def
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9324
    apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9325
    unfolding set_plus_def
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9326
    apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9327
    done
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9328
  ultimately show ?thesis by auto
40887
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9329
qed
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9330
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9331
lemma rel_interior_convex_hull_union:
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9332
  fixes S :: "'a \<Rightarrow> 'n::euclidean_space set"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9333
  assumes "finite I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9334
    and "\<forall>i\<in>I. convex (S i) \<and> S i \<noteq> {}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9335
  shows "rel_interior (convex hull (\<Union>(S ` I))) =
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9336
    {setsum (\<lambda>i. c i *\<^sub>R s i) I | c s. (\<forall>i\<in>I. c i > 0) \<and> setsum c I = 1 \<and>
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9337
      (\<forall>i\<in>I. s i \<in> rel_interior(S i))}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9338
  (is "?lhs = ?rhs")
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9339
proof (cases "I = {}")
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9340
  case True
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9341
  then show ?thesis
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9342
    using convex_hull_empty rel_interior_empty by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9343
next
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9344
  case False
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  9345
  define C0 where "C0 = convex hull (\<Union>(S ` I))"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9346
  have "\<forall>i\<in>I. C0 \<ge> S i"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9347
    unfolding C0_def using hull_subset[of "\<Union>(S ` I)"] by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  9348
  define K0 where "K0 = cone hull ({1 :: real} \<times> C0)"
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  9349
  define K where "K i = cone hull ({1 :: real} \<times> S i)" for i
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9350
  have "\<forall>i\<in>I. K i \<noteq> {}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9351
    unfolding K_def using assms
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9352
    by (simp add: cone_hull_empty_iff[symmetric])
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9353
  {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9354
    fix i
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9355
    assume "i \<in> I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9356
    then have "convex (K i)"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9357
      unfolding K_def
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9358
      apply (subst convex_cone_hull)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9359
      apply (subst convex_Times)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9360
      using assms
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9361
      apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9362
      done
40887
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9363
  }
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9364
  then have convK: "\<forall>i\<in>I. convex (K i)"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9365
    by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9366
  {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9367
    fix i
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9368
    assume "i \<in> I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9369
    then have "K0 \<supseteq> K i"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9370
      unfolding K0_def K_def
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9371
      apply (subst hull_mono)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9372
      using \<open>\<forall>i\<in>I. C0 \<ge> S i\<close>
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9373
      apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9374
      done
40887
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9375
  }
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9376
  then have "K0 \<supseteq> \<Union>(K ` I)" by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9377
  moreover have "convex K0"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9378
    unfolding K0_def
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9379
    apply (subst convex_cone_hull)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9380
    apply (subst convex_Times)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9381
    unfolding C0_def
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9382
    using convex_convex_hull
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9383
    apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9384
    done
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9385
  ultimately have geq: "K0 \<supseteq> convex hull (\<Union>(K ` I))"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9386
    using hull_minimal[of _ "K0" "convex"] by blast
55787
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  9387
  have "\<forall>i\<in>I. K i \<supseteq> {1 :: real} \<times> S i"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9388
    using K_def by (simp add: hull_subset)
55787
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  9389
  then have "\<Union>(K ` I) \<supseteq> {1 :: real} \<times> \<Union>(S ` I)"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9390
    by auto
55787
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  9391
  then have "convex hull \<Union>(K ` I) \<supseteq> convex hull ({1 :: real} \<times> \<Union>(S ` I))"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9392
    by (simp add: hull_mono)
55787
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  9393
  then have "convex hull \<Union>(K ` I) \<supseteq> {1 :: real} \<times> C0"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9394
    unfolding C0_def
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9395
    using convex_hull_Times[of "{(1 :: real)}" "\<Union>(S ` I)"] convex_hull_singleton
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9396
    by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9397
  moreover have "cone (convex hull (\<Union>(K ` I)))"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9398
    apply (subst cone_convex_hull)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9399
    using cone_Union[of "K ` I"]
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9400
    apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9401
    unfolding K_def
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9402
    using cone_cone_hull
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9403
    apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9404
    done
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9405
  ultimately have "convex hull (\<Union>(K ` I)) \<supseteq> K0"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9406
    unfolding K0_def
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60420
diff changeset
  9407
    using hull_minimal[of _ "convex hull (\<Union>(K ` I))" "cone"]
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9408
    by blast
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9409
  then have "K0 = convex hull (\<Union>(K ` I))"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9410
    using geq by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9411
  also have "\<dots> = setsum K I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9412
    apply (subst convex_hull_finite_union_cones[of I K])
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9413
    using assms
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9414
    apply blast
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9415
    using False
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9416
    apply blast
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9417
    unfolding K_def
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9418
    apply rule
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9419
    apply (subst convex_cone_hull)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9420
    apply (subst convex_Times)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9421
    using assms cone_cone_hull \<open>\<forall>i\<in>I. K i \<noteq> {}\<close> K_def
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9422
    apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9423
    done
47444
d21c95af2df7 removed "setsum_set", now subsumed by generic setsum
krauss
parents: 47108
diff changeset
  9424
  finally have "K0 = setsum K I" by auto
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9425
  then have *: "rel_interior K0 = setsum (\<lambda>i. (rel_interior (K i))) I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9426
    using rel_interior_sum_gen[of I K] convK by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9427
  {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9428
    fix x
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9429
    assume "x \<in> ?lhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9430
    then have "(1::real, x) \<in> rel_interior K0"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9431
      using K0_def C0_def rel_interior_convex_cone_aux[of C0 "1::real" x] convex_convex_hull
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9432
      by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9433
    then obtain k where k: "(1::real, x) = setsum k I \<and> (\<forall>i\<in>I. k i \<in> rel_interior (K i))"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9434
      using \<open>finite I\<close> * set_setsum_alt[of I "\<lambda>i. rel_interior (K i)"] by auto
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9435
    {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9436
      fix i
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9437
      assume "i \<in> I"
55787
41a73a41f6c8 more symbols;
wenzelm
parents: 55697
diff changeset
  9438
      then have "convex (S i) \<and> k i \<in> rel_interior (cone hull {1} \<times> S i)"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9439
        using k K_def assms by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9440
      then have "\<exists>ci si. k i = (ci, ci *\<^sub>R si) \<and> 0 < ci \<and> si \<in> rel_interior (S i)"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9441
        using rel_interior_convex_cone[of "S i"] by auto
40887
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9442
    }
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9443
    then obtain c s where
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9444
      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)"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9445
      by metis
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9446
    then have "x = (\<Sum>i\<in>I. c i *\<^sub>R s i) \<and> setsum c I = 1"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9447
      using k by (simp add: setsum_prod)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9448
    then have "x \<in> ?rhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9449
      using k
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9450
      apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9451
      apply (rule_tac x = c in exI)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9452
      apply (rule_tac x = s in exI)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9453
      using cs
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9454
      apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9455
      done
40887
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9456
  }
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9457
  moreover
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9458
  {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9459
    fix x
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9460
    assume "x \<in> ?rhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9461
    then obtain c s where cs: "x = setsum (\<lambda>i. c i *\<^sub>R s i) I \<and>
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9462
        (\<forall>i\<in>I. c i > 0) \<and> setsum c I = 1 \<and> (\<forall>i\<in>I. s i \<in> rel_interior (S i))"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9463
      by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  9464
    define k where "k i = (c i, c i *\<^sub>R s i)" for i
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9465
    {
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9466
      fix i assume "i:I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9467
      then have "k i \<in> rel_interior (K i)"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9468
        using k_def K_def assms cs rel_interior_convex_cone[of "S i"]
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9469
        by auto
40887
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9470
    }
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9471
    then have "(1::real, x) \<in> rel_interior K0"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9472
      using K0_def * set_setsum_alt[of I "(\<lambda>i. rel_interior (K i))"] assms k_def cs
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9473
      apply auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9474
      apply (rule_tac x = k in exI)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9475
      apply (simp add: setsum_prod)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9476
      done
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9477
    then have "x \<in> ?lhs"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9478
      using K0_def C0_def rel_interior_convex_cone_aux[of C0 1 x]
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9479
      by (auto simp add: convex_convex_hull)
40887
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9480
  }
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9481
  ultimately show ?thesis by blast
40887
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9482
qed
ee8d0548c148 Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents: 40719
diff changeset
  9483
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9484
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9485
lemma convex_le_Inf_differential:
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9486
  fixes f :: "real \<Rightarrow> real"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9487
  assumes "convex_on I f"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9488
    and "x \<in> interior I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9489
    and "y \<in> I"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9490
  shows "f y \<ge> f x + Inf ((\<lambda>t. (f x - f t) / (x - t)) ` ({x<..} \<inter> I)) * (y - x)"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9491
  (is "_ \<ge> _ + Inf (?F x) * (y - x)")
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9492
proof (cases rule: linorder_cases)
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9493
  assume "x < y"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9494
  moreover
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9495
  have "open (interior I)" by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9496
  from openE[OF this \<open>x \<in> interior I\<close>]
55697
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  9497
  obtain e where e: "0 < e" "ball x e \<subseteq> interior I" .
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  9498
  moreover define t where "t = min (x + e / 2) ((x + y) / 2)"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9499
  ultimately have "x < t" "t < y" "t \<in> ball x e"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9500
    by (auto simp: dist_real_def field_simps split: split_min)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9501
  with \<open>x \<in> interior I\<close> e interior_subset[of I] have "t \<in> I" "x \<in> I" by auto
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9502
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9503
  have "open (interior I)" by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9504
  from openE[OF this \<open>x \<in> interior I\<close>]
55697
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  9505
  obtain e where "0 < e" "ball x e \<subseteq> interior I" .
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  9506
  moreover define K where "K = x - e / 2"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9507
  with \<open>0 < e\<close> have "K \<in> ball x e" "K < x"
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9508
    by (auto simp: dist_real_def)
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9509
  ultimately have "K \<in> I" "K < x" "x \<in> I"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9510
    using interior_subset[of I] \<open>x \<in> interior I\<close> by auto
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9511
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9512
  have "Inf (?F x) \<le> (f x - f y) / (x - y)"
54258
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  9513
  proof (intro bdd_belowI cInf_lower2)
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9514
    show "(f x - f t) / (x - t) \<in> ?F x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9515
      using \<open>t \<in> I\<close> \<open>x < t\<close> by auto
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9516
    show "(f x - f t) / (x - t) \<le> (f x - f y) / (x - y)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9517
      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>
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9518
      by (rule convex_on_diff)
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9519
  next
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9520
    fix y
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9521
    assume "y \<in> ?F x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9522
    with order_trans[OF convex_on_diff[OF \<open>convex_on I f\<close> \<open>K \<in> I\<close> _ \<open>K < x\<close> _]]
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9523
    show "(f K - f x) / (K - x) \<le> y" by auto
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9524
  qed
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9525
  then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9526
    using \<open>x < y\<close> by (simp add: field_simps)
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9527
next
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9528
  assume "y < x"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9529
  moreover
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9530
  have "open (interior I)" by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9531
  from openE[OF this \<open>x \<in> interior I\<close>]
55697
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  9532
  obtain e where e: "0 < e" "ball x e \<subseteq> interior I" .
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  9533
  moreover define t where "t = x + e / 2"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9534
  ultimately have "x < t" "t \<in> ball x e"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9535
    by (auto simp: dist_real_def field_simps)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9536
  with \<open>x \<in> interior I\<close> e interior_subset[of I] have "t \<in> I" "x \<in> I" by auto
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9537
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9538
  have "(f x - f y) / (x - y) \<le> Inf (?F x)"
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 50979
diff changeset
  9539
  proof (rule cInf_greatest)
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9540
    have "(f x - f y) / (x - y) = (f y - f x) / (y - x)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9541
      using \<open>y < x\<close> by (auto simp: field_simps)
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9542
    also
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9543
    fix z
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9544
    assume "z \<in> ?F x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9545
    with order_trans[OF convex_on_diff[OF \<open>convex_on I f\<close> \<open>y \<in> I\<close> _ \<open>y < x\<close>]]
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9546
    have "(f y - f x) / (y - x) \<le> z"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9547
      by auto
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9548
    finally show "(f x - f y) / (x - y) \<le> z" .
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9549
  next
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9550
    have "open (interior I)" by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9551
    from openE[OF this \<open>x \<in> interior I\<close>]
55697
abec82f4e3e9 tuned proofs;
wenzelm
parents: 54780
diff changeset
  9552
    obtain e where e: "0 < e" "ball x e \<subseteq> interior I" .
54465
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9553
    then have "x + e / 2 \<in> ball x e"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9554
      by (auto simp: dist_real_def)
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9555
    with e interior_subset[of I] have "x + e / 2 \<in> {x<..} \<inter> I"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9556
      by auto
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9557
    then show "?F x \<noteq> {}"
2f7867850cc3 tuned proofs;
wenzelm
parents: 54263
diff changeset
  9558
      by blast
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9559
  qed
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9560
  then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9561
    using \<open>y < x\<close> by (simp add: field_simps)
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
  9562
qed simp
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  9563
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9564
subsection\<open>Explicit formulas for interior and relative interior of convex hull\<close>
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  9565
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  9566
lemma interior_atLeastAtMost [simp]:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  9567
  fixes a::real shows "interior {a..b} = {a<..<b}"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  9568
  using interior_cbox [of a b] by auto
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  9569
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  9570
lemma interior_atLeastLessThan [simp]:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  9571
  fixes a::real shows "interior {a..<b} = {a<..<b}"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  9572
  by (metis atLeastLessThan_def greaterThanLessThan_def interior_atLeastAtMost interior_Int interior_interior interior_real_semiline)
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  9573
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  9574
lemma interior_lessThanAtMost [simp]:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  9575
  fixes a::real shows "interior {a<..b} = {a<..<b}"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  9576
  by (metis atLeastAtMost_def greaterThanAtMost_def interior_atLeastAtMost interior_Int
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  9577
            interior_interior interior_real_semiline)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  9578
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  9579
lemma at_within_closed_interval:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  9580
    fixes x::real
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  9581
    shows "a < x \<Longrightarrow> x < b \<Longrightarrow> (at x within {a..b}) = at x"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  9582
  by (metis at_within_interior greaterThanLessThan_iff interior_atLeastAtMost)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
  9583
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9584
lemma affine_independent_convex_affine_hull:
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9585
  fixes s :: "'a::euclidean_space set"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9586
  assumes "~affine_dependent s" "t \<subseteq> s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9587
    shows "convex hull t = affine hull t \<inter> convex hull s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9588
proof -
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9589
  have fin: "finite s" "finite t" using assms aff_independent_finite finite_subset by auto
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9590
    { fix u v x
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9591
      assume uv: "setsum u t = 1" "\<forall>x\<in>s. 0 \<le> v x" "setsum v s = 1"
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9592
                 "(\<Sum>x\<in>s. v x *\<^sub>R x) = (\<Sum>v\<in>t. u v *\<^sub>R v)" "x \<in> t"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61762
diff changeset
  9593
      then have s: "s = (s - t) \<union> t" \<comment>\<open>split into separate cases\<close>
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9594
        using assms by auto
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9595
      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)"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9596
                   "setsum v t + setsum v (s - t) = 1"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9597
        using uv fin s
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9598
        by (auto simp: setsum.union_disjoint [symmetric] Un_commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9599
      have "(\<Sum>x\<in>s. if x \<in> t then v x - u x else v x) = 0"
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9600
           "(\<Sum>x\<in>s. (if x \<in> t then v x - u x else v x) *\<^sub>R x) = 0"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9601
        using uv fin
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9602
        by (subst s, subst setsum.union_disjoint, auto simp: algebra_simps setsum_subtractf)+
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9603
    } note [simp] = this
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9604
  have "convex hull t \<subseteq> affine hull t"
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9605
    using convex_hull_subset_affine_hull by blast
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9606
  moreover have "convex hull t \<subseteq> convex hull s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9607
    using assms hull_mono by blast
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9608
  moreover have "affine hull t \<inter> convex hull s \<subseteq> convex hull t"
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9609
    using assms
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9610
    apply (simp add: convex_hull_finite affine_hull_finite fin affine_dependent_explicit)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9611
    apply (drule_tac x=s in spec)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9612
    apply (auto simp: fin)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9613
    apply (rule_tac x=u in exI)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9614
    apply (rename_tac v)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9615
    apply (drule_tac x="\<lambda>x. if x \<in> t then v x - u x else v x" in spec)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9616
    apply (force)+
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9617
    done
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9618
  ultimately show ?thesis
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9619
    by blast
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9620
qed
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9621
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9622
lemma affine_independent_span_eq:
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9623
  fixes s :: "'a::euclidean_space set"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9624
  assumes "~affine_dependent s" "card s = Suc (DIM ('a))"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9625
    shows "affine hull s = UNIV"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9626
proof (cases "s = {}")
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9627
  case True then show ?thesis
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9628
    using assms by simp
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9629
next
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9630
  case False
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9631
    then obtain a t where t: "a \<notin> t" "s = insert a t"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9632
      by blast
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9633
    then have fin: "finite t" using assms
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9634
      by (metis finite_insert aff_independent_finite)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9635
    show ?thesis
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9636
    using assms t fin
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9637
      apply (simp add: affine_dependent_iff_dependent affine_hull_insert_span_gen)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9638
      apply (rule subset_antisym)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9639
      apply force
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9640
      apply (rule Fun.vimage_subsetD)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9641
      apply (metis add.commute diff_add_cancel surj_def)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9642
      apply (rule card_ge_dim_independent)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9643
      apply (auto simp: card_image inj_on_def dim_subset_UNIV)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9644
      done
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9645
qed
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9646
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9647
lemma affine_independent_span_gt:
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9648
  fixes s :: "'a::euclidean_space set"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9649
  assumes ind: "~ affine_dependent s" and dim: "DIM ('a) < card s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9650
    shows "affine hull s = UNIV"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9651
  apply (rule affine_independent_span_eq [OF ind])
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9652
  apply (rule antisym)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9653
  using assms
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9654
  apply auto
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9655
  apply (metis add_2_eq_Suc' not_less_eq_eq affine_dependent_biggerset aff_independent_finite)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9656
  done
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9657
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9658
lemma empty_interior_affine_hull:
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9659
  fixes s :: "'a::euclidean_space set"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9660
  assumes "finite s" and dim: "card s \<le> DIM ('a)"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9661
    shows "interior(affine hull s) = {}"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9662
  using assms
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9663
  apply (induct s rule: finite_induct)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9664
  apply (simp_all add:  affine_dependent_iff_dependent affine_hull_insert_span_gen interior_translation)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9665
  apply (rule empty_interior_lowdim)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9666
  apply (simp add: affine_dependent_iff_dependent affine_hull_insert_span_gen)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9667
  apply (metis Suc_le_lessD not_less order_trans card_image_le finite_imageI dim_le_card)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9668
  done
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9669
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9670
lemma empty_interior_convex_hull:
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9671
  fixes s :: "'a::euclidean_space set"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9672
  assumes "finite s" and dim: "card s \<le> DIM ('a)"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9673
    shows "interior(convex hull s) = {}"
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9674
  by (metis Diff_empty Diff_eq_empty_iff convex_hull_subset_affine_hull
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9675
            interior_mono empty_interior_affine_hull [OF assms])
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9676
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9677
lemma explicit_subset_rel_interior_convex_hull:
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9678
  fixes s :: "'a::euclidean_space set"
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9679
  shows "finite s
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9680
         \<Longrightarrow> {y. \<exists>u. (\<forall>x \<in> s. 0 < u x \<and> u x < 1) \<and> setsum u s = 1 \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y}
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9681
             \<subseteq> rel_interior (convex hull s)"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9682
  by (force simp add:  rel_interior_convex_hull_union [where S="\<lambda>x. {x}" and I=s, simplified])
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9683
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9684
lemma explicit_subset_rel_interior_convex_hull_minimal:
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9685
  fixes s :: "'a::euclidean_space set"
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9686
  shows "finite s
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9687
         \<Longrightarrow> {y. \<exists>u. (\<forall>x \<in> s. 0 < u x) \<and> setsum u s = 1 \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y}
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9688
             \<subseteq> rel_interior (convex hull s)"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9689
  by (force simp add:  rel_interior_convex_hull_union [where S="\<lambda>x. {x}" and I=s, simplified])
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9690
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9691
lemma rel_interior_convex_hull_explicit:
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9692
  fixes s :: "'a::euclidean_space set"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9693
  assumes "~ affine_dependent s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9694
  shows "rel_interior(convex hull s) =
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9695
         {y. \<exists>u. (\<forall>x \<in> s. 0 < u x) \<and> setsum u s = 1 \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y}"
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9696
         (is "?lhs = ?rhs")
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9697
proof
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9698
  show "?rhs \<le> ?lhs"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9699
    by (simp add: aff_independent_finite explicit_subset_rel_interior_convex_hull_minimal assms)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9700
next
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9701
  show "?lhs \<le> ?rhs"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9702
  proof (cases "\<exists>a. s = {a}")
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9703
    case True then show "?lhs \<le> ?rhs"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9704
      by force
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9705
  next
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9706
    case False
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9707
    have fs: "finite s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9708
      using assms by (simp add: aff_independent_finite)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9709
    { fix a b and d::real
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9710
      assume ab: "a \<in> s" "b \<in> s" "a \<noteq> b"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61762
diff changeset
  9711
      then have s: "s = (s - {a,b}) \<union> {a,b}" \<comment>\<open>split into separate cases\<close>
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9712
        by auto
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9713
      have "(\<Sum>x\<in>s. if x = a then - d else if x = b then d else 0) = 0"
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9714
           "(\<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"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9715
        using ab fs
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9716
        by (subst s, subst setsum.union_disjoint, auto)+
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9717
    } note [simp] = this
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9718
    { fix y
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9719
      assume y: "y \<in> convex hull s" "y \<notin> ?rhs"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9720
      { fix u T a
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9721
        assume ua: "\<forall>x\<in>s. 0 \<le> u x" "setsum u s = 1" "\<not> 0 < u a" "a \<in> s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9722
           and yT: "y = (\<Sum>x\<in>s. u x *\<^sub>R x)" "y \<in> T" "open T"
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9723
           and sb: "T \<inter> affine hull s \<subseteq> {w. \<exists>u. (\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s = 1 \<and> (\<Sum>x\<in>s. u x *\<^sub>R x) = w}"
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9724
        have ua0: "u a = 0"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9725
          using ua by auto
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9726
        obtain b where b: "b\<in>s" "a \<noteq> b"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9727
          using ua False by auto
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9728
        obtain e where e: "0 < e" "ball (\<Sum>x\<in>s. u x *\<^sub>R x) e \<subseteq> T"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9729
          using yT by (auto elim: openE)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9730
        with b obtain d where d: "0 < d" "norm(d *\<^sub>R (a-b)) < e"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9731
          by (auto intro: that [of "e / 2 / norm(a-b)"])
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9732
        have "(\<Sum>x\<in>s. u x *\<^sub>R x) \<in> affine hull s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9733
          using yT y by (metis affine_hull_convex_hull hull_redundant_eq)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9734
        then have "(\<Sum>x\<in>s. u x *\<^sub>R x) - d *\<^sub>R (a - b) \<in> affine hull s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9735
          using ua b by (auto simp: hull_inc intro: mem_affine_3_minus2)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9736
        then have "y - d *\<^sub>R (a - b) \<in> T \<inter> affine hull s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9737
          using d e yT by auto
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9738
        then obtain v where "\<forall>x\<in>s. 0 \<le> v x"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9739
                            "setsum v s = 1"
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9740
                            "(\<Sum>x\<in>s. v x *\<^sub>R x) = (\<Sum>x\<in>s. u x *\<^sub>R x) - d *\<^sub>R (a - b)"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9741
          using subsetD [OF sb] yT
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9742
          by auto
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9743
        then have False
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9744
          using assms
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9745
          apply (simp add: affine_dependent_explicit_finite fs)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9746
          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)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9747
          using ua b d
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9748
          apply (auto simp: algebra_simps setsum_subtractf setsum.distrib)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9749
          done
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9750
      } note * = this
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9751
      have "y \<notin> rel_interior (convex hull s)"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9752
        using y
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9753
        apply (simp add: mem_rel_interior affine_hull_convex_hull)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9754
        apply (auto simp: convex_hull_finite [OF fs])
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9755
        apply (drule_tac x=u in spec)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9756
        apply (auto intro: *)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9757
        done
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9758
    } with rel_interior_subset show "?lhs \<le> ?rhs"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9759
      by blast
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9760
  qed
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9761
qed
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9762
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9763
lemma interior_convex_hull_explicit_minimal:
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9764
  fixes s :: "'a::euclidean_space set"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9765
  shows
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9766
   "~ affine_dependent s
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9767
        ==> interior(convex hull s) =
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9768
             (if card(s) \<le> DIM('a) then {}
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9769
              else {y. \<exists>u. (\<forall>x \<in> s. 0 < u x) \<and> setsum u s = 1 \<and> (\<Sum>x\<in>s. u x *\<^sub>R x) = y})"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9770
  apply (simp add: aff_independent_finite empty_interior_convex_hull, clarify)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9771
  apply (rule trans [of _ "rel_interior(convex hull s)"])
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9772
  apply (simp add: affine_hull_convex_hull affine_independent_span_gt rel_interior_interior)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9773
  by (simp add: rel_interior_convex_hull_explicit)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9774
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9775
lemma interior_convex_hull_explicit:
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9776
  fixes s :: "'a::euclidean_space set"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9777
  assumes "~ affine_dependent s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9778
  shows
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9779
   "interior(convex hull s) =
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9780
             (if card(s) \<le> DIM('a) then {}
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9781
              else {y. \<exists>u. (\<forall>x \<in> s. 0 < u x \<and> u x < 1) \<and> setsum u s = 1 \<and> (\<Sum>x\<in>s. u x *\<^sub>R x) = y})"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9782
proof -
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9783
  { fix u :: "'a \<Rightarrow> real" and a
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9784
    assume "card Basis < card s" and u: "\<And>x. x\<in>s \<Longrightarrow> 0 < u x" "setsum u s = 1" and a: "a \<in> s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9785
    then have cs: "Suc 0 < card s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9786
      by (metis DIM_positive less_trans_Suc)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9787
    obtain b where b: "b \<in> s" "a \<noteq> b"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9788
    proof (cases "s \<le> {a}")
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9789
      case True
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9790
      then show thesis
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9791
        using cs subset_singletonD by fastforce
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9792
    next
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9793
      case False
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9794
      then show thesis
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9795
      by (blast intro: that)
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9796
    qed
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9797
    have "u a + u b \<le> setsum u {a,b}"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9798
      using a b by simp
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9799
    also have "... \<le> setsum u s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9800
      apply (rule Groups_Big.setsum_mono2)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9801
      using a b u
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9802
      apply (auto simp: less_imp_le aff_independent_finite assms)
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9803
      done
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9804
    finally have "u a < 1"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9805
      using \<open>b \<in> s\<close> u by fastforce
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9806
  } note [simp] = this
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9807
  show ?thesis
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9808
    using assms
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9809
    apply (auto simp: interior_convex_hull_explicit_minimal)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9810
    apply (rule_tac x=u in exI)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9811
    apply (auto simp: not_le)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9812
    done
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9813
qed
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9814
62620
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9815
lemma interior_closed_segment_ge2:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9816
  fixes a :: "'a::euclidean_space"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9817
  assumes "2 \<le> DIM('a)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9818
    shows  "interior(closed_segment a b) = {}"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9819
using assms unfolding segment_convex_hull
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9820
proof -
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9821
  have "card {a, b} \<le> DIM('a)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9822
    using assms
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9823
    by (simp add: card_insert_if linear not_less_eq_eq numeral_2_eq_2)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9824
  then show "interior (convex hull {a, b}) = {}"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9825
    by (metis empty_interior_convex_hull finite.insertI finite.emptyI)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9826
qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9827
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9828
lemma interior_open_segment:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9829
  fixes a :: "'a::euclidean_space"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9830
  shows  "interior(open_segment a b) =
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9831
                 (if 2 \<le> DIM('a) then {} else open_segment a b)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9832
proof (simp add: not_le, intro conjI impI)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9833
  assume "2 \<le> DIM('a)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9834
  then show "interior (open_segment a b) = {}"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9835
    apply (simp add: segment_convex_hull open_segment_def)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9836
    apply (metis Diff_subset interior_mono segment_convex_hull subset_empty interior_closed_segment_ge2)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9837
    done
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9838
next
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9839
  assume le2: "DIM('a) < 2"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9840
  show "interior (open_segment a b) = open_segment a b"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9841
  proof (cases "a = b")
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9842
    case True then show ?thesis by auto
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9843
  next
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9844
    case False
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9845
    with le2 have "affine hull (open_segment a b) = UNIV"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9846
      apply simp
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9847
      apply (rule affine_independent_span_gt)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9848
      apply (simp_all add: affine_dependent_def insert_Diff_if)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9849
      done
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9850
    then show "interior (open_segment a b) = open_segment a b"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9851
      using rel_interior_interior rel_interior_open_segment by blast
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9852
  qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9853
qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9854
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9855
lemma interior_closed_segment:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9856
  fixes a :: "'a::euclidean_space"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9857
  shows "interior(closed_segment a b) =
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9858
                 (if 2 \<le> DIM('a) then {} else open_segment a b)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9859
proof (cases "a = b")
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9860
  case True then show ?thesis by simp
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9861
next
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9862
  case False
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9863
  then have "closure (open_segment a b) = closed_segment a b"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9864
    by simp
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9865
  then show ?thesis
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9866
    by (metis (no_types) convex_interior_closure convex_open_segment interior_open_segment)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9867
qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9868
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9869
lemmas interior_segment = interior_closed_segment interior_open_segment
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9870
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9871
lemma closed_segment_eq [simp]:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9872
  fixes a :: "'a::euclidean_space"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9873
  shows "closed_segment a b = closed_segment c d \<longleftrightarrow> {a,b} = {c,d}"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9874
proof
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9875
  assume abcd: "closed_segment a b = closed_segment c d"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9876
  show "{a,b} = {c,d}"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9877
  proof (cases "a=b \<or> c=d")
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9878
    case True with abcd show ?thesis by force
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9879
  next
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9880
    case False
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9881
    then have neq: "a \<noteq> b \<and> c \<noteq> d" by force
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9882
    have *: "closed_segment c d - {a, b} = rel_interior (closed_segment c d)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9883
      using neq abcd by (metis (no_types) open_segment_def rel_interior_closed_segment)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9884
    have "b \<in> {c, d}"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9885
    proof -
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9886
      have "insert b (closed_segment c d) = closed_segment c d"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9887
        using abcd by blast
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9888
      then show ?thesis
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9889
        by (metis DiffD2 Diff_insert2 False * insertI1 insert_Diff_if open_segment_def rel_interior_closed_segment)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9890
    qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9891
    moreover have "a \<in> {c, d}"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9892
      by (metis Diff_iff False * abcd ends_in_segment(1) insertI1 open_segment_def rel_interior_closed_segment)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9893
    ultimately show "{a, b} = {c, d}"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9894
      using neq by fastforce
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9895
  qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9896
next
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9897
  assume "{a,b} = {c,d}"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9898
  then show "closed_segment a b = closed_segment c d"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9899
    by (simp add: segment_convex_hull)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9900
qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9901
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9902
lemma closed_open_segment_eq [simp]:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9903
  fixes a :: "'a::euclidean_space"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9904
  shows "closed_segment a b \<noteq> open_segment c d"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9905
by (metis DiffE closed_segment_neq_empty closure_closed_segment closure_open_segment ends_in_segment(1) insertI1 open_segment_def)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9906
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9907
lemma open_closed_segment_eq [simp]:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9908
  fixes a :: "'a::euclidean_space"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9909
  shows "open_segment a b \<noteq> closed_segment c d"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9910
using closed_open_segment_eq by blast
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9911
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9912
lemma open_segment_eq [simp]:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9913
  fixes a :: "'a::euclidean_space"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9914
  shows "open_segment a b = open_segment c d \<longleftrightarrow> a = b \<and> c = d \<or> {a,b} = {c,d}"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9915
        (is "?lhs = ?rhs")
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9916
proof
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9917
  assume abcd: ?lhs
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9918
  show ?rhs
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9919
  proof (cases "a=b \<or> c=d")
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9920
    case True with abcd show ?thesis
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9921
      using finite_open_segment by fastforce
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9922
  next
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9923
    case False
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9924
    then have a2: "a \<noteq> b \<and> c \<noteq> d" by force
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9925
    with abcd show ?rhs
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9926
      unfolding open_segment_def
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9927
      by (metis (no_types) abcd closed_segment_eq closure_open_segment)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9928
  qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9929
next
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9930
  assume ?rhs
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9931
  then show ?lhs
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9932
    by (metis Diff_cancel convex_hull_singleton insert_absorb2 open_segment_def segment_convex_hull)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9933
qed
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
  9934
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60307
diff changeset
  9935
subsection\<open>Similar results for closure and (relative or absolute) frontier.\<close>
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9936
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9937
lemma closure_convex_hull [simp]:
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9938
  fixes s :: "'a::euclidean_space set"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9939
  shows "compact s ==> closure(convex hull s) = convex hull s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9940
  by (simp add: compact_imp_closed compact_convex_hull)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9941
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9942
lemma rel_frontier_convex_hull_explicit:
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9943
  fixes s :: "'a::euclidean_space set"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9944
  assumes "~ affine_dependent s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9945
  shows "rel_frontier(convex hull s) =
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9946
         {y. \<exists>u. (\<forall>x \<in> s. 0 \<le> u x) \<and> (\<exists>x \<in> s. u x = 0) \<and> setsum u s = 1 \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y}"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9947
proof -
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9948
  have fs: "finite s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9949
    using assms by (simp add: aff_independent_finite)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9950
  show ?thesis
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9951
    apply (simp add: rel_frontier_def finite_imp_compact rel_interior_convex_hull_explicit assms fs)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9952
    apply (auto simp: convex_hull_finite fs)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9953
    apply (drule_tac x=u in spec)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9954
    apply (rule_tac x=u in exI)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9955
    apply force
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9956
    apply (rename_tac v)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9957
    apply (rule notE [OF assms])
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9958
    apply (simp add: affine_dependent_explicit)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9959
    apply (rule_tac x=s in exI)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9960
    apply (auto simp: fs)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9961
    apply (rule_tac x = "\<lambda>x. u x - v x" in exI)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9962
    apply (force simp: setsum_subtractf scaleR_diff_left)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9963
    done
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9964
qed
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9965
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9966
lemma frontier_convex_hull_explicit:
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9967
  fixes s :: "'a::euclidean_space set"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9968
  assumes "~ affine_dependent s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9969
  shows "frontier(convex hull s) =
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9970
         {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>
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9971
             setsum u s = 1 \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y}"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9972
proof -
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9973
  have fs: "finite s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9974
    using assms by (simp add: aff_independent_finite)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9975
  show ?thesis
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9976
  proof (cases "DIM ('a) < card s")
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9977
    case True
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9978
    with assms fs show ?thesis
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  9979
      by (simp add: rel_frontier_def frontier_def rel_frontier_convex_hull_explicit [symmetric]
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9980
                    interior_convex_hull_explicit_minimal rel_interior_convex_hull_explicit)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9981
  next
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9982
    case False
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9983
    then have "card s \<le> DIM ('a)"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9984
      by linarith
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9985
    then show ?thesis
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9986
      using assms fs
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9987
      apply (simp add: frontier_def interior_convex_hull_explicit finite_imp_compact)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9988
      apply (simp add: convex_hull_finite)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9989
      done
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9990
  qed
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9991
qed
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9992
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9993
lemma rel_frontier_convex_hull_cases:
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9994
  fixes s :: "'a::euclidean_space set"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9995
  assumes "~ affine_dependent s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9996
  shows "rel_frontier(convex hull s) = \<Union>{convex hull (s - {x}) |x. x \<in> s}"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9997
proof -
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9998
  have fs: "finite s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
  9999
    using assms by (simp add: aff_independent_finite)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10000
  { fix u a
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10001
  have "\<forall>x\<in>s. 0 \<le> u x \<Longrightarrow> a \<in> s \<Longrightarrow> u a = 0 \<Longrightarrow> setsum u s = 1 \<Longrightarrow>
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10002
            \<exists>x v. x \<in> s \<and>
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10003
                  (\<forall>x\<in>s - {x}. 0 \<le> v x) \<and>
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10004
                      setsum v (s - {x}) = 1 \<and> (\<Sum>x\<in>s - {x}. v x *\<^sub>R x) = (\<Sum>x\<in>s. u x *\<^sub>R x)"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10005
    apply (rule_tac x=a in exI)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10006
    apply (rule_tac x=u in exI)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10007
    apply (simp add: Groups_Big.setsum_diff1 fs)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10008
    done }
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
 10009
  moreover
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10010
  { fix a u
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10011
    have "a \<in> s \<Longrightarrow> \<forall>x\<in>s - {a}. 0 \<le> u x \<Longrightarrow> setsum u (s - {a}) = 1 \<Longrightarrow>
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10012
            \<exists>v. (\<forall>x\<in>s. 0 \<le> v x) \<and>
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10013
                 (\<exists>x\<in>s. v x = 0) \<and> setsum v s = 1 \<and> (\<Sum>x\<in>s. v x *\<^sub>R x) = (\<Sum>x\<in>s - {a}. u x *\<^sub>R x)"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10014
    apply (rule_tac x="\<lambda>x. if x = a then 0 else u x" in exI)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10015
    apply (auto simp: setsum.If_cases Diff_eq if_smult fs)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10016
    done }
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10017
  ultimately show ?thesis
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10018
    using assms
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10019
    apply (simp add: rel_frontier_convex_hull_explicit)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10020
    apply (simp add: convex_hull_finite fs Union_SetCompr_eq, auto)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10021
    done
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10022
qed
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10023
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10024
lemma frontier_convex_hull_eq_rel_frontier:
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10025
  fixes s :: "'a::euclidean_space set"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10026
  assumes "~ affine_dependent s"
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
 10027
  shows "frontier(convex hull s) =
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10028
           (if card s \<le> DIM ('a) then convex hull s else rel_frontier(convex hull s))"
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
 10029
  using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
 10030
  unfolding rel_frontier_def frontier_def
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
 10031
  by (simp add: affine_independent_span_gt rel_interior_interior
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10032
                finite_imp_compact empty_interior_convex_hull aff_independent_finite)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10033
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10034
lemma frontier_convex_hull_cases:
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10035
  fixes s :: "'a::euclidean_space set"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10036
  assumes "~ affine_dependent s"
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
 10037
  shows "frontier(convex hull s) =
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10038
           (if card s \<le> DIM ('a) then convex hull s else \<Union>{convex hull (s - {x}) |x. x \<in> s})"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10039
by (simp add: assms frontier_convex_hull_eq_rel_frontier rel_frontier_convex_hull_cases)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10040
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10041
lemma in_frontier_convex_hull:
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10042
  fixes s :: "'a::euclidean_space set"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10043
  assumes "finite s" "card s \<le> Suc (DIM ('a))" "x \<in> s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10044
  shows   "x \<in> frontier(convex hull s)"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10045
proof (cases "affine_dependent s")
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
 10046
  case True
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10047
  with assms show ?thesis
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10048
    apply (auto simp: affine_dependent_def frontier_def finite_imp_compact hull_inc)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10049
    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)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10050
next
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
 10051
  case False
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
 10052
  { assume "card s = Suc (card Basis)"
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10053
    then have cs: "Suc 0 < card s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10054
      by (simp add: DIM_positive)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10055
    with subset_singletonD have "\<exists>y \<in> s. y \<noteq> x"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10056
      by (cases "s \<le> {x}") fastforce+
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10057
  } note [dest!] = this
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10058
  show ?thesis using assms
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10059
    unfolding frontier_convex_hull_cases [OF False] Union_SetCompr_eq
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10060
    by (auto simp: le_Suc_eq hull_inc)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10061
qed
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10062
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10063
lemma not_in_interior_convex_hull:
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10064
  fixes s :: "'a::euclidean_space set"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10065
  assumes "finite s" "card s \<le> Suc (DIM ('a))" "x \<in> s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10066
  shows   "x \<notin> interior(convex hull s)"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10067
using in_frontier_convex_hull [OF assms]
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10068
by (metis Diff_iff frontier_def)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10069
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10070
lemma interior_convex_hull_eq_empty:
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10071
  fixes s :: "'a::euclidean_space set"
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10072
  assumes "card s = Suc (DIM ('a))"
60307
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10073
  shows   "interior(convex hull s) = {} \<longleftrightarrow> affine_dependent s"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10074
proof -
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10075
  { fix a b
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10076
    assume ab: "a \<in> interior (convex hull s)" "b \<in> s" "b \<in> affine hull (s - {b})"
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10077
    then have "interior(affine hull s) = {}" using assms
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10078
      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)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10079
    then have False using ab
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10080
      by (metis convex_hull_subset_affine_hull equals0D interior_mono subset_eq)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10081
  } then
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10082
  show ?thesis
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10083
    using assms
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10084
    apply auto
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10085
    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)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10086
    apply (auto simp: affine_dependent_def)
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10087
    done
75e1aa7a450e Convex hulls: theorems about interior, etc. And a few simple lemmas.
paulson <lp15@cam.ac.uk>
parents: 60303
diff changeset
 10088
qed
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49962
diff changeset
 10089
60800
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10090
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10091
subsection \<open>Coplanarity, and collinearity in terms of affine hull\<close>
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10092
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10093
definition coplanar  where
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10094
   "coplanar s \<equiv> \<exists>u v w. s \<subseteq> affine hull {u,v,w}"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10095
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10096
lemma collinear_affine_hull:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10097
  "collinear s \<longleftrightarrow> (\<exists>u v. s \<subseteq> affine hull {u,v})"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10098
proof (cases "s={}")
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10099
  case True then show ?thesis
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10100
    by simp
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10101
next
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10102
  case False
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10103
  then obtain x where x: "x \<in> s" by auto
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10104
  { fix u
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10105
    assume *: "\<And>x y. \<lbrakk>x\<in>s; y\<in>s\<rbrakk> \<Longrightarrow> \<exists>c. x - y = c *\<^sub>R u"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10106
    have "\<exists>u v. s \<subseteq> {a *\<^sub>R u + b *\<^sub>R v |a b. a + b = 1}"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10107
      apply (rule_tac x=x in exI)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10108
      apply (rule_tac x="x+u" in exI, clarify)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10109
      apply (erule exE [OF * [OF x]])
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10110
      apply (rename_tac c)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10111
      apply (rule_tac x="1+c" in exI)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10112
      apply (rule_tac x="-c" in exI)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10113
      apply (simp add: algebra_simps)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10114
      done
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10115
  } moreover
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10116
  { fix u v x y
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10117
    assume *: "s \<subseteq> {a *\<^sub>R u + b *\<^sub>R v |a b. a + b = 1}"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10118
    have "x\<in>s \<Longrightarrow> y\<in>s \<Longrightarrow> \<exists>c. x - y = c *\<^sub>R (v-u)"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10119
      apply (drule subsetD [OF *])+
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10120
      apply simp
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10121
      apply clarify
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10122
      apply (rename_tac r1 r2)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10123
      apply (rule_tac x="r1-r2" in exI)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10124
      apply (simp add: algebra_simps)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10125
      apply (metis scaleR_left.add)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10126
      done
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10127
  } ultimately
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10128
  show ?thesis
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10129
  unfolding collinear_def affine_hull_2
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10130
    by blast
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10131
qed
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10132
62620
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
 10133
lemma collinear_closed_segment [simp]: "collinear (closed_segment a b)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
 10134
by (metis affine_hull_convex_hull collinear_affine_hull hull_subset segment_convex_hull)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
 10135
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
 10136
lemma collinear_open_segment [simp]: "collinear (open_segment a b)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
 10137
  unfolding open_segment_def
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
 10138
  by (metis convex_hull_subset_affine_hull segment_convex_hull dual_order.trans
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
 10139
    convex_hull_subset_affine_hull Diff_subset collinear_affine_hull)
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
 10140
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
 10141
lemma subset_continuous_image_segment_1:
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
 10142
  fixes f :: "'a::euclidean_space \<Rightarrow> real"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
 10143
  assumes "continuous_on (closed_segment a b) f"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
 10144
  shows "closed_segment (f a) (f b) \<subseteq> image f (closed_segment a b)"
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
 10145
by (metis connected_segment convex_contains_segment ends_in_segment imageI
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
 10146
           is_interval_connected_1 is_interval_convex connected_continuous_image [OF assms])
d21dab28b3f9 New results about paths, segments, etc. The notion of simply_connected.
paulson <lp15@cam.ac.uk>
parents: 62618
diff changeset
 10147
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10148
lemma collinear_imp_coplanar:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10149
  "collinear s ==> coplanar s"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10150
by (metis collinear_affine_hull coplanar_def insert_absorb2)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10151
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10152
lemma collinear_small:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10153
  assumes "finite s" "card s \<le> 2"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10154
    shows "collinear s"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10155
proof -
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10156
  have "card s = 0 \<or> card s = 1 \<or> card s = 2"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10157
    using assms by linarith
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10158
  then show ?thesis using assms
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10159
    using card_eq_SucD
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10160
    by auto (metis collinear_2 numeral_2_eq_2)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10161
qed
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10162
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10163
lemma coplanar_small:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10164
  assumes "finite s" "card s \<le> 3"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10165
    shows "coplanar s"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10166
proof -
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10167
  have "card s \<le> 2 \<or> card s = Suc (Suc (Suc 0))"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10168
    using assms by linarith
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10169
  then show ?thesis using assms
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10170
    apply safe
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10171
    apply (simp add: collinear_small collinear_imp_coplanar)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10172
    apply (safe dest!: card_eq_SucD)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10173
    apply (auto simp: coplanar_def)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10174
    apply (metis hull_subset insert_subset)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10175
    done
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10176
qed
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10177
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10178
lemma coplanar_empty: "coplanar {}"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10179
  by (simp add: coplanar_small)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10180
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10181
lemma coplanar_sing: "coplanar {a}"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10182
  by (simp add: coplanar_small)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10183
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10184
lemma coplanar_2: "coplanar {a,b}"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10185
  by (auto simp: card_insert_if coplanar_small)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10186
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10187
lemma coplanar_3: "coplanar {a,b,c}"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10188
  by (auto simp: card_insert_if coplanar_small)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10189
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10190
lemma collinear_affine_hull_collinear: "collinear(affine hull s) \<longleftrightarrow> collinear s"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10191
  unfolding collinear_affine_hull
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10192
  by (metis affine_affine_hull subset_hull hull_hull hull_mono)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10193
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10194
lemma coplanar_affine_hull_coplanar: "coplanar(affine hull s) \<longleftrightarrow> coplanar s"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10195
  unfolding coplanar_def
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10196
  by (metis affine_affine_hull subset_hull hull_hull hull_mono)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10197
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10198
lemma coplanar_linear_image:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10199
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10200
  assumes "coplanar s" "linear f" shows "coplanar(f ` s)"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10201
proof -
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10202
  { fix u v w
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10203
    assume "s \<subseteq> affine hull {u, v, w}"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10204
    then have "f ` s \<subseteq> f ` (affine hull {u, v, w})"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10205
      by (simp add: image_mono)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10206
    then have "f ` s \<subseteq> affine hull (f ` {u, v, w})"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10207
      by (metis assms(2) linear_conv_bounded_linear affine_hull_linear_image)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10208
  } then
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10209
  show ?thesis
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10210
    by auto (meson assms(1) coplanar_def)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10211
qed
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10212
60800
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10213
lemma coplanar_translation_imp: "coplanar s \<Longrightarrow> coplanar ((\<lambda>x. a + x) ` s)"
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10214
  unfolding coplanar_def
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10215
  apply clarify
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10216
  apply (rule_tac x="u+a" in exI)
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10217
  apply (rule_tac x="v+a" in exI)
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10218
  apply (rule_tac x="w+a" in exI)
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10219
  using affine_hull_translation [of a "{u,v,w}" for u v w]
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10220
  apply (force simp: add.commute)
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10221
  done
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10222
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10223
lemma coplanar_translation_eq: "coplanar((\<lambda>x. a + x) ` s) \<longleftrightarrow> coplanar s"
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10224
    by (metis (no_types) coplanar_translation_imp translation_galois)
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10225
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10226
lemma coplanar_linear_image_eq:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10227
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10228
  assumes "linear f" "inj f" shows "coplanar(f ` s) = coplanar s"
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
 10229
proof
60800
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10230
  assume "coplanar s"
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10231
  then show "coplanar (f ` s)"
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10232
    unfolding coplanar_def
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10233
    using affine_hull_linear_image [of f "{u,v,w}" for u v w]  assms
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10234
    by (meson coplanar_def coplanar_linear_image)
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10235
next
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10236
  obtain g where g: "linear g" "g \<circ> f = id"
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10237
    using linear_injective_left_inverse [OF assms]
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10238
    by blast
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10239
  assume "coplanar (f ` s)"
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10240
  then obtain u v w where "f ` s \<subseteq> affine hull {u, v, w}"
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10241
    by (auto simp: coplanar_def)
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10242
  then have "g ` f ` s \<subseteq> g ` (affine hull {u, v, w})"
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10243
    by blast
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10244
  then have "s \<subseteq> g ` (affine hull {u, v, w})"
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10245
    using g by (simp add: Fun.image_comp)
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10246
  then show "coplanar s"
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10247
    unfolding coplanar_def
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61104
diff changeset
 10248
    using affine_hull_linear_image [of g "{u,v,w}" for u v w]  \<open>linear g\<close> linear_conv_bounded_linear
60800
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10249
    by fastforce
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10250
qed
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10251
(*The HOL Light proof is simply
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
 10252
    MATCH_ACCEPT_TAC(LINEAR_INVARIANT_RULE COPLANAR_LINEAR_IMAGE));;
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10253
*)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10254
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10255
lemma coplanar_subset: "\<lbrakk>coplanar t; s \<subseteq> t\<rbrakk> \<Longrightarrow> coplanar s"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10256
  by (meson coplanar_def order_trans)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10257
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10258
lemma affine_hull_3_imp_collinear: "c \<in> affine hull {a,b} \<Longrightarrow> collinear {a,b,c}"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10259
  by (metis collinear_2 collinear_affine_hull_collinear hull_redundant insert_commute)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10260
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10261
lemma collinear_3_imp_in_affine_hull: "\<lbrakk>collinear {a,b,c}; a \<noteq> b\<rbrakk> \<Longrightarrow> c \<in> affine hull {a,b}"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10262
  unfolding collinear_def
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10263
  apply clarify
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10264
  apply (frule_tac x=b in bspec, blast, drule_tac x=a in bspec, blast, erule exE)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10265
  apply (drule_tac x=c in bspec, blast, drule_tac x=a in bspec, blast, erule exE)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10266
  apply (rename_tac y x)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10267
  apply (simp add: affine_hull_2)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10268
  apply (rule_tac x="1 - x/y" in exI)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10269
  apply (simp add: algebra_simps)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10270
  done
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10271
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10272
lemma collinear_3_affine_hull:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10273
  assumes "a \<noteq> b"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10274
    shows "collinear {a,b,c} \<longleftrightarrow> c \<in> affine hull {a,b}"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10275
using affine_hull_3_imp_collinear assms collinear_3_imp_in_affine_hull by blast
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10276
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10277
lemma collinear_3_eq_affine_dependent:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10278
  "collinear{a,b,c} \<longleftrightarrow> a = b \<or> a = c \<or> b = c \<or> affine_dependent {a,b,c}"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10279
apply (case_tac "a=b", simp)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10280
apply (case_tac "a=c")
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10281
apply (simp add: insert_commute)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10282
apply (case_tac "b=c")
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10283
apply (simp add: insert_commute)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10284
apply (auto simp: affine_dependent_def collinear_3_affine_hull insert_Diff_if)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10285
apply (metis collinear_3_affine_hull insert_commute)+
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10286
done
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10287
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10288
lemma affine_dependent_imp_collinear_3:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10289
  "affine_dependent {a,b,c} \<Longrightarrow> collinear{a,b,c}"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10290
by (simp add: collinear_3_eq_affine_dependent)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10291
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10292
lemma collinear_3: "NO_MATCH 0 x \<Longrightarrow> collinear {x,y,z} \<longleftrightarrow> collinear {0, x-y, z-y}"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10293
  by (auto simp add: collinear_def)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10294
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10295
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10296
thm affine_hull_nonempty
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10297
corollary affine_hull_eq_empty [simp]: "affine hull S = {} \<longleftrightarrow> S = {}"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10298
  using affine_hull_nonempty by blast
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10299
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10300
lemma affine_hull_2_alt:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10301
  fixes a b :: "'a::real_vector"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10302
  shows "affine hull {a,b} = range (\<lambda>u. a + u *\<^sub>R (b - a))"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10303
apply (simp add: affine_hull_2, safe)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10304
apply (rule_tac x=v in image_eqI)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10305
apply (simp add: algebra_simps)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10306
apply (metis scaleR_add_left scaleR_one, simp)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10307
apply (rule_tac x="1-u" in exI)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10308
apply (simp add: algebra_simps)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10309
done
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10310
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10311
lemma interior_convex_hull_3_minimal:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10312
  fixes a :: "'a::euclidean_space"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10313
  shows "\<lbrakk>~ collinear{a,b,c}; DIM('a) = 2\<rbrakk>
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10314
         \<Longrightarrow> interior(convex hull {a,b,c}) =
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10315
                {v. \<exists>x y z. 0 < x \<and> 0 < y \<and> 0 < z \<and> x + y + z = 1 \<and>
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10316
                            x *\<^sub>R a + y *\<^sub>R b + z *\<^sub>R c = v}"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10317
apply (simp add: collinear_3_eq_affine_dependent interior_convex_hull_explicit_minimal, safe)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10318
apply (rule_tac x="u a" in exI, simp)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10319
apply (rule_tac x="u b" in exI, simp)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10320
apply (rule_tac x="u c" in exI, simp)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10321
apply (rename_tac uu x y z)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10322
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)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10323
apply simp
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10324
done
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60585
diff changeset
 10325
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10326
subsection\<open>The infimum of the distance between two sets\<close>
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10327
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10328
definition setdist :: "'a::metric_space set \<Rightarrow> 'a set \<Rightarrow> real" where
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10329
  "setdist s t \<equiv>
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10330
       (if s = {} \<or> t = {} then 0
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10331
        else Inf {dist x y| x y. x \<in> s \<and> y \<in> t})"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10332
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10333
lemma setdist_empty1 [simp]: "setdist {} t = 0"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10334
  by (simp add: setdist_def)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10335
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10336
lemma setdist_empty2 [simp]: "setdist t {} = 0"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10337
  by (simp add: setdist_def)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10338
63301
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10339
lemma setdist_pos_le [simp]: "0 \<le> setdist s t"
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10340
  by (auto simp: setdist_def ex_in_conv [symmetric] intro: cInf_greatest)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10341
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10342
lemma le_setdistI:
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10343
  assumes "s \<noteq> {}" "t \<noteq> {}" "\<And>x y. \<lbrakk>x \<in> s; y \<in> t\<rbrakk> \<Longrightarrow> d \<le> dist x y"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10344
    shows "d \<le> setdist s t"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10345
  using assms
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10346
  by (auto simp: setdist_def Set.ex_in_conv [symmetric] intro: cInf_greatest)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10347
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10348
lemma setdist_le_dist: "\<lbrakk>x \<in> s; y \<in> t\<rbrakk> \<Longrightarrow> setdist s t \<le> dist x y"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10349
  unfolding setdist_def
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10350
  by (auto intro!: bdd_belowI [where m=0] cInf_lower)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10351
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
 10352
lemma le_setdist_iff:
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10353
        "d \<le> setdist s t \<longleftrightarrow>
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10354
        (\<forall>x \<in> s. \<forall>y \<in> t. d \<le> dist x y) \<and> (s = {} \<or> t = {} \<longrightarrow> d \<le> 0)"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10355
  apply (cases "s = {} \<or> t = {}")
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10356
  apply (force simp add: setdist_def)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10357
  apply (intro iffI conjI)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10358
  using setdist_le_dist apply fastforce
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10359
  apply (auto simp: intro: le_setdistI)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10360
  done
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10361
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
 10362
lemma setdist_ltE:
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10363
  assumes "setdist s t < b" "s \<noteq> {}" "t \<noteq> {}"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10364
    obtains x y where "x \<in> s" "y \<in> t" "dist x y < b"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10365
using assms
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10366
by (auto simp: not_le [symmetric] le_setdist_iff)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10367
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10368
lemma setdist_refl: "setdist s s = 0"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10369
  apply (cases "s = {}")
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10370
  apply (force simp add: setdist_def)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10371
  apply (rule antisym [OF _ setdist_pos_le])
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10372
  apply (metis all_not_in_conv dist_self setdist_le_dist)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10373
  done
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10374
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10375
lemma setdist_sym: "setdist s t = setdist t s"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10376
  by (force simp: setdist_def dist_commute intro!: arg_cong [where f=Inf])
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10377
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10378
lemma setdist_triangle: "setdist s t \<le> setdist s {a} + setdist {a} t"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10379
proof (cases "s = {} \<or> t = {}")
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10380
  case True then show ?thesis
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10381
    using setdist_pos_le by fastforce
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10382
next
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10383
  case False
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
 10384
  have "\<And>x. x \<in> s \<Longrightarrow> setdist s t - dist x a \<le> setdist {a} t"
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10385
    apply (rule le_setdistI, blast)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10386
    using False apply (fastforce intro: le_setdistI)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10387
    apply (simp add: algebra_simps)
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62398
diff changeset
 10388
    apply (metis dist_commute dist_triangle3 order_trans [OF setdist_le_dist])
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10389
    done
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10390
  then have "setdist s t - setdist {a} t \<le> setdist s {a}"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10391
    using False by (fastforce intro: le_setdistI)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10392
  then show ?thesis
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10393
    by (simp add: algebra_simps)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10394
qed
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10395
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10396
lemma setdist_singletons [simp]: "setdist {x} {y} = dist x y"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10397
  by (simp add: setdist_def)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10398
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61880
diff changeset
 10399
lemma setdist_Lipschitz: "\<bar>setdist {x} s - setdist {y} s\<bar> \<le> dist x y"
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10400
  apply (subst setdist_singletons [symmetric])
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10401
  by (metis abs_diff_le_iff diff_le_eq setdist_triangle setdist_sym)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10402
63301
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10403
lemma continuous_at_setdist [continuous_intros]: "continuous (at x) (\<lambda>y. (setdist {y} s))"
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10404
  by (force simp: continuous_at_eps_delta dist_real_def intro: le_less_trans [OF setdist_Lipschitz])
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10405
63301
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10406
lemma continuous_on_setdist [continuous_intros]: "continuous_on t (\<lambda>y. (setdist {y} s))"
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10407
  by (metis continuous_at_setdist continuous_at_imp_continuous_on)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10408
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10409
lemma uniformly_continuous_on_setdist: "uniformly_continuous_on t (\<lambda>y. (setdist {y} s))"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10410
  by (force simp: uniformly_continuous_on_def dist_real_def intro: le_less_trans [OF setdist_Lipschitz])
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10411
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10412
lemma setdist_subset_right: "\<lbrakk>t \<noteq> {}; t \<subseteq> u\<rbrakk> \<Longrightarrow> setdist s u \<le> setdist s t"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10413
  apply (cases "s = {} \<or> u = {}", force)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10414
  apply (auto simp: setdist_def intro!: bdd_belowI [where m=0] cInf_superset_mono)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10415
  done
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10416
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10417
lemma setdist_subset_left: "\<lbrakk>s \<noteq> {}; s \<subseteq> t\<rbrakk> \<Longrightarrow> setdist t u \<le> setdist s u"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10418
  by (metis setdist_subset_right setdist_sym)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10419
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10420
lemma setdist_closure_1 [simp]: "setdist (closure s) t = setdist s t"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10421
proof (cases "s = {} \<or> t = {}")
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10422
  case True then show ?thesis by force
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10423
next
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10424
  case False
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10425
  { fix y
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10426
    assume "y \<in> t"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10427
    have "continuous_on (closure s) (\<lambda>a. dist a y)"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10428
      by (auto simp: continuous_intros dist_norm)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10429
    then have *: "\<And>x. x \<in> closure s \<Longrightarrow> setdist s t \<le> dist x y"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10430
      apply (rule continuous_ge_on_closure)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10431
      apply assumption
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61104
diff changeset
 10432
      apply (blast intro: setdist_le_dist \<open>y \<in> t\<close> )
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10433
      done
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10434
  } note * = this
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10435
  show ?thesis
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10436
    apply (rule antisym)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10437
     using False closure_subset apply (blast intro: setdist_subset_left)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10438
    using False *
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10439
    apply (force simp add: closure_eq_empty intro!: le_setdistI)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10440
    done
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10441
qed
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10442
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10443
lemma setdist_closure_2 [simp]: "setdist t (closure s) = setdist t s"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10444
by (metis setdist_closure_1 setdist_sym)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10445
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10446
lemma setdist_compact_closed:
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10447
  fixes s :: "'a::euclidean_space set"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10448
  assumes s: "compact s" and t: "closed t"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10449
      and "s \<noteq> {}" "t \<noteq> {}"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10450
    shows "\<exists>x \<in> s. \<exists>y \<in> t. dist x y = setdist s t"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10451
proof -
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10452
  have "{x - y |x y. x \<in> s \<and> y \<in> t} \<noteq> {}"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10453
    using assms by blast
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10454
  then
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10455
  have "\<exists>x \<in> s. \<exists>y \<in> t. dist x y \<le> setdist s t"
62381
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
 10456
    apply (rule distance_attains_inf [where a=0, OF compact_closed_differences [OF s t]])
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
 10457
    apply (simp add: dist_norm le_setdist_iff)
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62131
diff changeset
 10458
    apply blast
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10459
    done
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10460
  then show ?thesis
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10461
    by (blast intro!: antisym [OF _ setdist_le_dist] )
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10462
qed
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10463
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10464
lemma setdist_closed_compact:
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10465
  fixes s :: "'a::euclidean_space set"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10466
  assumes s: "closed s" and t: "compact t"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10467
      and "s \<noteq> {}" "t \<noteq> {}"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10468
    shows "\<exists>x \<in> s. \<exists>y \<in> t. dist x y = setdist s t"
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61104
diff changeset
 10469
  using setdist_compact_closed [OF t s \<open>t \<noteq> {}\<close> \<open>s \<noteq> {}\<close>]
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10470
  by (metis dist_commute setdist_sym)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10471
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10472
lemma setdist_eq_0I: "\<lbrakk>x \<in> s; x \<in> t\<rbrakk> \<Longrightarrow> setdist s t = 0"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10473
  by (metis antisym dist_self setdist_le_dist setdist_pos_le)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10474
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10475
lemma setdist_eq_0_compact_closed:
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10476
  fixes s :: "'a::euclidean_space set"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10477
  assumes s: "compact s" and t: "closed t"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10478
    shows "setdist s t = 0 \<longleftrightarrow> s = {} \<or> t = {} \<or> s \<inter> t \<noteq> {}"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10479
  apply (cases "s = {} \<or> t = {}", force)
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
 10480
  using setdist_compact_closed [OF s t]
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10481
  apply (force intro: setdist_eq_0I )
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10482
  done
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10483
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10484
corollary setdist_gt_0_compact_closed:
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10485
  fixes s :: "'a::euclidean_space set"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10486
  assumes s: "compact s" and t: "closed t"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10487
    shows "setdist s t > 0 \<longleftrightarrow> (s \<noteq> {} \<and> t \<noteq> {} \<and> s \<inter> t = {})"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10488
  using setdist_pos_le [of s t] setdist_eq_0_compact_closed [OF assms]
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10489
  by linarith
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10490
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10491
lemma setdist_eq_0_closed_compact:
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10492
  fixes s :: "'a::euclidean_space set"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10493
  assumes s: "closed s" and t: "compact t"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10494
    shows "setdist s t = 0 \<longleftrightarrow> s = {} \<or> t = {} \<or> s \<inter> t \<noteq> {}"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10495
  using setdist_eq_0_compact_closed [OF t s]
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10496
  by (metis Int_commute setdist_sym)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10497
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10498
lemma setdist_eq_0_bounded:
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10499
  fixes s :: "'a::euclidean_space set"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10500
  assumes "bounded s \<or> bounded t"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10501
    shows "setdist s t = 0 \<longleftrightarrow> s = {} \<or> t = {} \<or> closure s \<inter> closure t \<noteq> {}"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10502
  apply (cases "s = {} \<or> t = {}", force)
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
 10503
  using setdist_eq_0_compact_closed [of "closure s" "closure t"]
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
 10504
        setdist_eq_0_closed_compact [of "closure s" "closure t"] assms
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10505
  apply (force simp add:  bounded_closure compact_eq_bounded_closed)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10506
  done
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10507
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
 10508
lemma setdist_unique:
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10509
  "\<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>
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10510
   \<Longrightarrow> setdist s t = dist a b"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10511
  by (force simp add: setdist_le_dist le_setdist_iff intro: antisym)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10512
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
 10513
lemma setdist_closest_point:
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10514
    "\<lbrakk>closed s; s \<noteq> {}\<rbrakk> \<Longrightarrow> setdist {a} s = dist a (closest_point s a)"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10515
  apply (rule setdist_unique)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10516
  using closest_point_le
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10517
  apply (auto simp: closest_point_in_set)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10518
  done
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10519
63301
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10520
lemma setdist_eq_0_sing_1:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10521
    fixes s :: "'a::euclidean_space set"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10522
    shows "setdist {x} s = 0 \<longleftrightarrow> s = {} \<or> x \<in> closure s"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10523
  by (auto simp: setdist_eq_0_bounded)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10524
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10525
lemma setdist_eq_0_sing_2:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10526
    fixes s :: "'a::euclidean_space set"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10527
    shows "setdist s {x} = 0 \<longleftrightarrow> s = {} \<or> x \<in> closure s"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10528
  by (auto simp: setdist_eq_0_bounded)
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10529
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 10530
lemma setdist_neq_0_sing_1:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 10531
    fixes s :: "'a::euclidean_space set"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 10532
    shows "\<lbrakk>setdist {x} s = a; a \<noteq> 0\<rbrakk> \<Longrightarrow> s \<noteq> {} \<and> x \<notin> closure s"
63301
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10533
  by (auto simp: setdist_eq_0_sing_1)
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 10534
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 10535
lemma setdist_neq_0_sing_2:
63301
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10536
    fixes s :: "'a::euclidean_space set"
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 10537
    shows "\<lbrakk>setdist s {x} = a; a \<noteq> 0\<rbrakk> \<Longrightarrow> s \<noteq> {} \<and> x \<notin> closure s"
63301
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10538
  by (auto simp: setdist_eq_0_sing_2)
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 10539
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10540
lemma setdist_sing_in_set:
63301
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10541
    fixes s :: "'a::euclidean_space set"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10542
    shows "x \<in> s \<Longrightarrow> setdist {x} s = 0"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10543
  using closure_subset by (auto simp: setdist_eq_0_sing_1)
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10544
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10545
lemma setdist_le_sing: "x \<in> s ==> setdist s t \<le> setdist {x} t"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10546
  using setdist_subset_left by auto
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60809
diff changeset
 10547
63301
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10548
lemma setdist_eq_0_closed:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10549
  fixes s :: "'a::euclidean_space set"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10550
  shows  "closed s \<Longrightarrow> (setdist {x} s = 0 \<longleftrightarrow> s = {} \<or> x \<in> s)"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10551
by (simp add: setdist_eq_0_sing_1)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10552
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10553
lemma setdist_eq_0_closedin:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10554
  fixes s :: "'a::euclidean_space set"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10555
  shows "\<lbrakk>closedin (subtopology euclidean u) s; x \<in> u\<rbrakk>
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10556
         \<Longrightarrow> (setdist {x} s = 0 \<longleftrightarrow> s = {} \<or> x \<in> s)"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10557
  by (auto simp: closedin_limpt setdist_eq_0_sing_1 closure_def)
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10558
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10559
subsection\<open>Basic lemmas about hyperplanes and halfspaces\<close>
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10560
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10561
lemma hyperplane_eq_Ex:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10562
  assumes "a \<noteq> 0" obtains x where "a \<bullet> x = b"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10563
  by (rule_tac x = "(b / (a \<bullet> a)) *\<^sub>R a" in that) (simp add: assms)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10564
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10565
lemma hyperplane_eq_empty:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10566
     "{x. a \<bullet> x = b} = {} \<longleftrightarrow> a = 0 \<and> b \<noteq> 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10567
  using hyperplane_eq_Ex apply auto[1]
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10568
  using inner_zero_right by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10569
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10570
lemma hyperplane_eq_UNIV:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10571
   "{x. a \<bullet> x = b} = UNIV \<longleftrightarrow> a = 0 \<and> b = 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10572
proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10573
  have "UNIV \<subseteq> {x. a \<bullet> x = b} \<Longrightarrow> a = 0 \<and> b = 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10574
    apply (drule_tac c = "((b+1) / (a \<bullet> a)) *\<^sub>R a" in subsetD)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10575
    apply simp_all
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10576
    by (metis add_cancel_right_right divide_1 zero_neq_one)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10577
  then show ?thesis by force
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10578
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10579
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10580
lemma halfspace_eq_empty_lt:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10581
   "{x. a \<bullet> x < b} = {} \<longleftrightarrow> a = 0 \<and> b \<le> 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10582
proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10583
  have "{x. a \<bullet> x < b} \<subseteq> {} \<Longrightarrow> a = 0 \<and> b \<le> 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10584
    apply (rule ccontr)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10585
    apply (drule_tac c = "((b-1) / (a \<bullet> a)) *\<^sub>R a" in subsetD)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10586
    apply force+
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10587
    done
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10588
  then show ?thesis by force
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10589
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10590
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10591
lemma halfspace_eq_empty_gt:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10592
   "{x. a \<bullet> x > b} = {} \<longleftrightarrow> a = 0 \<and> b \<ge> 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10593
using halfspace_eq_empty_lt [of "-a" "-b"]
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10594
by simp
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10595
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10596
lemma halfspace_eq_empty_le:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10597
   "{x. a \<bullet> x \<le> b} = {} \<longleftrightarrow> a = 0 \<and> b < 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10598
proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10599
  have "{x. a \<bullet> x \<le> b} \<subseteq> {} \<Longrightarrow> a = 0 \<and> b < 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10600
    apply (rule ccontr)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10601
    apply (drule_tac c = "((b-1) / (a \<bullet> a)) *\<^sub>R a" in subsetD)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10602
    apply force+
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10603
    done
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10604
  then show ?thesis by force
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10605
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10606
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10607
lemma halfspace_eq_empty_ge:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10608
   "{x. a \<bullet> x \<ge> b} = {} \<longleftrightarrow> a = 0 \<and> b > 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10609
using halfspace_eq_empty_le [of "-a" "-b"]
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10610
by simp
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10611
63301
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10612
subsection\<open>Use set distance for an easy proof of separation properties\<close>
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10613
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10614
proposition separation_closures:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10615
  fixes S :: "'a::euclidean_space set"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10616
  assumes "S \<inter> closure T = {}" "T \<inter> closure S = {}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10617
  obtains U V where "U \<inter> V = {}" "open U" "open V" "S \<subseteq> U" "T \<subseteq> V"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10618
proof (cases "S = {} \<or> T = {}")
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10619
  case True with that show ?thesis by auto
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10620
next
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10621
  case False
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10622
  define f where "f \<equiv> \<lambda>x. setdist {x} T - setdist {x} S"
63332
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63305
diff changeset
 10623
  have contf: "continuous_on UNIV f"
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63305
diff changeset
 10624
    unfolding f_def by (intro continuous_intros continuous_on_setdist)
63301
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10625
  show ?thesis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10626
  proof (rule_tac U = "{x. f x > 0}" and V = "{x. f x < 0}" in that)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10627
    show "{x. 0 < f x} \<inter> {x. f x < 0} = {}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10628
      by auto
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10629
    show "open {x. 0 < f x}"
63332
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63305
diff changeset
 10630
      by (simp add: open_Collect_less contf continuous_on_const)
63301
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10631
    show "open {x. f x < 0}"
63332
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63305
diff changeset
 10632
      by (simp add: open_Collect_less contf continuous_on_const)
63301
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10633
    show "S \<subseteq> {x. 0 < f x}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10634
      apply (clarsimp simp add: f_def setdist_sing_in_set)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10635
      using assms
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10636
      by (metis False IntI empty_iff le_less setdist_eq_0_sing_2 setdist_pos_le setdist_sym)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10637
    show "T \<subseteq> {x. f x < 0}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10638
      apply (clarsimp simp add: f_def setdist_sing_in_set)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10639
      using assms
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10640
      by (metis False IntI empty_iff le_less setdist_eq_0_sing_2 setdist_pos_le setdist_sym)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10641
  qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10642
qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10643
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10644
lemma separation_normal:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10645
  fixes S :: "'a::euclidean_space set"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10646
  assumes "closed S" "closed T" "S \<inter> T = {}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10647
  obtains U V where "open U" "open V" "S \<subseteq> U" "T \<subseteq> V" "U \<inter> V = {}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10648
using separation_closures [of S T]
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10649
by (metis assms closure_closed disjnt_def inf_commute)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10650
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10651
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10652
lemma separation_normal_local:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10653
  fixes S :: "'a::euclidean_space set"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10654
  assumes US: "closedin (subtopology euclidean U) S"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10655
      and UT: "closedin (subtopology euclidean U) T"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10656
      and "S \<inter> T = {}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10657
  obtains S' T' where "openin (subtopology euclidean U) S'"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10658
                      "openin (subtopology euclidean U) T'"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10659
                      "S \<subseteq> S'"  "T \<subseteq> T'"  "S' \<inter> T' = {}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10660
proof (cases "S = {} \<or> T = {}")
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10661
  case True with that show ?thesis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10662
    apply safe
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10663
    using UT closedin_subset apply blast
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10664
    using US closedin_subset apply blast
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10665
    done
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10666
next
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10667
  case False
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10668
  define f where "f \<equiv> \<lambda>x. setdist {x} T - setdist {x} S"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10669
  have contf: "continuous_on U f"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10670
    unfolding f_def by (intro continuous_intros)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10671
  show ?thesis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10672
  proof (rule_tac S' = "{x\<in>U. f x > 0}" and T' = "{x\<in>U. f x < 0}" in that)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10673
    show "{x \<in> U. 0 < f x} \<inter> {x \<in> U. f x < 0} = {}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10674
      by auto
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10675
    have "openin (subtopology euclidean U) {x \<in> U. f x \<in> {0<..}}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10676
      apply (rule continuous_openin_preimage [where T=UNIV])
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10677
        apply (simp_all add: contf)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10678
      using open_greaterThan open_openin by blast
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10679
    then show "openin (subtopology euclidean U) {x \<in> U. 0 < f x}" by simp
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10680
  next
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10681
    have "openin (subtopology euclidean U) {x \<in> U. f x \<in> {..<0}}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10682
      apply (rule continuous_openin_preimage [where T=UNIV])
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10683
        apply (simp_all add: contf)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10684
      using open_lessThan open_openin by blast
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10685
    then show "openin (subtopology euclidean U) {x \<in> U. f x < 0}" by simp
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10686
  next
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10687
    show "S \<subseteq> {x \<in> U. 0 < f x}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10688
      apply (clarsimp simp add: f_def setdist_sing_in_set)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10689
      using assms
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10690
      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)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10691
    show "T \<subseteq> {x \<in> U. f x < 0}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10692
      apply (clarsimp simp add: f_def setdist_sing_in_set)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10693
      using assms
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10694
      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)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10695
  qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10696
qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10697
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10698
lemma separation_normal_compact:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10699
  fixes S :: "'a::euclidean_space set"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10700
  assumes "compact S" "closed T" "S \<inter> T = {}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10701
  obtains U V where "open U" "compact(closure U)" "open V" "S \<subseteq> U" "T \<subseteq> V" "U \<inter> V = {}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10702
proof -
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10703
  have "closed S" "bounded S"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10704
    using assms by (auto simp: compact_eq_bounded_closed)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10705
  then obtain r where "r>0" and r: "S \<subseteq> ball 0 r"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10706
    by (auto dest!: bounded_subset_ballD)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10707
  have **: "closed (T \<union> - ball 0 r)" "S \<inter> (T \<union> - ball 0 r) = {}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10708
    using assms r by blast+
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10709
  then show ?thesis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10710
    apply (rule separation_normal [OF \<open>closed S\<close>])
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10711
    apply (rule_tac U=U and V=V in that)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10712
    by auto (meson bounded_ball bounded_subset compl_le_swap2 disjoint_eq_subset_Compl)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10713
qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10714
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10715
subsection\<open>Proper maps, including projections out of compact sets\<close>
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10716
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10717
lemma finite_indexed_bound:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10718
  assumes A: "finite A" "\<And>x. x \<in> A \<Longrightarrow> \<exists>n::'a::linorder. P x n"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10719
    shows "\<exists>m. \<forall>x \<in> A. \<exists>k\<le>m. P x k"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10720
using A
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10721
proof (induction A)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10722
  case empty then show ?case by force
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10723
next
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10724
  case (insert a A)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10725
    then obtain m n where "\<forall>x \<in> A. \<exists>k\<le>m. P x k" "P a n"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10726
      by force
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10727
    then show ?case
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10728
      apply (rule_tac x="max m n" in exI, safe)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10729
      using max.cobounded2 apply blast
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10730
      by (meson le_max_iff_disj)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10731
qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10732
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10733
proposition proper_map:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10734
  fixes f :: "'a::heine_borel \<Rightarrow> 'b::heine_borel"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10735
  assumes "closedin (subtopology euclidean S) K"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10736
      and com: "\<And>U. \<lbrakk>U \<subseteq> T; compact U\<rbrakk> \<Longrightarrow> compact {x \<in> S. f x \<in> U}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10737
      and "f ` S \<subseteq> T"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10738
    shows "closedin (subtopology euclidean T) (f ` K)"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10739
proof -
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10740
  have "K \<subseteq> S"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10741
    using assms closedin_imp_subset by metis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10742
  obtain C where "closed C" and Keq: "K = S \<inter> C"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10743
    using assms by (auto simp: closedin_closed)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10744
  have *: "y \<in> f ` K" if "y \<in> T" and y: "y islimpt f ` K" for y
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10745
  proof -
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10746
    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"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10747
      using \<open>y \<in> T\<close> y by (force simp: limpt_sequential_inj)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10748
    then obtain X where X: "\<And>n. X n \<in> K \<and> h n = f (X n) \<and> h n \<noteq> y"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10749
      by metis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10750
    then have fX: "\<And>n. f (X n) = h n"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10751
      by metis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10752
    have "compact (C \<inter> {a \<in> S. f a \<in> insert y (range (\<lambda>i. f(X(n + i))))})" for n
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10753
      apply (rule closed_Int_compact [OF \<open>closed C\<close>])
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10754
      apply (rule com)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10755
       using X \<open>K \<subseteq> S\<close> \<open>f ` S \<subseteq> T\<close> \<open>y \<in> T\<close> apply blast
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10756
      apply (rule compact_sequence_with_limit)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10757
      apply (simp add: fX add.commute [of n] LIMSEQ_ignore_initial_segment [OF hlim])
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10758
      done
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10759
    then have comf: "compact {a \<in> K. f a \<in> insert y (range (\<lambda>i. f(X(n + i))))}" for n
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10760
      by (simp add: Keq Int_def conj_commute)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10761
    have ne: "\<Inter>\<F> \<noteq> {}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10762
             if "finite \<F>"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10763
                and \<F>: "\<And>t. t \<in> \<F> \<Longrightarrow>
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10764
                           (\<exists>n. t = {a \<in> K. f a \<in> insert y (range (\<lambda>i. f (X (n + i))))})"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10765
             for \<F>
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10766
    proof -
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10767
      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))))}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10768
        apply (rule exE)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10769
        apply (rule finite_indexed_bound [OF \<open>finite \<F>\<close> \<F>], assumption, force)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10770
        done
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10771
      have "X m \<in> \<Inter>\<F>"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10772
        using X le_Suc_ex by (fastforce dest: m)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10773
      then show ?thesis by blast
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10774
    qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10775
    have "\<Inter>{{a. a \<in> K \<and> f a \<in> insert y (range (\<lambda>i. f(X(n + i))))} |n. n \<in> UNIV}
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10776
               \<noteq> {}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10777
      apply (rule compact_fip_heine_borel)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10778
       using comf apply force
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10779
      using ne  apply (simp add: subset_iff del: insert_iff)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10780
      done
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10781
    then have "\<exists>x. x \<in> (\<Inter>n. {a \<in> K. f a \<in> insert y (range (\<lambda>i. f (X (n + i))))})"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10782
      by blast
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10783
    then show ?thesis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10784
      apply (simp add: image_iff fX)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10785
      by (metis \<open>inj h\<close> le_add1 not_less_eq_eq rangeI range_ex1_eq)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10786
  qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10787
  with assms closedin_subset show ?thesis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10788
    by (force simp: closedin_limpt)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10789
qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10790
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10791
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10792
lemma compact_continuous_image_eq:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10793
  fixes f :: "'a::heine_borel \<Rightarrow> 'b::heine_borel"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10794
  assumes f: "inj_on f S"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10795
  shows "continuous_on S f \<longleftrightarrow> (\<forall>T. compact T \<and> T \<subseteq> S \<longrightarrow> compact(f ` T))"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10796
           (is "?lhs = ?rhs")
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10797
proof
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10798
  assume ?lhs then show ?rhs
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10799
    by (metis continuous_on_subset compact_continuous_image)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10800
next
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10801
  assume RHS: ?rhs
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10802
  obtain g where gf: "\<And>x. x \<in> S \<Longrightarrow> g (f x) = x"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10803
    by (metis inv_into_f_f f)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10804
  then have *: "{x \<in> S. f x \<in> U} = g ` U" if "U \<subseteq> f ` S" for U
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10805
    using that by fastforce
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10806
  have gfim: "g ` f ` S \<subseteq> S" using gf by auto
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10807
  have **: "compact {x \<in> f ` S. g x \<in> C}" if C: "C \<subseteq> S" "compact C" for C
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10808
  proof -
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10809
    obtain h :: "'a set \<Rightarrow> 'a" where "h C \<in> C \<and> h C \<notin> S \<or> compact (f ` C)"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10810
      by (force simp: C RHS)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10811
    moreover have "f ` C = {b \<in> f ` S. g b \<in> C}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10812
      using C gf by auto
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10813
    ultimately show "compact {b \<in> f ` S. g b \<in> C}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10814
      using C by auto
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10815
  qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10816
  show ?lhs
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10817
    using proper_map [OF _ _ gfim] **
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10818
    by (simp add: continuous_on_closed * closedin_imp_subset)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10819
qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10820
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10821
lemma proper_map_from_compact:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10822
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10823
  assumes contf: "continuous_on S f" and imf: "f ` S \<subseteq> T" and "compact S"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10824
          "closedin (subtopology euclidean T) K"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10825
  shows "compact {x. x \<in> S \<and> f x \<in> K}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10826
by (rule closedin_compact [OF \<open>compact S\<close>] continuous_closedin_preimage_gen assms)+
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10827
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10828
lemma proper_map_fst:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10829
  assumes "compact T" "K \<subseteq> S" "compact K"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10830
    shows "compact {z \<in> S \<times> T. fst z \<in> K}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10831
proof -
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10832
  have "{z \<in> S \<times> T. fst z \<in> K} = K \<times> T"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10833
    using assms by auto
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10834
  then show ?thesis by (simp add: assms compact_Times)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10835
qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10836
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10837
lemma closed_map_fst:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10838
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10839
  assumes "compact T" "closedin (subtopology euclidean (S \<times> T)) c"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10840
   shows "closedin (subtopology euclidean S) (fst ` c)"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10841
proof -
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10842
  have *: "fst ` (S \<times> T) \<subseteq> S"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10843
    by auto
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10844
  show ?thesis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10845
    using proper_map [OF _ _ *] by (simp add: proper_map_fst assms)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10846
qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10847
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10848
lemma proper_map_snd:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10849
  assumes "compact S" "K \<subseteq> T" "compact K"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10850
    shows "compact {z \<in> S \<times> T. snd z \<in> K}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10851
proof -
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10852
  have "{z \<in> S \<times> T. snd z \<in> K} = S \<times> K"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10853
    using assms by auto
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10854
  then show ?thesis by (simp add: assms compact_Times)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10855
qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10856
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10857
lemma closed_map_snd:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10858
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10859
  assumes "compact S" "closedin (subtopology euclidean (S \<times> T)) c"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10860
   shows "closedin (subtopology euclidean T) (snd ` c)"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10861
proof -
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10862
  have *: "snd ` (S \<times> T) \<subseteq> T"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10863
    by auto
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10864
  show ?thesis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10865
    using proper_map [OF _ _ *] by (simp add: proper_map_snd assms)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10866
qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10867
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10868
lemma closedin_compact_projection:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10869
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10870
  assumes "compact S" and clo: "closedin (subtopology euclidean (S \<times> T)) U"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10871
    shows "closedin (subtopology euclidean T) {y. \<exists>x. x \<in> S \<and> (x, y) \<in> U}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10872
proof -
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10873
  have "U \<subseteq> S \<times> T"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10874
    by (metis clo closedin_imp_subset)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10875
  then have "{y. \<exists>x. x \<in> S \<and> (x, y) \<in> U} = snd ` U"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10876
    by force
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10877
  moreover have "closedin (subtopology euclidean T) (snd ` U)"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10878
    by (rule closed_map_snd [OF assms])
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10879
  ultimately show ?thesis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10880
    by simp
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10881
qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10882
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10883
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10884
lemma closed_compact_projection:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10885
  fixes S :: "'a::euclidean_space set"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10886
    and T :: "('a * 'b::euclidean_space) set"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10887
  assumes "compact S" and clo: "closed T"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10888
    shows "closed {y. \<exists>x. x \<in> S \<and> (x, y) \<in> T}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10889
proof -
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10890
  have *: "{y. \<exists>x. x \<in> S \<and> Pair x y \<in> T} =
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10891
        {y. \<exists>x. x \<in> S \<and> Pair x y \<in> ((S \<times> UNIV) \<inter> T)}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10892
    by auto
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10893
  show ?thesis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10894
    apply (subst *)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10895
    apply (rule closedin_closed_trans [OF _ closed_UNIV])
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10896
    apply (rule closedin_compact_projection [OF \<open>compact S\<close>])
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10897
    by (simp add: clo closedin_closed_Int)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10898
qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 10899
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10900
subsubsection\<open>Representing affine hull as a finite intersection of hyperplanes\<close>
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10901
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10902
proposition affine_hull_convex_Int_nonempty_interior:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10903
  fixes S :: "'a::real_normed_vector set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10904
  assumes "convex S" "S \<inter> interior T \<noteq> {}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10905
    shows "affine hull (S \<inter> T) = affine hull S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10906
proof
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10907
  show "affine hull (S \<inter> T) \<subseteq> affine hull S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10908
    by (simp add: hull_mono)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10909
next
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10910
  obtain a where "a \<in> S" "a \<in> T" and at: "a \<in> interior T"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10911
    using assms interior_subset by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10912
  then obtain e where "e > 0" and e: "cball a e \<subseteq> T"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10913
    using mem_interior_cball by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10914
  have *: "x \<in> op + a ` span ((\<lambda>x. x - a) ` (S \<inter> T))" if "x \<in> S" for x
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10915
  proof (cases "x = a")
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10916
    case True with that span_0 eq_add_iff image_def mem_Collect_eq show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10917
      by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10918
  next
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10919
    case False
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
 10920
    define k where "k = min (1/2) (e / norm (x-a))"
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10921
    have k: "0 < k" "k < 1"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10922
      using \<open>e > 0\<close> False by (auto simp: k_def)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10923
    then have xa: "(x-a) = inverse k *\<^sub>R k *\<^sub>R (x-a)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10924
      by simp
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10925
    have "e / norm (x - a) \<ge> k"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10926
      using k_def by linarith
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10927
    then have "a + k *\<^sub>R (x - a) \<in> cball a e"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10928
      using \<open>0 < k\<close> False by (simp add: dist_norm field_simps)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10929
    then have T: "a + k *\<^sub>R (x - a) \<in> T"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10930
      using e by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10931
    have S: "a + k *\<^sub>R (x - a) \<in> S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10932
      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]
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10933
      by (simp add: algebra_simps)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10934
    have "inverse k *\<^sub>R k *\<^sub>R (x-a) \<in> span ((\<lambda>x. x - a) ` (S \<inter> T))"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10935
      apply (rule span_mul)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10936
      apply (rule span_superset)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10937
      apply (rule image_eqI [where x = "a + k *\<^sub>R (x - a)"])
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10938
      apply (auto simp: S T)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10939
      done
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10940
    with xa image_iff show ?thesis  by fastforce
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10941
  qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10942
  show "affine hull S \<subseteq> affine hull (S \<inter> T)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10943
    apply (simp add: subset_hull)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10944
    apply (simp add: \<open>a \<in> S\<close> \<open>a \<in> T\<close> hull_inc affine_hull_span_gen [of a])
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10945
    apply (force simp: *)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10946
    done
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10947
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10948
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10949
corollary affine_hull_convex_Int_open:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10950
  fixes S :: "'a::real_normed_vector set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10951
  assumes "convex S" "open T" "S \<inter> T \<noteq> {}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10952
    shows "affine hull (S \<inter> T) = affine hull S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10953
using affine_hull_convex_Int_nonempty_interior assms interior_eq by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10954
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10955
corollary affine_hull_affine_Int_nonempty_interior:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10956
  fixes S :: "'a::real_normed_vector set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10957
  assumes "affine S" "S \<inter> interior T \<noteq> {}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10958
    shows "affine hull (S \<inter> T) = affine hull S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10959
by (simp add: affine_hull_convex_Int_nonempty_interior affine_imp_convex assms)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10960
63018
ae2ec7d86ad4 tidying some proofs; getting rid of "nonempty_witness"
paulson <lp15@cam.ac.uk>
parents: 63016
diff changeset
 10961
corollary affine_hull_affine_Int_open:
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10962
  fixes S :: "'a::real_normed_vector set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10963
  assumes "affine S" "open T" "S \<inter> T \<noteq> {}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10964
    shows "affine hull (S \<inter> T) = affine hull S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10965
by (simp add: affine_hull_convex_Int_open affine_imp_convex assms)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10966
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10967
corollary affine_hull_convex_Int_openin:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10968
  fixes S :: "'a::real_normed_vector set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10969
  assumes "convex S" "openin (subtopology euclidean (affine hull S)) T" "S \<inter> T \<noteq> {}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10970
    shows "affine hull (S \<inter> T) = affine hull S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10971
using assms unfolding openin_open
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10972
by (metis affine_hull_convex_Int_open hull_subset inf.orderE inf_assoc)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10973
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10974
corollary affine_hull_open_in:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10975
  fixes S :: "'a::real_normed_vector set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10976
  assumes "openin (subtopology euclidean (affine hull T)) S" "S \<noteq> {}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10977
    shows "affine hull S = affine hull T"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10978
using assms unfolding openin_open
63018
ae2ec7d86ad4 tidying some proofs; getting rid of "nonempty_witness"
paulson <lp15@cam.ac.uk>
parents: 63016
diff changeset
 10979
by (metis affine_affine_hull affine_hull_affine_Int_open hull_hull)
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10980
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10981
corollary affine_hull_open:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10982
  fixes S :: "'a::real_normed_vector set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10983
  assumes "open S" "S \<noteq> {}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10984
    shows "affine hull S = UNIV"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10985
by (metis affine_hull_convex_Int_nonempty_interior assms convex_UNIV hull_UNIV inf_top.left_neutral interior_open)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10986
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10987
lemma aff_dim_convex_Int_nonempty_interior:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10988
  fixes S :: "'a::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10989
  shows "\<lbrakk>convex S; S \<inter> interior T \<noteq> {}\<rbrakk> \<Longrightarrow> aff_dim(S \<inter> T) = aff_dim S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10990
using aff_dim_affine_hull2 affine_hull_convex_Int_nonempty_interior by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10991
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10992
lemma aff_dim_convex_Int_open:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10993
  fixes S :: "'a::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10994
  shows "\<lbrakk>convex S; open T; S \<inter> T \<noteq> {}\<rbrakk> \<Longrightarrow>  aff_dim(S \<inter> T) = aff_dim S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10995
using aff_dim_convex_Int_nonempty_interior interior_eq by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10996
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10997
lemma affine_hull_halfspace_lt:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10998
  fixes a :: "'a::euclidean_space"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 10999
  shows "affine hull {x. a \<bullet> x < r} = (if a = 0 \<and> r \<le> 0 then {} else UNIV)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11000
using halfspace_eq_empty_lt [of a r]
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11001
by (simp add: open_halfspace_lt affine_hull_open)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11002
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11003
lemma affine_hull_halfspace_le:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11004
  fixes a :: "'a::euclidean_space"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11005
  shows "affine hull {x. a \<bullet> x \<le> r} = (if a = 0 \<and> r < 0 then {} else UNIV)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11006
proof (cases "a = 0")
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11007
  case True then show ?thesis by simp
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11008
next
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11009
  case False
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11010
  then have "affine hull closure {x. a \<bullet> x < r} = UNIV"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11011
    using affine_hull_halfspace_lt closure_same_affine_hull by fastforce
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11012
  moreover have "{x. a \<bullet> x < r} \<subseteq> {x. a \<bullet> x \<le> r}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11013
    by (simp add: Collect_mono)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11014
  ultimately show ?thesis using False antisym_conv hull_mono top_greatest
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11015
    by (metis affine_hull_halfspace_lt)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11016
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11017
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11018
lemma affine_hull_halfspace_gt:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11019
  fixes a :: "'a::euclidean_space"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11020
  shows "affine hull {x. a \<bullet> x > r} = (if a = 0 \<and> r \<ge> 0 then {} else UNIV)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11021
using halfspace_eq_empty_gt [of r a]
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11022
by (simp add: open_halfspace_gt affine_hull_open)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11023
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11024
lemma affine_hull_halfspace_ge:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11025
  fixes a :: "'a::euclidean_space"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11026
  shows "affine hull {x. a \<bullet> x \<ge> r} = (if a = 0 \<and> r > 0 then {} else UNIV)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11027
using affine_hull_halfspace_le [of "-a" "-r"] by simp
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11028
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11029
lemma aff_dim_halfspace_lt:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11030
  fixes a :: "'a::euclidean_space"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11031
  shows "aff_dim {x. a \<bullet> x < r} =
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11032
        (if a = 0 \<and> r \<le> 0 then -1 else DIM('a))"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11033
by simp (metis aff_dim_open halfspace_eq_empty_lt open_halfspace_lt)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11034
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11035
lemma aff_dim_halfspace_le:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11036
  fixes a :: "'a::euclidean_space"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11037
  shows "aff_dim {x. a \<bullet> x \<le> r} =
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11038
        (if a = 0 \<and> r < 0 then -1 else DIM('a))"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11039
proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11040
  have "int (DIM('a)) = aff_dim (UNIV::'a set)"
63072
eb5d493a9e03 renamings and refinements
paulson <lp15@cam.ac.uk>
parents: 63040
diff changeset
 11041
    by (simp add: aff_dim_UNIV)
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11042
  then have "aff_dim (affine hull {x. a \<bullet> x \<le> r}) = DIM('a)" if "(a = 0 \<longrightarrow> r \<ge> 0)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11043
    using that by (simp add: affine_hull_halfspace_le not_less)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11044
  then show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11045
    by (force simp: aff_dim_affine_hull)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11046
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11047
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11048
lemma aff_dim_halfspace_gt:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11049
  fixes a :: "'a::euclidean_space"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11050
  shows "aff_dim {x. a \<bullet> x > r} =
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11051
        (if a = 0 \<and> r \<ge> 0 then -1 else DIM('a))"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11052
by simp (metis aff_dim_open halfspace_eq_empty_gt open_halfspace_gt)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11053
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11054
lemma aff_dim_halfspace_ge:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11055
  fixes a :: "'a::euclidean_space"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11056
  shows "aff_dim {x. a \<bullet> x \<ge> r} =
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11057
        (if a = 0 \<and> r > 0 then -1 else DIM('a))"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11058
using aff_dim_halfspace_le [of "-a" "-r"] by simp
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11059
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11060
subsection\<open>Properties of special hyperplanes\<close>
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11061
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11062
lemma subspace_hyperplane: "subspace {x. a \<bullet> x = 0}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11063
  by (simp add: subspace_def inner_right_distrib)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11064
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
 11065
lemma subspace_hyperplane2: "subspace {x. x \<bullet> a = 0}"
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
 11066
  by (simp add: inner_commute inner_right_distrib subspace_def)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
 11067
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11068
lemma special_hyperplane_span:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11069
  fixes S :: "'n::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11070
  assumes "k \<in> Basis"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11071
  shows "{x. k \<bullet> x = 0} = span (Basis - {k})"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11072
proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11073
  have *: "x \<in> span (Basis - {k})" if "k \<bullet> x = 0" for x
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11074
  proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11075
    have "x = (\<Sum>b\<in>Basis. (x \<bullet> b) *\<^sub>R b)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11076
      by (simp add: euclidean_representation)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11077
    also have "... = (\<Sum>b \<in> Basis - {k}. (x \<bullet> b) *\<^sub>R b)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11078
      by (auto simp: setsum.remove [of _ k] inner_commute assms that)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11079
    finally have "x = (\<Sum>b\<in>Basis - {k}. (x \<bullet> b) *\<^sub>R b)" .
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11080
    then show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11081
      by (simp add: Linear_Algebra.span_finite) metis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11082
  qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11083
  show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11084
    apply (rule span_subspace [symmetric])
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11085
    using assms
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11086
    apply (auto simp: inner_not_same_Basis intro: * subspace_hyperplane)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11087
    done
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11088
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11089
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11090
lemma dim_special_hyperplane:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11091
  fixes k :: "'n::euclidean_space"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11092
  shows "k \<in> Basis \<Longrightarrow> dim {x. k \<bullet> x = 0} = DIM('n) - 1"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11093
apply (simp add: special_hyperplane_span)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11094
apply (rule Linear_Algebra.dim_unique [OF subset_refl])
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11095
apply (auto simp: Diff_subset independent_substdbasis)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11096
apply (metis member_remove remove_def span_clauses(1))
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11097
done
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11098
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11099
proposition dim_hyperplane:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11100
  fixes a :: "'a::euclidean_space"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11101
  assumes "a \<noteq> 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11102
    shows "dim {x. a \<bullet> x = 0} = DIM('a) - 1"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11103
proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11104
  have span0: "span {x. a \<bullet> x = 0} = {x. a \<bullet> x = 0}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11105
    by (rule span_unique) (auto simp: subspace_hyperplane)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11106
  then obtain B where "independent B"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11107
              and Bsub: "B \<subseteq> {x. a \<bullet> x = 0}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11108
              and subspB: "{x. a \<bullet> x = 0} \<subseteq> span B"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11109
              and card0: "(card B = dim {x. a \<bullet> x = 0})"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11110
              and ortho: "pairwise orthogonal B"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11111
    using orthogonal_basis_exists by metis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11112
  with assms have "a \<notin> span B"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11113
    by (metis (mono_tags, lifting) span_eq inner_eq_zero_iff mem_Collect_eq span0 span_subspace)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11114
  then have ind: "independent (insert a B)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11115
    by (simp add: \<open>independent B\<close> independent_insert)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11116
  have "finite B"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11117
    using \<open>independent B\<close> independent_bound by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11118
  have "UNIV \<subseteq> span (insert a B)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11119
  proof fix y::'a
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11120
    obtain r z where z: "y = r *\<^sub>R a + z" "a \<bullet> z = 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11121
      apply (rule_tac r="(a \<bullet> y) / (a \<bullet> a)" and z = "y - ((a \<bullet> y) / (a \<bullet> a)) *\<^sub>R a" in that)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11122
      using assms
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11123
      by (auto simp: algebra_simps)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11124
    show "y \<in> span (insert a B)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11125
      by (metis (mono_tags, lifting) z Bsub Convex_Euclidean_Space.span_eq
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11126
         add_diff_cancel_left' mem_Collect_eq span0 span_breakdown_eq span_subspace subspB)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11127
  qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11128
  then have dima: "DIM('a) = dim(insert a B)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11129
    by (metis antisym dim_UNIV dim_subset_UNIV subset_le_dim)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11130
  then show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11131
    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)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11132
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11133
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11134
lemma lowdim_eq_hyperplane:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11135
  fixes S :: "'a::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11136
  assumes "dim S = DIM('a) - 1"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11137
  obtains a where "a \<noteq> 0" and "span S = {x. a \<bullet> x = 0}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11138
proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11139
  have [simp]: "dim S < DIM('a)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11140
    by (simp add: DIM_positive assms)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11141
  then obtain b where b: "b \<noteq> 0" "span S \<subseteq> {a. b \<bullet> a = 0}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11142
    using lowdim_subset_hyperplane [of S] by fastforce
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11143
  show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11144
    using b that real_vector_class.subspace_span [of S]
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11145
    by (simp add: assms dim_hyperplane subspace_dim_equal subspace_hyperplane)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11146
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11147
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11148
lemma dim_eq_hyperplane:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11149
  fixes S :: "'n::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11150
  shows "dim S = DIM('n) - 1 \<longleftrightarrow> (\<exists>a. a \<noteq> 0 \<and> span S = {x. a \<bullet> x = 0})"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11151
by (metis One_nat_def dim_hyperplane dim_span lowdim_eq_hyperplane)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11152
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11153
proposition aff_dim_eq_hyperplane:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11154
  fixes S :: "'a::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11155
  shows "aff_dim S = DIM('a) - 1 \<longleftrightarrow> (\<exists>a b. a \<noteq> 0 \<and> affine hull S = {x. a \<bullet> x = b})"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11156
proof (cases "S = {}")
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11157
  case True then show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11158
    by (auto simp: dest: hyperplane_eq_Ex)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11159
next
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11160
  case False
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11161
  then obtain c where "c \<in> S" by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11162
  show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11163
  proof (cases "c = 0")
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11164
    case True show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11165
    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
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11166
                del: One_nat_def)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11167
    apply (rule ex_cong)
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11168
    apply (metis (mono_tags) span_0 \<open>c = 0\<close> image_add_0 inner_zero_right mem_Collect_eq)
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11169
    done
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11170
  next
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11171
    case False
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11172
    have xc_im: "x \<in> op + c ` {y. a \<bullet> y = 0}" if "a \<bullet> x = a \<bullet> c" for a x
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11173
    proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11174
      have "\<exists>y. a \<bullet> y = 0 \<and> c + y = x"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11175
        by (metis that add.commute diff_add_cancel inner_commute inner_diff_left right_minus_eq)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11176
      then show "x \<in> op + c ` {y. a \<bullet> y = 0}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11177
        by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11178
    qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11179
    have 2: "span ((\<lambda>x. x - c) ` S) = {x. a \<bullet> x = 0}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11180
         if "op + c ` span ((\<lambda>x. x - c) ` S) = {x. a \<bullet> x = b}" for a b
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11181
    proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11182
      have "b = a \<bullet> c"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11183
        using span_0 that by fastforce
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11184
      with that have "op + c ` span ((\<lambda>x. x - c) ` S) = {x. a \<bullet> x = a \<bullet> c}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11185
        by simp
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11186
      then have "span ((\<lambda>x. x - c) ` S) = (\<lambda>x. x - c) ` {x. a \<bullet> x = a \<bullet> c}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11187
        by (metis (no_types) image_cong translation_galois uminus_add_conv_diff)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11188
      also have "... = {x. a \<bullet> x = 0}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11189
        by (force simp: inner_distrib inner_diff_right
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11190
             intro: image_eqI [where x="x+c" for x])
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11191
      finally show ?thesis .
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11192
    qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11193
    show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11194
      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
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11195
                  del: One_nat_def, safe)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11196
      apply (fastforce simp add: inner_distrib intro: xc_im)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11197
      apply (force simp: intro!: 2)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11198
      done
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11199
  qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11200
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11201
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11202
corollary aff_dim_hyperplane [simp]:
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11203
  fixes a :: "'a::euclidean_space"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11204
  shows "a \<noteq> 0 \<Longrightarrow> aff_dim {x. a \<bullet> x = r} = DIM('a) - 1"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11205
by (metis aff_dim_eq_hyperplane affine_hull_eq affine_hyperplane)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11206
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11207
subsection\<open>Some stepping theorems\<close>
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11208
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11209
lemma dim_empty [simp]: "dim ({} :: 'a::euclidean_space set) = 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11210
  by (force intro!: dim_unique)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11211
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11212
lemma dim_insert:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11213
  fixes x :: "'a::euclidean_space"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11214
  shows "dim (insert x S) = (if x \<in> span S then dim S else dim S + 1)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11215
proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11216
  show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11217
  proof (cases "x \<in> span S")
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11218
    case True then show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11219
      by (metis dim_span span_redundant)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11220
  next
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11221
    case False
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11222
    obtain B where B: "B \<subseteq> span S" "independent B" "span S \<subseteq> span B" "card B = dim (span S)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11223
      using basis_exists [of "span S"] by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11224
    have 1: "insert x B \<subseteq> span (insert x S)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11225
      by (meson \<open>B \<subseteq> span S\<close> dual_order.trans insertI1 insert_subsetI span_mono span_superset subset_insertI)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11226
    have 2: "span (insert x S) \<subseteq> span (insert x B)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11227
      by (metis \<open>B \<subseteq> span S\<close> \<open>span S \<subseteq> span B\<close> span_breakdown_eq span_subspace subsetI subspace_span)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11228
    have 3: "independent (insert x B)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11229
      by (metis B independent_insert span_subspace subspace_span False)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11230
    have "dim (span (insert x S)) = Suc (dim S)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11231
      apply (rule dim_unique [OF 1 2 3])
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11232
      by (metis B False card_insert_disjoint dim_span independent_imp_finite subsetCE)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11233
    then show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11234
      by (simp add: False)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11235
  qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11236
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11237
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11238
lemma dim_singleton [simp]:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11239
  fixes x :: "'a::euclidean_space"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11240
  shows "dim{x} = (if x = 0 then 0 else 1)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11241
by (simp add: dim_insert)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11242
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11243
lemma dim_eq_0 [simp]:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11244
  fixes S :: "'a::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11245
  shows "dim S = 0 \<longleftrightarrow> S \<subseteq> {0}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11246
apply safe
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11247
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)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11248
by (metis dim_singleton dim_subset le_0_eq)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11249
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11250
lemma aff_dim_insert:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11251
  fixes a :: "'a::euclidean_space"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11252
  shows "aff_dim (insert a S) = (if a \<in> affine hull S then aff_dim S else aff_dim S + 1)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11253
proof (cases "S = {}")
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11254
  case True then show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11255
    by simp
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11256
next
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11257
  case False
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11258
  then obtain x s' where S: "S = insert x s'" "x \<notin> s'"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11259
    by (meson Set.set_insert all_not_in_conv)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11260
  show ?thesis using S
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11261
    apply (simp add: hull_redundant cong: aff_dim_affine_hull2)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11262
    apply (simp add: affine_hull_insert_span_gen hull_inc)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11263
    apply (simp add: insert_commute [of a] hull_inc aff_dim_eq_dim [of x] dim_insert span_0)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11264
    apply (metis (no_types, lifting) add_minus_cancel image_iff uminus_add_conv_diff)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11265
    done
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11266
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11267
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11268
lemma subspace_bounded_eq_trivial:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11269
  fixes S :: "'a::real_normed_vector set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11270
  assumes "subspace S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11271
    shows "bounded S \<longleftrightarrow> S = {0}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11272
proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11273
  have "False" if "bounded S" "x \<in> S" "x \<noteq> 0" for x
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11274
  proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11275
    obtain B where B: "\<And>y. y \<in> S \<Longrightarrow> norm y < B" "B > 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11276
      using \<open>bounded S\<close> by (force simp: bounded_pos_less)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11277
    have "(B / norm x) *\<^sub>R x \<in> S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11278
      using assms subspace_mul \<open>x \<in> S\<close> by auto
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11279
    moreover have "norm ((B / norm x) *\<^sub>R x) = B"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11280
      using that B by (simp add: algebra_simps)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11281
    ultimately show False using B by force
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11282
  qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11283
  then have "bounded S \<Longrightarrow> S = {0}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11284
    using assms subspace_0 by fastforce
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11285
  then show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11286
    by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11287
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11288
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11289
lemma affine_bounded_eq_trivial:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11290
  fixes S :: "'a::real_normed_vector set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11291
  assumes "affine S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11292
    shows "bounded S \<longleftrightarrow> S = {} \<or> (\<exists>a. S = {a})"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11293
proof (cases "S = {}")
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11294
  case True then show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11295
    by simp
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11296
next
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11297
  case False
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11298
  then obtain b where "b \<in> S" by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11299
  with False assms show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11300
    apply safe
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11301
    using affine_diffs_subspace [OF assms \<open>b \<in> S\<close>]
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11302
    apply (metis (no_types, lifting) subspace_bounded_eq_trivial ab_left_minus bounded_translation
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11303
                image_empty image_insert translation_invert)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11304
    apply force
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11305
    done
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11306
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11307
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11308
lemma affine_bounded_eq_lowdim:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11309
  fixes S :: "'a::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11310
  assumes "affine S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11311
    shows "bounded S \<longleftrightarrow> aff_dim S \<le> 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11312
apply safe
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11313
using affine_bounded_eq_trivial assms apply fastforce
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11314
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)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11315
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11316
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11317
lemma bounded_hyperplane_eq_trivial_0:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11318
  fixes a :: "'a::euclidean_space"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11319
  assumes "a \<noteq> 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11320
  shows "bounded {x. a \<bullet> x = 0} \<longleftrightarrow> DIM('a) = 1"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11321
proof
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11322
  assume "bounded {x. a \<bullet> x = 0}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11323
  then have "aff_dim {x. a \<bullet> x = 0} \<le> 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11324
    by (simp add: affine_bounded_eq_lowdim affine_hyperplane)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11325
  with assms show "DIM('a) = 1"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11326
    by (simp add: le_Suc_eq aff_dim_hyperplane)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11327
next
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11328
  assume "DIM('a) = 1"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11329
  then show "bounded {x. a \<bullet> x = 0}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11330
    by (simp add: aff_dim_hyperplane affine_bounded_eq_lowdim affine_hyperplane assms)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11331
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11332
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11333
lemma bounded_hyperplane_eq_trivial:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11334
  fixes a :: "'a::euclidean_space"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11335
  shows "bounded {x. a \<bullet> x = r} \<longleftrightarrow> (if a = 0 then r \<noteq> 0 else DIM('a) = 1)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11336
proof (simp add: bounded_hyperplane_eq_trivial_0, clarify)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11337
  assume "r \<noteq> 0" "a \<noteq> 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11338
  have "aff_dim {x. y \<bullet> x = 0} = aff_dim {x. a \<bullet> x = r}" if "y \<noteq> 0" for y::'a
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11339
    by (metis that \<open>a \<noteq> 0\<close> aff_dim_hyperplane)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11340
  then show "bounded {x. a \<bullet> x = r} = (DIM('a) = Suc 0)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11341
    by (metis One_nat_def \<open>a \<noteq> 0\<close> affine_bounded_eq_lowdim affine_hyperplane bounded_hyperplane_eq_trivial_0)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11342
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11343
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11344
subsection\<open>General case without assuming closure and getting non-strict separation\<close>
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11345
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11346
proposition separating_hyperplane_closed_point_inset:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11347
  fixes S :: "'a::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11348
  assumes "convex S" "closed S" "S \<noteq> {}" "z \<notin> S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11349
  obtains a b where "a \<in> S" "(a - z) \<bullet> z < b" "\<And>x. x \<in> S \<Longrightarrow> b < (a - z) \<bullet> x"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11350
proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11351
  obtain y where "y \<in> S" and y: "\<And>u. u \<in> S \<Longrightarrow> dist z y \<le> dist z u"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11352
    using distance_attains_inf [of S z] assms by auto
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11353
  then have *: "(y - z) \<bullet> z < (y - z) \<bullet> z + (norm (y - z))\<^sup>2 / 2"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11354
    using \<open>y \<in> S\<close> \<open>z \<notin> S\<close> by auto
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11355
  show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11356
  proof (rule that [OF \<open>y \<in> S\<close> *])
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11357
    fix x
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11358
    assume "x \<in> S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11359
    have yz: "0 < (y - z) \<bullet> (y - z)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11360
      using \<open>y \<in> S\<close> \<open>z \<notin> S\<close> by auto
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11361
    { assume 0: "0 < ((z - y) \<bullet> (x - y))"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11362
      with any_closest_point_dot [OF \<open>convex S\<close> \<open>closed S\<close>]
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11363
      have False
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11364
        using y \<open>x \<in> S\<close> \<open>y \<in> S\<close> not_less by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11365
    }
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11366
    then have "0 \<le> ((y - z) \<bullet> (x - y))"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11367
      by (force simp: not_less inner_diff_left)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11368
    with yz have "0 < 2 * ((y - z) \<bullet> (x - y)) + (y - z) \<bullet> (y - z)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11369
      by (simp add: algebra_simps)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11370
    then show "(y - z) \<bullet> z + (norm (y - z))\<^sup>2 / 2 < (y - z) \<bullet> x"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11371
      by (simp add: field_simps inner_diff_left inner_diff_right dot_square_norm [symmetric])
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11372
  qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11373
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11374
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11375
lemma separating_hyperplane_closed_0_inset:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11376
  fixes S :: "'a::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11377
  assumes "convex S" "closed S" "S \<noteq> {}" "0 \<notin> S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11378
  obtains a b where "a \<in> S" "a \<noteq> 0" "0 < b" "\<And>x. x \<in> S \<Longrightarrow> a \<bullet> x > b"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11379
using separating_hyperplane_closed_point_inset [OF assms]
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11380
by simp (metis \<open>0 \<notin> S\<close>)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11381
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11382
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11383
proposition separating_hyperplane_set_0_inspan:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11384
  fixes S :: "'a::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11385
  assumes "convex S" "S \<noteq> {}" "0 \<notin> S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11386
  obtains a where "a \<in> span S" "a \<noteq> 0" "\<And>x. x \<in> S \<Longrightarrow> 0 \<le> a \<bullet> x"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11387
proof -
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
 11388
  define k where [abs_def]: "k c = {x. 0 \<le> c \<bullet> x}" for c :: 'a
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11389
  have *: "span S \<inter> frontier (cball 0 1) \<inter> \<Inter>f' \<noteq> {}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11390
          if f': "finite f'" "f' \<subseteq> k ` S" for f'
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11391
  proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11392
    obtain C where "C \<subseteq> S" "finite C" and C: "f' = k ` C"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11393
      using finite_subset_image [OF f'] by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11394
    obtain a where "a \<in> S" "a \<noteq> 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11395
      using \<open>S \<noteq> {}\<close> \<open>0 \<notin> S\<close> ex_in_conv by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11396
    then have "norm (a /\<^sub>R (norm a)) = 1"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11397
      by simp
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11398
    moreover have "a /\<^sub>R (norm a) \<in> span S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11399
      by (simp add: \<open>a \<in> S\<close> span_mul span_superset)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11400
    ultimately have ass: "a /\<^sub>R (norm a) \<in> span S \<inter> sphere 0 1"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11401
      by simp
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11402
    show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11403
    proof (cases "C = {}")
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11404
      case True with C ass show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11405
        by auto
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11406
    next
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11407
      case False
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11408
      have "closed (convex hull C)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11409
        using \<open>finite C\<close> compact_eq_bounded_closed finite_imp_compact_convex_hull by auto
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11410
      moreover have "convex hull C \<noteq> {}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11411
        by (simp add: False)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11412
      moreover have "0 \<notin> convex hull C"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11413
        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)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11414
      ultimately obtain a b
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11415
            where "a \<in> convex hull C" "a \<noteq> 0" "0 < b"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11416
                  and ab: "\<And>x. x \<in> convex hull C \<Longrightarrow> a \<bullet> x > b"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11417
        using separating_hyperplane_closed_0_inset by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11418
      then have "a \<in> S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11419
        by (metis \<open>C \<subseteq> S\<close> assms(1) subsetCE subset_hull)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11420
      moreover have "norm (a /\<^sub>R (norm a)) = 1"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11421
        using \<open>a \<noteq> 0\<close> by simp
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11422
      moreover have "a /\<^sub>R (norm a) \<in> span S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11423
        by (simp add: \<open>a \<in> S\<close> span_mul span_superset)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11424
      ultimately have ass: "a /\<^sub>R (norm a) \<in> span S \<inter> sphere 0 1"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11425
        by simp
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11426
      have aa: "a /\<^sub>R (norm a) \<in> (\<Inter>c\<in>C. {x. 0 \<le> c \<bullet> x})"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11427
        apply (clarsimp simp add: divide_simps)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11428
        using ab \<open>0 < b\<close>
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11429
        by (metis hull_inc inner_commute less_eq_real_def less_trans)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11430
      show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11431
        apply (simp add: C k_def)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11432
        using ass aa Int_iff empty_iff by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11433
    qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11434
  qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11435
  have "(span S \<inter> frontier(cball 0 1)) \<inter> (\<Inter> (k ` S)) \<noteq> {}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11436
    apply (rule compact_imp_fip)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11437
    apply (blast intro: compact_cball)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11438
    using closed_halfspace_ge k_def apply blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11439
    apply (metis *)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11440
    done
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11441
  then show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11442
    unfolding set_eq_iff k_def
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11443
    by simp (metis inner_commute norm_eq_zero that zero_neq_one)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11444
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11445
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11446
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11447
lemma separating_hyperplane_set_point_inaff:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11448
  fixes S :: "'a::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11449
  assumes "convex S" "S \<noteq> {}" and zno: "z \<notin> S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11450
  obtains a b where "(z + a) \<in> affine hull (insert z S)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11451
                and "a \<noteq> 0" and "a \<bullet> z \<le> b"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11452
                and "\<And>x. x \<in> S \<Longrightarrow> a \<bullet> x \<ge> b"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11453
proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11454
from separating_hyperplane_set_0_inspan [of "image (\<lambda>x. -z + x) S"]
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11455
  have "convex (op + (- z) ` S)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11456
    by (simp add: \<open>convex S\<close>)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11457
  moreover have "op + (- z) ` S \<noteq> {}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11458
    by (simp add: \<open>S \<noteq> {}\<close>)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11459
  moreover have "0 \<notin> op + (- z) ` S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11460
    using zno by auto
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11461
  ultimately obtain a where "a \<in> span (op + (- z) ` S)" "a \<noteq> 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11462
                  and a:  "\<And>x. x \<in> (op + (- z) ` S) \<Longrightarrow> 0 \<le> a \<bullet> x"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11463
    using separating_hyperplane_set_0_inspan [of "image (\<lambda>x. -z + x) S"]
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11464
    by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11465
  then have szx: "\<And>x. x \<in> S \<Longrightarrow> a \<bullet> z \<le> a \<bullet> x"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11466
    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)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11467
  show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11468
    apply (rule_tac a=a and b = "a  \<bullet> z" in that, simp_all)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11469
    using \<open>a \<in> span (op + (- z) ` S)\<close> affine_hull_insert_span_gen apply blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11470
    apply (simp_all add: \<open>a \<noteq> 0\<close> szx)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11471
    done
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11472
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11473
63072
eb5d493a9e03 renamings and refinements
paulson <lp15@cam.ac.uk>
parents: 63040
diff changeset
 11474
proposition supporting_hyperplane_rel_boundary:
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11475
  fixes S :: "'a::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11476
  assumes "convex S" "x \<in> S" and xno: "x \<notin> rel_interior S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11477
  obtains a where "a \<noteq> 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11478
              and "\<And>y. y \<in> S \<Longrightarrow> a \<bullet> x \<le> a \<bullet> y"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11479
              and "\<And>y. y \<in> rel_interior S \<Longrightarrow> a \<bullet> x < a \<bullet> y"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11480
proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11481
  obtain a b where aff: "(x + a) \<in> affine hull (insert x (rel_interior S))"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11482
                  and "a \<noteq> 0" and "a \<bullet> x \<le> b"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11483
                  and ageb: "\<And>u. u \<in> (rel_interior S) \<Longrightarrow> a \<bullet> u \<ge> b"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11484
    using separating_hyperplane_set_point_inaff [of "rel_interior S" x] assms
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11485
    by (auto simp: rel_interior_eq_empty convex_rel_interior)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11486
  have le_ay: "a \<bullet> x \<le> a \<bullet> y" if "y \<in> S" for y
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11487
  proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11488
    have con: "continuous_on (closure (rel_interior S)) (op \<bullet> a)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11489
      by (rule continuous_intros continuous_on_subset | blast)+
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11490
    have y: "y \<in> closure (rel_interior S)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11491
      using \<open>convex S\<close> closure_def convex_closure_rel_interior \<open>y \<in> S\<close>
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11492
      by fastforce
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11493
    show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11494
      using continuous_ge_on_closure [OF con y] ageb \<open>a \<bullet> x \<le> b\<close>
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11495
      by fastforce
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11496
  qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11497
  have 3: "a \<bullet> x < a \<bullet> y" if "y \<in> rel_interior S" for y
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11498
  proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11499
    obtain e where "0 < e" "y \<in> S" and e: "cball y e \<inter> affine hull S \<subseteq> S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11500
      using \<open>y \<in> rel_interior S\<close> by (force simp: rel_interior_cball)
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
 11501
    define y' where "y' = y - (e / norm a) *\<^sub>R ((x + a) - x)"
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11502
    have "y' \<in> cball y e"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11503
      unfolding y'_def using \<open>0 < e\<close> by force
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11504
    moreover have "y' \<in> affine hull S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11505
      unfolding y'_def
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11506
      by (metis \<open>x \<in> S\<close> \<open>y \<in> S\<close> \<open>convex S\<close> aff affine_affine_hull hull_redundant
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11507
                rel_interior_same_affine_hull hull_inc mem_affine_3_minus2)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11508
    ultimately have "y' \<in> S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11509
      using e by auto
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11510
    have "a \<bullet> x \<le> a \<bullet> y"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11511
      using le_ay \<open>a \<noteq> 0\<close> \<open>y \<in> S\<close> by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11512
    moreover have "a \<bullet> x \<noteq> a \<bullet> y"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11513
      using le_ay [OF \<open>y' \<in> S\<close>] \<open>a \<noteq> 0\<close>
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11514
      apply (simp add: y'_def inner_diff dot_square_norm power2_eq_square)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11515
      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)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11516
    ultimately show ?thesis by force
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11517
  qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11518
  show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11519
    by (rule that [OF \<open>a \<noteq> 0\<close> le_ay 3])
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11520
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11521
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11522
lemma supporting_hyperplane_relative_frontier:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11523
  fixes S :: "'a::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11524
  assumes "convex S" "x \<in> closure S" "x \<notin> rel_interior S"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11525
  obtains a where "a \<noteq> 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11526
              and "\<And>y. y \<in> closure S \<Longrightarrow> a \<bullet> x \<le> a \<bullet> y"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11527
              and "\<And>y. y \<in> rel_interior S \<Longrightarrow> a \<bullet> x < a \<bullet> y"
63072
eb5d493a9e03 renamings and refinements
paulson <lp15@cam.ac.uk>
parents: 63040
diff changeset
 11528
using supporting_hyperplane_rel_boundary [of "closure S" x]
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11529
by (metis assms convex_closure convex_rel_interior_closure)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11530
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11531
subsection\<open> Some results on decomposing convex hulls, e.g. simplicial subdivision\<close>
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11532
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11533
lemma
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11534
  fixes s :: "'a::euclidean_space set"
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11535
  assumes "~ (affine_dependent(s \<union> t))"
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11536
    shows convex_hull_Int_subset: "convex hull s \<inter> convex hull t \<subseteq> convex hull (s \<inter> t)" (is ?C)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11537
      and affine_hull_Int_subset: "affine hull s \<inter> affine hull t \<subseteq> affine hull (s \<inter> t)" (is ?A)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11538
proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11539
  have [simp]: "finite s" "finite t"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11540
    using aff_independent_finite assms by blast+
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11541
    have "setsum u (s \<inter> t) = 1 \<and>
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11542
          (\<Sum>v\<in>s \<inter> t. u v *\<^sub>R v) = (\<Sum>v\<in>s. u v *\<^sub>R v)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11543
      if [simp]:  "setsum u s = 1"
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11544
                 "setsum v t = 1"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11545
         and eq: "(\<Sum>x\<in>t. v x *\<^sub>R x) = (\<Sum>x\<in>s. u x *\<^sub>R x)" for u v
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11546
    proof -
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
 11547
    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
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11548
    have "setsum f (s \<union> t) = 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11549
      apply (simp add: f_def setsum_Un setsum_subtractf)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11550
      apply (simp add: setsum.inter_restrict [symmetric] Int_commute)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11551
      done
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11552
    moreover have "(\<Sum>x\<in>(s \<union> t). f x *\<^sub>R x) = 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11553
      apply (simp add: f_def setsum_Un scaleR_left_diff_distrib setsum_subtractf)
63566
e5abbdee461a more accurate cong del;
wenzelm
parents: 63492
diff changeset
 11554
      apply (simp add: if_smult setsum.inter_restrict [symmetric] Int_commute eq
e5abbdee461a more accurate cong del;
wenzelm
parents: 63492
diff changeset
 11555
          cong del: if_weak_cong)
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11556
      done
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11557
    ultimately have "\<And>v. v \<in> s \<union> t \<Longrightarrow> f v = 0"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11558
      using aff_independent_finite assms unfolding affine_dependent_explicit
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11559
      by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11560
    then have u [simp]: "\<And>x. x \<in> s \<Longrightarrow> u x = (if x \<in> t then v x else 0)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11561
      by (simp add: f_def) presburger
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11562
    have "setsum u (s \<inter> t) = setsum u s"
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11563
      by (simp add: setsum.inter_restrict)
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11564
    then have "setsum u (s \<inter> t) = 1"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11565
      using that by linarith
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11566
    moreover have "(\<Sum>v\<in>s \<inter> t. u v *\<^sub>R v) = (\<Sum>v\<in>s. u v *\<^sub>R v)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11567
      by (auto simp: if_smult setsum.inter_restrict intro: setsum.cong)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11568
    ultimately show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11569
      by force
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11570
    qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11571
    then show ?A ?C
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11572
      by (auto simp: convex_hull_finite affine_hull_finite)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11573
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11574
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11575
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11576
proposition affine_hull_Int:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11577
  fixes s :: "'a::euclidean_space set"
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11578
  assumes "~ (affine_dependent(s \<union> t))"
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11579
    shows "affine hull (s \<inter> t) = affine hull s \<inter> affine hull t"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11580
apply (rule subset_antisym)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11581
apply (simp add: hull_mono)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11582
by (simp add: affine_hull_Int_subset assms)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11583
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11584
proposition convex_hull_Int:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11585
  fixes s :: "'a::euclidean_space set"
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11586
  assumes "~ (affine_dependent(s \<union> t))"
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11587
    shows "convex hull (s \<inter> t) = convex hull s \<inter> convex hull t"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11588
apply (rule subset_antisym)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11589
apply (simp add: hull_mono)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11590
by (simp add: convex_hull_Int_subset assms)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11591
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11592
proposition
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11593
  fixes s :: "'a::euclidean_space set set"
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11594
  assumes "~ (affine_dependent (\<Union>s))"
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11595
    shows affine_hull_Inter: "affine hull (\<Inter>s) = (\<Inter>t\<in>s. affine hull t)" (is "?A")
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11596
      and convex_hull_Inter: "convex hull (\<Inter>s) = (\<Inter>t\<in>s. convex hull t)" (is "?C")
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11597
proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11598
  have "finite s"
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11599
    using aff_independent_finite assms finite_UnionD by blast
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11600
  then have "?A \<and> ?C" using assms
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11601
  proof (induction s rule: finite_induct)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11602
    case empty then show ?case by auto
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11603
  next
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11604
    case (insert t F)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11605
    then show ?case
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11606
    proof (cases "F={}")
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11607
      case True then show ?thesis by simp
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11608
    next
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11609
      case False
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11610
      with "insert.prems" have [simp]: "\<not> affine_dependent (t \<union> \<Inter>F)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11611
        by (auto intro: affine_dependent_subset)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11612
      have [simp]: "\<not> affine_dependent (\<Union>F)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11613
        using affine_independent_subset insert.prems by fastforce
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11614
      show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11615
        by (simp add: affine_hull_Int convex_hull_Int insert.IH)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11616
    qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11617
  qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11618
  then show "?A" "?C"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11619
    by auto
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11620
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11621
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11622
lemma affine_hull_finite_intersection_hyperplanes:
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11623
  fixes s :: "'a::euclidean_space set"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11624
  obtains f where
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11625
     "finite f"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11626
     "of_nat (card f) + aff_dim s = DIM('a)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11627
     "affine hull s = \<Inter>f"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11628
     "\<And>h. h \<in> f \<Longrightarrow> \<exists>a b. a \<noteq> 0 \<and> h = {x. a \<bullet> x = b}"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11629
proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11630
  obtain b where "b \<subseteq> s"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11631
             and indb: "\<not> affine_dependent b"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11632
             and eq: "affine hull s = affine hull b"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11633
    using affine_basis_exists by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11634
  obtain c where indc: "\<not> affine_dependent c" and "b \<subseteq> c"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11635
             and affc: "affine hull c = UNIV"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11636
    by (metis extend_to_affine_basis affine_UNIV hull_same indb subset_UNIV)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11637
  then have "finite c"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11638
    by (simp add: aff_independent_finite)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11639
  then have fbc: "finite b" "card b \<le> card c"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11640
    using \<open>b \<subseteq> c\<close> infinite_super by (auto simp: card_mono)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11641
  have imeq: "(\<lambda>x. affine hull x) ` ((\<lambda>a. c - {a}) ` (c - b)) = ((\<lambda>a. affine hull (c - {a})) ` (c - b))"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11642
    by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11643
  have card1: "card ((\<lambda>a. affine hull (c - {a})) ` (c - b)) = card (c - b)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11644
    apply (rule card_image [OF inj_onI])
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11645
    by (metis Diff_eq_empty_iff Diff_iff indc affine_dependent_def hull_subset insert_iff)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11646
  have card2: "(card (c - b)) + aff_dim s = DIM('a)"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11647
  proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11648
    have aff: "aff_dim (UNIV::'a set) = aff_dim c"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11649
      by (metis aff_dim_affine_hull affc)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11650
    have "aff_dim b = aff_dim s"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11651
      by (metis (no_types) aff_dim_affine_hull eq)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11652
    then have "int (card b) = 1 + aff_dim s"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11653
      by (simp add: aff_dim_affine_independent indb)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11654
    then show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11655
      using fbc aff
63072
eb5d493a9e03 renamings and refinements
paulson <lp15@cam.ac.uk>
parents: 63040
diff changeset
 11656
      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)
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11657
  qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11658
  show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11659
  proof (cases "c = b")
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11660
    case True show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11661
      apply (rule_tac f="{}" in that)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11662
      using True affc
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11663
      apply (simp_all add: eq [symmetric])
63072
eb5d493a9e03 renamings and refinements
paulson <lp15@cam.ac.uk>
parents: 63040
diff changeset
 11664
      by (metis aff_dim_UNIV aff_dim_affine_hull)
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11665
  next
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11666
    case False
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11667
    have ind: "\<not> affine_dependent (\<Union>a\<in>c - b. c - {a})"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11668
      by (rule affine_independent_subset [OF indc]) auto
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11669
    have affeq: "affine hull s = (\<Inter>x\<in>(\<lambda>a. c - {a}) ` (c - b). affine hull x)"
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11670
      using \<open>b \<subseteq> c\<close> False
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11671
      apply (subst affine_hull_Inter [OF ind, symmetric])
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11672
      apply (simp add: eq double_diff)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11673
      done
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11674
    have *: "1 + aff_dim (c - {t}) = int (DIM('a))"
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11675
            if t: "t \<in> c" for t
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11676
    proof -
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11677
      have "insert t c = c"
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11678
        using t by blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11679
      then show ?thesis
63072
eb5d493a9e03 renamings and refinements
paulson <lp15@cam.ac.uk>
parents: 63040
diff changeset
 11680
        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)
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11681
    qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11682
    show ?thesis
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11683
      apply (rule_tac f = "(\<lambda>x. affine hull x) ` ((\<lambda>a. c - {a}) ` (c - b))" in that)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11684
         using \<open>finite c\<close> apply blast
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11685
        apply (simp add: imeq card1 card2)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11686
      apply (simp add: affeq, clarify)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11687
      apply (metis DIM_positive One_nat_def Suc_leI add_diff_cancel_left' of_nat_1 aff_dim_eq_hyperplane of_nat_diff *)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11688
      done
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11689
  qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11690
qed
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
 11691
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11692
subsection\<open>Misc results about span\<close>
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11693
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11694
lemma eq_span_insert_eq:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11695
  assumes "(x - y) \<in> span S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11696
    shows "span(insert x S) = span(insert y S)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11697
proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11698
  have *: "span(insert x S) \<subseteq> span(insert y S)" if "(x - y) \<in> span S" for x y
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11699
  proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11700
    have 1: "(r *\<^sub>R x - r *\<^sub>R y) \<in> span S" for r
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11701
      by (metis real_vector.scale_right_diff_distrib span_mul that)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11702
    have 2: "(z - k *\<^sub>R y) - k *\<^sub>R (x - y) = z - k *\<^sub>R x" for  z k
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11703
      by (simp add: real_vector.scale_right_diff_distrib)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11704
  show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11705
    apply (clarsimp simp add: span_breakdown_eq)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11706
    by (metis 1 2 diff_add_cancel real_vector.scale_right_diff_distrib span_add_eq)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11707
  qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11708
  show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11709
    apply (intro subset_antisym * assms)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11710
    using assms subspace_neg subspace_span minus_diff_eq by force
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11711
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11712
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11713
lemma dim_psubset:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11714
    fixes S :: "'a :: euclidean_space set"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11715
    shows "span S \<subset> span T \<Longrightarrow> dim S < dim T"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11716
by (metis (no_types, hide_lams) dim_span less_le not_le subspace_dim_equal subspace_span)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11717
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11718
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11719
lemma basis_subspace_exists:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11720
  fixes S :: "'a::euclidean_space set"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11721
  shows
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11722
   "subspace S
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11723
        \<Longrightarrow> \<exists>b. finite b \<and> b \<subseteq> S \<and>
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11724
                independent b \<and> span b = S \<and> card b = dim S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11725
by (metis span_subspace basis_exists independent_imp_finite)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11726
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11727
lemma affine_hyperplane_sums_eq_UNIV_0:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11728
  fixes S :: "'a :: euclidean_space set"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11729
  assumes "affine S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11730
     and "0 \<in> S" and "w \<in> S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11731
     and "a \<bullet> w \<noteq> 0"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11732
   shows "{x + y| x y. x \<in> S \<and> a \<bullet> y = 0} = UNIV"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11733
proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11734
  have "subspace S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11735
    by (simp add: assms subspace_affine)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11736
  have span1: "span {y. a \<bullet> y = 0} \<subseteq> span {x + y |x y. x \<in> S \<and> a \<bullet> y = 0}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11737
    apply (rule span_mono)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11738
    using \<open>0 \<in> S\<close> add.left_neutral by force
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11739
  have "w \<notin> span {y. a \<bullet> y = 0}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11740
    using \<open>a \<bullet> w \<noteq> 0\<close> span_induct subspace_hyperplane by auto
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11741
  moreover have "w \<in> span {x + y |x y. x \<in> S \<and> a \<bullet> y = 0}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11742
    using \<open>w \<in> S\<close>
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11743
    by (metis (mono_tags, lifting) inner_zero_right mem_Collect_eq pth_d span_superset)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11744
  ultimately have span2: "span {y. a \<bullet> y = 0} \<noteq> span {x + y |x y. x \<in> S \<and> a \<bullet> y = 0}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11745
    by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11746
  have "a \<noteq> 0" using assms inner_zero_left by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11747
  then have "DIM('a) - 1 = dim {y. a \<bullet> y = 0}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11748
    by (simp add: dim_hyperplane)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11749
  also have "... < dim {x + y |x y. x \<in> S \<and> a \<bullet> y = 0}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11750
    using span1 span2 by (blast intro: dim_psubset)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11751
  finally have DIM_lt: "DIM('a) - 1 < dim {x + y |x y. x \<in> S \<and> a \<bullet> y = 0}" .
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11752
  have subs: "subspace {x + y| x y. x \<in> S \<and> a \<bullet> y = 0}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11753
    using subspace_sums [OF \<open>subspace S\<close> subspace_hyperplane] by simp
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11754
  moreover have "span {x + y| x y. x \<in> S \<and> a \<bullet> y = 0} = UNIV"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11755
    apply (rule dim_eq_full [THEN iffD1])
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11756
    apply (rule antisym [OF dim_subset_UNIV])
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11757
    using DIM_lt apply simp
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11758
    done
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11759
  ultimately show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11760
    by (simp add: subs) (metis (lifting) span_eq subs)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11761
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11762
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11763
proposition affine_hyperplane_sums_eq_UNIV:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11764
  fixes S :: "'a :: euclidean_space set"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11765
  assumes "affine S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11766
      and "S \<inter> {v. a \<bullet> v = b} \<noteq> {}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11767
      and "S - {v. a \<bullet> v = b} \<noteq> {}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11768
    shows "{x + y| x y. x \<in> S \<and> a \<bullet> y = b} = UNIV"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11769
proof (cases "a = 0")
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11770
  case True with assms show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11771
    by (auto simp: if_splits)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11772
next
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11773
  case False
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11774
  obtain c where "c \<in> S" and c: "a \<bullet> c = b"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11775
    using assms by force
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11776
  with affine_diffs_subspace [OF \<open>affine S\<close>]
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11777
  have "subspace (op + (- c) ` S)" by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11778
  then have aff: "affine (op + (- c) ` S)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11779
    by (simp add: subspace_imp_affine)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11780
  have 0: "0 \<in> op + (- c) ` S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11781
    by (simp add: \<open>c \<in> S\<close>)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11782
  obtain d where "d \<in> S" and "a \<bullet> d \<noteq> b" and dc: "d-c \<in> op + (- c) ` S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11783
    using assms by auto
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11784
  then have adc: "a \<bullet> (d - c) \<noteq> 0"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11785
    by (simp add: c inner_diff_right)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11786
  let ?U = "op + (c+c) ` {x + y |x y. x \<in> op + (- c) ` S \<and> a \<bullet> y = 0}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11787
  have "u + v \<in> op + (c + c) ` {x + v |x v. x \<in> op + (- c) ` S \<and> a \<bullet> v = 0}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11788
              if "u \<in> S" "b = a \<bullet> v" for u v
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11789
    apply (rule_tac x="u+v-c-c" in image_eqI)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11790
    apply (simp_all add: algebra_simps)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11791
    apply (rule_tac x="u-c" in exI)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11792
    apply (rule_tac x="v-c" in exI)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11793
    apply (simp add: algebra_simps that c)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11794
    done
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11795
  moreover have "\<lbrakk>a \<bullet> v = 0; u \<in> S\<rbrakk>
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11796
       \<Longrightarrow> \<exists>x ya. v + (u + c) = x + ya \<and> x \<in> S \<and> a \<bullet> ya = b" for v u
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11797
    by (metis add.left_commute c inner_right_distrib pth_d)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11798
  ultimately have "{x + y |x y. x \<in> S \<and> a \<bullet> y = b} = ?U"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11799
    by (fastforce simp: algebra_simps)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11800
  also have "... = op + (c+c) ` UNIV"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11801
    by (simp add: affine_hyperplane_sums_eq_UNIV_0 [OF aff 0 dc adc])
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11802
  also have "... = UNIV"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11803
    by (simp add: translation_UNIV)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11804
  finally show ?thesis .
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11805
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11806
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11807
proposition dim_sums_Int:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11808
    fixes S :: "'a :: euclidean_space set"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11809
  assumes "subspace S" "subspace T"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11810
  shows "dim {x + y |x y. x \<in> S \<and> y \<in> T} + dim(S \<inter> T) = dim S + dim T"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11811
proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11812
  obtain B where B: "B \<subseteq> S \<inter> T" "S \<inter> T \<subseteq> span B"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11813
             and indB: "independent B"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11814
             and cardB: "card B = dim (S \<inter> T)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11815
    using basis_exists by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11816
  then obtain C D where "B \<subseteq> C" "C \<subseteq> S" "independent C" "S \<subseteq> span C"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11817
                    and "B \<subseteq> D" "D \<subseteq> T" "independent D" "T \<subseteq> span D"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11818
    using maximal_independent_subset_extend
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11819
    by (metis Int_subset_iff \<open>B \<subseteq> S \<inter> T\<close> indB)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11820
  then have "finite B" "finite C" "finite D"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11821
    by (simp_all add: independent_imp_finite indB independent_bound)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11822
  have Beq: "B = C \<inter> D"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11823
    apply (rule sym)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11824
    apply (rule spanning_subset_independent)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11825
    using \<open>B \<subseteq> C\<close> \<open>B \<subseteq> D\<close> apply blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11826
    apply (meson \<open>independent C\<close> independent_mono inf.cobounded1)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11827
    using B \<open>C \<subseteq> S\<close> \<open>D \<subseteq> T\<close> apply auto
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11828
    done
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11829
  then have Deq: "D = B \<union> (D - C)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11830
    by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11831
  have CUD: "C \<union> D \<subseteq> {x + y |x y. x \<in> S \<and> y \<in> T}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11832
    apply safe
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11833
    apply (metis add.right_neutral subsetCE \<open>C \<subseteq> S\<close> \<open>subspace T\<close> set_eq_subset span_0 span_minimal)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11834
    apply (metis add.left_neutral subsetCE \<open>D \<subseteq> T\<close> \<open>subspace S\<close> set_eq_subset span_0 span_minimal)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11835
    done
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11836
  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"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11837
                 and v: "v \<in> C \<union> (D-C)" for a v
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11838
  proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11839
    have eq: "(\<Sum>v\<in>D - C. a v *\<^sub>R v) = - (\<Sum>v\<in>C. a v *\<^sub>R v)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11840
      using that add_eq_0_iff by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11841
    have "(\<Sum>v\<in>D - C. a v *\<^sub>R v) \<in> S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11842
      apply (subst eq)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11843
      apply (rule subspace_neg [OF \<open>subspace S\<close>])
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11844
      apply (rule subspace_setsum [OF \<open>subspace S\<close>])
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11845
      by (meson subsetCE subspace_mul \<open>C \<subseteq> S\<close> \<open>subspace S\<close>)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11846
    moreover have "(\<Sum>v\<in>D - C. a v *\<^sub>R v) \<in> T"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11847
      apply (rule subspace_setsum [OF \<open>subspace T\<close>])
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11848
      by (meson DiffD1 \<open>D \<subseteq> T\<close> \<open>subspace T\<close> subset_eq subspace_def)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11849
    ultimately have "(\<Sum>v \<in> D-C. a v *\<^sub>R v) \<in> span B"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11850
      using B by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11851
    then obtain e where e: "(\<Sum>v\<in>B. e v *\<^sub>R v) = (\<Sum>v \<in> D-C. a v *\<^sub>R v)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11852
      using span_finite [OF \<open>finite B\<close>] by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11853
    have "\<And>c v. \<lbrakk>(\<Sum>v\<in>C. c v *\<^sub>R v) = 0; v \<in> C\<rbrakk> \<Longrightarrow> c v = 0"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11854
      using independent_explicit \<open>independent C\<close> by blast
63148
6a767355d1a9 updated 'define';
wenzelm
parents: 63129
diff changeset
 11855
    define cc where "cc x = (if x \<in> B then a x + e x else a x)" for x
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11856
    have [simp]: "C \<inter> B = B" "D \<inter> B = B" "C \<inter> - B = C-D" "B \<inter> (D - C) = {}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11857
      using \<open>B \<subseteq> C\<close> \<open>B \<subseteq> D\<close> Beq by blast+
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11858
    have f2: "(\<Sum>v\<in>C \<inter> D. e v *\<^sub>R v) = (\<Sum>v\<in>D - C. a v *\<^sub>R v)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11859
      using Beq e by presburger
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11860
    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)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11861
      using \<open>finite C\<close> \<open>finite D\<close> setsum.union_diff2 by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11862
    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)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11863
      by (meson Diff_disjoint \<open>finite C\<close> \<open>finite D\<close> finite_Diff setsum.union_disjoint)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11864
    have "(\<Sum>v\<in>C. cc v *\<^sub>R v) = 0"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11865
      using 0 f2 f3 f4
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11866
      apply (simp add: cc_def Beq if_smult \<open>finite C\<close> setsum.If_cases algebra_simps setsum.distrib)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11867
      apply (simp add: add.commute add.left_commute diff_eq)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11868
      done
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11869
    then have "\<And>v. v \<in> C \<Longrightarrow> cc v = 0"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11870
      using independent_explicit \<open>independent C\<close> by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11871
    then have C0: "\<And>v. v \<in> C - B \<Longrightarrow> a v = 0"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11872
      by (simp add: cc_def Beq) meson
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11873
    then have [simp]: "(\<Sum>x\<in>C - B. a x *\<^sub>R x) = 0"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11874
      by simp
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11875
    have "(\<Sum>x\<in>C. a x *\<^sub>R x) = (\<Sum>x\<in>B. a x *\<^sub>R x)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11876
    proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11877
      have "C - D = C - B"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11878
        using Beq by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11879
      then show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11880
        using Beq \<open>(\<Sum>x\<in>C - B. a x *\<^sub>R x) = 0\<close> f3 f4 by auto
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11881
    qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11882
    with 0 have Dcc0: "(\<Sum>v\<in>D. a v *\<^sub>R v) = 0"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11883
      apply (subst Deq)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11884
      by (simp add: \<open>finite B\<close> \<open>finite D\<close> setsum_Un)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11885
    then have D0: "\<And>v. v \<in> D \<Longrightarrow> a v = 0"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11886
      using independent_explicit \<open>independent D\<close> by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11887
    show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11888
      using v C0 D0 Beq by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11889
  qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11890
  then have "independent (C \<union> (D - C))"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11891
    by (simp add: independent_explicit \<open>finite C\<close> \<open>finite D\<close> setsum_Un del: Un_Diff_cancel)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11892
  then have indCUD: "independent (C \<union> D)" by simp
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11893
  have "dim (S \<inter> T) = card B"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11894
    by (rule dim_unique [OF B indB refl])
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11895
  moreover have "dim S = card C"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11896
    by (metis \<open>C \<subseteq> S\<close> \<open>independent C\<close> \<open>S \<subseteq> span C\<close> basis_card_eq_dim)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11897
  moreover have "dim T = card D"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11898
    by (metis \<open>D \<subseteq> T\<close> \<open>independent D\<close> \<open>T \<subseteq> span D\<close> basis_card_eq_dim)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11899
  moreover have "dim {x + y |x y. x \<in> S \<and> y \<in> T} = card(C \<union> D)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11900
    apply (rule dim_unique [OF CUD _ indCUD refl], clarify)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11901
    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)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11902
    done
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11903
  ultimately show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11904
    using \<open>B = C \<inter> D\<close> [symmetric]
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11905
    by (simp add:  \<open>independent C\<close> \<open>independent D\<close> card_Un_Int independent_finite)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11906
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11907
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11908
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11909
lemma aff_dim_sums_Int_0:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11910
  assumes "affine S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11911
      and "affine T"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11912
      and "0 \<in> S" "0 \<in> T"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11913
    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)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11914
proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11915
  have "0 \<in> {x + y |x y. x \<in> S \<and> y \<in> T}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11916
    using assms by force
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11917
  then have 0: "0 \<in> affine hull {x + y |x y. x \<in> S \<and> y \<in> T}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11918
    by (metis (lifting) hull_inc)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11919
  have sub: "subspace S"  "subspace T"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11920
    using assms by (auto simp: subspace_affine)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11921
  show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11922
    using dim_sums_Int [OF sub] by (simp add: aff_dim_zero assms 0 hull_inc)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11923
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11924
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11925
proposition aff_dim_sums_Int:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11926
  assumes "affine S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11927
      and "affine T"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11928
      and "S \<inter> T \<noteq> {}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11929
    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)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11930
proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11931
  obtain a where a: "a \<in> S" "a \<in> T" using assms by force
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11932
  have aff: "affine (op+ (-a) ` S)"  "affine (op+ (-a) ` T)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11933
    using assms by (auto simp: affine_translation [symmetric])
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11934
  have zero: "0 \<in> (op+ (-a) ` S)"  "0 \<in> (op+ (-a) ` T)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11935
    using a assms by auto
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11936
  have [simp]: "{x + y |x y. x \<in> op + (- a) ` S \<and> y \<in> op + (- a) ` T} =
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11937
        op + (- 2 *\<^sub>R a) ` {x + y| x y. x \<in> S \<and> y \<in> T}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11938
    by (force simp: algebra_simps scaleR_2)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11939
  have [simp]: "op + (- a) ` S \<inter> op + (- a) ` T = op + (- a) ` (S \<inter> T)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11940
    by auto
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11941
  show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11942
    using aff_dim_sums_Int_0 [OF aff zero]
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11943
    by (auto simp: aff_dim_translation_eq)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11944
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11945
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11946
lemma aff_dim_affine_Int_hyperplane:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11947
  fixes a :: "'a::euclidean_space"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11948
  assumes "affine S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11949
    shows "aff_dim(S \<inter> {x. a \<bullet> x = b}) =
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11950
             (if S \<inter> {v. a \<bullet> v = b} = {} then - 1
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11951
              else if S \<subseteq> {v. a \<bullet> v = b} then aff_dim S
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11952
              else aff_dim S - 1)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11953
proof (cases "a = 0")
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11954
  case True with assms show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11955
    by auto
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11956
next
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11957
  case False
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11958
  then have "aff_dim (S \<inter> {x. a \<bullet> x = b}) = aff_dim S - 1"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11959
            if "x \<in> S" "a \<bullet> x \<noteq> b" and non: "S \<inter> {v. a \<bullet> v = b} \<noteq> {}" for x
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11960
  proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11961
    have [simp]: "{x + y| x y. x \<in> S \<and> a \<bullet> y = b} = UNIV"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11962
      using affine_hyperplane_sums_eq_UNIV [OF assms non] that  by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11963
    show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11964
      using aff_dim_sums_Int [OF assms affine_hyperplane non]
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11965
      by (simp add: of_nat_diff False)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11966
  qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11967
  then show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11968
    by (metis (mono_tags, lifting) inf.orderE aff_dim_empty_eq mem_Collect_eq subsetI)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11969
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11970
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11971
lemma aff_dim_lt_full:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11972
  fixes S :: "'a::euclidean_space set"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11973
  shows "aff_dim S < DIM('a) \<longleftrightarrow> (affine hull S \<noteq> UNIV)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11974
by (metis (no_types) aff_dim_affine_hull aff_dim_le_DIM aff_dim_UNIV affine_hull_UNIV less_le)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11975
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11976
subsection\<open> Orthogonal bases, Gram-Schmidt process, and related theorems\<close>
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11977
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11978
lemma span_delete_0 [simp]: "span(S - {0}) = span S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11979
proof
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11980
  show "span (S - {0}) \<subseteq> span S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11981
    by (blast intro!: span_mono)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11982
next
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11983
  have "span S \<subseteq> span(insert 0 (S - {0}))"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11984
    by (blast intro!: span_mono)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11985
  also have "... \<subseteq> span(S - {0})"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11986
    using span_insert_0 by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11987
  finally show "span S \<subseteq> span (S - {0})" .
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11988
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11989
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11990
lemma span_image_scale:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11991
  assumes "finite S" and nz: "\<And>x. x \<in> S \<Longrightarrow> c x \<noteq> 0"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11992
    shows "span ((\<lambda>x. c x *\<^sub>R x) ` S) = span S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11993
using assms
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11994
proof (induction S arbitrary: c)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11995
  case (empty c) show ?case by simp
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11996
next
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11997
  case (insert x F c)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11998
  show ?case
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 11999
  proof (intro set_eqI iffI)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12000
    fix y
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12001
      assume "y \<in> span ((\<lambda>x. c x *\<^sub>R x) ` insert x F)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12002
      then show "y \<in> span (insert x F)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12003
        using insert by (force simp: span_breakdown_eq)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12004
  next
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12005
    fix y
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12006
      assume "y \<in> span (insert x F)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12007
      then show "y \<in> span ((\<lambda>x. c x *\<^sub>R x) ` insert x F)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12008
        using insert
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12009
        apply (clarsimp simp: span_breakdown_eq)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12010
        apply (rule_tac x="k / c x" in exI)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12011
        by simp
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12012
  qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12013
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12014
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12015
lemma pairwise_orthogonal_independent:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12016
  assumes "pairwise orthogonal S" and "0 \<notin> S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12017
    shows "independent S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12018
proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12019
  have 0: "\<And>x y. \<lbrakk>x \<noteq> y; x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> x \<bullet> y = 0"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12020
    using assms by (simp add: pairwise_def orthogonal_def)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12021
  have "False" if "a \<in> S" and a: "a \<in> span (S - {a})" for a
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12022
  proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12023
    obtain T U where "T \<subseteq> S - {a}" "a = (\<Sum>v\<in>T. U v *\<^sub>R v)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12024
      using a by (force simp: span_explicit)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12025
    then have "a \<bullet> a = a \<bullet> (\<Sum>v\<in>T. U v *\<^sub>R v)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12026
      by simp
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12027
    also have "... = 0"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12028
      apply (simp add: inner_setsum_right)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12029
      apply (rule comm_monoid_add_class.setsum.neutral)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12030
      by (metis "0" DiffE \<open>T \<subseteq> S - {a}\<close> mult_not_zero singletonI subsetCE \<open>a \<in> S\<close>)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12031
    finally show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12032
      using \<open>0 \<notin> S\<close> \<open>a \<in> S\<close> by auto
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12033
  qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12034
  then show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12035
    by (force simp: dependent_def)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12036
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12037
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12038
lemma pairwise_orthogonal_imp_finite:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12039
  fixes S :: "'a::euclidean_space set"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12040
  assumes "pairwise orthogonal S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12041
    shows "finite S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12042
proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12043
  have "independent (S - {0})"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12044
    apply (rule pairwise_orthogonal_independent)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12045
     apply (metis Diff_iff assms pairwise_def)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12046
    by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12047
  then show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12048
    by (meson independent_imp_finite infinite_remove)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12049
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12050
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12051
lemma subspace_orthogonal_to_vector: "subspace {y. orthogonal x y}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12052
  by (simp add: subspace_def orthogonal_clauses)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12053
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12054
lemma subspace_orthogonal_to_vectors: "subspace {y. \<forall>x \<in> S. orthogonal x y}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12055
  by (simp add: subspace_def orthogonal_clauses)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12056
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12057
lemma orthogonal_to_span:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12058
  assumes a: "a \<in> span S" and x: "\<And>y. y \<in> S \<Longrightarrow> orthogonal x y"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12059
    shows "orthogonal x a"
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
 12060
apply (rule span_induct [OF a subspace_orthogonal_to_vector])
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12061
apply (simp add: x)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12062
done
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12063
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12064
proposition Gram_Schmidt_step:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12065
  fixes S :: "'a::euclidean_space set"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12066
  assumes S: "pairwise orthogonal S" and x: "x \<in> span S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12067
    shows "orthogonal x (a - (\<Sum>b\<in>S. (b \<bullet> a / (b \<bullet> b)) *\<^sub>R b))"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12068
proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12069
  have "finite S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12070
    by (simp add: S pairwise_orthogonal_imp_finite)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12071
  have "orthogonal (a - (\<Sum>b\<in>S. (b \<bullet> a / (b \<bullet> b)) *\<^sub>R b)) x"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12072
       if "x \<in> S" for x
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12073
  proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12074
    have "a \<bullet> x = (\<Sum>y\<in>S. if y = x then y \<bullet> a else 0)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12075
      by (simp add: \<open>finite S\<close> inner_commute setsum.delta that)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12076
    also have "... =  (\<Sum>b\<in>S. b \<bullet> a * (b \<bullet> x) / (b \<bullet> b))"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12077
      apply (rule setsum.cong [OF refl], simp)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12078
      by (meson S orthogonal_def pairwise_def that)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12079
   finally show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12080
     by (simp add: orthogonal_def algebra_simps inner_setsum_left)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12081
  qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12082
  then show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12083
    using orthogonal_to_span orthogonal_commute x by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12084
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12085
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12086
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12087
lemma orthogonal_extension_aux:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12088
  fixes S :: "'a::euclidean_space set"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12089
  assumes "finite T" "finite S" "pairwise orthogonal S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12090
    shows "\<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> T)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12091
using assms
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12092
proof (induction arbitrary: S)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12093
  case empty then show ?case
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12094
    by simp (metis sup_bot_right)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12095
next
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12096
  case (insert a T)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12097
  have 0: "\<And>x y. \<lbrakk>x \<noteq> y; x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> x \<bullet> y = 0"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12098
    using insert by (simp add: pairwise_def orthogonal_def)
63148
6a767355d1a9 updated 'define';
wenzelm
parents: 63129
diff changeset
 12099
  define a' where "a' = a - (\<Sum>b\<in>S. (b \<bullet> a / (b \<bullet> b)) *\<^sub>R b)"
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12100
  obtain U where orthU: "pairwise orthogonal (S \<union> insert a' U)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12101
             and spanU: "span (insert a' S \<union> U) = span (insert a' S \<union> T)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12102
    apply (rule exE [OF insert.IH [of "insert a' S"]])
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12103
    apply (auto simp: Gram_Schmidt_step a'_def insert.prems orthogonal_commute pairwise_orthogonal_insert span_clauses)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12104
    done
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12105
  have orthS: "\<And>x. x \<in> S \<Longrightarrow> a' \<bullet> x = 0"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12106
    apply (simp add: a'_def)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12107
    using Gram_Schmidt_step [OF \<open>pairwise orthogonal S\<close>]
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12108
    apply (force simp: orthogonal_def inner_commute span_inc [THEN subsetD])
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12109
    done
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12110
  have "span (S \<union> insert a' U) = span (insert a' (S \<union> T))"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12111
    using spanU by simp
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12112
  also have "... = span (insert a (S \<union> T))"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12113
    apply (rule eq_span_insert_eq)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12114
    apply (simp add: a'_def span_neg span_setsum span_clauses(1) span_mul)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12115
    done
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12116
  also have "... = span (S \<union> insert a T)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12117
    by simp
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12118
  finally show ?case
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12119
    apply (rule_tac x="insert a' U" in exI)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12120
    using orthU apply auto
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12121
    done
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12122
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12123
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12124
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12125
proposition orthogonal_extension:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12126
  fixes S :: "'a::euclidean_space set"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12127
  assumes S: "pairwise orthogonal S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12128
  obtains U where "pairwise orthogonal (S \<union> U)" "span (S \<union> U) = span (S \<union> T)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12129
proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12130
  obtain B where "finite B" "span B = span T"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12131
    using basis_subspace_exists [of "span T"] subspace_span by auto
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12132
  with orthogonal_extension_aux [of B S]
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12133
  obtain U where "pairwise orthogonal (S \<union> U)" "span (S \<union> U) = span (S \<union> B)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12134
    using assms pairwise_orthogonal_imp_finite by auto
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12135
  show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12136
    apply (rule_tac U=U in that)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12137
     apply (simp add: \<open>pairwise orthogonal (S \<union> U)\<close>)
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
 12138
    by (metis \<open>span (S \<union> U) = span (S \<union> B)\<close> \<open>span B = span T\<close> span_Un)
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12139
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12140
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12141
corollary orthogonal_extension_strong:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12142
  fixes S :: "'a::euclidean_space set"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12143
  assumes S: "pairwise orthogonal S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12144
  obtains U where "U \<inter> (insert 0 S) = {}" "pairwise orthogonal (S \<union> U)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12145
                   "span (S \<union> U) = span (S \<union> T)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12146
proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12147
  obtain U where "pairwise orthogonal (S \<union> U)" "span (S \<union> U) = span (S \<union> T)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12148
    using orthogonal_extension assms by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12149
  then show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12150
    apply (rule_tac U = "U - (insert 0 S)" in that)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12151
      apply blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12152
     apply (force simp: pairwise_def)
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
 12153
    apply (metis (no_types, lifting) Un_Diff_cancel span_insert_0 span_Un)
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12154
  done
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12155
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12156
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12157
subsection\<open>Decomposing a vector into parts in orthogonal subspaces.\<close>
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12158
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12159
text\<open>existence of orthonormal basis for a subspace.\<close>
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12160
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12161
lemma orthogonal_spanningset_subspace:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12162
  fixes S :: "'a :: euclidean_space set"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12163
  assumes "subspace S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12164
  obtains B where "B \<subseteq> S" "pairwise orthogonal B" "span B = S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12165
proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12166
  obtain B where "B \<subseteq> S" "independent B" "S \<subseteq> span B" "card B = dim S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12167
    using basis_exists by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12168
  with orthogonal_extension [of "{}" B]
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12169
  show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12170
    by (metis Un_empty_left assms pairwise_empty span_inc span_subspace that)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12171
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12172
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12173
lemma orthogonal_basis_subspace:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12174
  fixes S :: "'a :: euclidean_space set"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12175
  assumes "subspace S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12176
  obtains B where "0 \<notin> B" "B \<subseteq> S" "pairwise orthogonal B" "independent B"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12177
                  "card B = dim S" "span B = S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12178
proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12179
  obtain B where "B \<subseteq> S" "pairwise orthogonal B" "span B = S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12180
    using assms orthogonal_spanningset_subspace by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12181
  then show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12182
    apply (rule_tac B = "B - {0}" in that)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12183
    apply (auto simp: indep_card_eq_dim_span pairwise_subset Diff_subset pairwise_orthogonal_independent elim: pairwise_subset)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12184
    done
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12185
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12186
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12187
proposition orthonormal_basis_subspace:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12188
  fixes S :: "'a :: euclidean_space set"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12189
  assumes "subspace S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12190
  obtains B where "B \<subseteq> S" "pairwise orthogonal B"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12191
              and "\<And>x. x \<in> B \<Longrightarrow> norm x = 1"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12192
              and "independent B" "card B = dim S" "span B = S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12193
proof -
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12194
  obtain B where "0 \<notin> B" "B \<subseteq> S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12195
             and orth: "pairwise orthogonal B"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12196
             and "independent B" "card B = dim S" "span B = S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12197
    by (blast intro: orthogonal_basis_subspace [OF assms])
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12198
  have 1: "(\<lambda>x. x /\<^sub>R norm x) ` B \<subseteq> S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12199
    using \<open>span B = S\<close> span_clauses(1) span_mul by fastforce
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12200
  have 2: "pairwise orthogonal ((\<lambda>x. x /\<^sub>R norm x) ` B)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12201
    using orth by (force simp: pairwise_def orthogonal_clauses)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12202
  have 3: "\<And>x. x \<in> (\<lambda>x. x /\<^sub>R norm x) ` B \<Longrightarrow> norm x = 1"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12203
    by (metis (no_types, lifting) \<open>0 \<notin> B\<close> image_iff norm_sgn sgn_div_norm)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12204
  have 4: "independent ((\<lambda>x. x /\<^sub>R norm x) ` B)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12205
    by (metis "2" "3" norm_zero pairwise_orthogonal_independent zero_neq_one)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12206
  have "inj_on (\<lambda>x. x /\<^sub>R norm x) B"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12207
  proof
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12208
    fix x y
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12209
    assume "x \<in> B" "y \<in> B" "x /\<^sub>R norm x = y /\<^sub>R norm y"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12210
    moreover have "\<And>i. i \<in> B \<Longrightarrow> norm (i /\<^sub>R norm i) = 1"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12211
      using 3 by blast
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12212
    ultimately show "x = y"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12213
      by (metis norm_eq_1 orth orthogonal_clauses(7) orthogonal_commute orthogonal_def pairwise_def zero_neq_one)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12214
  qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12215
  then have 5: "card ((\<lambda>x. x /\<^sub>R norm x) ` B) = dim S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12216
    by (metis \<open>card B = dim S\<close> card_image)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12217
  have 6: "span ((\<lambda>x. x /\<^sub>R norm x) ` B) = S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12218
    by (metis "1" "4" "5" assms card_eq_dim independent_finite span_subspace)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12219
  show ?thesis
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12220
    by (rule that [OF 1 2 3 4 5 6])
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12221
qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12222
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12223
proposition orthogonal_subspace_decomp_exists:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12224
  fixes S :: "'a :: euclidean_space set"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12225
  obtains y z where "y \<in> span S" "\<And>w. w \<in> span S \<Longrightarrow> orthogonal z w" "x = y + z"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12226
proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12227
  obtain T where "0 \<notin> T" "T \<subseteq> span S" "pairwise orthogonal T" "independent T" "card T = dim (span S)" "span T = span S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12228
    using orthogonal_basis_subspace subspace_span by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12229
  let ?a = "\<Sum>b\<in>T. (b \<bullet> x / (b \<bullet> b)) *\<^sub>R b"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12230
  have orth: "orthogonal (x - ?a) w" if "w \<in> span S" for w
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12231
    by (simp add: Gram_Schmidt_step \<open>pairwise orthogonal T\<close> \<open>span T = span S\<close> orthogonal_commute that)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12232
  show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12233
    apply (rule_tac y = "?a" and z = "x - ?a" in that)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12234
      apply (meson \<open>T \<subseteq> span S\<close> span_mul span_setsum subsetCE)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12235
     apply (fact orth, simp)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12236
    done
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12237
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12238
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12239
lemma orthogonal_subspace_decomp_unique:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12240
  fixes S :: "'a :: euclidean_space set"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12241
  assumes "x + y = x' + y'"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12242
      and ST: "x \<in> span S" "x' \<in> span S" "y \<in> span T" "y' \<in> span T"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12243
      and orth: "\<And>a b. \<lbrakk>a \<in> S; b \<in> T\<rbrakk> \<Longrightarrow> orthogonal a b"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12244
  shows "x = x' \<and> y = y'"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12245
proof -
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12246
  have "x + y - y' = x'"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12247
    by (simp add: assms)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12248
  moreover have "\<And>a b. \<lbrakk>a \<in> span S; b \<in> span T\<rbrakk> \<Longrightarrow> orthogonal a b"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12249
    by (meson orth orthogonal_commute orthogonal_to_span)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12250
  ultimately have "0 = x' - x"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12251
    by (metis (full_types) add_diff_cancel_left' ST diff_right_commute orthogonal_clauses(10) orthogonal_clauses(5) orthogonal_self)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12252
  with assms show ?thesis by auto
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12253
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12254
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12255
proposition dim_orthogonal_sum:
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12256
  fixes A :: "'a::euclidean_space set"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12257
  assumes "\<And>x y. \<lbrakk>x \<in> A; y \<in> B\<rbrakk> \<Longrightarrow> x \<bullet> y = 0"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12258
    shows "dim(A \<union> B) = dim A + dim B"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12259
proof -
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12260
  have 1: "\<And>x y. \<lbrakk>x \<in> span A; y \<in> B\<rbrakk> \<Longrightarrow> x \<bullet> y = 0"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12261
    by (erule span_induct [OF _ subspace_hyperplane2]; simp add: assms)
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12262
  have "\<And>x y. \<lbrakk>x \<in> span A; y \<in> span B\<rbrakk> \<Longrightarrow> x \<bullet> y = 0"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12263
    apply (erule span_induct [OF _ subspace_hyperplane])
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12264
    using 1 by (simp add: )
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12265
  then have 0: "\<And>x y. \<lbrakk>x \<in> span A; y \<in> span B\<rbrakk> \<Longrightarrow> x \<bullet> y = 0"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12266
    by simp
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12267
  have "dim(A \<union> B) = dim (span (A \<union> B))"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12268
    by simp
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12269
  also have "... = dim ((\<lambda>(a, b). a + b) ` (span A \<times> span B))"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12270
    by (simp add: span_Un)
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12271
  also have "... = dim {x + y |x y. x \<in> span A \<and> y \<in> span B}"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12272
    by (auto intro!: arg_cong [where f=dim])
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12273
  also have "... = dim {x + y |x y. x \<in> span A \<and> y \<in> span B} + dim(span A \<inter> span B)"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12274
    by (auto simp: dest: 0)
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12275
  also have "... = dim (span A) + dim (span B)"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12276
    by (rule dim_sums_Int) auto
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12277
  also have "... = dim A + dim B"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12278
    by simp
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12279
  finally show ?thesis .
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12280
qed
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12281
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12282
lemma dim_subspace_orthogonal_to_vectors:
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12283
  fixes A :: "'a::euclidean_space set"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12284
  assumes "subspace A" "subspace B" "A \<subseteq> B"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12285
    shows "dim {y \<in> B. \<forall>x \<in> A. orthogonal x y} + dim A = dim B"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12286
proof -
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12287
  have "dim (span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)) = dim (span B)"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12288
  proof (rule arg_cong [where f=dim, OF subset_antisym])
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12289
    show "span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A) \<subseteq> span B"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12290
      by (simp add: \<open>A \<subseteq> B\<close> Collect_restrict span_mono)
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12291
  next
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12292
    have *: "x \<in> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12293
         if "x \<in> B" for x
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12294
    proof -
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12295
      obtain y z where "x = y + z" "y \<in> span A" and orth: "\<And>w. w \<in> span A \<Longrightarrow> orthogonal z w"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12296
        using orthogonal_subspace_decomp_exists [of A x] that by auto
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12297
      have "y \<in> span B"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12298
        by (metis span_eq \<open>y \<in> span A\<close> assms subset_iff)
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12299
      then have "z \<in> {a \<in> B. \<forall>x. x \<in> A \<longrightarrow> orthogonal x a}"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12300
        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)
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12301
      then have z: "z \<in> span {y \<in> B. \<forall>x\<in>A. orthogonal x y}"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12302
        by (meson span_inc subset_iff)
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12303
      then show ?thesis
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12304
        apply (simp add: span_Un image_def)
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12305
        apply (rule bexI [OF _ z])
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12306
        apply (simp add: \<open>x = y + z\<close> \<open>y \<in> span A\<close>)
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12307
        done
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12308
    qed
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12309
    show "span B \<subseteq> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12310
      by (rule span_minimal) (auto intro: * span_minimal elim: )
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12311
  qed
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12312
  then show ?thesis
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12313
    by (metis (no_types, lifting) dim_orthogonal_sum dim_span mem_Collect_eq orthogonal_commute orthogonal_def)
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12314
qed
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
 12315
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12316
subsection\<open>Parallel slices, etc.\<close>
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12317
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12318
text\<open> If we take a slice out of a set, we can do it perpendicularly,
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12319
  with the normal vector to the slice parallel to the affine hull.\<close>
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12320
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12321
proposition affine_parallel_slice:
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12322
  fixes S :: "'a :: euclidean_space set"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12323
  assumes "affine S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12324
      and "S \<inter> {x. a \<bullet> x \<le> b} \<noteq> {}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12325
      and "~ (S \<subseteq> {x. a \<bullet> x \<le> b})"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12326
  obtains a' b' where "a' \<noteq> 0"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12327
                   "S \<inter> {x. a' \<bullet> x \<le> b'} = S \<inter> {x. a \<bullet> x \<le> b}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12328
                   "S \<inter> {x. a' \<bullet> x = b'} = S \<inter> {x. a \<bullet> x = b}"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12329
                   "\<And>w. w \<in> S \<Longrightarrow> (w + a') \<in> S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12330
proof (cases "S \<inter> {x. a \<bullet> x = b} = {}")
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12331
  case True
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12332
  then obtain u v where "u \<in> S" "v \<in> S" "a \<bullet> u \<le> b" "a \<bullet> v > b"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12333
    using assms by (auto simp: not_le)
63148
6a767355d1a9 updated 'define';
wenzelm
parents: 63129
diff changeset
 12334
  define \<eta> where "\<eta> = u + ((b - a \<bullet> u) / (a \<bullet> v - a \<bullet> u)) *\<^sub>R (v - u)"
63075
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12335
  have "\<eta> \<in> S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12336
    by (simp add: \<eta>_def \<open>u \<in> S\<close> \<open>v \<in> S\<close> \<open>affine S\<close> mem_affine_3_minus)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12337
  moreover have "a \<bullet> \<eta> = b"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12338
    using \<open>a \<bullet> u \<le> b\<close> \<open>b < a \<bullet> v\<close>
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12339
    by (simp add: \<eta>_def algebra_simps) (simp add: field_simps)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12340
  ultimately have False
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12341
    using True by force
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12342
  then show ?thesis ..
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12343
next
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12344
  case False
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12345
  then obtain z where "z \<in> S" and z: "a \<bullet> z = b"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12346
    using assms by auto
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12347
  with affine_diffs_subspace [OF \<open>affine S\<close>]
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12348
  have sub: "subspace (op + (- z) ` S)" by blast
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12349
  then have aff: "affine (op + (- z) ` S)" and span: "span (op + (- z) ` S) = (op + (- z) ` S)"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12350
    by (auto simp: subspace_imp_affine)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12351
  obtain a' a'' where a': "a' \<in> span (op + (- z) ` S)" and a: "a = a' + a''"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12352
                  and "\<And>w. w \<in> span (op + (- z) ` S) \<Longrightarrow> orthogonal a'' w"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12353
      using orthogonal_subspace_decomp_exists [of "op + (- z) ` S" "a"] by metis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12354
  then have "\<And>w. w \<in> S \<Longrightarrow> a'' \<bullet> (w-z) = 0"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12355
    by (simp add: imageI orthogonal_def span)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12356
  then have a'': "\<And>w. w \<in> S \<Longrightarrow> a'' \<bullet> w = (a - a') \<bullet> z"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12357
    by (simp add: a inner_diff_right)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12358
  then have ba'': "\<And>w. w \<in> S \<Longrightarrow> a'' \<bullet> w = b - a' \<bullet> z"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12359
    by (simp add: inner_diff_left z)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12360
  have "\<And>w. w \<in> op + (- z) ` S \<Longrightarrow> (w + a') \<in> op + (- z) ` S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12361
    by (metis subspace_add a' span_eq sub)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12362
  then have Sclo: "\<And>w. w \<in> S \<Longrightarrow> (w + a') \<in> S"
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12363
    by fastforce
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12364
  show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12365
  proof (cases "a' = 0")
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12366
    case True
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12367
    with a assms True a'' diff_zero less_irrefl show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12368
      by auto
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12369
  next
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12370
    case False
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12371
    show ?thesis
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12372
      apply (rule_tac a' = "a'" and b' = "a' \<bullet> z" in that)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12373
      apply (auto simp: a ba'' inner_left_distrib False Sclo)
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12374
      done
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12375
  qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12376
qed
60a42a4166af lemmas about dimension, hyperplanes, span, etc.
paulson <lp15@cam.ac.uk>
parents: 63072
diff changeset
 12377
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12378
lemma diffs_affine_hull_span:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12379
  assumes "a \<in> S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12380
    shows "{x - a |x. x \<in> affine hull S} = span {x - a |x. x \<in> S}"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12381
proof -
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12382
  have *: "((\<lambda>x. x - a) ` (S - {a})) = {x. x + a \<in> S} - {0}"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12383
    by (auto simp: algebra_simps)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12384
  show ?thesis
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12385
    apply (simp add: affine_hull_span2 [OF assms] *)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12386
    apply (auto simp: algebra_simps)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12387
    done
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12388
qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12389
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12390
lemma aff_dim_dim_affine_diffs:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12391
  fixes S :: "'a :: euclidean_space set"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12392
  assumes "affine S" "a \<in> S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12393
    shows "aff_dim S = dim {x - a |x. x \<in> S}"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12394
proof -
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12395
  obtain B where aff: "affine hull B = affine hull S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12396
             and ind: "\<not> affine_dependent B"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12397
             and card: "of_nat (card B) = aff_dim S + 1"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12398
    using aff_dim_basis_exists by blast
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12399
  then have "B \<noteq> {}" using assms
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12400
    by (metis affine_hull_eq_empty ex_in_conv)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12401
  then obtain c where "c \<in> B" by auto
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12402
  then have "c \<in> S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12403
    by (metis aff affine_hull_eq \<open>affine S\<close> hull_inc)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12404
  have xy: "x - c = y - a \<longleftrightarrow> y = x + 1 *\<^sub>R (a - c)" for x y c and a::'a
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12405
    by (auto simp: algebra_simps)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12406
  have *: "{x - c |x. x \<in> S} = {x - a |x. x \<in> S}"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12407
    apply safe
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12408
    apply (simp_all only: xy)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12409
    using mem_affine_3_minus [OF \<open>affine S\<close>] \<open>a \<in> S\<close> \<open>c \<in> S\<close> apply blast+
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12410
    done
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12411
  have affS: "affine hull S = S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12412
    by (simp add: \<open>affine S\<close>)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12413
  have "aff_dim S = of_nat (card B) - 1"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12414
    using card by simp
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12415
  also have "... = dim {x - c |x. x \<in> B}"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12416
    by (simp add: affine_independent_card_dim_diffs [OF ind \<open>c \<in> B\<close>])
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12417
  also have "... = dim {x - c | x. x \<in> affine hull B}"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12418
     by (simp add: diffs_affine_hull_span \<open>c \<in> B\<close>)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12419
  also have "... = dim {x - a |x. x \<in> S}"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12420
     by (simp add: affS aff *)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12421
   finally show ?thesis .
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12422
qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12423
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12424
lemma aff_dim_linear_image_le:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12425
  assumes "linear f"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12426
    shows "aff_dim(f ` S) \<le> aff_dim S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12427
proof -
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12428
  have "aff_dim (f ` T) \<le> aff_dim T" if "affine T" for T
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12429
  proof (cases "T = {}")
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12430
    case True then show ?thesis by (simp add: aff_dim_geq)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12431
  next
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12432
    case False
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12433
    then obtain a where "a \<in> T" by auto
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12434
    have 1: "((\<lambda>x. x - f a) ` f ` T) = {x - f a |x. x \<in> f ` T}"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12435
      by auto
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12436
    have 2: "{x - f a| x. x \<in> f ` T} = f ` {x - a| x. x \<in> T}"
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
 12437
      by (force simp: linear_diff [OF assms])
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12438
    have "aff_dim (f ` T) = int (dim {x - f a |x. x \<in> f ` T})"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12439
      by (simp add: \<open>a \<in> T\<close> hull_inc aff_dim_eq_dim [of "f a"] 1)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12440
    also have "... = int (dim (f ` {x - a| x. x \<in> T}))"
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
 12441
      by (force simp: linear_diff [OF assms] 2)
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12442
    also have "... \<le> int (dim {x - a| x. x \<in> T})"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12443
      by (simp add: dim_image_le [OF assms])
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12444
    also have "... \<le> aff_dim T"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12445
      by (simp add: aff_dim_dim_affine_diffs [symmetric] \<open>a \<in> T\<close> \<open>affine T\<close>)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12446
    finally show ?thesis .
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12447
  qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12448
  then
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12449
  have "aff_dim (f ` (affine hull S)) \<le> aff_dim (affine hull S)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12450
    using affine_affine_hull [of S] by blast
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12451
  then show ?thesis
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12452
    using affine_hull_linear_image assms linear_conv_bounded_linear by fastforce
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12453
qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12454
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12455
lemma aff_dim_injective_linear_image [simp]:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12456
  assumes "linear f" "inj f"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12457
    shows "aff_dim (f ` S) = aff_dim S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12458
proof (rule antisym)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12459
  show "aff_dim (f ` S) \<le> aff_dim S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12460
    by (simp add: aff_dim_linear_image_le assms(1))
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12461
next
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12462
  obtain g where "linear g" "g \<circ> f = id"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12463
    using linear_injective_left_inverse assms by blast
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12464
  then have "aff_dim S \<le> aff_dim(g ` f ` S)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12465
    by (simp add: image_comp)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12466
  also have "... \<le> aff_dim (f ` S)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12467
    by (simp add: \<open>linear g\<close> aff_dim_linear_image_le)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12468
  finally show "aff_dim S \<le> aff_dim (f ` S)" .
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12469
qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12470
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12471
text\<open>Choosing a subspace of a given dimension\<close>
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12472
proposition choose_subspace_of_subspace:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12473
  fixes S :: "'n::euclidean_space set"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12474
  assumes "n \<le> dim S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12475
  obtains T where "subspace T" "T \<subseteq> span S" "dim T = n"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12476
proof -
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12477
  have "\<exists>T. subspace T \<and> T \<subseteq> span S \<and> dim T = n"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12478
  using assms
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12479
  proof (induction n)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12480
    case 0 then show ?case by force
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12481
  next
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12482
    case (Suc n)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12483
    then obtain T where "subspace T" "T \<subseteq> span S" "dim T = n"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12484
      by force
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12485
    then show ?case
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12486
    proof (cases "span S \<subseteq> span T")
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12487
      case True
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12488
      have "dim S = dim T"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12489
        apply (rule span_eq_dim [OF subset_antisym [OF True]])
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12490
        by (simp add: \<open>T \<subseteq> span S\<close> span_minimal subspace_span)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12491
      then show ?thesis
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12492
        using Suc.prems \<open>dim T = n\<close> by linarith
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12493
    next
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12494
      case False
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12495
      then obtain y where y: "y \<in> S" "y \<notin> T"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12496
        by (meson span_mono subsetI)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12497
      then have "span (insert y T) \<subseteq> span S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12498
        by (metis (no_types) \<open>T \<subseteq> span S\<close> subsetD insert_subset span_inc span_mono span_span)
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
 12499
      with \<open>dim T = n\<close>  \<open>subspace T\<close> y show ?thesis
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12500
        apply (rule_tac x="span(insert y T)" in exI)
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
 12501
        apply (auto simp: dim_insert)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63332
diff changeset
 12502
        using span_eq by blast
63114
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12503
    qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12504
  qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12505
  with that show ?thesis by blast
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12506
qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12507
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12508
lemma choose_affine_subset:
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12509
  assumes "affine S" "-1 \<le> d" and dle: "d \<le> aff_dim S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12510
  obtains T where "affine T" "T \<subseteq> S" "aff_dim T = d"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12511
proof (cases "d = -1 \<or> S={}")
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12512
  case True with assms show ?thesis
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12513
    by (metis aff_dim_empty affine_empty bot.extremum that eq_iff)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12514
next
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12515
  case False
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12516
  with assms obtain a where "a \<in> S" "0 \<le> d" by auto
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12517
  with assms have ss: "subspace (op + (- a) ` S)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12518
    by (simp add: affine_diffs_subspace)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12519
  have "nat d \<le> dim (op + (- a) ` S)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12520
    by (metis aff_dim_subspace aff_dim_translation_eq dle nat_int nat_mono ss)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12521
  then obtain T where "subspace T" and Tsb: "T \<subseteq> span (op + (- a) ` S)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12522
                  and Tdim: "dim T = nat d"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12523
    using choose_subspace_of_subspace [of "nat d" "op + (- a) ` S"] by blast
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12524
  then have "affine T"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12525
    using subspace_affine by blast
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12526
  then have "affine (op + a ` T)"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12527
    by (metis affine_hull_eq affine_hull_translation)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12528
  moreover have "op + a ` T \<subseteq> S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12529
  proof -
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12530
    have "T \<subseteq> op + (- a) ` S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12531
      by (metis (no_types) span_eq Tsb ss)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12532
    then show "op + a ` T \<subseteq> S"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12533
      using add_ac by auto
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12534
  qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12535
  moreover have "aff_dim (op + a ` T) = d"
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12536
    by (simp add: aff_dim_subspace Tdim \<open>0 \<le> d\<close> \<open>subspace T\<close> aff_dim_translation_eq)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12537
  ultimately show ?thesis
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12538
    by (rule that)
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12539
qed
27afe7af7379 Lots of new material for multivariate analysis
paulson <lp15@cam.ac.uk>
parents: 63092
diff changeset
 12540
63301
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12541
subsection\<open>Several Variants of Paracompactness\<close>
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12542
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12543
proposition paracompact:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12544
  fixes S :: "'a :: euclidean_space set"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12545
  assumes "S \<subseteq> \<Union>\<C>" and opC: "\<And>T. T \<in> \<C> \<Longrightarrow> open T"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12546
  obtains \<C>' where "S \<subseteq> \<Union> \<C>'"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12547
               and "\<And>U. U \<in> \<C>' \<Longrightarrow> open U \<and> (\<exists>T. T \<in> \<C> \<and> U \<subseteq> T)"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12548
               and "\<And>x. x \<in> S
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12549
                       \<Longrightarrow> \<exists>V. open V \<and> x \<in> V \<and>
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12550
                               finite {U. U \<in> \<C>' \<and> (U \<inter> V \<noteq> {})}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12551
proof (cases "S = {}")
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12552
  case True with that show ?thesis by blast
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12553
next
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12554
  case False
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12555
  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
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12556
  proof -
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12557
    obtain T where "x \<in> T" "T \<in> \<C>" "open T"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12558
      using assms \<open>x \<in> S\<close> by blast
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12559
    then obtain e where "e > 0" "cball x e \<subseteq> T"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12560
      by (force simp: open_contains_cball)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12561
    then show ?thesis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12562
      apply (rule_tac x = T in exI)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12563
      apply (rule_tac x = "ball x e" in exI)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12564
      using  \<open>T \<in> \<C>\<close>
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12565
      apply (simp add: closure_minimal)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12566
      done
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12567
  qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12568
  then obtain F G where Gin: "x \<in> G x" and oG: "open (G x)"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12569
                    and clos: "closure (G x) \<subseteq> F x" and Fin: "F x \<in> \<C>"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12570
         if "x \<in> S" for x
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12571
    by metis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12572
  then obtain \<F> where "\<F> \<subseteq> G ` S" "countable \<F>" "\<Union>\<F> = UNION S G"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12573
    using Lindelof [of "G ` S"] by (metis image_iff)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12574
  then obtain K where K: "K \<subseteq> S" "countable K" and eq: "UNION K G = UNION S G"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12575
    by (metis countable_subset_image)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12576
  with False Gin have "K \<noteq> {}" by force
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12577
  then obtain a :: "nat \<Rightarrow> 'a" where "range a = K"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12578
    by (metis range_from_nat_into \<open>countable K\<close>)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12579
  then have odif: "\<And>n. open (F (a n) - \<Union>{closure (G (a m)) |m. m < n})"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12580
    using \<open>K \<subseteq> S\<close> Fin opC by (fastforce simp add:)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12581
  let ?C = "range (\<lambda>n. F(a n) - \<Union>{closure(G(a m)) |m. m < n})"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12582
  have enum_S: "\<exists>n. x \<in> F(a n) \<and> x \<in> G(a n)" if "x \<in> S" for x
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12583
  proof -
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12584
    have "\<exists>y \<in> K. x \<in> G y" using eq that Gin by fastforce
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12585
    then show ?thesis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12586
      using clos K \<open>range a = K\<close> closure_subset by blast
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12587
  qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12588
  have 1: "S \<subseteq> Union ?C"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12589
  proof
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12590
    fix x assume "x \<in> S"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12591
    define n where "n \<equiv> LEAST n. x \<in> F(a n)"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12592
    have n: "x \<in> F(a n)"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12593
      using enum_S [OF \<open>x \<in> S\<close>] by (force simp: n_def intro: LeastI)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12594
    have notn: "x \<notin> F(a m)" if "m < n" for m
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12595
      using that not_less_Least by (force simp: n_def)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12596
    then have "x \<notin> \<Union>{closure (G (a m)) |m. m < n}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12597
      using n \<open>K \<subseteq> S\<close> \<open>range a = K\<close> clos notn by fastforce
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12598
    with n show "x \<in> Union ?C"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12599
      by blast
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12600
  qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12601
  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
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12602
  proof -
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12603
    obtain n where n: "x \<in> F(a n)" "x \<in> G(a n)"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12604
      using \<open>x \<in> S\<close> enum_S by auto
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12605
    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"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12606
    proof clarsimp
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12607
      fix k  assume "(F (a k) - \<Union>{closure (G (a m)) |m. m < k}) \<inter> G (a n) \<noteq> {}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12608
      then have "k \<le> n"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12609
        by auto (metis closure_subset not_le subsetCE)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12610
      then show "F (a k) - \<Union>{closure (G (a m)) |m. m < k}
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12611
                 \<in> (\<lambda>n. F (a n) - \<Union>{closure (G (a m)) |m. m < n}) ` {..n}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12612
        by force
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12613
    qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12614
    moreover have "finite ((\<lambda>n. F(a n) - \<Union>{closure(G(a m)) |m. m < n}) ` atMost n)"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12615
      by force
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12616
    ultimately have *: "finite {U \<in> ?C. U \<inter> G (a n) \<noteq> {}}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12617
      using finite_subset by blast
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12618
    show ?thesis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12619
      apply (rule_tac x="G (a n)" in exI)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12620
      apply (intro conjI oG n *)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12621
      using \<open>K \<subseteq> S\<close> \<open>range a = K\<close> apply blast
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12622
      done
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12623
  qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12624
  show ?thesis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12625
    apply (rule that [OF 1 _ 3])
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12626
    using Fin \<open>K \<subseteq> S\<close> \<open>range a = K\<close>  apply (auto simp: odif)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12627
    done
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12628
qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12629
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12630
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12631
corollary paracompact_closedin:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12632
  fixes S :: "'a :: euclidean_space set"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12633
  assumes cin: "closedin (subtopology euclidean U) S"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12634
      and oin: "\<And>T. T \<in> \<C> \<Longrightarrow> openin (subtopology euclidean U) T"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12635
      and "S \<subseteq> \<Union>\<C>"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12636
  obtains \<C>' where "S \<subseteq> \<Union> \<C>'"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12637
               and "\<And>V. V \<in> \<C>' \<Longrightarrow> openin (subtopology euclidean U) V \<and> (\<exists>T. T \<in> \<C> \<and> V \<subseteq> T)"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12638
               and "\<And>x. x \<in> U
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12639
                       \<Longrightarrow> \<exists>V. openin (subtopology euclidean U) V \<and> x \<in> V \<and>
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12640
                               finite {X. X \<in> \<C>' \<and> (X \<inter> V \<noteq> {})}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12641
proof -
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12642
  have "\<exists>Z. open Z \<and> (T = U \<inter> Z)" if "T \<in> \<C>" for T
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12643
    using oin [OF that] by (auto simp: openin_open)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12644
  then obtain F where opF: "open (F T)" and intF: "U \<inter> F T = T" if "T \<in> \<C>" for T
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12645
    by metis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12646
  obtain K where K: "closed K" "U \<inter> K = S"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12647
    using cin by (auto simp: closedin_closed)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12648
  have 1: "U \<subseteq> \<Union>insert (- K) (F ` \<C>)"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12649
    by clarsimp (metis Int_iff Union_iff \<open>U \<inter> K = S\<close> \<open>S \<subseteq> \<Union>\<C>\<close> subsetD intF)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12650
  have 2: "\<And>T. T \<in> insert (- K) (F ` \<C>) \<Longrightarrow> open T"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12651
    using \<open>closed K\<close> by (auto simp: opF)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12652
  obtain \<D> where "U \<subseteq> \<Union>\<D>"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12653
             and D1: "\<And>U. U \<in> \<D> \<Longrightarrow> open U \<and> (\<exists>T. T \<in> insert (- K) (F ` \<C>) \<and> U \<subseteq> T)"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12654
             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> {}}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12655
    using paracompact [OF 1 2] by auto
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12656
  let ?C = "{U \<inter> V |V. V \<in> \<D> \<and> (V \<inter> K \<noteq> {})}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12657
  show ?thesis
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12658
  proof (rule_tac \<C>' = "{U \<inter> V |V. V \<in> \<D> \<and> (V \<inter> K \<noteq> {})}" in that)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12659
    show "S \<subseteq> \<Union>?C"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12660
      using \<open>U \<inter> K = S\<close> \<open>U \<subseteq> \<Union>\<D>\<close> K by (blast dest!: subsetD)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12661
    show "\<And>V. V \<in> ?C \<Longrightarrow> openin (subtopology euclidean U) V \<and> (\<exists>T. T \<in> \<C> \<and> V \<subseteq> T)"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12662
      using D1 intF by fastforce
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12663
    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>
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12664
             (\<lambda>x. U \<inter> x) ` {U \<in> \<D>. U \<inter> V \<noteq> {}}" for V
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12665
      by blast
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12666
    show "\<exists>V. openin (subtopology euclidean U) V \<and> x \<in> V \<and> finite {X \<in> ?C. X \<inter> V \<noteq> {}}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12667
         if "x \<in> U" for x
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12668
      using D2 [OF that]
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12669
      apply clarify
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12670
      apply (rule_tac x="U \<inter> V" in exI)
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12671
      apply (auto intro: that finite_subset [OF *])
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12672
      done
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12673
    qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12674
qed
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12675
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12676
corollary paracompact_closed:
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12677
  fixes S :: "'a :: euclidean_space set"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12678
  assumes "closed S"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12679
      and opC: "\<And>T. T \<in> \<C> \<Longrightarrow> open T"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12680
      and "S \<subseteq> \<Union>\<C>"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12681
  obtains \<C>' where "S \<subseteq> \<Union>\<C>'"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12682
               and "\<And>U. U \<in> \<C>' \<Longrightarrow> open U \<and> (\<exists>T. T \<in> \<C> \<and> U \<subseteq> T)"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12683
               and "\<And>x. \<exists>V. open V \<and> x \<in> V \<and>
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12684
                               finite {U. U \<in> \<C>' \<and> (U \<inter> V \<noteq> {})}"
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12685
using paracompact_closedin [of UNIV S \<C>] assms
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12686
by (auto simp: open_openin [symmetric] closed_closedin [symmetric])
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63170
diff changeset
 12687
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
 12688
end