Skip to content

Commit

Permalink
chore(*): use ∃ x ∈ s, _ instead of ∃ (x) (_ : x ∈ s), _ (#9184)
Browse files Browse the repository at this point in the history
Search for `[∀∃].*(_` and manually replace some occurrences with more readable versions.
In case of `∀`, the new expressions are defeq to the old ones.
In case of `∃`, they differ by `exists_prop`.

In some rare cases, golf proofs that needed fixing.
  • Loading branch information
urkud committed Dec 21, 2023
1 parent da34c25 commit 14c7296
Show file tree
Hide file tree
Showing 97 changed files with 266 additions and 316 deletions.
2 changes: 1 addition & 1 deletion Archive/Imo/Imo1994Q1.lean
Expand Up @@ -53,7 +53,7 @@ open Imo1994Q1

theorem imo1994_q1 (n : ℕ) (m : ℕ) (A : Finset ℕ) (hm : A.card = m + 1)
(hrange : ∀ a ∈ A, 0 < a ∧ a ≤ n)
(hadd : ∀ (a) (_ : a ∈ A) (b) (_ : b ∈ A), a + b ≤ n → a + b ∈ A) :
(hadd : ∀ a ∈ A, ∀ b ∈ A, a + b ≤ n → a + b ∈ A) :
(m + 1) * (n + 1) ≤ 2 * ∑ x in A, x := by
set a := orderEmbOfFin A hm
-- We sort the elements of `A`
Expand Down
2 changes: 1 addition & 1 deletion Counterexamples/LinearOrderWithPosMulPosEqZero.lean
Expand Up @@ -86,7 +86,7 @@ instance : LinearOrderedCommMonoidWithZero Foo :=
zero_le_one := by decide }

theorem not_mul_pos : ¬∀ {M : Type} [LinearOrderedCommMonoidWithZero M],
(a b : M) (_ : 0 < a) (_ : 0 < b), 0 < a * b := by
∀ a b : M, 0 < a0 < b 0 < a * b := by
intro h
specialize h ε ε (by boom) (by boom)
exact (lt_irrefl 0 (h.trans_le (by boom))).elim
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Algebra/Algebra/Operations.lean
Expand Up @@ -186,8 +186,8 @@ protected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)
/-- A dependent version of `mul_induction_on`. -/
@[elab_as_elim]
protected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}
(hm : ∀ m (_ : m ∈ M), ∀ n (_ : n ∈ N), C (m * n) (mul_mem_mul ‹_› ‹_›))
(ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem ‹_› ‹_›)) {r : A} (hr : r ∈ M * N) :
(hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))
(ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :
C r hr := by
refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc
exact
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Algebra/BigOperators/Basic.lean
Expand Up @@ -2239,7 +2239,7 @@ theorem add_eq_union_right_of_le {x y z : Multiset α} (h : z ≤ y) :

theorem finset_sum_eq_sup_iff_disjoint {β : Type*} {i : Finset β} {f : β → Multiset α} :
i.sum f = i.sup f ↔
∀ (x) (_ : x ∈ i) (y) (_ : y ∈ i), x ≠ y → Multiset.Disjoint (f x) (f y) := by
(x ∈ i) (y ∈ i), x ≠ y → Multiset.Disjoint (f x) (f y) := by
induction' i using Finset.cons_induction_on with z i hz hr
· simp only [Finset.not_mem_empty, IsEmpty.forall_iff, imp_true_iff, Finset.sum_empty,
Finset.sup_empty, bot_eq_zero, eq_self_iff_true]
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Algebra/BigOperators/Multiset/Basic.lean
Expand Up @@ -133,14 +133,14 @@ theorem prod_replicate (n : ℕ) (a : α) : (replicate n a).prod = a ^ n := by

@[to_additive]
theorem prod_map_eq_pow_single [DecidableEq ι] (i : ι)
(hf : ∀ (i') (_ : i' ≠ i), i' ∈ m → f i' = 1) : (m.map f).prod = f i ^ m.count i := by
(hf : ∀ i' ≠ i, i' ∈ m → f i' = 1) : (m.map f).prod = f i ^ m.count i := by
induction' m using Quotient.inductionOn with l
simp [List.prod_map_eq_pow_single i f hf]
#align multiset.prod_map_eq_pow_single Multiset.prod_map_eq_pow_single
#align multiset.sum_map_eq_nsmul_single Multiset.sum_map_eq_nsmul_single

@[to_additive]
theorem prod_eq_pow_single [DecidableEq α] (a : α) (h : ∀ (a') (_ : a' ≠ a), a' ∈ s → a' = 1) :
theorem prod_eq_pow_single [DecidableEq α] (a : α) (h : ∀ a' ≠ a, a' ∈ s → a' = 1) :
s.prod = a ^ s.count a := by
induction' s using Quotient.inductionOn with l
simp [List.prod_eq_pow_single a h]
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Algebra/BigOperators/Order.lean
Expand Up @@ -242,7 +242,7 @@ variable {ι' : Type*} [DecidableEq ι']
-- Porting note: Mathport warning: expanding binder collection (y «expr ∉ » t)
@[to_additive sum_fiberwise_le_sum_of_sum_fiber_nonneg]
theorem prod_fiberwise_le_prod_of_one_le_prod_fiber' {t : Finset ι'} {g : ι → ι'} {f : ι → N}
(h : ∀ (y) (_ : y ∉ t), (1 : N) ≤ ∏ x in s.filter fun x ↦ g x = y, f x) :
(h : ∀ y ∉ t, (1 : N) ≤ ∏ x in s.filter fun x ↦ g x = y, f x) :
(∏ y in t, ∏ x in s.filter fun x ↦ g x = y, f x) ≤ ∏ x in s, f x :=
calc
(∏ y in t, ∏ x in s.filter fun x ↦ g x = y, f x) ≤
Expand All @@ -256,7 +256,7 @@ theorem prod_fiberwise_le_prod_of_one_le_prod_fiber' {t : Finset ι'} {g : ι
-- Porting note: Mathport warning: expanding binder collection (y «expr ∉ » t)
@[to_additive sum_le_sum_fiberwise_of_sum_fiber_nonpos]
theorem prod_le_prod_fiberwise_of_prod_fiber_le_one' {t : Finset ι'} {g : ι → ι'} {f : ι → N}
(h : ∀ (y) (_ : y ∉ t), ∏ x in s.filter fun x ↦ g x = y, f x ≤ 1) :
(h : ∀ y ∉ t, ∏ x in s.filter fun x ↦ g x = y, f x ≤ 1) :
∏ x in s, f x ≤ ∏ y in t, ∏ x in s.filter fun x ↦ g x = y, f x :=
@prod_fiberwise_le_prod_of_one_le_prod_fiber' _ Nᵒᵈ _ _ _ _ _ _ _ h
#align finset.prod_le_prod_fiberwise_of_prod_fiber_le_one' Finset.prod_le_prod_fiberwise_of_prod_fiber_le_one'
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Algebra/GroupPower/Order.lean
Expand Up @@ -65,12 +65,12 @@ theorem pow_add_pow_le (hx : 0 ≤ x) (hy : 0 ≤ y) (hn : n ≠ 0) : x ^ n + y
exact mul_le_mul_of_nonneg_left (ih (Nat.succ_ne_zero k)) h2
#align pow_add_pow_le pow_add_pow_le

theorem pow_le_one : ∀ (n : ℕ) (_ : 0 ≤ a) (_ : a ≤ 1), a ^ n ≤ 1
theorem pow_le_one : ∀ n : ℕ, 0 ≤ aa ≤ 1 a ^ n ≤ 1
| 0, _, _ => (pow_zero a).le
| n + 1, h₀, h₁ => (pow_succ' a n).le.trans (mul_le_one (pow_le_one n h₀ h₁) h₀ h₁)
#align pow_le_one pow_le_one

theorem pow_lt_one (h₀ : 0 ≤ a) (h₁ : a < 1) : ∀ {n : ℕ} (_ : n ≠ 0), a ^ n < 1
theorem pow_lt_one (h₀ : 0 ≤ a) (h₁ : a < 1) : ∀ {n : ℕ}, n ≠ 0 a ^ n < 1
| 0, h => (h rfl).elim
| n + 1, _ => by
rw [pow_succ]
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Algebra/Order/Support.lean
Expand Up @@ -91,7 +91,7 @@ lemma le_mulIndicator_apply (hfg : a ∈ s → y ≤ g a) (hf : a ∉ s → y
#align set.le_indicator_apply Set.le_indicator_apply

@[to_additive]
lemma le_mulIndicator (hfg : ∀ a ∈ s, f a ≤ g a) (hf : ∀ (a) (_ : a ∉ s), f a ≤ 1) :
lemma le_mulIndicator (hfg : ∀ a ∈ s, f a ≤ g a) (hf : ∀ a ∉ s, f a ≤ 1) :
f ≤ mulIndicator s g := fun _ ↦ le_mulIndicator_apply (hfg _) (hf _)
#align set.le_mul_indicator Set.le_mulIndicator
#align set.le_indicator Set.le_indicator
Expand Down Expand Up @@ -143,7 +143,7 @@ lemma mulIndicator_le_mulIndicator_of_subset (h : s ⊆ t) (hf : ∀ a, 1 ≤ f
#align set.indicator_le_indicator_of_subset Set.indicator_le_indicator_of_subset

@[to_additive]
lemma mulIndicator_le_self' (hf : ∀ (x) (_ : x ∉ s), 1 ≤ f x) : mulIndicator s f ≤ f :=
lemma mulIndicator_le_self' (hf : ∀ x ∉ s, 1 ≤ f x) : mulIndicator s f ≤ f :=
mulIndicator_le' (fun _ _ ↦ le_rfl) hf
#align set.mul_indicator_le_self' Set.mulIndicator_le_self'
#align set.indicator_le_self' Set.indicator_le_self'
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/AlgebraicGeometry/PrimeSpectrum/Noetherian.lean
Expand Up @@ -37,7 +37,7 @@ theorem exists_primeSpectrum_prod_le (I : Ideal R) :
by_cases htop : M = ⊤
· rw [htop]
exact ⟨0, le_top⟩
have lt_add : ∀ (z) (_ : z ∉ M), M < M + span R {z} := by
have lt_add : ∀ z ∉ M, M < M + span R {z} := by
intro z hz
refine' lt_of_le_of_ne le_sup_left fun m_eq => hz _
rw [m_eq]
Expand Down Expand Up @@ -81,7 +81,7 @@ theorem exists_primeSpectrum_prod_le_and_ne_bot_of_domain (h_fA : ¬IsField A) {
rw [Multiset.map_singleton, Multiset.prod_singleton]
exact ⟨le_rfl, h_nzM⟩
obtain ⟨x, hx, y, hy, h_xy⟩ := (Ideal.not_isPrime_iff.mp h_prM).resolve_left h_topM
have lt_add : ∀ (z) (_ : z ∉ M), M < M + span A {z} := by
have lt_add : ∀ z ∉ M, M < M + span A {z} := by
intro z hz
refine' lt_of_le_of_ne le_sup_left fun m_eq => hz _
rw [m_eq]
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Analysis/Analytic/Basic.lean
Expand Up @@ -802,7 +802,7 @@ ball, the norm of the difference `f y - f z - p 1 (fun _ ↦ y - z)` is bounded
`C * (max ‖y - x‖ ‖z - x‖) * ‖y - z‖`. -/
theorem HasFPowerSeriesOnBall.image_sub_sub_deriv_le (hf : HasFPowerSeriesOnBall f p x r)
(hr : r' < r) :
∃ C, ∀ (y) (_ : y ∈ EMetric.ball x r') (z) (_ : z ∈ EMetric.ball x r'),
∃ C, ∀ (y ∈ EMetric.ball x r') (z ∈ EMetric.ball x r'),
‖f y - f z - p 1 fun _ => y - z‖ ≤ C * max ‖y - x‖ ‖z - x‖ * ‖y - z‖ := by
simpa only [isBigO_principal, mul_assoc, norm_mul, norm_norm, Prod.forall, EMetric.mem_ball,
Prod.edist_eq, max_lt_iff, and_imp, @forall_swap (_ < _) E] using
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Analysis/Calculus/FDeriv/Extend.lean
Expand Up @@ -178,7 +178,7 @@ theorem has_deriv_at_interval_right_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
/-- If a real function `f` has a derivative `g` everywhere but at a point, and `f` and `g` are
continuous at this point, then `g` is also the derivative of `f` at this point. -/
theorem hasDerivAt_of_hasDerivAt_of_ne {f g : ℝ → E} {x : ℝ}
(f_diff : ∀ (y) (_ : y ≠ x), HasDerivAt f (g y) y) (hf : ContinuousAt f x)
(f_diff : ∀ y ≠ x, HasDerivAt f (g y) y) (hf : ContinuousAt f x)
(hg : ContinuousAt g x) : HasDerivAt f (g x) x := by
have A : HasDerivWithinAt f (g x) (Ici x) x := by
have diff : DifferentiableOn ℝ f (Ioi x) := fun y hy =>
Expand Down Expand Up @@ -212,7 +212,7 @@ theorem hasDerivAt_of_hasDerivAt_of_ne {f g : ℝ → E} {x : ℝ}
/-- If a real function `f` has a derivative `g` everywhere but at a point, and `f` and `g` are
continuous at this point, then `g` is the derivative of `f` everywhere. -/
theorem hasDerivAt_of_hasDerivAt_of_ne' {f g : ℝ → E} {x : ℝ}
(f_diff : ∀ (y) (_ : y ≠ x), HasDerivAt f (g y) y) (hf : ContinuousAt f x)
(f_diff : ∀ y ≠ x, HasDerivAt f (g y) y) (hf : ContinuousAt f x)
(hg : ContinuousAt g x) (y : ℝ) : HasDerivAt f (g y) y := by
rcases eq_or_ne y x with (rfl | hne)
· exact hasDerivAt_of_hasDerivAt_of_ne f_diff hf hg
Expand Down
6 changes: 2 additions & 4 deletions Mathlib/Analysis/Calculus/FDeriv/Measurable.lean
Expand Up @@ -459,10 +459,8 @@ namespace RightDerivMeasurableAux
at scale `r` by the linear map `h ↦ h • L`, up to an error `ε`. We tweak the definition to
make sure that this is open on the right. -/
def A (f : ℝ → F) (L : F) (r ε : ℝ) : Set ℝ :=
{ x |
∃ r' ∈ Ioc (r / 2) r,
∀ (y) (_ : y ∈ Icc x (x + r')) (z) (_ : z ∈ Icc x (x + r')),
‖f z - f y - (z - y) • L‖ ≤ ε * r }
{ x | ∃ r' ∈ Ioc (r / 2) r, ∀ᵉ (y ∈ Icc x (x + r')) (z ∈ Icc x (x + r')),
‖f z - f y - (z - y) • L‖ ≤ ε * r }
#align right_deriv_measurable_aux.A RightDerivMeasurableAux.A

/-- The set `B f K r s ε` is the set of points `x` around which there exists a vector
Expand Down
8 changes: 4 additions & 4 deletions Mathlib/Analysis/Calculus/Taylor.lean
Expand Up @@ -239,7 +239,7 @@ theorem taylor_mean_remainder {f : ℝ → ℝ} {g g' : ℝ → ℝ} {x x₀ :
(gcont : ContinuousOn g (Icc x₀ x))
(gdiff : ∀ x_1 : ℝ, x_1 ∈ Ioo x₀ x → HasDerivAt g (g' x_1) x_1)
(g'_ne : ∀ x_1 : ℝ, x_1 ∈ Ioo x₀ x → g' x_1 ≠ 0) :
(x' : ℝ) (_ : x' ∈ Ioo x₀ x), f x - taylorWithinEval f n (Icc x₀ x) x₀ x =
∃ x' ∈ Ioo x₀ x, f x - taylorWithinEval f n (Icc x₀ x) x₀ x =
((x - x') ^ n / n ! * (g x - g x₀) / g' x') • iteratedDerivWithin (n + 1) f (Icc x₀ x) x' := by
-- We apply the mean value theorem
rcases exists_ratio_hasDerivAt_eq_ratio_slope (fun t => taylorWithinEval f n (Icc x₀ x) t x)
Expand All @@ -265,7 +265,7 @@ derivative. -/
theorem taylor_mean_remainder_lagrange {f : ℝ → ℝ} {x x₀ : ℝ} {n : ℕ} (hx : x₀ < x)
(hf : ContDiffOn ℝ n f (Icc x₀ x))
(hf' : DifferentiableOn ℝ (iteratedDerivWithin n f (Icc x₀ x)) (Ioo x₀ x)) :
(x' : ℝ) (_ : x' ∈ Ioo x₀ x), f x - taylorWithinEval f n (Icc x₀ x) x₀ x =
∃ x' ∈ Ioo x₀ x, f x - taylorWithinEval f n (Icc x₀ x) x₀ x =
iteratedDerivWithin (n + 1) f (Icc x₀ x) x' * (x - x₀) ^ (n + 1) / (n + 1)! := by
have gcont : ContinuousOn (fun t : ℝ => (x - t) ^ (n + 1)) (Icc x₀ x) := by
refine' Continuous.continuousOn _
Expand Down Expand Up @@ -297,7 +297,7 @@ derivative. -/
theorem taylor_mean_remainder_cauchy {f : ℝ → ℝ} {x x₀ : ℝ} {n : ℕ} (hx : x₀ < x)
(hf : ContDiffOn ℝ n f (Icc x₀ x))
(hf' : DifferentiableOn ℝ (iteratedDerivWithin n f (Icc x₀ x)) (Ioo x₀ x)) :
(x' : ℝ) (_ : x' ∈ Ioo x₀ x), f x - taylorWithinEval f n (Icc x₀ x) x₀ x =
∃ x' ∈ Ioo x₀ x, f x - taylorWithinEval f n (Icc x₀ x) x₀ x =
iteratedDerivWithin (n + 1) f (Icc x₀ x) x' * (x - x') ^ n / n ! * (x - x₀) := by
have gcont : ContinuousOn id (Icc x₀ x) := Continuous.continuousOn (by continuity)
have gdiff : ∀ x_1 : ℝ, x_1 ∈ Ioo x₀ x → HasDerivAt id ((fun _ : ℝ => (1 : ℝ)) x_1) x_1 :=
Expand Down Expand Up @@ -327,7 +327,7 @@ theorem taylor_mean_remainder_bound {f : ℝ → E} {a b C x : ℝ} {n : ℕ} (h
hf.differentiableOn_iteratedDerivWithin (WithTop.coe_lt_coe.mpr n.lt_succ_self)
(uniqueDiffOn_Icc h)
-- We can uniformly bound the derivative of the Taylor polynomial
have h' : ∀ (y : ℝ) (_ : y ∈ Ico a x),
have h' : ∀ y ∈ Ico a x,
‖((n ! : ℝ)⁻¹ * (x - y) ^ n) • iteratedDerivWithin (n + 1) f (Icc a b) y‖ ≤
(n ! : ℝ)⁻¹ * |x - a| ^ n * C := by
rintro y ⟨hay, hyx⟩
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Analysis/ConstantSpeed.lean
Expand Up @@ -155,7 +155,7 @@ theorem HasConstantSpeedOnWith.Icc_Icc {x y z : ℝ} (hfs : HasConstantSpeedOnWi
#align has_constant_speed_on_with.Icc_Icc HasConstantSpeedOnWith.Icc_Icc

theorem hasConstantSpeedOnWith_zero_iff :
HasConstantSpeedOnWith f s 0 ↔ ∀ (x) (_ : x ∈ s) (y) (_ : y ∈ s), edist (f x) (f y) = 0 := by
HasConstantSpeedOnWith f s 0 ↔ ∀ (x ∈ s) (y ∈ s), edist (f x) (f y) = 0 := by
dsimp [HasConstantSpeedOnWith]
simp only [zero_mul, ENNReal.ofReal_zero, ← eVariationOn.eq_zero_iff]
constructor
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Analysis/Convex/Caratheodory.lean
Expand Up @@ -166,8 +166,8 @@ theorem convexHull_eq_union : convexHull 𝕜 s =
/-- A more explicit version of `convexHull_eq_union`. -/
theorem eq_pos_convex_span_of_mem_convexHull {x : E} (hx : x ∈ convexHull 𝕜 s) :
∃ (ι : Sort (u + 1)) (_ : Fintype ι),
∃ (z : ι → E) (w : ι → 𝕜) (_ : Set.range z ⊆ s) (_ : AffineIndependent 𝕜 z)
(_ : ∀ i, 0 < w i), ∑ i, w i = 1 ∧ ∑ i, w i • z i = x := by
∃ (z : ι → E) (w : ι → 𝕜), Set.range z ⊆ sAffineIndependent 𝕜 z ∧ (∀ i, 0 < w i) ∧
∑ i, w i = 1 ∧ ∑ i, w i • z i = x := by
rw [convexHull_eq_union] at hx
simp only [exists_prop, Set.mem_iUnion] at hx
obtain ⟨t, ht₁, ht₂, ht₃⟩ := hx
Expand Down
17 changes: 8 additions & 9 deletions Mathlib/Analysis/Convex/Combination.lean
Expand Up @@ -290,8 +290,8 @@ theorem Finset.centroid_mem_convexHull (s : Finset E) (hs : s.Nonempty) :
#align finset.centroid_mem_convex_hull Finset.centroid_mem_convexHull

theorem convexHull_range_eq_exists_affineCombination (v : ι → E) : convexHull R (range v) =
{ x | ∃ (s : Finset ι) (w : ι → R) (_ : ∀ i ∈ s, 0 ≤ w i) (_ : s.sum w = 1),
s.affineCombination R v w = x } := by
{ x | ∃ (s : Finset ι) (w : ι → R), (∀ i ∈ s, 0 ≤ w i) s.sum w = 1
s.affineCombination R v w = x } := by
refine' Subset.antisymm (convexHull_min _ _) _
· intro x hx
obtain ⟨i, hi⟩ := Set.mem_range.mp hx
Expand Down Expand Up @@ -326,8 +326,8 @@ For universe reasons, you shouldn't use this lemma to prove that a given center
to the convex hull. Use convexity of the convex hull instead.
-/
theorem convexHull_eq (s : Set E) : convexHull R s =
{ x : E | ∃ (ι : Type) (t : Finset ι) (w : ι → R) (z : ι → E) (_ : ∀ i ∈ t, 0 ≤ w i)
(_ : ∑ i in t, w i = 1) (_ : ∀ i ∈ t, z i ∈ s), t.centerMass w z = x } := by
{ x : E | ∃ (ι : Type) (t : Finset ι) (w : ι → R) (z : ι → E), (∀ i ∈ t, 0 ≤ w i)
∑ i in t, w i = 1 ∧ (∀ i ∈ t, z i ∈ s) t.centerMass w z = x } := by
refine' Subset.antisymm (convexHull_min _ _) _
· intro x hx
use PUnit, {PUnit.unit}, fun _ => 1, fun _ => x, fun _ _ => zero_le_one, sum_singleton _ _,
Expand All @@ -350,8 +350,7 @@ theorem convexHull_eq (s : Set E) : convexHull R s =
#align convex_hull_eq convexHull_eq

theorem Finset.convexHull_eq (s : Finset E) : convexHull R ↑s =
{ x : E | ∃ (w : E → R) (_ : ∀ y ∈ s, 0 ≤ w y) (_ : ∑ y in s, w y = 1),
s.centerMass w id = x } := by
{ x : E | ∃ w : E → R, (∀ y ∈ s, 0 ≤ w y) ∧ ∑ y in s, w y = 1 ∧ s.centerMass w id = x } := by
refine' Set.Subset.antisymm (convexHull_min _ _) _
· intro x hx
rw [Finset.mem_coe] at hx
Expand All @@ -372,13 +371,13 @@ theorem Finset.convexHull_eq (s : Finset E) : convexHull R ↑s =
#align finset.convex_hull_eq Finset.convexHull_eq

theorem Finset.mem_convexHull {s : Finset E} {x : E} : x ∈ convexHull R (s : Set E) ↔
(w : E → R) (_ : ∀ y ∈ s, 0 ≤ w y) (_ : ∑ y in s, w y = 1), s.centerMass w id = x := by
∃ w : E → R, (∀ y ∈ s, 0 ≤ w y) ∑ y in s, w y = 1 s.centerMass w id = x := by
rw [Finset.convexHull_eq, Set.mem_setOf_eq]
#align finset.mem_convex_hull Finset.mem_convexHull

theorem Set.Finite.convexHull_eq {s : Set E} (hs : s.Finite) : convexHull R s =
{ x : E | ∃ (w : E → R) (_ : ∀ y ∈ s, 0 ≤ w y) (_ : ∑ y in hs.toFinset, w y = 1),
hs.toFinset.centerMass w id = x } := by
{ x : E | ∃ w : E → R, (∀ y ∈ s, 0 ≤ w y) ∑ y in hs.toFinset, w y = 1
hs.toFinset.centerMass w id = x } := by
simpa only [Set.Finite.coe_toFinset, Set.Finite.mem_toFinset, exists_prop] using
hs.toFinset.convexHull_eq
#align set.finite.convex_hull_eq Set.Finite.convexHull_eq
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Analysis/Convex/Extreme.lean
Expand Up @@ -127,7 +127,7 @@ theorem isExtreme_sInter {F : Set (Set E)} (hF : F.Nonempty) (hAF : ∀ B ∈ F,
#align is_extreme_sInter isExtreme_sInter

theorem mem_extremePoints : x ∈ A.extremePoints 𝕜 ↔
x ∈ A ∧ ∀ (x₁) (_ : x₁ ∈ A) (x₂) (_ : x₂ ∈ A), x ∈ openSegment 𝕜 x₁ x₂ → x₁ = x ∧ x₂ = x :=
x ∈ A ∧ ∀ (x₁ ∈ A) (x₂ ∈ A), x ∈ openSegment 𝕜 x₁ x₂ → x₁ = x ∧ x₂ = x :=
Iff.rfl
#align mem_extreme_points mem_extremePoints

Expand Down Expand Up @@ -256,7 +256,7 @@ variable [DenselyOrdered 𝕜] [NoZeroSMulDivisors 𝕜 E] {A B : Set E} {x : E}
/-- A useful restatement using `segment`: `x` is an extreme point iff the only (closed) segments
that contain it are those with `x` as one of their endpoints. -/
theorem mem_extremePoints_iff_forall_segment : x ∈ A.extremePoints 𝕜 ↔
x ∈ A ∧ ∀ (x₁) (_ : x₁ ∈ A) (x₂) (_ : x₂ ∈ A), x ∈ segment 𝕜 x₁ x₂ → x₁ = x ∨ x₂ = x := by
x ∈ A ∧ ∀ (x₁ ∈ A) (x₂ ∈ A), x ∈ segment 𝕜 x₁ x₂ → x₁ = x ∨ x₂ = x := by
refine' and_congr_right fun hxA ↦ forall₄_congr fun x₁ h₁ x₂ h₂ ↦ _
constructor
· rw [← insert_endpoints_openSegment]
Expand Down

0 comments on commit 14c7296

Please sign in to comment.