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

Commit ceb9da6

Browse files
committed
feat(analysis/convex/caratheodory): strengthen Caratheodory's lemma to provide affine independence (#8892)
The changes here are: - Use hypothesis `¬ affine_independent ℝ (coe : t → E)` instead of `finrank ℝ E + 1 < t.card` - Drop no-longer-necessary `[finite_dimensional ℝ E]` assumption - Do not use a shrinking argument but start by choosing an appropriate subset of minimum cardinality via `min_card_finset_of_mem_convex_hull` - Provide a single alternative form of Carathéodory's lemma `eq_pos_convex_span_of_mem_convex_hull` - In the alternate form, define the explicit linear combination using elements parameterised by a new `fintype` rather than on the entire ambient space `E` (we thus avoid the issue of junk values outside of the relevant subset)
1 parent 5eb1918 commit ceb9da6

File tree

2 files changed

+118
-141
lines changed

2 files changed

+118
-141
lines changed

src/analysis/convex/caratheodory.lean

Lines changed: 100 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,25 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Johan Commelin, Scott Morrison
55
-/
66
import analysis.convex.basic
7+
import linear_algebra.affine_space.independent
78

89
/-!
910
# Carathéodory's convexity theorem
1011
11-
This file is devoted to proving Carathéodory's convexity theorem:
12-
The convex hull of a set `s` in ℝᵈ is the union of the convex hulls of the (d+1)-tuples in `s`.
12+
Convex hull can be regarded as a refinement of affine span. Both are closure operators but whereas
13+
convex hull takes values in the lattice of convex subsets, affine span takes values in the much
14+
coarser sublattice of affine subspaces.
1315
14-
## Main results:
16+
The cost of this refinement is that one no longer has bases. However Carathéodory's convexity
17+
theorem offers some compensation. Given a set `s` together with a point `x` in its convex hull,
18+
Carathéodory says that one may find an affine-independent family of elements `s` whose convex hull
19+
contains `x`. Thus the difference from the case of affine span is that the affine-independent family
20+
depends on `x`.
21+
22+
In particular, in finite dimensions Carathéodory's theorem implies that the convex hull of a set `s`
23+
in `ℝᵈ` is the union of the convex hulls of the `(d+1)`-tuples in `s`.
24+
25+
## Main results
1526
1627
* `convex_hull_eq_union`: Carathéodory's convexity theorem
1728
@@ -26,24 +37,23 @@ convex hull, caratheodory
2637

2738
universes u
2839

29-
open set finset finite_dimensional
40+
open set finset
3041
open_locale big_operators
3142

32-
variables {E : Type u} [add_comm_group E] [module ℝ E] [finite_dimensional ℝ E]
43+
variables {E : Type u} [add_comm_group E] [module ℝ E]
3344

3445
namespace caratheodory
3546

36-
/--
37-
If `x` is in the convex hull of some finset `t` with strictly more than `finrank + 1` elements,
38-
then it is in the union of the convex hulls of the finsets `t.erase y` for `y ∈ t`.
39-
-/
40-
lemma mem_convex_hull_erase [decidable_eq E] {t : finset E} (h : finrank ℝ E + 1 < t.card)
41-
{x : E} (m : x ∈ convex_hull (↑t : set E)) :
47+
/-- If `x` is in the convex hull of some finset `t` whose elements are not affine-independent,
48+
then it is in the convex hull of a strict subset of `t`. -/
49+
lemma mem_convex_hull_erase [decidable_eq E] {t : finset E}
50+
(h : ¬ affine_independent ℝ (coe : t → E)) {x : E} (m : x ∈ convex_hull (↑t : set E)) :
4251
∃ (y : (↑t : set E)), x ∈ convex_hull (↑(t.erase y) : set E) :=
4352
begin
4453
simp only [finset.convex_hull_eq, mem_set_of_eq] at m ⊢,
4554
obtain ⟨f, fpos, fsum, rfl⟩ := m,
46-
obtain ⟨g, gcombo, gsum, gpos⟩ := exists_relation_sum_zero_pos_coefficient_of_dim_succ_lt_card h,
55+
obtain ⟨g, gcombo, gsum, gpos⟩ := exists_nontrivial_relation_sum_zero_of_not_affine_ind h,
56+
replace gpos := exists_pos_of_sum_zero_of_exists_nonzero g gsum gpos,
4757
clear h,
4858
let s := t.filter (λ z : E, 0 < g z),
4959
obtain ⟨i₀, mem, w⟩ : ∃ i₀ ∈ s, ∀ i ∈ s, f i₀ / g i₀ ≤ f i / g i,
@@ -78,148 +88,97 @@ begin
7888
sub_zero, center_mass, fsum, inv_one, one_smul, id.def], },
7989
end
8090

81-
/--
82-
The convex hull of a finset `t` with `finrank ℝ E + 1 < t.card` is equal to
83-
the union of the convex hulls of the finsets `t.erase x` for `x ∈ t`.
84-
-/
85-
lemma step [decidable_eq E] (t : finset E) (h : finrank ℝ E + 1 < t.card) :
86-
convex_hull (↑t : set E) = ⋃ (x : (↑t : set E)), convex_hull ↑(t.erase x) :=
87-
begin
88-
apply set.subset.antisymm,
89-
{ intros x m',
90-
obtain ⟨y, m⟩ := mem_convex_hull_erase h m',
91-
exact mem_Union.2 ⟨y, m⟩, },
92-
{ refine Union_subset _,
93-
intro x,
94-
apply convex_hull_mono,
95-
apply erase_subset, }
96-
end
91+
variables {s : set E} {x : E} (hx : x ∈ convex_hull s)
92+
include hx
9793

98-
/--
99-
The convex hull of a finset `t` with `finrank ℝ E + 1 < t.card` is contained in
100-
the union of the convex hulls of the finsets `t' ⊆ t` with `t'.card ≤ finrank ℝ E + 1`.
101-
-/
102-
lemma shrink' (t : finset E) (k : ℕ) (h : t.card = finrank ℝ E + 1 + k) :
103-
convex_hull (↑t : set E) ⊆
104-
⋃ (t' : finset E) (w : t' ⊆ t) (b : t'.card ≤ finrank ℝ E + 1), convex_hull ↑t' :=
105-
begin
106-
induction k with k ih generalizing t,
107-
{ apply subset_subset_Union t,
108-
apply subset_subset_Union (set.subset.refl _),
109-
exact subset_subset_Union (le_of_eq h) (subset.refl _), },
110-
{ classical,
111-
rw step _ (by { rw h, simp, } : finrank ℝ E + 1 < t.card),
112-
apply Union_subset,
113-
intro i,
114-
transitivity,
115-
{ apply ih,
116-
rw [card_erase_of_mem, h, nat.add_succ, nat.pred_succ],
117-
exact i.2, },
118-
{ apply Union_subset_Union,
119-
intro t',
120-
apply Union_subset_Union_const,
121-
exact λ h, set.subset.trans h (erase_subset _ _), } }
122-
end
94+
/-- Given a point `x` in the convex hull of a set `s`, this is a finite subset of `s` of minimum
95+
cardinality, whose convex hull contains `x`. -/
96+
noncomputable def min_card_finset_of_mem_convex_hull : finset E :=
97+
function.argmin_on finset.card nat.lt_wf { t | ↑t ⊆ s ∧ x ∈ convex_hull (t : set E) }
98+
(by simpa only [convex_hull_eq_union_convex_hull_finite_subsets s, exists_prop, mem_Union] using hx)
12399

124-
/--
125-
The convex hull of any finset `t` is contained in
126-
the union of the convex hulls of the finsets `t' ⊆ t` with `t'.card ≤ finrank ℝ E + 1`.
127-
-/
128-
lemma shrink (t : finset E) :
129-
convex_hull (↑t : set E) ⊆
130-
⋃ (t' : finset E) (w : t' ⊆ t) (b : t'.card ≤ finrank ℝ E + 1), convex_hull ↑t' :=
131-
begin
132-
by_cases h : t.card ≤ finrank ℝ E + 1,
133-
{ apply subset_subset_Union t,
134-
apply subset_subset_Union (set.subset.refl _),
135-
exact subset_subset_Union h (set.subset.refl _), },
136-
push_neg at h,
137-
obtain ⟨k, w⟩ := le_iff_exists_add.mp (le_of_lt h), clear h,
138-
exact shrink' _ _ w,
139-
end
100+
lemma min_card_finset_of_mem_convex_hull_subseteq : ↑(min_card_finset_of_mem_convex_hull hx) ⊆ s :=
101+
(function.argmin_on_mem _ _ { t : finset E | ↑t ⊆ s ∧ x ∈ convex_hull (t : set E) } _).1
140102

141-
end caratheodory
142-
143-
/--
144-
One inclusion of **Carathéodory's convexity theorem**.
103+
lemma mem_min_card_finset_of_mem_convex_hull :
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
145106

146-
The convex hull of a set `s` in ℝᵈ is contained in
147-
the union of the convex hulls of the (d+1)-tuples in `s`.
148-
-/
149-
lemma convex_hull_subset_union (s : set E) :
150-
convex_hull s ⊆ ⋃ (t : finset E) (w : ↑t ⊆ s) (b : t.card ≤ finrank ℝ E + 1), convex_hull ↑t :=
107+
lemma min_card_finset_of_mem_convex_hull_nonempty :
108+
(min_card_finset_of_mem_convex_hull hx).nonempty :=
151109
begin
152-
-- First we replace `convex_hull s` with the union of the convex hulls of finite subsets,
153-
rw convex_hull_eq_union_convex_hull_finite_subsets,
154-
-- and prove the inclusion for each of those.
155-
apply Union_subset, intro r,
156-
apply Union_subset, intro h,
157-
-- Second, for each convex hull of a finite subset, we shrink it.
158-
refine subset.trans (caratheodory.shrink _) _,
159-
-- After that it's just shuffling unions around.
160-
refine Union_subset_Union (λ t, _),
161-
exact Union_subset_Union2 (λ htr, ⟨subset.trans htr h, subset.refl _⟩)
110+
rw [← finset.coe_nonempty, ← convex_hull_nonempty_iff],
111+
exact ⟨x, mem_min_card_finset_of_mem_convex_hull hx⟩,
162112
end
163113

164-
/--
165-
**Carathéodory's convexity theorem**.
114+
lemma min_card_finset_of_mem_convex_hull_card_le_card
115+
{t : finset E} (ht₁ : ↑t ⊆ s) (ht₂ : x ∈ convex_hull (t : set E)) :
116+
(min_card_finset_of_mem_convex_hull hx).card ≤ t.card :=
117+
function.argmin_on_le _ _ _ ⟨ht₁, ht₂⟩
166118

167-
The convex hull of a set `s` in ℝᵈ is the union of the convex hulls of the (d+1)-tuples in `s`.
168-
-/
169-
theorem convex_hull_eq_union (s : set E) :
170-
convex_hull s = ⋃ (t : finset E) (w : ↑t ⊆ s) (b : t.card ≤ finrank ℝ E + 1), convex_hull ↑t :=
119+
lemma affine_independent_min_card_finset_of_mem_convex_hull :
120+
affine_independent ℝ (coe : min_card_finset_of_mem_convex_hull hx → E) :=
171121
begin
172-
apply set.subset.antisymm,
173-
{ apply convex_hull_subset_union, },
174-
iterate 3 { convert Union_subset _, intro, },
175-
exact convex_hull_mono ‹_›,
122+
let k := (min_card_finset_of_mem_convex_hull hx).card - 1,
123+
have hk : (min_card_finset_of_mem_convex_hull hx).card = k + 1,
124+
{ exact (nat.succ_pred_eq_of_pos
125+
(finset.card_pos.mpr (min_card_finset_of_mem_convex_hull_nonempty hx))).symm, },
126+
classical,
127+
by_contra,
128+
obtain ⟨p, hp⟩ := mem_convex_hull_erase h (mem_min_card_finset_of_mem_convex_hull hx),
129+
have contra := min_card_finset_of_mem_convex_hull_card_le_card hx (set.subset.trans
130+
(finset.erase_subset ↑p (min_card_finset_of_mem_convex_hull hx))
131+
(min_card_finset_of_mem_convex_hull_subseteq hx)) hp,
132+
rw [← not_lt] at contra,
133+
apply contra,
134+
erw [card_erase_of_mem p.2, hk],
135+
exact lt_add_one _,
176136
end
177137

178-
/--
179-
A more explicit formulation of **Carathéodory's convexity theorem**,
180-
writing an element of a convex hull as the center of mass
181-
of an explicit `finset` with cardinality at most `dim + 1`.
182-
-/
183-
theorem eq_center_mass_card_le_dim_succ_of_mem_convex_hull
184-
{s : set E} {x : E} (h : x ∈ convex_hull s) :
185-
∃ (t : finset E) (w : ↑t ⊆ s) (b : t.card ≤ finrank ℝ E + 1)
186-
(f : E → ℝ), (∀ y ∈ t, 0 ≤ f y) ∧ t.sum f = 1 ∧ t.center_mass f id = x :=
138+
end caratheodory
139+
140+
variables {s : set E}
141+
142+
/-- **Carathéodory's convexity theorem** -/
143+
lemma convex_hull_eq_union :
144+
convex_hull s =
145+
⋃ (t : finset E) (hss : ↑t ⊆ s) (hai : affine_independent ℝ (coe : t → E)), convex_hull ↑t :=
187146
begin
188-
rw convex_hull_eq_union at h,
189-
simp only [exists_prop, mem_Union] at h,
190-
obtain ⟨t, w, b, m⟩ := h,
191-
refine ⟨t, w, b, _⟩,
192-
rw finset.convex_hull_eq at m,
193-
simpa only [exists_prop] using m,
147+
apply set.subset.antisymm,
148+
{ intros x hx,
149+
simp only [exists_prop, set.mem_Union],
150+
exact ⟨caratheodory.min_card_finset_of_mem_convex_hull hx,
151+
caratheodory.min_card_finset_of_mem_convex_hull_subseteq hx,
152+
caratheodory.affine_independent_min_card_finset_of_mem_convex_hull hx,
153+
caratheodory.mem_min_card_finset_of_mem_convex_hull hx⟩, },
154+
{ iterate 3 { convert set.Union_subset _, intro, },
155+
exact convex_hull_mono ‹_›, },
194156
end
195157

196-
/--
197-
A variation on **Carathéodory's convexity theorem**,
198-
writing an element of a convex hull as a center of mass
199-
of an explicit `finset` with cardinality at most `dim + 1`,
200-
where all coefficients in the center of mass formula
201-
are strictly positive.
202-
203-
(This is proved using `eq_center_mass_card_le_dim_succ_of_mem_convex_hull`,
204-
and discarding any elements of the set with coefficient zero.)
205-
-/
206-
theorem eq_pos_center_mass_card_le_dim_succ_of_mem_convex_hull
207-
{s : set E} {x : E} (h : x ∈ convex_hull s) :
208-
∃ (t : finset E) (w : ↑t ⊆ s) (b : t.card ≤ finrank ℝ E + 1)
209-
(f : E → ℝ), (∀ y ∈ t, 0 < f y) ∧ t.sum f = 1 ∧ t.center_mass f id = x :=
158+
/-- A more explicit version of `convex_hull_eq_union`. -/
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)
162+
(hw : ∀ i, 0 < w i), ∑ i, w i = 1 ∧ ∑ i, w i • z i = x :=
210163
begin
211-
obtain ⟨t, w, b, f, ⟨pos, sum, center⟩⟩ := eq_center_mass_card_le_dim_succ_of_mem_convex_hull h,
212-
let t' := t.filter (λ z, 0 < f z),
213-
have t'sum : t'.sum f = 1,
214-
{ rw ← sum,
215-
exact sum_filter_of_ne (λ x hxt hfx, (pos x hxt).lt_of_ne hfx.symm) },
216-
refine ⟨t', _, _, f, ⟨_, t'sum, _⟩⟩,
217-
{ exact subset.trans (filter_subset _ t) w, },
218-
{ exact (card_filter_le _ _).trans b, },
219-
{ exact λ y H, (mem_filter.mp H).right, },
220-
{ rw ← center,
221-
simp only [center_mass, t'sum, sum, inv_one, one_smul, id.def],
222-
refine sum_filter_of_ne (λ x hxt hfx, (pos x hxt).lt_of_ne $ λ hf₀, _),
223-
rw [← hf₀, zero_smul] at hfx,
224-
exact hfx rfl },
164+
rw convex_hull_eq_union at hx,
165+
simp only [exists_prop, set.mem_Union] at hx,
166+
obtain ⟨t, ht₁, ht₂, ht₃⟩ := hx,
167+
simp only [t.convex_hull_eq, exists_prop, set.mem_set_of_eq] at ht₃,
168+
obtain ⟨w, hw₁, hw₂, hw₃⟩ := ht₃,
169+
let t' := t.filter (λ i, w i ≠ 0),
170+
refine ⟨t', t'.fintype_coe_sort, (coe : t' → E), w ∘ (coe : t' → E), _, _, _, _, _⟩,
171+
{ rw subtype.range_coe_subtype, exact set.subset.trans (finset.filter_subset _ t) ht₁, },
172+
{ exact affine_independent_embedding_of_affine_independent
173+
⟨_, inclusion_injective (finset.filter_subset (λ i, w i ≠ 0) t)⟩ ht₂, },
174+
{ intros i, suffices : w i ≠ 0,
175+
{ cases this.lt_or_lt with hneg hpos,
176+
{ exfalso, rw ← not_le at hneg, apply hneg, exact hw₁ _ (finset.mem_filter.mp i.2).1, },
177+
{ exact hpos, }, },
178+
exact (finset.mem_filter.mp i.property).2, },
179+
{ erw [finset.sum_attach, finset.sum_filter_ne_zero, hw₂], },
180+
{ change ∑ (i : t') in t'.attach, (λ e, w e • e) ↑i = x,
181+
erw [finset.sum_attach, finset.sum_filter_of_ne],
182+
{ rw t.center_mass_eq_of_sum_1 id hw₂ at hw₃, exact hw₃, },
183+
{ intros e he hwe contra, apply hwe, rw [contra, zero_smul], }, },
225184
end

src/linear_algebra/affine_space/independent.lean

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,24 @@ lemma not_mem_affine_span_diff_of_affine_independent [nontrivial k] {p : ι →
381381
p i ∉ affine_span k (p '' (s \ {i})) :=
382382
by simp [ha]
383383

384+
lemma exists_nontrivial_relation_sum_zero_of_not_affine_ind
385+
{t : finset V} (h : ¬ affine_independent k (coe : t → V)) :
386+
∃ f : V → k, ∑ e in t, f e • e = 0 ∧ ∑ e in t, f e = 0 ∧ ∃ x ∈ t, f x ≠ 0 :=
387+
begin
388+
classical,
389+
rw affine_independent_iff_of_fintype at h,
390+
simp only [exists_prop, not_forall] at h,
391+
obtain ⟨w, hw, hwt, i, hi⟩ := h,
392+
simp only [finset.weighted_vsub_eq_weighted_vsub_of_point_of_sum_eq_zero _ w (coe : t → V) hw 0,
393+
vsub_eq_sub, finset.weighted_vsub_of_point_apply, sub_zero] at hwt,
394+
let f : Π (x : V), x ∈ t → k := λ x hx, w ⟨x, hx⟩,
395+
refine ⟨λ x, if hx : x ∈ t then f x hx else (0 : k), _, _, by { use i, simp [hi, f], }⟩,
396+
suffices : ∑ (e : V) in t, dite (e ∈ t) (λ hx, (f e hx) • e) (λ hx, 0) = 0,
397+
{ convert this, ext, by_cases hx : x ∈ t; simp [hx], },
398+
all_goals
399+
{ simp only [finset.sum_dite_of_true (λx h, h), subtype.val_eq_coe, finset.mk_coe, f, hwt, hw], },
400+
end
401+
384402
end affine_independent
385403

386404
section field

0 commit comments

Comments
 (0)