fix: canonicalize `OfNat` instances of nested numerals in `grind` This PR fixes `grind` producing a proof the kernel rejects (`decide (4 = 4) = false`) when a numeral is written as `OfNat.ofNat 4`. The canonicalizer replaced the nested numeral argument of `OfNat.ofNat` with a raw literal, but kept the instance `instOfNatNat (OfNat.ofNat 4)`: the instance was resynthesized for its own type, which still mentions the nested numeral, so resynthesis returned it unchanged. The two spellings of `4` then became distinct interpreted nodes in the E-graph, and `grind` closed the goal using the incorrect fact that they denote distinct values. The instance is now resynthesized for `OfNat α n` with the canonical `α` and `n`. In addition, nested numerals of any depth, such as `@OfNat.ofNat Nat (@OfNat.ofNat Nat 4 _) _`, are now reduced to a raw literal. Closes #15604 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This is the repository for Lean 4.
See Install Lean.
Please read our Contribution Guidelines first.
See Building Lean.