Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
dea5815
refactor(Analysis/Calculus/Gradient): ungate inner_gradient lemmas
FordUniver May 11, 2026
88dce58
feat(Analysis/Calculus/AddTorsor/AffineMap): smoothness of AffineMap.…
FordUniver May 11, 2026
5e40b13
added simp attribute and additional lemma by Komyyy's suggestion
FordUniver May 17, 2026
0485def
feat(Analysis/Calculus/LipschitzSmooth): add LipschitzSmoothWith pred…
FordUniver May 18, 2026
db5713e
refactor(Analysis/Calculus/LipschitzSmooth): opaque predicate + add F…
FordUniver May 18, 2026
0d3752e
feat(Analysis/Calculus/LipschitzSmooth): add Deriv and Gradient layers
FordUniver May 18, 2026
9b4c90b
refactor(LipschitzSmooth): weaken extractor hypotheses to Differentia…
FordUniver May 18, 2026
5e90e57
chore(LipschitzSmooth): drop redundant per-theorem docstrings
FordUniver May 18, 2026
86e28e3
chore(LipschitzSmooth): audit-pass on docstrings and imports
FordUniver May 18, 2026
49820ae
chore(LipschitzSmooth/Basic): refactor lineDeriv_apply_sub_le, trim d…
FordUniver May 18, 2026
ea0191c
chore(LipschitzSmooth): consolidate Main results bullets
FordUniver May 18, 2026
7d686b1
chore(LipschitzSmooth): use comma-separated names in Main results
FordUniver May 18, 2026
cf64bce
chore(LipschitzSmooth): minor style/formatting tweaks
FordUniver May 19, 2026
3365004
chore(LipschitzSmooth): trim verbose file-level docstrings
FordUniver May 19, 2026
1c3478c
feat(Analysis/Calculus/LipschitzSmooth): add CocoerciveWith
FordUniver May 19, 2026
c5147c2
chore(LipschitzSmooth/Cocoercive): inline single-use hcs hypothesis
FordUniver May 19, 2026
6eecf03
refactor(LipschitzSmooth): fold Cocoercive.lean into Gradient.lean
FordUniver May 19, 2026
49f4741
chore(LipschitzSmooth): drop 'deferred to follow-up' from module docs…
FordUniver May 19, 2026
3ff2393
refactor(LipschitzSmooth): switch to two-sided absolute-value predicate
FordUniver May 19, 2026
6b44bc9
feat(LipschitzSmooth): prove hasLineDerivAt
FordUniver May 19, 2026
b594c2c
review: address EtienneC30 feedback
FordUniver May 25, 2026
ac72ebb
feat(CurveIntegral): segment-level lemmas and FTC along a line segment
FordUniver May 11, 2026
613b043
refactor(CurveIntegral): apply review feedback
FordUniver May 18, 2026
4615cf7
review: rename to AffineMap.contDiff_lineMap
FordUniver May 25, 2026
77c92d4
review: extend review feedback to this PR
FordUniver May 25, 2026
00207b9
Merge branch 'master' into feat/curveIntegral-segment-FTC
FordUniver Jul 8, 2026
ab2cae4
Merge branch 'master' into feat/lipschitzSmooth-basic
FordUniver Jul 8, 2026
56342d2
Update Mathlib/Analysis/Calculus/LipschitzSmooth/Basic.lean
FordUniver Jul 8, 2026
0584ae9
Update Mathlib/Analysis/Calculus/LipschitzSmooth/Basic.lean
FordUniver Jul 8, 2026
3302125
chore: drop redundant coercion arrows on K, fix sub_apply deprecation
FordUniver Jul 8, 2026
f080395
chore: replace "extractor" jargon with plain descriptions in docstrings
FordUniver Jul 8, 2026
b00b1e9
chore: drop bare author name-drop from module docstring
FordUniver Jul 8, 2026
fcff1ba
chore: "variance" -> "variation" in line-derivative bound docstrings
FordUniver Jul 8, 2026
ecebcc0
feat: generalize LipschitzSmoothWith codomain to normed spaces
FordUniver Jul 8, 2026
de50c2f
style: tighten proofs after codomain generalization
FordUniver Jul 8, 2026
4b144de
Merge remote-tracking branch 'origin/feat/curveIntegral-segment-FTC' …
FordUniver Jul 8, 2026
d7b45d9
feat(Analysis/Convex): first-order convexity inequalities
FordUniver May 18, 2026
d599d2a
refactor(Analysis/Convex): apply review feedback
FordUniver May 18, 2026
53d5f07
chore(Analysis/Convex): trim main-results lists to the main statements
FordUniver Jul 8, 2026
0c21f15
refactor(Analysis/Convex): tighten proofs
FordUniver Jul 8, 2026
a9a383f
chore(Analysis/Convex): ContinuousLinearMap.sub_apply -> sub_apply (d…
FordUniver Jul 8, 2026
608f5bb
feat(Analysis/Calculus/LipschitzSmooth): add descent lemma
FordUniver May 19, 2026
d9e8bb5
Merge remote-tracking branch 'origin/feat/convex-first-order-inequali…
FordUniver Jul 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Mathlib.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1831,6 +1831,10 @@ public import Mathlib.Analysis.Calculus.LineDeriv.Basic
public import Mathlib.Analysis.Calculus.LineDeriv.IntegrationByParts
public import Mathlib.Analysis.Calculus.LineDeriv.Measurable
public import Mathlib.Analysis.Calculus.LineDeriv.QuadraticMap
public import Mathlib.Analysis.Calculus.LipschitzSmooth.Basic
public import Mathlib.Analysis.Calculus.LipschitzSmooth.Deriv
public import Mathlib.Analysis.Calculus.LipschitzSmooth.FDeriv
public import Mathlib.Analysis.Calculus.LipschitzSmooth.Gradient
public import Mathlib.Analysis.Calculus.LocalExtr.Basic
public import Mathlib.Analysis.Calculus.LocalExtr.LineDeriv
public import Mathlib.Analysis.Calculus.LocalExtr.Polynomial
Expand Down Expand Up @@ -1951,17 +1955,20 @@ public import Mathlib.Analysis.Convex.EGauge
public import Mathlib.Analysis.Convex.Exposed
public import Mathlib.Analysis.Convex.Extrema
public import Mathlib.Analysis.Convex.Extreme
public import Mathlib.Analysis.Convex.FDeriv
public import Mathlib.Analysis.Convex.Function
public import Mathlib.Analysis.Convex.FunctionTopology
public import Mathlib.Analysis.Convex.Gauge
public import Mathlib.Analysis.Convex.GaugeRescale
public import Mathlib.Analysis.Convex.Gradient
public import Mathlib.Analysis.Convex.Hull
public import Mathlib.Analysis.Convex.Independent
public import Mathlib.Analysis.Convex.Integral
public import Mathlib.Analysis.Convex.Intrinsic
public import Mathlib.Analysis.Convex.Jensen
public import Mathlib.Analysis.Convex.Join
public import Mathlib.Analysis.Convex.KreinMilman
public import Mathlib.Analysis.Convex.LineDeriv
public import Mathlib.Analysis.Convex.LinearIsometry
public import Mathlib.Analysis.Convex.Measure
public import Mathlib.Analysis.Convex.MetricSpace
Expand Down
134 changes: 134 additions & 0 deletions Mathlib/Analysis/Calculus/LipschitzSmooth/Basic.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/-
Copyright (c) 2026 Christoph Spiegel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Christoph Spiegel
-/
module

public import Mathlib.Analysis.Calculus.LineDeriv.Basic

/-!
# Lipschitz smoothness

A function `f : E → F` between real normed vector spaces is **`K`-smooth** if the
first-order Taylor remainder is bounded quadratically:

`‖f y - f x - lineDeriv ℝ f x (y - x)‖ ≤ (K / 2) * (dist x y) ^ 2`

for all `x, y`. The predicate uses `lineDeriv` so as not to presuppose Fréchet
differentiability; equivalent characterisations in `fderiv`, 1D `deriv`, and
Hilbert-space gradient form live in the sibling files in this directory.

This two-sided (norm) form is orientation-agnostic (closed under `f ↦ -f`) —
matching, for real-valued `f`, the textbook notion of L-smoothness (Lipschitz
gradient, the class `C^{1,1}`). The one-sided descent bounds require an order
on the codomain and are stated for real-valued `f` in a dedicated section.
-/

public section

variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[NormedAddCommGroup F] [NormedSpace ℝ F]

/-- A function `f : E → F` between real normed vector spaces is `K`-smooth
if the first-order Taylor remainder is bounded quadratically:
`‖f y - f x - lineDeriv ℝ f x (y - x)‖ ≤ (K / 2) * (dist x y) ^ 2` for all `x, y`.

The predicate is two-sided (norm), so closed under `f ↦ -f` and matching, for
real-valued `f`, the textbook L-smoothness / `C^{1,1}` class. The `lineDeriv`
form is the weakest possible underlying derivative form — the predicate implies
line-differentiability everywhere (`LipschitzSmoothWith.hasLineDerivAt`), so
the `lineDeriv` value is always the actual line derivative.

Equivalent characterisations in `fderiv`, `gradient`, and `deriv` form are
provided in the sibling files, predicated on `Differentiable` where useful.
The one-sided descent bounds, which require an order on the codomain, are
stated for real-valued `f`. -/
def LipschitzSmoothWith (K : NNReal) (f : E → F) :=
∀ (x y : E), ‖f y - f x - lineDeriv ℝ f x (y - x)‖ ≤ K / 2 * (dist x y) ^ 2

theorem lipschitzSmoothWith_iff_lineDeriv {K : NNReal} {f : E → F} : LipschitzSmoothWith K f ↔
∀ x y : E, ‖f y - f x - lineDeriv ℝ f x (y - x)‖ ≤ K / 2 * (dist x y) ^ 2 := Iff.rfl

namespace LipschitzSmoothWith

variable {K : NNReal} {f : E → F}

/-- The two-sided quadratic bound on the first-order Taylor remainder, restated
from the definition for dot notation. -/
theorem lineDeriv_norm_le (h : LipschitzSmoothWith K f) (x y : E) :
‖f y - f x - lineDeriv ℝ f x (y - x)‖ ≤ K / 2 * (dist x y) ^ 2 := h x y

/-- Two-sided bound on the variation of the line derivative along `y - x`. -/
theorem lineDeriv_apply_sub_norm_le (h : LipschitzSmoothWith K f) (x y : E) :
‖lineDeriv ℝ f y (y - x) - lineDeriv ℝ f x (y - x)‖ ≤ K * (dist x y) ^ 2 := by
have hyx := h.lineDeriv_norm_le y x
rw [← neg_sub y x, lineDeriv_neg, sub_neg_eq_add, dist_comm] at hyx
have key := (norm_add_le _ _).trans (add_le_add hyx (h.lineDeriv_norm_le x y))
rw [show f x - f y + lineDeriv ℝ f y (y - x) + (f y - f x - lineDeriv ℝ f x (y - x))
= lineDeriv ℝ f y (y - x) - lineDeriv ℝ f x (y - x) from by abel] at key
linarith

/-- `K`-smoothness implies line-differentiability: the actual line derivative
exists at every `x, v` and equals `lineDeriv ℝ f x v`. The predicate bound
`‖f (x + tv) - f x - t • L‖ ≤ K/2 · t² ‖v‖²` (via `lineDeriv_smul` to factor `t`)
is `o(t)`. -/
theorem hasLineDerivAt (h : LipschitzSmoothWith K f) (x v : E) :
HasLineDerivAt ℝ f (lineDeriv ℝ f x v) x v := by
set L := lineDeriv ℝ f x v
change HasDerivAt (fun t : ℝ => f (x + t • v)) L 0
rw [hasDerivAt_iff_isLittleO_nhds_zero, Asymptotics.isLittleO_iff]
intro ε hε
have hsum_pos : (0:ℝ) < K * ‖v‖^2 / 2 + 1 := by positivity
filter_upwards [Metric.ball_mem_nhds (0 : ℝ) (div_pos hε hsum_pos)] with t ht
simp only [Metric.mem_ball, Real.dist_eq, sub_zero] at ht
simp only [zero_add, zero_smul, add_zero, Real.norm_eq_abs]
have hpred := h x (x + t • v)
rw [show (x + t • v) - x = t • v from by abel, lineDeriv_smul,
dist_self_add_right, norm_smul, Real.norm_eq_abs, mul_pow, sq_abs] at hpred
refine hpred.trans ?_
have ht' : |t| * (K * ‖v‖^2 / 2 + 1) < ε := (lt_div_iff₀ hsum_pos).mp ht
have ht'' : K * ‖v‖^2 / 2 * |t| ≤ ε := by nlinarith [abs_nonneg t]
calc K / 2 * (t ^ 2 * ‖v‖ ^ 2)
= K * ‖v‖^2 / 2 * |t| * |t| := by rw [← sq_abs t]; ring
_ ≤ ε * |t| := mul_le_mul_of_nonneg_right ht'' (abs_nonneg t)

/-- A `K`-smooth function is line-differentiable everywhere. -/
theorem lineDifferentiableAt (h : LipschitzSmoothWith K f) (x v : E) :
LineDifferentiableAt ℝ f x v :=
(h.hasLineDerivAt x v).lineDifferentiableAt

/-! ### Real-valued functions

The one-sided (order-based) bounds require an order on the codomain, so they are
stated for real-valued `f`. The norm and the absolute value agree on `ℝ`
(`Real.norm_eq_abs`), so the two-sided bounds above apply verbatim. -/

section Real

variable {f : E → ℝ}

/-- The quadratic upper bound on `f y`, traditionally called the *descent lemma*. -/
theorem lineDeriv_descent_le (h : LipschitzSmoothWith K f) (x y : E) :
f y ≤ f x + lineDeriv ℝ f x (y - x) + K / 2 * (dist x y) ^ 2 := by
linarith [(abs_le.mp (h.lineDeriv_norm_le x y)).2]

/-- The quadratic lower bound on `f y`: the descent lemma applied to `-f`. -/
theorem lineDeriv_descent_ge (h : LipschitzSmoothWith K f) (x y : E) :
f x + lineDeriv ℝ f x (y - x) - K / 2 * (dist x y) ^ 2 ≤ f y := by
linarith [(abs_le.mp (h.lineDeriv_norm_le x y)).1]

/-- One-sided bound on the variation of the line derivative along `y - x`. -/
theorem lineDeriv_apply_sub_le (h : LipschitzSmoothWith K f) (x y : E) :
lineDeriv ℝ f y (y - x) - lineDeriv ℝ f x (y - x) ≤ K * (dist x y) ^ 2 :=
le_of_abs_le (h.lineDeriv_apply_sub_norm_le x y)

/-- The one-sided variation bound in functional form: the difference of
line-derivative maps applied to `y - x`. -/
theorem lineDeriv_sub_apply_le (h : LipschitzSmoothWith K f) (x y : E) :
(lineDeriv ℝ f y - lineDeriv ℝ f x) (y - x) ≤ K * (dist x y) ^ 2 :=
Pi.sub_apply (lineDeriv ℝ f _) _ _ ▸ h.lineDeriv_apply_sub_le x y

end Real

end LipschitzSmoothWith
93 changes: 93 additions & 0 deletions Mathlib/Analysis/Calculus/LipschitzSmooth/Deriv.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/-
Copyright (c) 2026 Christoph Spiegel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Christoph Spiegel
-/
module

public import Mathlib.Analysis.Calculus.Deriv.Basic
public import Mathlib.Analysis.Calculus.LipschitzSmooth.FDeriv

/-!
# Lipschitz smoothness in 1D via the derivative

For a `K`-smooth function `f : ℝ → F`, the Taylor bound takes its 1D form

`‖f y - f x - (y - x) • deriv f x‖ ≤ K/2 · (y - x)²`,

lifted from the Fréchet-derivative form in
`Mathlib.Analysis.Calculus.LipschitzSmooth.FDeriv` via `fderiv_eq_smul_deriv`.
For real-valued `f` the one-sided bounds take their classical forms

`f y ≤ f x + deriv f x * (y - x) + K/2 · (y - x)²`,
`(deriv f y - deriv f x) * (y - x) ≤ K · (y - x)²`,

with the scalar action spelled as multiplication (`smul_eq_mul` bridges the two).
-/

public section

variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F]
variable {K : NNReal} {f : ℝ → F}

theorem lipschitzSmoothWith_iff_deriv (hf : Differentiable ℝ f) : LipschitzSmoothWith K f ↔
∀ x y : ℝ, ‖f y - f x - (y - x) • deriv f x‖ ≤ K / 2 * (y - x) ^ 2 := by
rw [lipschitzSmoothWith_iff_fderiv hf]
refine forall_congr' fun x => forall_congr' fun y => ?_
rw [fderiv_eq_smul_deriv, dist_comm, Real.dist_eq, sq_abs]

namespace LipschitzSmoothWith

theorem deriv_norm_le (h : LipschitzSmoothWith K f) (x y : ℝ) (hf : DifferentiableAt ℝ f x) :
‖f y - f x - (y - x) • deriv f x‖ ≤ K / 2 * (y - x) ^ 2 := by
simpa only [fderiv_eq_smul_deriv, dist_comm x y, Real.dist_eq, sq_abs]
using h.fderiv_norm_le x y hf

/-! ### Real-valued functions -/

section Real

variable {f : ℝ → ℝ}

theorem deriv_descent_le (h : LipschitzSmoothWith K f) (x y : ℝ) (hf : DifferentiableAt ℝ f x) :
f y ≤ f x + deriv f x * (y - x) + K / 2 * (y - x) ^ 2 := by
simpa only [fderiv_eq_deriv_mul, dist_comm x y, Real.dist_eq, sq_abs]
using h.fderiv_descent_le x y hf

theorem deriv_descent_ge (h : LipschitzSmoothWith K f) (x y : ℝ) (hf : DifferentiableAt ℝ f x) :
f x + deriv f x * (y - x) - K / 2 * (y - x) ^ 2 ≤ f y := by
simpa only [fderiv_eq_deriv_mul, dist_comm x y, Real.dist_eq, sq_abs]
using h.fderiv_descent_ge x y hf

theorem deriv_sub_mul_le (h : LipschitzSmoothWith K f) (x y : ℝ)
(hfx : DifferentiableAt ℝ f x) (hfy : DifferentiableAt ℝ f y) :
(deriv f y - deriv f x) * (y - x) ≤ K * (y - x) ^ 2 := by
simpa only [sub_apply, fderiv_eq_deriv_mul, ← sub_mul, dist_comm x y, Real.dist_eq, sq_abs]
using h.fderiv_sub_apply_le x y hfx hfy

end Real

end LipschitzSmoothWith

/-! ### Lipschitz constants of `fderiv` versus `deriv` -/

section Real

variable {f : ℝ → ℝ}

/-- For `f : ℝ → ℝ`, the Lipschitz constants of `fderiv ℝ f` and `deriv f` coincide:
`deriv f` is the composition of `fderiv ℝ f` with the isometry
`(ContinuousLinearMap.toSpanSingletonLIE ℝ ℝ).symm` (evaluation at `1`). -/
theorem lipschitzWith_fderiv_iff_lipschitzWith_deriv :
LipschitzWith K (fderiv ℝ f) ↔ LipschitzWith K (deriv f) :=
((ContinuousLinearMap.toSpanSingletonLIE ℝ ℝ).symm.isometry.lipschitzWith_iff K).symm

/-! ### Descent lemma (1D) -/

/-- **Descent lemma (1D).** If `f : ℝ → ℝ` is differentiable and its derivative is
`K`-Lipschitz, then `f` is `K`-smooth. -/
theorem Differentiable.lipschitzSmoothWith_of_lipschitzWith_deriv
(hf : Differentiable ℝ f) (hL : LipschitzWith K (deriv f)) : LipschitzSmoothWith K f :=
hf.lipschitzSmoothWith_of_lipschitzWith (lipschitzWith_fderiv_iff_lipschitzWith_deriv.mpr hL)

end Real
Loading
Loading