Skip to content

Commit

Permalink
chore(analysis/convex/basic): add finset.convex_hull_eq (#2956)
Browse files Browse the repository at this point in the history
  • Loading branch information
urkud committed Jun 5, 2020
1 parent 2ceb7f7 commit 80a52e9
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/analysis/convex/basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -796,13 +796,13 @@ begin
exact ⟨z i, hz i hit, Hi⟩
end

lemma set.finite.convex_hull_eq {s : set E} (hs : finite s) :
convex_hull s = {x : E | ∃ (w : E → ℝ) (hw₀ : ∀ y ∈ s, 0 ≤ w y) (hw₁ : hs.to_finset.sum w = 1),
hs.to_finset.center_mass w id = x} :=
lemma finset.convex_hull_eq (s : finset E) :
convex_hull s = {x : E | ∃ (w : E → ℝ) (hw₀ : ∀ y ∈ s, 0 ≤ w y) (hw₁ : s.sum w = 1),
s.center_mass w id = x} :=
begin
refine subset.antisymm (convex_hull_min _ _) _,
{ intros x hx,
replace hx : x ∈ hs.to_finset, from finite.mem_to_finset.2 hx,
rw [finset.mem_coe] at hx,
refine ⟨_, _, _, finset.center_mass_ite_eq _ _ _ hx⟩,
{ intros, split_ifs, exacts [zero_le_one, le_refl 0] },
{ rw [finset.sum_ite_eq, if_pos hx] } },
Expand All @@ -814,10 +814,16 @@ begin
apply_rules [add_nonneg, mul_nonneg, hwx₀, hwy₀], },
{ simp only [finset.sum_add_distrib, finset.mul_sum.symm, mul_one, *] } },
{ rintros _ ⟨w, hw₀, hw₁, rfl⟩,
exact hs.to_finset.center_mass_mem_convex_hull (λ x hx, hw₀ _ $ finite.mem_to_finset.1 hx)
(hw₁.symm ▸ zero_lt_one) (λ x hx, finite.mem_to_finset.1 hx) }
exact s.center_mass_mem_convex_hull (λ x hx, hw₀ _ hx)
(hw₁.symm ▸ zero_lt_one) (λ x hx, hx) }
end

lemma set.finite.convex_hull_eq {s : set E} (hs : finite s) :
convex_hull s = {x : E | ∃ (w : E → ℝ) (hw₀ : ∀ y ∈ s, 0 ≤ w y) (hw₁ : hs.to_finset.sum w = 1),
hs.to_finset.center_mass w id = x} :=
by simpa only [set.finite.coe_to_finset, set.finite.mem_to_finset, exists_prop]
using hs.to_finset.convex_hull_eq

lemma convex_hull_eq_union_convex_hull_finite_subsets (s : set E) :
convex_hull s = ⋃ (t : finset E) (w : ↑t ⊆ s), convex_hull ↑t :=
begin
Expand Down

0 comments on commit 80a52e9

Please sign in to comment.