Skip to content

feat(Analysis/Convex): first-order convexity inequalities#41494

Open
FordUniver wants to merge 5 commits into
leanprover-community:masterfrom
FordUniver:feat/convex-first-order-inequalities
Open

feat(Analysis/Convex): first-order convexity inequalities#41494
FordUniver wants to merge 5 commits into
leanprover-community:masterfrom
FordUniver:feat/convex-first-order-inequalities

Conversation

@FordUniver

@FordUniver FordUniver commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Adds first-order characterizations of convexity for differentiable functions in three forms — directional, Fréchet, and gradient — together with concave duals, strict variants, iff converses, and the first-order optimality corollaries ConvexOn.isMinOn_of_fderiv_eq_zero / ConvexOn.isMinOn_of_gradient_eq_zero. Analysis.Convex.Deriv picks up the 1D additive forms of the slope inequalities.


The motivation is the Baillon–Haddad theorem in the Lipschitz-smooth stack (#39574 and follow-ups), whose proof plays the gradient form of the first-order convexity inequality against the descent bound of a K-smooth function. LineDeriv carries the proof content via 1D line restriction (ConvexOn.lineRestriction); FDeriv and Gradient are restatements via lineDeriv_eq_fderiv and Riesz (inner_gradient_left) respectively. This inverts mathlib's usual FDeriv-as-foundation default because convex first-order inequalities are naturally 1D — they only need directional differentiability, and the FDeriv/gradient forms are strictly stronger restatements.

Adds first-order characterizations of convexity for differentiable functions:
`f` is convex on `s` iff `f y ≥ f x + lineDeriv f x (y - x)` (and Fréchet /
gradient analogues), plus the strict variant, the iff converse, and a few
corollaries.

* `Mathlib/Analysis/Convex/LineDeriv.lean` (new): the proof-content layer.
  `ConvexOn.lineRestriction`, `ConvexOn.add_lineDeriv_le`,
  `ConvexOn.lineDeriv_sub_apply_nonneg`, `ConcaveOn.le_add_lineDeriv`,
  `StrictConvexOn.add_lineDeriv_lt`, `convexOn_iff_add_lineDeriv_le`.
* `Mathlib/Analysis/Convex/FDeriv.lean` (new): Fréchet-form lifts via
  `lineDeriv_eq_fderiv`. `ConvexOn.add_fderiv_le`,
  `ConvexOn.fderiv_sub_apply_nonneg`, `ConcaveOn.le_add_fderiv`,
  `StrictConvexOn.add_fderiv_lt`, `convexOn_iff_add_fderiv_le`.
* `Mathlib/Analysis/Convex/Gradient.lean` (new): gradient-form lifts via
  Riesz (`inner_gradient_left`). `ConvexOn.add_inner_gradient_le`,
  `ConvexOn.inner_gradient_sub_nonneg`, `ConvexOn.isMinOn_of_gradient_eq_zero`,
  `ConcaveOn.le_add_inner_gradient`, `StrictConvexOn.add_inner_gradient_lt`,
  `convexOn_iff_add_inner_gradient_le`.
* `Mathlib/Analysis/Convex/Deriv.lean` (additions): 1D additive form +
  line-restriction helper.
Must-fixes (1)–(3):
- Add strict 1D additive forms `StrictConvexOn.add_hasDerivAt_mul_lt` and
  `StrictConcaveOn.lt_add_hasDerivAt_mul` (plus `deriv`-form variants) to
  `Convex/Deriv.lean`.
- Refactor `StrictConvexOn.add_lineDeriv_lt` to use the new strict 1D additive
  form via `StrictConvexOn.lineRestriction` (drops the brittle midpoint `calc`).
- Add `StrictConcaveOn.lt_add_lineDeriv`, `.lt_add_fderiv`, `.lt_add_inner_gradient`
  (missing concave strict duals across all three layers).
- Add `ConvexOn.isMinOn_of_fderiv_eq_zero` (FDeriv-form sibling of the gradient
  one; needs only `NormedSpace ℝ E`, not Hilbert).
- Add `HasLineDerivAt`- and `HasFDerivAt`-flavoured primitive forms for all
  inequality lemmas; the `lineDeriv` / `fderiv` versions become one-line
  corollaries via `LineDifferentiableAt.hasLineDerivAt` /
  `DifferentiableAt.hasFDerivAt`.

Should-fixes (4)–(7):
- Rename `_sub_apply_nonneg` → `_sub_nonneg` in both LineDeriv and FDeriv;
  `_apply` was vestigial for the scalar `lineDeriv` and added noise for
  `fderiv` where the application is visible in the statement.
- Drop the LineDeriv-layer iff converse (`convexOn_iff_add_lineDeriv_le`);
  the FDeriv-layer iff is the canonical statement users want, and its
  premise `∀ x ∈ s, DifferentiableAt ℝ f x` is easier to instantiate than
  the pair-quantified line-differentiability of the dropped version.
- Reprove `convexOn_iff_add_fderiv_le` directly using `fderiv`-arithmetic
  (no longer delegating through the dropped LineDeriv iff).
- Rewrite Gradient module docstring to lead with "Hilbert space" framing.
- Refactor the `▸` chain in `ConvexOn.lineDeriv_sub_nonneg` to a `have` +
  `rw` block.

Bonus: factor out `private lineMap_eq_add_smul_sub` helper.
Concave duals and strict variants are systematic companions, not main
results; fold them into one prose line per module docstring.
- replace have/rwa-at chains with simpa only ... using
- drop a no-op change + simp only [smul_eq_mul] pair in
  convexOn_iff_add_fderiv_le (the calc closes the smul goal by defeq)
- derive ConcaveOn.lineRestriction by neg-duality, matching the
  StrictConcaveOn version; factor the duplicated membership argument in
  StrictConvexOn.lineRestriction
- simp_rw [inner_gradient_left] instead of a forall_congr'/imp_congr_right
  chain in convexOn_iff_add_inner_gradient_le
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

PR summary a9a383ff18

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Analysis.Convex.LineDeriv (new file) 1895
Mathlib.Analysis.Convex.FDeriv (new file) 1896
Mathlib.Analysis.Convex.Gradient (new file) 2269

Declarations diff (regex)

+ ConcaveOn.lineRestriction
+ ConvexOn.lineRestriction
+ StrictConcaveOn.lineRestriction
+ StrictConvexOn.lineRestriction
+ add_deriv_mul_le
+ add_deriv_mul_lt
+ add_fderiv_le
+ add_fderiv_lt
+ add_hasDerivAt_mul_le
+ add_hasDerivAt_mul_lt
+ add_hasFDerivAt_le
+ add_hasFDerivAt_lt
+ add_hasLineDerivAt_le
+ add_hasLineDerivAt_lt
+ add_inner_gradient_le
+ add_inner_gradient_lt
+ add_lineDeriv_le
+ add_lineDeriv_lt
+ convexOn_iff_add_fderiv_le
+ convexOn_iff_add_inner_gradient_le
+ fderiv_sub_nonneg
+ inner_gradient_sub_nonneg
+ isMinOn_of_fderiv_eq_zero
+ isMinOn_of_gradient_eq_zero
+ le_add_deriv_mul
+ le_add_fderiv
+ le_add_hasDerivAt_mul
+ le_add_hasFDerivAt
+ le_add_hasLineDerivAt
+ le_add_inner_gradient
+ le_add_lineDeriv
+ lineDeriv_sub_nonneg
+ lineMap_eq_add_smul_sub
+ lt_add_deriv_mul
+ lt_add_fderiv
+ lt_add_hasDerivAt_mul
+ lt_add_hasFDerivAt
+ lt_add_hasLineDerivAt
+ lt_add_inner_gradient
+ lt_add_lineDeriv

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

Lean-aware diff — post-build, computed from the Lean environment (commit a9a383f).

  • +39 new declarations
  • −0 removed declarations
+ConcaveOn.le_add_deriv_mul
+ConcaveOn.le_add_fderiv
+ConcaveOn.le_add_hasDerivAt_mul
+ConcaveOn.le_add_hasFDerivAt
+ConcaveOn.le_add_hasLineDerivAt
+ConcaveOn.le_add_inner_gradient
+ConcaveOn.le_add_lineDeriv
+ConcaveOn.lineRestriction
+ConvexOn.add_deriv_mul_le
+ConvexOn.add_fderiv_le
+ConvexOn.add_hasDerivAt_mul_le
+ConvexOn.add_hasFDerivAt_le
+ConvexOn.add_hasLineDerivAt_le
+ConvexOn.add_inner_gradient_le
+ConvexOn.add_lineDeriv_le
+ConvexOn.fderiv_sub_nonneg
+ConvexOn.inner_gradient_sub_nonneg
+ConvexOn.isMinOn_of_fderiv_eq_zero
+ConvexOn.isMinOn_of_gradient_eq_zero
+ConvexOn.lineDeriv_sub_nonneg
+ConvexOn.lineRestriction
+StrictConcaveOn.lineRestriction
+StrictConcaveOn.lt_add_deriv_mul
+StrictConcaveOn.lt_add_fderiv
+StrictConcaveOn.lt_add_hasDerivAt_mul
+StrictConcaveOn.lt_add_hasFDerivAt
+StrictConcaveOn.lt_add_hasLineDerivAt
+StrictConcaveOn.lt_add_inner_gradient
+StrictConcaveOn.lt_add_lineDeriv
+StrictConvexOn.add_deriv_mul_lt
+StrictConvexOn.add_fderiv_lt
+StrictConvexOn.add_hasDerivAt_mul_lt
+StrictConvexOn.add_hasFDerivAt_lt
+StrictConvexOn.add_hasLineDerivAt_lt
+StrictConvexOn.add_inner_gradient_lt
+StrictConvexOn.add_lineDeriv_lt
+StrictConvexOn.lineRestriction
+convexOn_iff_add_fderiv_le
+convexOn_iff_add_inner_gradient_le

No changes to strong technical debt.

No changes to weak technical debt.

Current commit a9a383ff18
Reference commit 1c3e8f34a8

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@mathlib-dependent-issues

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-analysis Analysis (normed *, calculus)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant