Skip to content
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

fix: ignore unused alternatives in Ord derive handler #3725

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

arthur-adjedj
Copy link
Contributor

Closes #3706

This derive handler's implementation is very similar to BEq's, which already ignores unused alternative so as to work correctly on indexed inductive types. This PR simply implements the same solution as the one present in BEq.lean.

After some tests, it doesn't seem like any other derive handler present in Core suffers from the same issue (though some handlers don't work on indexed inductives for other reasons).

@arthur-adjedj arthur-adjedj requested a review from kim-em as a code owner March 21, 2024 07:43
@github-actions github-actions bot added the awaiting-review Waiting for someone to review the PR label Mar 21, 2024
Closes leanprover#3706
This derive handler's implementation is very similar to `BEq`'s, which already ignores unused alternative so as to work correctly on indexed inductive types. This PR simply implements the same solution as the one present in `BEq.lean`.
@arthur-adjedj
Copy link
Contributor Author

WIP

@github-actions github-actions bot added WIP This is work in progress, and only a PR for the sake of CI or sharing. No review yet. toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN and removed awaiting-review Waiting for someone to review the PR labels Mar 21, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Mar 21, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Mar 21, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Mar 21, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

leanprover-community-mathlib4-bot commented Mar 21, 2024

Mathlib CI status (docs):

leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Mar 21, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Mar 21, 2024
@arthur-adjedj
Copy link
Contributor Author

awaiting-review

@github-actions github-actions bot added awaiting-review Waiting for someone to review the PR and removed WIP This is work in progress, and only a PR for the sake of CI or sharing. No review yet. labels Mar 21, 2024
Copy link
Collaborator

@nomeata nomeata left a comment

Choose a reason for hiding this comment

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

If it’s good for BEq, then surely also for Ord. Thanks!

@nomeata nomeata added this pull request to the merge queue Mar 21, 2024
Merged via the queue into leanprover:master with commit bf8b66c Mar 21, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review Waiting for someone to review the PR builds-mathlib CI has verified that Mathlib builds against this PR toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

deriving an ord instance fails with redundant alternative
3 participants