Skip to content

[Merged by Bors] - feat(Analysis/Calculus/FDeriv): add fderiv_apply simp lemmas#37637

Closed
IlPreteRosso wants to merge 6 commits intoleanprover-community:masterfrom
IlPreteRosso:fderiv-pi-apply
Closed

[Merged by Bors] - feat(Analysis/Calculus/FDeriv): add fderiv_apply simp lemmas#37637
IlPreteRosso wants to merge 6 commits intoleanprover-community:masterfrom
IlPreteRosso:fderiv-pi-apply

Conversation

@IlPreteRosso
Copy link
Copy Markdown
Contributor

Add @[simp] lemmas fderiv_apply and fderivWithin_apply that extract a component from the fderiv of a Pi-type function: (proj i).comp (fderiv 𝕜 Φ x) = fderiv 𝕜 (fun x => Φ x i) x. This completes the extraction direction of the Pi fderiv API alongside the existing construction direction (fderiv_pi).

@github-actions github-actions bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label Apr 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 4, 2026

Welcome new contributor!

Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests.

We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the awaiting-author tag, or another reason described in the Lifecycle of a PR. The review dashboard has a dedicated webpage which shows whether your PR is on the review queue, and (if not), why.

If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR.

Thank you again for joining our community.

@github-actions github-actions bot added the easy < 20s of review time. See the lifecycle page for guidelines. label Apr 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 4, 2026

PR summary eb4f246868

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ fderivWithin_apply
+ fderiv_apply

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.


No changes to technical debt.

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

@github-actions github-actions bot added the t-analysis Analysis (normed *, calculus) label Apr 4, 2026
Comment thread Mathlib/Analysis/Calculus/FDeriv/Prod.lean Outdated
@eric-wieser eric-wieser added the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 5, 2026
@github-actions github-actions bot removed the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 5, 2026
@IlPreteRosso
Copy link
Copy Markdown
Contributor Author

IlPreteRosso commented Apr 5, 2026

One question about the direction. In my downstream project the pattern that shows up frequently is Φ : XL1 ν L → XL1 ν L to fderiv 𝕜 (fun x => Φ x i) x v, from bundled derivative evaluated then projected simplified to proj., deriv, then eval., so that component-level proof can proceed.

The fderiv_pi' can go in the direction complying with the API convention, and can be unsimped, but the real simp workhorse I can tell from my project is something like

@[simp]
lemma fderiv_apply {Φ : E → ∀ i, F' i} (hΦ : DifferentiableAt 𝕜 Φ x) (v : E) (i : ι) :                       
      fderiv 𝕜 Φ x v i = fderiv 𝕜 (fun x => Φ x i) x v := by                                                               
      rw [fderiv_pi']; ... 

Ok I misunderstood the _apply suffix in Mathlib's fderiv API so after a second thought I will just keep this simp lemma to local project instead.

(hasFDerivAt_pi.2 fun i => (h i).hasFDerivAt).fderiv

@[simp]
theorem fderivWithin_pi' (hΦ : DifferentiableWithinAt 𝕜 Φ s x)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
theorem fderivWithin_pi' (hΦ : DifferentiableWithinAt 𝕜 Φ s x)
theorem fderivWithin_apply (hΦ : DifferentiableWithinAt 𝕜 Φ s x)

is now the right name I think; my comment earlier was that your name suggested the current direction but the type was the opposite.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah apologies, I missed the message above. Perhaps get a second opinion

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.

Ah apologies, I missed the message above. Perhaps get a second opinion

No worries. I was not folloing the api's _apply implication ealier on. Let me know your opinion.

Copy link
Copy Markdown
Contributor

@j-loreaux j-loreaux left a comment

Choose a reason for hiding this comment

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

I think apply is the right name here. Thanks!

bors merge

@mathlib-triage mathlib-triage bot added the ready-to-merge This PR has been sent to bors. label Apr 7, 2026
mathlib-bors bot pushed a commit that referenced this pull request Apr 7, 2026
Add `@[simp]` lemmas `fderiv_apply` and `fderivWithin_apply` that extract a component from the fderiv of a Pi-type function: `(proj i).comp (fderiv 𝕜 Φ x) = fderiv 𝕜 (fun x => Φ x i) x`. This completes the extraction direction of the Pi fderiv API alongside the existing construction direction (`fderiv_pi`).

Co-authored-by: Fengyang Wang <will1541286313@gmail.com>
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Apr 7, 2026

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat(Analysis/Calculus/FDeriv): add fderiv_apply simp lemmas [Merged by Bors] - feat(Analysis/Calculus/FDeriv): add fderiv_apply simp lemmas Apr 7, 2026
@mathlib-bors mathlib-bors bot closed this Apr 7, 2026
xroblot pushed a commit to xroblot/mathlib4 that referenced this pull request Apr 10, 2026
…ver-community#37637)

Add `@[simp]` lemmas `fderiv_apply` and `fderivWithin_apply` that extract a component from the fderiv of a Pi-type function: `(proj i).comp (fderiv 𝕜 Φ x) = fderiv 𝕜 (fun x => Φ x i) x`. This completes the extraction direction of the Pi fderiv API alongside the existing construction direction (`fderiv_pi`).

Co-authored-by: Fengyang Wang <will1541286313@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

easy < 20s of review time. See the lifecycle page for guidelines. new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! ready-to-merge This PR has been sent to bors. t-analysis Analysis (normed *, calculus)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants