Skip to content

Commit

Permalink
refactor: replace some @foo _ _ _ _ _ ... by named arguments (#8702)
Browse files Browse the repository at this point in the history
Using Lean4's named arguments, we manage to remove a few hard-to-read explicit function calls `@foo _ _ _ _ _ ...` which used to be necessary in Lean3.

Occasionally, this results in slightly longer code. The benefit of named arguments is readability, as well as to reduce the brittleness of the code when the argument order is changed.



Co-authored-by: Michael Rothgang <rothgami@math.hu-berlin.de>
  • Loading branch information
winstonyin and grunweg committed Dec 4, 2023
1 parent 0fee6f3 commit df634f2
Show file tree
Hide file tree
Showing 44 changed files with 210 additions and 231 deletions.
4 changes: 2 additions & 2 deletions Mathlib/Algebra/Bounds.lean
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ theorem subset_upperBounds_mul (s t : Set M) :
@[to_additive]
theorem mul_mem_lowerBounds_mul {s t : Set M} {a b : M} (ha : a ∈ lowerBounds s)
(hb : b ∈ lowerBounds t) : a * b ∈ lowerBounds (s * t) :=
@mul_mem_upperBounds_mul Mᵒᵈ _ _ _ _ _ _ _ _ ha hb
mul_mem_upperBounds_mul (M := Mᵒᵈ) ha hb
#align mul_mem_lower_bounds_mul mul_mem_lowerBounds_mul
#align add_mem_lower_bounds_add add_mem_lowerBounds_add

@[to_additive]
theorem subset_lowerBounds_mul (s t : Set M) :
lowerBounds s * lowerBounds t ⊆ lowerBounds (s * t) :=
@subset_upperBounds_mul Mᵒᵈ _ _ _ _ _ _
subset_upperBounds_mul (M := Mᵒᵈ) _ _
#align subset_lower_bounds_mul subset_lowerBounds_mul
#align subset_lower_bounds_add subset_lowerBounds_add

Expand Down
3 changes: 1 addition & 2 deletions Mathlib/Algebra/Category/ModuleCat/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ instance moduleCategory : Category.{v, max (v+1) u} (ModuleCat.{v} R) where
comp f g := g.comp f
id_comp _ := LinearMap.id_comp _
comp_id _ := LinearMap.comp_id _
assoc f g h := @LinearMap.comp_assoc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
RingHomCompTriple.ids RingHomCompTriple.ids RingHomCompTriple.ids f g h
assoc f g h := LinearMap.comp_assoc (f := f) (g := g) (h := h)
#align Module.Module_category ModuleCat.moduleCategory

-- porting note: was not necessary in mathlib
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Module/DedekindDomain.lean
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ theorem isInternal_prime_power_torsion_of_is_torsion_by_ideal {I : Ideal R} (hI
let P := factors I
have prime_of_mem := fun p (hp : p ∈ P.toFinset) =>
prime_of_factor p (Multiset.mem_toFinset.mp hp)
apply @torsionBySet_isInternal _ _ _ _ _ _ _ _ (fun p => p ^ P.count p) _
apply torsionBySet_isInternal (p := fun p => p ^ P.count p) _
· convert hM
rw [← Finset.inf_eq_iInf, IsDedekindDomain.inf_prime_pow_eq_prod, ← Finset.prod_multiset_count,
← associated_iff_eq]
Expand Down
6 changes: 3 additions & 3 deletions Mathlib/Algebra/Module/PID.lean
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ theorem torsion_by_prime_power_decomposition (hN : Module.IsTorsion' N (Submonoi
Function.comp_apply]
refine ⟨?_, ⟨?_⟩⟩
· exact fun a => (fun i => (Option.rec (pOrder hN (s j)) k i : ℕ)) (finSuccEquiv d a)
· refine (((@lequivProdOfRightSplitExact _ _ _ _ _ _ _ _ _ _ _ _
((f.trans ULift.moduleEquiv.{u, u, v}.symm).toLinearMap.comp <| mkQ _)
((DirectSum.toModule _ _ _ fun i => (liftQSpanSingleton (p ^ k i)
· refine (((lequivProdOfRightSplitExact
(g := (f.trans ULift.moduleEquiv.{u, u, v}.symm).toLinearMap.comp <| mkQ _)
(f := (DirectSum.toModule _ _ _ fun i => (liftQSpanSingleton (p ^ k i)
(LinearMap.toSpanSingleton _ _ _) (this i).choose_spec.left : R ⧸ _ →ₗ[R] _)).comp
ULift.moduleEquiv.toLinearMap) (R ∙ s j).injective_subtype ?_ ?_).symm.trans
(((quotTorsionOfEquivSpanSingleton R N (s j)).symm.trans
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Algebra/Order/Group/DenselyOrdered.lean
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ variable [DenselyOrdered α] {a b c : α}

@[to_additive]
theorem le_of_forall_lt_one_mul_le (h : ∀ ε < 1, a * ε ≤ b) : a ≤ b :=
@le_of_forall_one_lt_le_mul αᵒᵈ _ _ _ _ _ _ _ _ h
le_of_forall_one_lt_le_mul (α := αᵒᵈ) h
#align le_of_forall_lt_one_mul_le le_of_forall_lt_one_mul_le
#align le_of_forall_neg_add_le le_of_forall_neg_add_le

Expand All @@ -45,7 +45,7 @@ theorem le_iff_forall_one_lt_le_mul : a ≤ b ↔ ∀ ε, 1 < ε → a ≤ b *

@[to_additive]
theorem le_iff_forall_lt_one_mul_le : a ≤ b ↔ ∀ ε < 1, a * ε ≤ b :=
@le_iff_forall_one_lt_le_mul αᵒᵈ _ _ _ _ _ _
le_iff_forall_one_lt_le_mul (α := αᵒᵈ)
#align le_iff_forall_lt_one_mul_le le_iff_forall_lt_one_mul_le
#align le_iff_forall_neg_add_le le_iff_forall_neg_add_le

Expand Down
22 changes: 11 additions & 11 deletions Mathlib/Algebra/Order/Monoid/WithTop.lean
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ theorem add_ne_bot : a + b ≠ ⊥ ↔ a ≠ ⊥ ∧ b ≠ ⊥ :=
#align with_bot.add_ne_bot WithBot.add_ne_bot

theorem bot_lt_add [LT α] {a b : WithBot α} : ⊥ < a + b ↔ ⊥ < a ∧ ⊥ < b :=
@WithTop.add_lt_top αᵒᵈ _ _ _ _
WithTop.add_lt_top (α := αᵒᵈ)
#align with_bot.bot_lt_add WithBot.bot_lt_add

theorem add_eq_coe : a + b = x ↔ ∃ a' b' : α, ↑a' = a ∧ ↑b' = b ∧ a' + b' = x :=
Expand Down Expand Up @@ -692,42 +692,42 @@ variable [Preorder α]

instance covariantClass_add_le [CovariantClass α α (· + ·) (· ≤ ·)] :
CovariantClass (WithBot α) (WithBot α) (· + ·) (· ≤ ·) :=
@OrderDual.covariantClass_add_le (WithTop αᵒᵈ) _ _ _
OrderDual.covariantClass_add_le (α := WithTop αᵒᵈ)
#align with_bot.covariant_class_add_le WithBot.covariantClass_add_le

instance covariantClass_swap_add_le [CovariantClass α α (swap (· + ·)) (· ≤ ·)] :
CovariantClass (WithBot α) (WithBot α) (swap (· + ·)) (· ≤ ·) :=
@OrderDual.covariantClass_swap_add_le (WithTop αᵒᵈ) _ _ _
OrderDual.covariantClass_swap_add_le (α := WithTop αᵒᵈ)
#align with_bot.covariant_class_swap_add_le WithBot.covariantClass_swap_add_le

instance contravariantClass_add_lt [ContravariantClass α α (· + ·) (· < ·)] :
ContravariantClass (WithBot α) (WithBot α) (· + ·) (· < ·) :=
@OrderDual.contravariantClass_add_lt (WithTop αᵒᵈ) _ _ _
OrderDual.contravariantClass_add_lt (α := WithTop αᵒᵈ)
#align with_bot.contravariant_class_add_lt WithBot.contravariantClass_add_lt

instance contravariantClass_swap_add_lt [ContravariantClass α α (swap (· + ·)) (· < ·)] :
ContravariantClass (WithBot α) (WithBot α) (swap (· + ·)) (· < ·) :=
@OrderDual.contravariantClass_swap_add_lt (WithTop αᵒᵈ) _ _ _
OrderDual.contravariantClass_swap_add_lt (α := WithTop αᵒᵈ)
#align with_bot.contravariant_class_swap_add_lt WithBot.contravariantClass_swap_add_lt

protected theorem le_of_add_le_add_left [ContravariantClass α α (· + ·) (· ≤ ·)] (ha : a ≠ ⊥)
(h : a + b ≤ a + c) : b ≤ c :=
@WithTop.le_of_add_le_add_left αᵒᵈ _ _ _ _ _ _ ha h
WithTop.le_of_add_le_add_left (α := αᵒᵈ) ha h
#align with_bot.le_of_add_le_add_left WithBot.le_of_add_le_add_left

protected theorem le_of_add_le_add_right [ContravariantClass α α (swap (· + ·)) (· ≤ ·)]
(ha : a ≠ ⊥) (h : b + a ≤ c + a) : b ≤ c :=
@WithTop.le_of_add_le_add_right αᵒᵈ _ _ _ _ _ _ ha h
WithTop.le_of_add_le_add_right (α := αᵒᵈ) ha h
#align with_bot.le_of_add_le_add_right WithBot.le_of_add_le_add_right

protected theorem add_lt_add_left [CovariantClass α α (· + ·) (· < ·)] (ha : a ≠ ⊥) (h : b < c) :
a + b < a + c :=
@WithTop.add_lt_add_left αᵒᵈ _ _ _ _ _ _ ha h
WithTop.add_lt_add_left (α := αᵒᵈ) ha h
#align with_bot.add_lt_add_left WithBot.add_lt_add_left

protected theorem add_lt_add_right [CovariantClass α α (swap (· + ·)) (· < ·)] (ha : a ≠ ⊥)
(h : b < c) : b + a < c + a :=
@WithTop.add_lt_add_right αᵒᵈ _ _ _ _ _ _ ha h
WithTop.add_lt_add_right (α := αᵒᵈ) ha h
#align with_bot.add_lt_add_right WithBot.add_lt_add_right

protected theorem add_le_add_iff_left [CovariantClass α α (· + ·) (· ≤ ·)]
Expand All @@ -753,13 +753,13 @@ protected theorem add_lt_add_iff_right [CovariantClass α α (swap (· + ·)) (
protected theorem add_lt_add_of_le_of_lt [CovariantClass α α (· + ·) (· < ·)]
[CovariantClass α α (swap (· + ·)) (· ≤ ·)] (hb : b ≠ ⊥) (hab : a ≤ b) (hcd : c < d) :
a + c < b + d :=
@WithTop.add_lt_add_of_le_of_lt αᵒᵈ _ _ _ _ _ _ _ _ hb hab hcd
WithTop.add_lt_add_of_le_of_lt (α := αᵒᵈ) hb hab hcd
#align with_bot.add_lt_add_of_le_of_lt WithBot.add_lt_add_of_le_of_lt

protected theorem add_lt_add_of_lt_of_le [CovariantClass α α (· + ·) (· ≤ ·)]
[CovariantClass α α (swap (· + ·)) (· < ·)] (hd : d ≠ ⊥) (hab : a < b) (hcd : c ≤ d) :
a + c < b + d :=
@WithTop.add_lt_add_of_lt_of_le αᵒᵈ _ _ _ _ _ _ _ _ hd hab hcd
WithTop.add_lt_add_of_lt_of_le (α := αᵒᵈ) hd hab hcd
#align with_bot.add_lt_add_of_lt_of_le WithBot.add_lt_add_of_lt_of_le

end Add
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ theorem y_smooth : ContDiffOn ℝ ⊤ (uncurry y) (Ioo (0 : ℝ) 1 ×ˢ (univ :
ne_of_gt (mul_pos (u_int_pos E) (pow_pos (abs_pos_of_pos hx.1.1) (finrank ℝ E)))
apply ContDiffOn.pow
simp_rw [← Real.norm_eq_abs]
apply @ContDiffOn.norm ℝ
apply ContDiffOn.norm ℝ
· exact contDiffOn_fst
· intro x hx; exact ne_of_gt hx.1.1
· apply (u_smooth E).comp_contDiffOn
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Analysis/Calculus/ContDiff/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,7 @@ theorem ContDiff.mul {f g : E → 𝔸} (hf : ContDiff 𝕜 n f) (hg : ContDiff
theorem contDiffWithinAt_prod' {t : Finset ι} {f : ι → E → 𝔸'}
(h : ∀ i ∈ t, ContDiffWithinAt 𝕜 n (f i) s x) : ContDiffWithinAt 𝕜 n (∏ i in t, f i) s x :=
Finset.prod_induction f (fun f => ContDiffWithinAt 𝕜 n f s x) (fun _ _ => ContDiffWithinAt.mul)
(@contDiffWithinAt_const _ _ _ _ _ _ _ _ _ _ _ 1) h
(contDiffWithinAt_const (c := 1)) h
#align cont_diff_within_at_prod' contDiffWithinAt_prod'

theorem contDiffWithinAt_prod {t : Finset ι} {f : ι → E → 𝔸'}
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Analysis/Convex/Extrema.lean
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ theorem IsMinOn.of_isLocalMinOn_of_convexOn {f : E → β} {a : E} (a_in_s : a
/-- A local maximum of a concave function is a global maximum, restricted to a set `s`. -/
theorem IsMaxOn.of_isLocalMaxOn_of_concaveOn {f : E → β} {a : E} (a_in_s : a ∈ s)
(h_localmax : IsLocalMaxOn f s a) (h_conc : ConcaveOn ℝ s f) : IsMaxOn f s a :=
@IsMinOn.of_isLocalMinOn_of_convexOn _ βᵒᵈ _ _ _ _ _ _ _ _ s f a a_in_s h_localmax h_conc
IsMinOn.of_isLocalMinOn_of_convexOn (β := βᵒᵈ) a_in_s h_localmax h_conc
#align is_max_on.of_is_local_max_on_of_concave_on IsMaxOn.of_isLocalMaxOn_of_concaveOn

/-- A local minimum of a convex function is a global minimum. -/
Expand All @@ -82,5 +82,5 @@ theorem IsMinOn.of_isLocalMin_of_convex_univ {f : E → β} {a : E} (h_local_min
/-- A local maximum of a concave function is a global maximum. -/
theorem IsMaxOn.of_isLocalMax_of_convex_univ {f : E → β} {a : E} (h_local_max : IsLocalMax f a)
(h_conc : ConcaveOn ℝ univ f) : ∀ x, f x ≤ f a :=
@IsMinOn.of_isLocalMin_of_convex_univ _ βᵒᵈ _ _ _ _ _ _ _ _ f a h_local_max h_conc
IsMinOn.of_isLocalMin_of_convex_univ (β := βᵒᵈ) h_local_max h_conc
#align is_max_on.of_is_local_max_of_convex_univ IsMaxOn.of_isLocalMax_of_convex_univ
18 changes: 9 additions & 9 deletions Mathlib/Analysis/Convex/Function.lean
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ theorem convexOn_const (c : β) (hs : Convex 𝕜 s) : ConvexOn 𝕜 s fun _ : E
#align convex_on_const convexOn_const

theorem concaveOn_const (c : β) (hs : Convex 𝕜 s) : ConcaveOn 𝕜 s fun _ => c :=
@convexOn_const _ _ βᵒᵈ _ _ _ _ _ _ c hs
convexOn_const (β := βᵒᵈ) _ hs
#align concave_on_const concaveOn_const

theorem convexOn_of_convex_epigraph (h : Convex 𝕜 { p : E × β | p.1 ∈ s ∧ f p.1 ≤ p.2 }) :
Expand All @@ -220,7 +220,7 @@ theorem convexOn_of_convex_epigraph (h : Convex 𝕜 { p : E × β | p.1 ∈ s

theorem concaveOn_of_convex_hypograph (h : Convex 𝕜 { p : E × β | p.1 ∈ s ∧ p.2 ≤ f p.1 }) :
ConcaveOn 𝕜 s f :=
@convexOn_of_convex_epigraph 𝕜 E βᵒᵈ _ _ _ _ _ _ _ h
convexOn_of_convex_epigraph (β := βᵒᵈ) h
#align concave_on_of_convex_hypograph concaveOn_of_convex_hypograph

end Module
Expand Down Expand Up @@ -264,7 +264,7 @@ theorem convexOn_iff_convex_epigraph :

theorem concaveOn_iff_convex_hypograph :
ConcaveOn 𝕜 s f ↔ Convex 𝕜 { p : E × β | p.1 ∈ s ∧ p.2 ≤ f p.1 } :=
@convexOn_iff_convex_epigraph 𝕜 E βᵒᵈ _ _ _ _ _ _ _ f
convexOn_iff_convex_epigraph (β := βᵒᵈ)
#align concave_on_iff_convex_hypograph concaveOn_iff_convex_hypograph

end OrderedSMul
Expand Down Expand Up @@ -329,7 +329,7 @@ theorem concaveOn_iff_forall_pos {s : Set E} {f : E → β} :
ConcaveOn 𝕜 s f ↔
Convex 𝕜 s ∧ ∀ ⦃x⦄, x ∈ s → ∀ ⦃y⦄, y ∈ s → ∀ ⦃a b : 𝕜⦄, 0 < a → 0 < b → a + b = 1
a • f x + b • f y ≤ f (a • x + b • y) :=
@convexOn_iff_forall_pos 𝕜 E βᵒᵈ _ _ _ _ _ _ _
convexOn_iff_forall_pos (β := βᵒᵈ)
#align concave_on_iff_forall_pos concaveOn_iff_forall_pos

theorem convexOn_iff_pairwise_pos {s : Set E} {f : E → β} :
Expand All @@ -351,7 +351,7 @@ theorem concaveOn_iff_pairwise_pos {s : Set E} {f : E → β} :
Convex 𝕜 s ∧
s.Pairwise fun x y =>
∀ ⦃a b : 𝕜⦄, 0 < a → 0 < b → a + b = 1 → a • f x + b • f y ≤ f (a • x + b • y) :=
@convexOn_iff_pairwise_pos 𝕜 E βᵒᵈ _ _ _ _ _ _ _
convexOn_iff_pairwise_pos (β := βᵒᵈ)
#align concave_on_iff_pairwise_pos concaveOn_iff_pairwise_pos

/-- A linear map is convex. -/
Expand Down Expand Up @@ -429,7 +429,7 @@ theorem LinearOrder.concaveOn_of_lt (hs : Convex 𝕜 s)
(hf : ∀ ⦃x⦄, x ∈ s → ∀ ⦃y⦄, y ∈ s → x < y → ∀ ⦃a b : 𝕜⦄, 0 < a → 0 < b → a + b = 1
a • f x + b • f y ≤ f (a • x + b • y)) :
ConcaveOn 𝕜 s f :=
@LinearOrder.convexOn_of_lt _ _ βᵒᵈ _ _ _ _ _ _ s f hs hf
LinearOrder.convexOn_of_lt (β := βᵒᵈ) hs hf
#align linear_order.concave_on_of_lt LinearOrder.concaveOn_of_lt

/-- For a function on a convex set in a linearly ordered space (where the order and the algebraic
Expand Down Expand Up @@ -459,7 +459,7 @@ theorem LinearOrder.strictConcaveOn_of_lt (hs : Convex 𝕜 s)
(hf : ∀ ⦃x⦄, x ∈ s → ∀ ⦃y⦄, y ∈ s → x < y → ∀ ⦃a b : 𝕜⦄, 0 < a → 0 < b → a + b = 1
a • f x + b • f y < f (a • x + b • y)) :
StrictConcaveOn 𝕜 s f :=
@LinearOrder.strictConvexOn_of_lt _ _ βᵒᵈ _ _ _ _ _ _ _ _ hs hf
LinearOrder.strictConvexOn_of_lt (β := βᵒᵈ) hs hf
#align linear_order.strict_concave_on_of_lt LinearOrder.strictConcaveOn_of_lt

end LinearOrder
Expand Down Expand Up @@ -1054,7 +1054,7 @@ theorem concaveOn_iff_div {f : E → β} :
ConcaveOn 𝕜 s f ↔
Convex 𝕜 s ∧ ∀ ⦃x⦄, x ∈ s → ∀ ⦃y⦄, y ∈ s → ∀ ⦃a b : 𝕜⦄, 0 ≤ a → 0 ≤ b → 0 < a + b →
(a / (a + b)) • f x + (b / (a + b)) • f y ≤ f ((a / (a + b)) • x + (b / (a + b)) • y) :=
@convexOn_iff_div _ _ βᵒᵈ _ _ _ _ _ _ _
convexOn_iff_div (β := βᵒᵈ)
#align concave_on_iff_div concaveOn_iff_div

theorem strictConvexOn_iff_div {f : E → β} :
Expand All @@ -1074,7 +1074,7 @@ theorem strictConcaveOn_iff_div {f : E → β} :
StrictConcaveOn 𝕜 s f ↔
Convex 𝕜 s ∧ ∀ ⦃x⦄, x ∈ s → ∀ ⦃y⦄, y ∈ s → x ≠ y → ∀ ⦃a b : 𝕜⦄, 0 < a → 0 < b →
(a / (a + b)) • f x + (b / (a + b)) • f y < f ((a / (a + b)) • x + (b / (a + b)) • y) :=
@strictConvexOn_iff_div _ _ βᵒᵈ _ _ _ _ _ _ _
strictConvexOn_iff_div (β := βᵒᵈ)
#align strict_concave_on_iff_div strictConcaveOn_iff_div

end SMul
Expand Down
8 changes: 4 additions & 4 deletions Mathlib/Analysis/Convex/Jensen.lean
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ theorem ConvexOn.map_centerMass_le (hf : ConvexOn 𝕜 s f) (h₀ : ∀ i ∈ t,
theorem ConcaveOn.le_map_centerMass (hf : ConcaveOn 𝕜 s f) (h₀ : ∀ i ∈ t, 0 ≤ w i)
(h₁ : 0 < ∑ i in t, w i) (hmem : ∀ i ∈ t, p i ∈ s) :
t.centerMass w (f ∘ p) ≤ f (t.centerMass w p) :=
@ConvexOn.map_centerMass_le 𝕜 E βᵒᵈ _ _ _ _ _ _ _ _ _ _ _ _ hf h₀ h₁ hmem
ConvexOn.map_centerMass_le (β := βᵒᵈ) hf h₀ h₁ hmem
#align concave_on.le_map_center_mass ConcaveOn.le_map_centerMass

/-- Convex **Jensen's inequality**, `Finset.sum` version. -/
Expand All @@ -70,7 +70,7 @@ theorem ConvexOn.map_sum_le (hf : ConvexOn 𝕜 s f) (h₀ : ∀ i ∈ t, 0 ≤
theorem ConcaveOn.le_map_sum (hf : ConcaveOn 𝕜 s f) (h₀ : ∀ i ∈ t, 0 ≤ w i)
(h₁ : ∑ i in t, w i = 1) (hmem : ∀ i ∈ t, p i ∈ s) :
(∑ i in t, w i • f (p i)) ≤ f (∑ i in t, w i • p i) :=
@ConvexOn.map_sum_le 𝕜 E βᵒᵈ _ _ _ _ _ _ _ _ _ _ _ _ hf h₀ h₁ hmem
ConvexOn.map_sum_le (β := βᵒᵈ) hf h₀ h₁ hmem
#align concave_on.le_map_sum ConcaveOn.le_map_sum

end Jensen
Expand Down Expand Up @@ -119,7 +119,7 @@ theorem ConvexOn.exists_ge_of_centerMass (h : ConvexOn 𝕜 s f) (hw₀ : ∀ i
`s` is greater than the value it takes on one of those points. -/
theorem ConcaveOn.exists_le_of_centerMass (h : ConcaveOn 𝕜 s f) (hw₀ : ∀ i ∈ t, 0 ≤ w i)
(hw₁ : 0 < ∑ i in t, w i) (hp : ∀ i ∈ t, p i ∈ s) : ∃ i ∈ t, f (p i) ≤ f (t.centerMass w p) :=
@ConvexOn.exists_ge_of_centerMass 𝕜 E βᵒᵈ _ _ _ _ _ _ _ _ _ _ _ _ h hw₀ hw₁ hp
ConvexOn.exists_ge_of_centerMass (β := βᵒᵈ) h hw₀ hw₁ hp
#align concave_on.exists_le_of_center_mass ConcaveOn.exists_le_of_centerMass

/-- Maximum principle for convex functions. If a function `f` is convex on the convex hull of `s`,
Expand All @@ -138,7 +138,7 @@ theorem ConvexOn.exists_ge_of_mem_convexHull (hf : ConvexOn 𝕜 (convexHull
then the eventual minimum of `f` on `convexHull 𝕜 s` lies in `s`. -/
theorem ConcaveOn.exists_le_of_mem_convexHull (hf : ConcaveOn 𝕜 (convexHull 𝕜 s) f) {x}
(hx : x ∈ convexHull 𝕜 s) : ∃ y ∈ s, f y ≤ f x :=
@ConvexOn.exists_ge_of_mem_convexHull 𝕜 E βᵒᵈ _ _ _ _ _ _ _ _ hf _ hx
ConvexOn.exists_ge_of_mem_convexHull (β := βᵒᵈ) hf hx
#align concave_on.exists_le_of_mem_convex_hull ConcaveOn.exists_le_of_mem_convexHull

end MaximumPrinciple
6 changes: 3 additions & 3 deletions Mathlib/Analysis/InnerProductSpace/EuclideanDist.lean
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] {G : Type*} [Nor
theorem ContDiff.euclidean_dist (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) (h : ∀ x, f x ≠ g x) :
ContDiff ℝ n fun x => Euclidean.dist (f x) (g x) := by
simp only [Euclidean.dist]
apply @ContDiff.dist ℝ
exacts [(@toEuclidean G _ _ _ _ _ _ _).contDiff.comp hf,
(@toEuclidean G _ _ _ _ _ _ _).contDiff.comp hg, fun x => toEuclidean.injective.ne (h x)]
apply ContDiff.dist ℝ
exacts [(toEuclidean (E := G)).contDiff.comp hf,
(toEuclidean (E := G)).contDiff.comp hg, fun x => toEuclidean.injective.ne (h x)]
#align cont_diff.euclidean_dist ContDiff.euclidean_dist
4 changes: 2 additions & 2 deletions Mathlib/Analysis/SpecialFunctions/Exponential.lean
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ theorem hasFDerivAt_exp_smul_const_of_mem_ball (x : 𝔸) (t : 𝕊)
fun h =>
exp 𝕂 ((t + h) • x) - exp 𝕂 (t • x) - (exp 𝕂 (t • x) • (1 : 𝕊 →L[𝕂] 𝕊).smulRight x) h by
apply (IsLittleO.const_mul_left _ _).congr' this (EventuallyEq.refl _ _)
rw [← @hasFDerivAt_iff_isLittleO_nhds_zero _ _ _ _ _ _ _ _ (fun u => exp 𝕂 (u • x))
((1 : 𝕊 →L[𝕂] 𝕊).smulRight x) 0]
rw [← hasFDerivAt_iff_isLittleO_nhds_zero (f := fun u => exp 𝕂 (u • x))
(f' := (1 : 𝕊 →L[𝕂] 𝕊).smulRight x) (x := 0)]
have : HasFDerivAt (exp 𝕂) (1 : 𝔸 →L[𝕂] 𝔸) ((1 : 𝕊 →L[𝕂] 𝕊).smulRight x 0) := by
rw [ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.one_apply, zero_smul]
exact hasFDerivAt_exp_zero_of_radius_pos hpos
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Analysis/SpecialFunctions/Pow/Continuity.lean
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ theorem continuousAt_ofReal_cpow (x : ℝ) (y : ℂ) (h : 0 < y.re ∨ x ≠ 0)
tauto
have B : ContinuousAt (fun p => ⟨↑p.1, p.2⟩ : ℝ × ℂ → ℂ × ℂ) ⟨0, y⟩ :=
continuous_ofReal.continuousAt.prod_map continuousAt_id
exact @ContinuousAt.comp (ℝ × ℂ) (ℂ × ℂ) ℂ _ _ _ _ (fun p => ⟨↑p.1, p.2⟩) ⟨0, y⟩ A B
exact ContinuousAt.comp (α := ℝ × ℂ) (f := fun p => ⟨↑p.1, p.2⟩) (x := 0, y⟩) A B
· -- x < 0 : difficult case
suffices ContinuousAt (fun p => (-(p.1 : ℂ)) ^ p.2 * exp (π * I * p.2) : ℝ × ℂ → ℂ) (x, y) by
refine' this.congr (eventually_of_mem (prod_mem_nhds (Iio_mem_nhds hx) univ_mem) _)
Expand All @@ -410,7 +410,7 @@ theorem continuousAt_ofReal_cpow (x : ℝ) (y : ℂ) (h : 0 < y.re ∨ x ≠ 0)

theorem continuousAt_ofReal_cpow_const (x : ℝ) (y : ℂ) (h : 0 < y.re ∨ x ≠ 0) :
ContinuousAt (fun a => (a : ℂ) ^ y : ℝ → ℂ) x :=
@ContinuousAt.comp _ _ _ _ _ _ _ _ x (continuousAt_ofReal_cpow x y h)
ContinuousAt.comp (x := x) (continuousAt_ofReal_cpow x y h)
(continuous_id.prod_mk continuous_const).continuousAt
#align complex.continuous_at_of_real_cpow_const Complex.continuousAt_ofReal_cpow_const

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ theorem contDiffOn_arccos {n : ℕ∞} : ContDiffOn ℝ n arccos {-1, 1}ᶜ :=
theorem contDiffAt_arccos_iff {x : ℝ} {n : ℕ∞} :
ContDiffAt ℝ n arccos x ↔ n = 0 ∨ x ≠ -1 ∧ x ≠ 1 := by
refine' Iff.trans ⟨fun h => _, fun h => _⟩ contDiffAt_arcsin_iff <;>
simpa [arccos] using (@contDiffAt_const _ _ _ _ _ _ _ _ _ _ (π / 2)).sub h
simpa [arccos] using (contDiffAt_const (c := π / 2)).sub h
#align real.cont_diff_at_arccos_iff Real.contDiffAt_arccos_iff

end Arccos
Expand Down
Loading

0 comments on commit df634f2

Please sign in to comment.