[Merged by Bors] - feat: custom elaborators for differential geometry#27021
[Merged by Bors] - feat: custom elaborators for differential geometry#27021grunweg wants to merge 108 commits intoleanprover-community:masterfrom
Conversation
PR summary b4264fbd75Import changes for modified filesNo significant changes to the import graph Import changes for all files
Declarations diff
You can run this locally as follows## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>The doc-module for No changes to technical debt.You can run this locally as
|
6f64439 to
7c4c0b0
Compare
|
Thanks for this! I agree that this is extremely useful, and should be merged quickly if that's possible. However, I think that the scoping to the |
|
Sure, I'm happy to do this - can you point me at how? |
|
Trying the obvious things (edit: But Yael suggested a fix on zulip, thanks!) |
7d3d364 to
54aae78
Compare
grunweg
left a comment
There was a problem hiding this comment.
Thanks for the comments; let me look into them now!
1ee60c5 to
2dc7a2c
Compare
2dc7a2c to
6a84a48
Compare
This depends on the custom elaborators added in leanprover-community#27021; for some reason, using these fails. To be investigated!
Add two sets of custom elaborators for differential geometry, to
- infer the model with corners in `MDifferentiable{WithinAt,At,On}` or `ContMDiff{WithinAt,At,On}`
expressions from the local context, and provide shorter notation in that setting
- convert a fibre bundle section from a dependent section to a function into the total space,
making working with differentiability of sections of fibre bundles less cumbersome
This was [discussed on zulip](...), to overall broad consensus.
This code has substantial tests and has been tried in the branch in leanprover-community#26221 (uncovering minor issues,
but not substantial ones). The implementation itself is of prototype quality and will be cleaned up
in the future. Once it is more robust, more differential geometry files can be converted to use it.
-----------
I agree that merging not fully polished code is not ideal, but propose doing so for two reasons:
- the work in leanprover-community#26221 used these elaborators extensively (to test them).
Reverting those changes, merging the code, only to re-apply them is not a good use of time.
Merging this PR now enables merging the work in leanprover-community#26221 soon.
- the feature is clearly useful and not going away: in the files that use it, it works well already.
Holding off on further adopting, but merging it now seems like a good compromise.
|
My current opinion is that
I've asked on zulip about this last point. |
|
Added a regression test about the wrong |
3b2f1f2 to
faf1b24
Compare
|
With a little reminder on zulip, I found the right spelling for smoothness and added a test covering it. |
I think that
|
|
In other words: from my side, this PR is ready to get merged. There are a number of folliow-up changes I'd like to make, but these can be subsequent PRs. |
|
LGTM (after updating Mathlib.Lean.Elab.Term + noshake)! 🎉 Thanks so much for your work on this, and to the others who contributed—and especially for your responsiveness during the review process! I'm very excited to see these continue to be iterated on and—hopefully at some not-too-distant date!—start to be used in Mathlib. :) |
|
CI passes on this PR. I've gone over the diff again, and also resolved all stale review comments. I'll keep Thomas' more substantial meta comments open (for future me to re-read them); they are all addressed. All in all, this seems ready for merging (but I'm of course biased). @thorimur Let me just repeat again that I'm really grateful for your extremely detailed review. I learned a lot (and will probably learn more as I return to your comments to re-process them). It was a pleasure, until next time/ one of the follow-up changes :-) |
|
I'm so glad my comments were useful to you! :) I'm always happy to talk about metaprogramming, so if you return to these comments later, feel free to ask me further questions about them (e.g. on Zulip)! :)
Hmm, I'm actually not sure if I should be on the author's list either! I once heard someone say that the authors list is basically the answer to "who do I ping if I need to address something in this file", and from that perspective, I'd be happy to take on the responsibility of being among those pinged. On the other hand, I'm not sure if it's a great idea to set a precedent of receiving authorship credit as a reviewer. I'm perfectly okay with either outcome, but I'd rather defer to an opinion from a maintainer on what should happen here than ask to be there myself. (If this turns out to be complicated, though, perhaps let's leave me off and not hold up the PR any further—I'd like to stay involved with these elaborators, so maybe I'll contribute to this file directly in the future and render the question moot. :) ) |
|
bors d+ |
|
✌️ grunweg can now approve this pull request. To approve and merge a pull request, simply reply with |
|
Thanks for the review! I've added Thomas as an author; let's merge this! |
Add two sets of custom elaborators for differential geometry, to
- infer the model with corners in `MDifferentiable{WithinAt,At,On}` or `ContMDiff{WithinAt,At,On}` expressions from the local context, and provide shorter notation in that setting
- do the same for mfderiv: `mfderiv% f` is shorthand for `mfderiv I J f`; `mfderiv[s] f x` is short for `mfderivWithin I J f s`
- convert a fibre bundle section from a dependent section to a function into the total space, making working with differentiability of sections of fibre bundles less cumbersome
This was [discussed on zulip](https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Differential.20geometry.20elaborators.20experiment/with/528035295), to overall broad consensus.
This code has substantial tests (which have caught bugs in the past). It has also been tested in the branch in #26221 (uncovering minor issues, but not substantial ones
Co-authored-by: thorimur <68410468+thorimur@users.noreply.github.com>
Co-authored-by: thorimur <thomasmurrills@gmail.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
|
Pull request successfully merged into master. Build succeeded: |
This depends on the custom elaborators added in leanprover-community#27021; for some reason, using these fails. To be investigated!
…ity#27021) Add two sets of custom elaborators for differential geometry, to - infer the model with corners in `MDifferentiable{WithinAt,At,On}` or `ContMDiff{WithinAt,At,On}` expressions from the local context, and provide shorter notation in that setting - do the same for mfderiv: `mfderiv% f` is shorthand for `mfderiv I J f`; `mfderiv[s] f x` is short for `mfderivWithin I J f s` - convert a fibre bundle section from a dependent section to a function into the total space, making working with differentiability of sections of fibre bundles less cumbersome This was [discussed on zulip](https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Differential.20geometry.20elaborators.20experiment/with/528035295), to overall broad consensus. This code has substantial tests (which have caught bugs in the past). It has also been tested in the branch in leanprover-community#26221 (uncovering minor issues, but not substantial ones Co-authored-by: thorimur <68410468+thorimur@users.noreply.github.com> Co-authored-by: thorimur <thomasmurrills@gmail.com> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
…ity#27021) Add two sets of custom elaborators for differential geometry, to - infer the model with corners in `MDifferentiable{WithinAt,At,On}` or `ContMDiff{WithinAt,At,On}` expressions from the local context, and provide shorter notation in that setting - do the same for mfderiv: `mfderiv% f` is shorthand for `mfderiv I J f`; `mfderiv[s] f x` is short for `mfderivWithin I J f s` - convert a fibre bundle section from a dependent section to a function into the total space, making working with differentiability of sections of fibre bundles less cumbersome This was [discussed on zulip](https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Differential.20geometry.20elaborators.20experiment/with/528035295), to overall broad consensus. This code has substantial tests (which have caught bugs in the past). It has also been tested in the branch in leanprover-community#26221 (uncovering minor issues, but not substantial ones Co-authored-by: thorimur <68410468+thorimur@users.noreply.github.com> Co-authored-by: thorimur <thomasmurrills@gmail.com> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Add two sets of custom elaborators for differential geometry, to
MDifferentiable{WithinAt,At,On}orContMDiff{WithinAt,At,On}expressions from the local context, and provide shorter notation in that settingmfderiv% fis shorthand formfderiv I J f;mfderiv[s] f xis short formfderivWithin I J f sThis was discussed on zulip, to overall broad consensus.
This code has substantial tests (which have caught bugs in the past). It has also been tested in the branch in #26221 (uncovering minor issues, but not substantial ones --- the worst of which have been fixed).
Many thanks go to
fpvandoorn(for lots of in-person comments on improving the meta code), and tothorimurfor rewriting the entire implementation from ground up to be much more robust and maintainable.A number of tweaks and extensions can be made in future PRs: this set of elaborators is useful already.
Once it is deemed sufficiently robust, differential geometry files can be converted to use it.
From the path towards geodesics and the Levi-Civita connection.
Co-authored-by: Patrick Massot patrickmassot@free.fr