@@ -27,8 +27,9 @@ open set function
2727open_locale big_operators classical pointwise
2828
2929universes u u'
30- variables {R E F ι ι' : Type *} [linear_ordered_field R] [add_comm_group E] [add_comm_group F]
31- [module R E] [module R F] {s : set E}
30+ variables {R E F ι ι' α : Type *} [linear_ordered_field R] [add_comm_group E] [add_comm_group F]
31+ [linear_ordered_add_comm_group α] [module R E] [module R F] [module R α] [ordered_smul R α]
32+ {s : set E}
3233
3334/-- Center of mass of a finite collection of points with prescribed weights.
3435Note that we require neither `0 ≤ w i` nor `∑ w = 1`. -/
@@ -119,6 +120,25 @@ lemma finset.center_mass_filter_ne_zero :
119120finset.center_mass_subset z (filter_subset _ _) $ λ i hit hit',
120121 by simpa only [hit, mem_filter, true_and, ne.def, not_not] using hit'
121122
123+ namespace finset
124+
125+ lemma center_mass_le_sup {s : finset ι} {f : ι → α} {w : ι → R}
126+ (hw₀ : ∀ i ∈ s, 0 ≤ w i) (hw₁ : 0 < ∑ i in s, w i) :
127+ s.center_mass w f ≤ s.sup' (nonempty_of_ne_empty $ by { rintro rfl, simpa using hw₁ }) f :=
128+ begin
129+ rw [center_mass, inv_smul_le_iff hw₁, sum_smul],
130+ exact sum_le_sum (λ i hi, smul_le_smul_of_nonneg (le_sup' _ hi) $ hw₀ i hi),
131+ apply_instance,
132+ end
133+
134+ lemma inf_le_center_mass {s : finset ι} {f : ι → α} {w : ι → R}
135+ (hw₀ : ∀ i ∈ s, 0 ≤ w i) (hw₁ : 0 < ∑ i in s, w i) :
136+ s.inf' (nonempty_of_ne_empty $ by { rintro rfl, simpa using hw₁ }) f ≤ s.center_mass w f :=
137+ @center_mass_le_sup R _ αᵒᵈ _ _ _ _ _ _ _ hw₀ hw₁
138+
139+ end finset
140+
141+
122142variable {z}
123143
124144/-- The center of mass of a finite subset of a convex set belongs to the set
@@ -318,6 +338,11 @@ begin
318338 (hw₁.symm ▸ zero_lt_one) (λ x hx, hx) }
319339end
320340
341+ lemma finset.mem_convex_hull {s : finset E} {x : E} :
342+ x ∈ convex_hull R (s : set E) ↔
343+ ∃ (w : E → R) (hw₀ : ∀ y ∈ s, 0 ≤ w y) (hw₁ : ∑ y in s, w y = 1 ), s.center_mass w id = x :=
344+ by rw [finset.convex_hull_eq, set.mem_set_of_eq]
345+
321346lemma set.finite.convex_hull_eq {s : set E} (hs : s.finite) :
322347 convex_hull R s = {x : E | ∃ (w : E → R) (hw₀ : ∀ y ∈ s, 0 ≤ w y)
323348 (hw₁ : ∑ y in hs.to_finset, w y = 1 ), hs.to_finset.center_mass w id = x} :=
0 commit comments