-
Notifications
You must be signed in to change notification settings - Fork 741
feat: upstream ToExpr deriving handler from Mathlib
#6473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fix: use prelude in `ToLevel`
fix: ensure `ToLevel.{u}` lives in `Type u` (rather than `Type (u+1)`)
fix: ensure that `ToLevel.{u} : Type`, for all universes `u`
remove old ToLevel pre-merge
use Array.back!
move namespace to Lean.Elab.Deriving.ToExpr
This also ensures that `mkLet` is resolved to `Lean.Elab.Deriving.mkLet` (as intended) instead of `Lean.mkLet`
deriving test cases
The final test case currently fails, exposing a bug when auto implicits are disabled
expand test to actually exercise generated instance
expand tests to include ambient and directly specified universes
expand tests to exercise explicitly provided universes, even when autoImplicits are enabled
fix test by correctly scoping universe
fix: only explicitly declare universe levels that are *not* already present in the ambient context
"fix" test
Turns out I had a typo in the argument list. The problem was not with implicit universes, rather it was with implicit parameters.
Also adds new testcases to expose this bug properly
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Dec 29, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Dec 29, 2024
Collaborator
|
Mathlib CI status (docs):
|
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Dec 30, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Dec 30, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Dec 30, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Dec 30, 2024
ToExpr deriving handler MathlibToExpr deriving handler from Mathlib
jcommelin
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Jan 17, 2025
* chore: bump to nightly-2024-12-23 * chore: adaptations for nightly-2024-12-23 (#20196) Co-authored-by: Kim Morrison <kim@tqft.net> Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Junyan Xu <junyanxu.math@gmail.com> Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com> Co-authored-by: Mitchell Lee <trivial171@gmail.com> Co-authored-by: Joël Riou <joel.riou@universite-paris-saclay.fr> Co-authored-by: Christian Merten <christian@merten.dev> Co-authored-by: Artie Khovanov <artem.khovanov@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Eric Wieser <efw@google.com> * fix * chore: bump to nightly-2024-12-24 * Merge master into nightly-testing * chore: bump to nightly-2024-12-25 * Merge master into nightly-testing * chore: bump to nightly-2024-12-26 * chore: bump to nightly-2024-12-27 * Merge master into nightly-testing * chore: bump to nightly-2024-12-28 * Merge master into nightly-testing * fix * fix * fix * chore: bump to nightly-2024-12-29 * Merge master into nightly-testing * deprecations * revert * revert * revert * Update lean-toolchain for testing leanprover/lean4#6473 * remove DeriveToExpr * Trigger CI for leanprover/lean4#6473 * fix * chore: bump to nightly-2024-12-30 * Merge master into nightly-testing * Trigger CI for leanprover/lean4#6473 * chore: bump to nightly-2024-12-31 * Merge master into nightly-testing * chore: bump to nightly-2025-01-01 * Merge master into nightly-testing * chore: bump to nightly-2025-01-02 * fix * partial fix * fix hopefully * chore: adaptations for nightly-2025-01-02 * chore: bump to nightly-2025-01-03 * chore: adaptations for nightly-2025-01-03 * chore: bump to nightly-2025-01-04 * fixes * shake --update * chore: bump to nightly-2025-01-05 * Merge master into nightly-testing * chore: bump to nightly-2025-01-06 * bump batteries * chore: bump to nightly-2025-01-07 * chore: bump to nightly-2025-01-08 * chore: bump to nightly-2025-01-09 * bump batteries * bump deps * fix * chore: adaptations for nightly-2025-01-09 * chore: bump to nightly-2025-01-10 * remove upstreamed * Update lean-toolchain for testing leanprover/lean4#6602 * Trigger CI for leanprover/lean4#6602 * fix breakage caused by leanprover/lean4#6602 * chore: adaptations for nightly-2025-01-10 * fix merge * avoid nonrec for leanprover/lean4#6602 * Trigger CI for leanprover/lean4#6602 * chore: bump to nightly-2025-01-14 * bump * fixes * fixes * fixes * chore: bump to nightly-2025-01-15 * fix * empty commit to bump CI * Update lean-toolchain for testing leanprover/lean4#6660 * fixes for leanprover/lean4#6660 * chore: bump to nightly-2025-01-16 * fix * move batteries back to nightly-testing * move batteries back to nightly-testing --------- Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Johan Commelin <johan@commelin.net> Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Junyan Xu <junyanxu.math@gmail.com> Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com> Co-authored-by: Mitchell Lee <trivial171@gmail.com> Co-authored-by: Joël Riou <joel.riou@universite-paris-saclay.fr> Co-authored-by: Christian Merten <christian@merten.dev> Co-authored-by: Artie Khovanov <artem.khovanov@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Eric Wieser <efw@google.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: Parth Shastri <31370288+cppio@users.noreply.github.com>
luisacicolini
pushed a commit
to opencompl/lean4
that referenced
this pull request
Jan 21, 2025
This PR adds a deriving handler for the `ToExpr` class. It can handle mutual and nested inductive types, however it falls back to creating `partial` instances in such cases. This is upstreamed from the Mathlib deriving handler written by @kmill, but has fixes to handle autoimplicit universe level variables. This is a followup to leanprover#6285 (adding the `ToLevel` class). This PR supersedes leanprover#5906. Co-authored-by: Alex Keizer <alex@keizer.dev> --------- Co-authored-by: Alex Keizer <alex@keizer.dev>
JovanGerb
pushed a commit
to JovanGerb/lean4
that referenced
this pull request
Jan 21, 2025
This PR adds a deriving handler for the `ToExpr` class. It can handle mutual and nested inductive types, however it falls back to creating `partial` instances in such cases. This is upstreamed from the Mathlib deriving handler written by @kmill, but has fixes to handle autoimplicit universe level variables. This is a followup to leanprover#6285 (adding the `ToLevel` class). This PR supersedes leanprover#5906. Co-authored-by: Alex Keizer <alex@keizer.dev> --------- Co-authored-by: Alex Keizer <alex@keizer.dev>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
builds-mathlib
CI has verified that Mathlib builds against this PR
changelog-language
Language features and metaprograms
toolchain-available
A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a deriving handler for the
ToExprclass. It can handle mutual and nested inductive types, however it falls back to creatingpartialinstances in such cases. This is upstreamed from the Mathlib deriving handler written by @kmill, but has fixes to handle autoimplicit universe level variables.This is a followup to #6285 (adding the
ToLevelclass). This PR supersedes #5906.Co-authored-by: Alex Keizer alex@keizer.dev