Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 06b184f

Browse files
committed
refactor(analysis/convex/caratheodory): generalize ℝ to an arbitrary linearly ordered field (#9479)
As a result; `convex_independent_iff_finset` also gets generalized.
1 parent 118d45a commit 06b184f

File tree

3 files changed

+53
-54
lines changed

3 files changed

+53
-54
lines changed

src/analysis/convex/caratheodory.lean

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Authors: Johan Commelin, Scott Morrison
55
-/
66
import analysis.convex.combination
77
import linear_algebra.affine_space.independent
8-
import data.real.basic
8+
import tactic.field_simp
99

1010
/-!
1111
# Carathéodory's convexity theorem
@@ -21,7 +21,7 @@ contains `x`. Thus the difference from the case of affine span is that the affin
2121
depends on `x`.
2222
2323
In particular, in finite dimensions Carathéodory's theorem implies that the convex hull of a set `s`
24-
in `ℝᵈ` is the union of the convex hulls of the `(d+1)`-tuples in `s`.
24+
in `𝕜ᵈ` is the union of the convex hulls of the `(d + 1)`-tuples in `s`.
2525
2626
## Main results
2727
@@ -36,20 +36,19 @@ convex hull, caratheodory
3636
3737
-/
3838

39-
universes u
40-
4139
open set finset
4240
open_locale big_operators
4341

44-
variables {E : Type u} [add_comm_group E] [module ℝ E]
42+
universes u
43+
variables {𝕜 : Type*} {E : Type u} [linear_ordered_field 𝕜] [add_comm_group E] [module 𝕜 E]
4544

4645
namespace caratheodory
4746

4847
/-- If `x` is in the convex hull of some finset `t` whose elements are not affine-independent,
4948
then it is in the convex hull of a strict subset of `t`. -/
5049
lemma mem_convex_hull_erase [decidable_eq E] {t : finset E}
51-
(h : ¬ affine_independent (coe : t → E)) {x : E} (m : x ∈ convex_hull (↑t : set E)) :
52-
∃ (y : (↑t : set E)), x ∈ convex_hull (↑(t.erase y) : set E) :=
50+
(h : ¬ affine_independent 𝕜 (coe : t → E)) {x : E} (m : x ∈ convex_hull 𝕜 (↑t : set E)) :
51+
∃ (y : (↑t : set E)), x ∈ convex_hull 𝕜 (↑(t.erase y) : set E) :=
5352
begin
5453
simp only [finset.convex_hull_eq, mem_set_of_eq] at m ⊢,
5554
obtain ⟨f, fpos, fsum, rfl⟩ := m,
@@ -63,7 +62,7 @@ begin
6362
exact ⟨x, mem_filter.mpr ⟨hx, hgx⟩⟩ },
6463
have hg : 0 < g i₀ := by { rw mem_filter at mem, exact mem.2 },
6564
have hi₀ : i₀ ∈ t := filter_subset _ _ mem,
66-
let k : E → := λ z, f z - (f i₀ / g i₀) * g z,
65+
let k : E → 𝕜 := λ z, f z - (f i₀ / g i₀) * g z,
6766
have hk : k i₀ = 0 := by field_simp [k, ne_of_gt hg],
6867
have ksum : ∑ e in t.erase i₀, k e = 1,
6968
{ calc ∑ e in t.erase i₀, k e = ∑ e in t, k e :
@@ -89,36 +88,36 @@ begin
8988
sub_zero, center_mass, fsum, inv_one, one_smul, id.def] }
9089
end
9190

92-
variables {s : set E} {x : E} (hx : x ∈ convex_hull s)
91+
variables {s : set E} {x : E} (hx : x ∈ convex_hull 𝕜 s)
9392
include hx
9493

9594
/-- Given a point `x` in the convex hull of a set `s`, this is a finite subset of `s` of minimum
9695
cardinality, whose convex hull contains `x`. -/
9796
noncomputable def min_card_finset_of_mem_convex_hull : finset E :=
98-
function.argmin_on finset.card nat.lt_wf { t | ↑t ⊆ s ∧ x ∈ convex_hull (t : set E) }
97+
function.argmin_on finset.card nat.lt_wf { t | ↑t ⊆ s ∧ x ∈ convex_hull 𝕜 (t : set E) }
9998
(by simpa only [convex_hull_eq_union_convex_hull_finite_subsets s, exists_prop, mem_Union] using hx)
10099

101100
lemma min_card_finset_of_mem_convex_hull_subseteq : ↑(min_card_finset_of_mem_convex_hull hx) ⊆ s :=
102-
(function.argmin_on_mem _ _ { t : finset E | ↑t ⊆ s ∧ x ∈ convex_hull (t : set E) } _).1
101+
(function.argmin_on_mem _ _ { t : finset E | ↑t ⊆ s ∧ x ∈ convex_hull 𝕜 (t : set E) } _).1
103102

104103
lemma mem_min_card_finset_of_mem_convex_hull :
105-
x ∈ convex_hull (min_card_finset_of_mem_convex_hull hx : set E) :=
106-
(function.argmin_on_mem _ _ { t : finset E | ↑t ⊆ s ∧ x ∈ convex_hull (t : set E) } _).2
104+
x ∈ convex_hull 𝕜 (min_card_finset_of_mem_convex_hull hx : set E) :=
105+
(function.argmin_on_mem _ _ { t : finset E | ↑t ⊆ s ∧ x ∈ convex_hull 𝕜 (t : set E) } _).2
107106

108107
lemma min_card_finset_of_mem_convex_hull_nonempty :
109108
(min_card_finset_of_mem_convex_hull hx).nonempty :=
110109
begin
111-
rw [← finset.coe_nonempty, ← @convex_hull_nonempty_iff ],
110+
rw [← finset.coe_nonempty, ← @convex_hull_nonempty_iff 𝕜],
112111
exact ⟨x, mem_min_card_finset_of_mem_convex_hull hx⟩,
113112
end
114113

115114
lemma min_card_finset_of_mem_convex_hull_card_le_card
116-
{t : finset E} (ht₁ : ↑t ⊆ s) (ht₂ : x ∈ convex_hull (t : set E)) :
115+
{t : finset E} (ht₁ : ↑t ⊆ s) (ht₂ : x ∈ convex_hull 𝕜 (t : set E)) :
117116
(min_card_finset_of_mem_convex_hull hx).card ≤ t.card :=
118117
function.argmin_on_le _ _ _ ⟨ht₁, ht₂⟩
119118

120119
lemma affine_independent_min_card_finset_of_mem_convex_hull :
121-
affine_independent (coe : min_card_finset_of_mem_convex_hull hx → E) :=
120+
affine_independent 𝕜 (coe : min_card_finset_of_mem_convex_hull hx → E) :=
122121
begin
123122
let k := (min_card_finset_of_mem_convex_hull hx).card - 1,
124123
have hk : (min_card_finset_of_mem_convex_hull hx).card = k + 1,
@@ -142,8 +141,8 @@ variables {s : set E}
142141

143142
/-- **Carathéodory's convexity theorem** -/
144143
lemma convex_hull_eq_union :
145-
convex_hull s =
146-
⋃ (t : finset E) (hss : ↑t ⊆ s) (hai : affine_independent (coe : t → E)), convex_hull ↑t :=
144+
convex_hull 𝕜 s =
145+
⋃ (t : finset E) (hss : ↑t ⊆ s) (hai : affine_independent 𝕜 (coe : t → E)), convex_hull 𝕜 ↑t :=
147146
begin
148147
apply set.subset.antisymm,
149148
{ intros x hx,
@@ -157,9 +156,9 @@ begin
157156
end
158157

159158
/-- A more explicit version of `convex_hull_eq_union`. -/
160-
theorem eq_pos_convex_span_of_mem_convex_hull {x : E} (hx : x ∈ convex_hull s) :
161-
∃ (ι : Sort (u+1)) (_ : fintype ι), by exactI ∃ (z : ι → E) (w : ι → )
162-
(hss : set.range z ⊆ s) (hai : affine_independent z)
159+
theorem eq_pos_convex_span_of_mem_convex_hull {x : E} (hx : x ∈ convex_hull 𝕜 s) :
160+
∃ (ι : Sort (u+1)) (_ : fintype ι), by exactI ∃ (z : ι → E) (w : ι → 𝕜)
161+
(hss : set.range z ⊆ s) (hai : affine_independent 𝕜 z)
163162
(hw : ∀ i, 0 < w i), ∑ i, w i = 1 ∧ ∑ i, w i • z i = x :=
164163
begin
165164
rw convex_hull_eq_union at hx,

src/analysis/convex/extreme.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import analysis.convex.hull
88
/-!
99
# Extreme sets
1010
11-
This file defines extreme sets and extreme points for sets in a real vector space.
11+
This file defines extreme sets and extreme points for sets in a module.
1212
1313
An extreme set of `A` is a subset of `A` that is as far as it can get in any outward direction: If
1414
point `x` is in it and point `y ∈ A`, then the line passing through `x` and `y` leaves `A` at `x`.

src/analysis/convex/independent.lean

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ independence, convex position
4242

4343
open_locale affine big_operators classical
4444
open finset function
45-
variables (𝕜 : Type*) {E : Type*}
45+
variables {𝕜 E ι : Type*}
4646

4747
section ordered_semiring
48-
variables [ordered_semiring 𝕜] [add_comm_group E] [module 𝕜 E] {ι : Type*} {s t : set E}
48+
variables (𝕜) [ordered_semiring 𝕜] [add_comm_group E] [module 𝕜 E] {s t : set E}
4949

5050
/-- An indexed family is said to be convex independent if every point only belongs to convex hulls
5151
of sets containing it. -/
@@ -54,34 +54,6 @@ def convex_independent (p : ι → E) : Prop :=
5454

5555
variables {𝕜}
5656

57-
/-- To check convex independence, one only has to check finsets thanks to Carathéodory's theorem. -/
58-
lemma convex_independent_iff_finset [module ℝ E] {p : ι → E} :
59-
convex_independent ℝ p
60-
↔ ∀ (s : finset ι) (x : ι), p x ∈ convex_hull ℝ (s.image p : set E) → x ∈ s :=
61-
begin
62-
refine ⟨λ hc s x hx, hc s x _, λ h s x hx, _⟩,
63-
{ rwa finset.coe_image at hx },
64-
have hp : injective p,
65-
{ rintro a b hab,
66-
rw ←mem_singleton,
67-
refine h {b} a _,
68-
rw [hab, image_singleton, coe_singleton, convex_hull_singleton],
69-
exact set.mem_singleton _ },
70-
let s' : finset ι :=
71-
(caratheodory.min_card_finset_of_mem_convex_hull hx).preimage p (hp.inj_on _),
72-
suffices hs' : x ∈ s',
73-
{ rw ←hp.mem_set_image,
74-
rw [finset.mem_preimage, ←mem_coe] at hs',
75-
exact caratheodory.min_card_finset_of_mem_convex_hull_subseteq hx hs' },
76-
refine h s' x _,
77-
have : s'.image p = caratheodory.min_card_finset_of_mem_convex_hull hx,
78-
{ rw [image_preimage, filter_true_of_mem],
79-
exact λ y hy, set.image_subset_range _ s
80-
(caratheodory.min_card_finset_of_mem_convex_hull_subseteq hx $ mem_coe.2 hy) },
81-
rw this,
82-
exact caratheodory.mem_min_card_finset_of_mem_convex_hull hx,
83-
end
84-
8557
/-- A family with at most one point is convex independent. -/
8658
lemma subsingleton.convex_independent [subsingleton ι] (p : ι → E) :
8759
convex_independent 𝕜 p :=
@@ -193,11 +165,39 @@ end
193165

194166
end ordered_semiring
195167

196-
/-! ### Extreme points -/
197-
198168
section linear_ordered_field
199169
variables [linear_ordered_field 𝕜] [add_comm_group E] [module 𝕜 E] {s : set E}
200170

171+
/-- To check convex independence, one only has to check finsets thanks to Carathéodory's theorem. -/
172+
lemma convex_independent_iff_finset {p : ι → E} :
173+
convex_independent 𝕜 p
174+
↔ ∀ (s : finset ι) (x : ι), p x ∈ convex_hull 𝕜 (s.image p : set E) → x ∈ s :=
175+
begin
176+
refine ⟨λ hc s x hx, hc s x _, λ h s x hx, _⟩,
177+
{ rwa finset.coe_image at hx },
178+
have hp : injective p,
179+
{ rintro a b hab,
180+
rw ←mem_singleton,
181+
refine h {b} a _,
182+
rw [hab, image_singleton, coe_singleton, convex_hull_singleton],
183+
exact set.mem_singleton _ },
184+
let s' : finset ι :=
185+
(caratheodory.min_card_finset_of_mem_convex_hull hx).preimage p (hp.inj_on _),
186+
suffices hs' : x ∈ s',
187+
{ rw ←hp.mem_set_image,
188+
rw [finset.mem_preimage, ←mem_coe] at hs',
189+
exact caratheodory.min_card_finset_of_mem_convex_hull_subseteq hx hs' },
190+
refine h s' x _,
191+
have : s'.image p = caratheodory.min_card_finset_of_mem_convex_hull hx,
192+
{ rw [image_preimage, filter_true_of_mem],
193+
exact λ y hy, set.image_subset_range _ s
194+
(caratheodory.min_card_finset_of_mem_convex_hull_subseteq hx $ mem_coe.2 hy) },
195+
rw this,
196+
exact caratheodory.mem_min_card_finset_of_mem_convex_hull hx,
197+
end
198+
199+
/-! ### Extreme points -/
200+
201201
lemma convex.convex_independent_extreme_points (hs : convex 𝕜 s) :
202202
convex_independent 𝕜 (λ p, p : s.extreme_points 𝕜 → E) :=
203203
convex_independent_set_iff_not_mem_convex_hull_diff.2 $ λ x hx h,

0 commit comments

Comments
 (0)