Repository navigation
fix: classify negative literals in grind by their syntactic type - #16341
Merged
Merged
Conversation
This PR fixes the `grind` internal error "linarith term has not been internalized" on negative numerals such as `-1 : T`, where `T` unfolds to `Int` and has an ordered `IntModule` instance but no `CommRing` instance. `getLitKind` unfolded `T` with `whnfD`, so it classified `-1 : T` as a literal and `internalize` skipped the inner `1`. `linarith` reifies `-1 : T` as the negation of `1` and needs that `1`. A negative literal's type must now be literally `Int`, `Int8`, `Int16`, `Int32`, or `Int64`, as in `isInterpreted`. The `Int8`..`Int64` goals from #16286 already succeed since #16298 and are included as regression tests. Closes #16286 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leodemoura
enabled auto-merge
November 7, 2026 22:21
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 the
grindinternal error "linarith term has not been internalized" on negative numerals such as-1 : T, whereTunfolds toIntand has an orderedIntModuleinstance but noCommRinginstance.getLitKindunfoldedTwithwhnfD, so it classified-1 : Tas a literal andinternalizeskipped the inner1.linarithreifies-1 : Tas the negation of1and needs that1. A negative literal's type must now be literallyInt,Int8,Int16,Int32, orInt64, as inisInterpreted. TheInt8..Int64goals from #16286 already succeed since #16298 and are included as regression tests.Closes #16286
🤖 Generated with Claude Code