Skip to content

fix: relate casts from Nat and Int in grind rings - #16204

Merged
leodemoura merged 1 commit into
masterfrom
sym-norm-next
Nov 3, 2026
Merged

leodemoura merged 1 commit into
masterfrom
sym-norm-next

Conversation

@leodemoura

Copy link
Copy Markdown
Member

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.

🤖 Generated with Claude Code

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 leodemoura added the changelog-tactics User facing tactics label Nov 3, 2026
@leodemoura
leodemoura enabled auto-merge November 3, 2026 03:29
@leodemoura
leodemoura added this pull request to the merge queue Nov 3, 2026
@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Nov 3, 2026
Merged via the queue into master with commit 04c6814 Nov 3, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-tactics User facing tactics 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.

1 participant