Repository navigation
fix: relate casts from Nat and Int in grind rings - #16204
Merged
Merged
Conversation
This PR fixes `grind` failing on goals that mix a cast from `Nat` and a cast from `Int` into the same ring, such as `(m : Int) (k : Nat) (h : m = k) : (m : R) = (k : R)`. With the new normalizer (`backward.grind.normalizer false`) this also affected goals written as `(m : R) = ((k : Int) : R)`, because the normalizer rewrites `((k : Int) : R)` to `(k : R)`. A ring has two casts, `NatCast.natCast` and `IntCast.intCast`, and congruence only relates applications of the same function, so `↑m` and `↑k` stayed unrelated even when `m = ↑k`. The ring solver now asserts `((a : Int) : α) = ↑a` for each cast `↑a` of a non-numeral from `Nat`, but only once the ring contains a cast of a non-numeral from `Int`. The equation bypasses the normalizer, which would rewrite it to `↑a = ↑a`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leodemoura
enabled auto-merge
November 3, 2026 03:29
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 fixes
grindfailing on goals that mix a cast fromNatand a cast fromIntinto the same ring, such as(m : Int) (k : Nat) (h : m = k) : (m : R) = (k : R). With the new normalizer (backward.grind.normalizer false) this also affected goals written as(m : R) = ((k : Int) : R), because the normalizer rewrites((k : Int) : R)to(k : R).A ring has two casts,
NatCast.natCastandIntCast.intCast, and congruence only relates applications of the same function, so↑mand↑kstayed unrelated even whenm = ↑k. The ring solver now asserts((a : Int) : α) = ↑afor each cast↑aof a non-numeral fromNat, but only once the ring contains a cast of a non-numeral fromInt. The equation bypasses the normalizer, which would rewrite it to↑a = ↑a.🤖 Generated with Claude Code