feat: cancel common terms in `Nat` subtraction in the `Sym.simp` `grind` normalizer (#15884) This PR makes the `Sym.simp`-based `grind` normalizer (`backward.grind.normalizer := false`) cancel the common part of both sides of a `Nat` subtraction, as the legacy normalizer does with `Nat.reduceSubDiff`: `n + 1 - 1` becomes `n`, `n + 2 - 1` becomes `n + 1`, and `3 - (n + 1)` becomes `2 - n`. Common monomials are cancelled too, so `n + k - k` becomes `n` and `x * y + 3 - (x * y + z + 1)` becomes `2 - z`. Without this, `[:n].size` unfolds to `n + 1 - 1`. Cutsat knows that this equals `n`, but the E-graph does not, so goals where the two terms occur under binders could not be closed by congruence. The new `post` simproc `Sym.Simp.simpNatSub` calls `Sym.Arith.cancelNatSub?`, which normalizes both sides, takes the monomial-wise minimum `c` of their polynomials, and rewrites `(a' + c) - (b' + c)` to `a' - b'` using `eq_normS` and `Nat.add_sub_add_right`. As with other facts the normalizer proves, `grind` now rejects theorems such as `Nat.add_sub_cancel` as having no usable pattern. 🤖 Generated with [Claude Code](https://claude.com/claude-code) 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.