Skip to content

feat: add mfderiv_const_smul#34262

Open
grunweg wants to merge 2 commits intoleanprover-community:masterfrom
grunweg:mfderiv-smul
Open

feat: add mfderiv_const_smul#34262
grunweg wants to merge 2 commits intoleanprover-community:masterfrom
grunweg:mfderiv-smul

Conversation

@grunweg
Copy link
Copy Markdown
Contributor

@grunweg grunweg commented Jan 22, 2026

This generalises an existing mathlib lemma (as the differentiability hypothesis is in fact not necessary).

Co-authored-by: Patrick Massot patrickmassot@free.fr


Note: this PR is now lower-priority (after some reorgs it is no longer on the path to the Levi-Civita connection); it should be rewritten following the approach in #34263.

Open in Gitpod

@grunweg grunweg added the t-differential-geometry Manifolds etc label Jan 22, 2026
@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented Jan 22, 2026

@ocfnash Would you like to review a simple differential geometry PR again? If so, I have a solution for you. (And if no, I'll be happy to ask around instead.)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 22, 2026

PR summary 2050510330

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ mfderiv_const_smul

You can run this locally as follows
## summary with just the declaration names:
./scripts/pr_summary/declarations_diff.sh <optional_commit>

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

The doc-module for scripts/pr_summary/declarations_diff.sh contains some details about this script.


Increase in tech debt: (relative, absolute) = (1.00, 0.00)
Current number Change Type
10109 1 backward.isDefEq

Current commit fee0f86a1e
Reference commit 2050510330

You can run this locally as

./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).

@ocfnash ocfnash self-assigned this Jan 22, 2026
@grunweg grunweg mentioned this pull request Jan 22, 2026
35 tasks
lemma mfderiv_const_smul {x : M} (a : 𝕜) (v : TangentSpace I x) :
mfderiv I 𝓘(𝕜, E') (a • f) x v = a • mfderiv I 𝓘(𝕜, E') f x v := by
by_cases hs : MDifferentiableAt I 𝓘(𝕜, E') f x
· rw [const_smul_mfderiv hs]; rfl
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rfl here is suspicious. I briefly tried ContinuousLinearMap.smul_apply but it complains and erw? [ContinuousLinearMap.smul_apply] tells me:

❌️ at reducible transparency,
  DFunLike.coe (β := fun x_1 ↦ TangentSpace 𝓘(𝕜, E') ((a • f) x))
and
  DFunLike.coe (β := fun x_1 ↦ TangentSpace 𝓘(𝕜, E') (f x))
are not defeq, but they are at default transparency.

Surely this sort of thing should just work?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should, but things appear less smooth. Floris and I were debugging this a bit last week. erw? has not helpful (as I just posted on zulip); it appears the issue is that the terms live in different tangent spaces. In this sense, const_smul_mfderiv is a bad lemma, because its left and right hand side live in different spaces.

This is a broader problem, let me start a thread on zulip.

Comment on lines +890 to +899
· by_cases ha : a = 0
· have : a • f = 0 := by ext; simp [ha]
have aux : (fun _ ↦ 0 : M → E') = 0 := by rfl
rw [this, ha, ← aux]
simp
have hs' : ¬ MDifferentiableAt I 𝓘(𝕜, E') (a • f) x :=
fun h ↦ hs (by simpa [ha] using h.const_smul a⁻¹)
rw [mfderiv_zero_of_not_mdifferentiableAt hs, mfderiv_zero_of_not_mdifferentiableAt hs']
simp
rfl
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise here the rfls and the extent to which we need to work hard suggest to me that there is a bigger fish to fry with the API. Is it possible to get the below working smoothly?

Suggested change
· by_cases ha : a = 0
· have : a • f = 0 := by ext; simp [ha]
have aux : (fun _ ↦ 0 : M → E') = 0 := by rfl
rw [this, ha, ← aux]
simp
have hs' : ¬ MDifferentiableAt I 𝓘(𝕜, E') (a • f) x :=
fun h ↦ hs (by simpa [ha] using h.const_smul a⁻¹)
rw [mfderiv_zero_of_not_mdifferentiableAt hs, mfderiv_zero_of_not_mdifferentiableAt hs']
simp
rfl
· rcases eq_or_ne a 0 with rfl | ha; · simp; /- Should be finished now! -/ sorry
have hs' : ¬ MDifferentiableAt I 𝓘(𝕜, E') (a • f) x :=
fun h ↦ hs (by simpa [ha] using h.const_smul a⁻¹)
simp [mfderiv_zero_of_not_mdifferentiableAt hs, mfderiv_zero_of_not_mdifferentiableAt hs']
/- Should be finished now because of `ContinuousLinearMap.zero_apply`. -/
sorry

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried for a fair bit now: we may have missing API (there's no lemma mfderiv_zero, for instance) --- but we also have the same defeq problem above. Let me add that to the zulip thread.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ocfnash ocfnash added the awaiting-author A reviewer has asked the author a question or requested changes. label Jan 22, 2026
@ocfnash
Copy link
Copy Markdown
Contributor

ocfnash commented Jan 22, 2026

To be clear, I don't really care about golfing the proof but a proof like this suggests to me that we might need to tweak our upstream API since it shouldn't be this awkward.

OTOH if these are known issues which we want to solve another time, we can move forward without addressing them here: clearly this lemma statement is good.

@mathlib-merge-conflicts mathlib-merge-conflicts bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Mar 6, 2026
@mathlib-merge-conflicts
Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@github-actions github-actions bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Mar 6, 2026
@hrmacbeth hrmacbeth added the WIP Work in progress label Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author A reviewer has asked the author a question or requested changes. t-differential-geometry Manifolds etc WIP Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants