You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The implementation of ReducibilityHints.lt was previously giving the ordering
.abbrev < .regular 1 < .regular 10 < .opaque
while the kernel is using a three-way comparison function compare(reducibility_hints, reducibility_hints) which returns -1 when the first argument should be unfolded and 1 when the second argument should be unfolded, where the one that should be unfolded is larger in the following ranking:
.opaque < .regular 1 < .regular 10 < .abbrev
Both of these are a bit weird (the compare function has reversed interpretation compared to strcmp, and the lean function gets the roles of .abbrev and .opaque mixed up). What is more, the interpretation of the lean ordering is also reversed in ExprDefEq, meaning that it actually implements the ordering
.opaque < .regular 10 < .regular 1 < .abbrev
which is almost but not quite the same as the kernel ordering.
My fix is to make the .lt function clearly represent "more reducible" with .abbrev at the top and .opaque at the bottom, and covariant in the definitional height (higher = more reducible). I have chosen not to negate the output values of compare, although this would also be a reasonable refactor. Should lean just have a three-way comparison as well?
❗ Mathlib CI can not be attempted yet, as the 'nightly-testing-2023-11-04' branch does not exist there yet. We will retry when you push more commits. It may be necessary to rebase onto 'nightly' tomorrow. (2023-11-04 14:35:57)
Apologies for the breaks-mathlib. Until #2734 hits a nightly release anything on top of that is going to break mathlib. After the next nightly release, touching this PR should be sufficient to make the Mathlib CI come good.
Apparently there is a small breakage in Mathlib (a dsimp fixes a universe unification problem)? This seems slightly surprising to me; @digama0, could you please check it out? leanprover-community/mathlib4#8289
ghost
added
builds-mathlib
CI has verified that Mathlib builds against this PR
and removed
breaks-mathlib
This is not necessarily a blocker for merging: but there needs to be a plan
labels
Nov 9, 2023
No, this PR and #3964 are identical up to a global flip of the ordering relation. Although I would like to ask @leodemoura to comment on this choice explicitly: If a.lt b are reducibilities then intuitively b should be "more reducible" and a should be "less reducible", such that when deciding between them we would prefer to unfold b. #3964 makes the opposite choice without comment. However it is consistent with the reducibility_hints::compare and clearly a smaller diff, so in any case this PR is no longer needed.
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
builds-mathlibCI has verified that Mathlib builds against this PRtoolchain-availableA toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
2 participants
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.
The implementation of
ReducibilityHints.ltwas previously giving the orderingwhile the kernel is using a three-way comparison function
compare(reducibility_hints, reducibility_hints)which returns-1when the first argument should be unfolded and1when the second argument should be unfolded, where the one that should be unfolded is larger in the following ranking:Both of these are a bit weird (the
comparefunction has reversed interpretation compared tostrcmp, and the lean function gets the roles of.abbrevand.opaquemixed up). What is more, the interpretation of the lean ordering is also reversed inExprDefEq, meaning that it actually implements the orderingwhich is almost but not quite the same as the kernel ordering.
My fix is to make the
.ltfunction clearly represent "more reducible" with.abbrevat the top and.opaqueat the bottom, and covariant in the definitional height (higher = more reducible). I have chosen not to negate the output values ofcompare, although this would also be a reasonable refactor. Should lean just have a three-way comparison as well?