fix: stale congruence root after merging equivalence classes in `grind` This PR fixes a `grind.debug` invariant violation in `checkEqc` on goals such as `(p && p && q) = (p && q)`. When `addEqStep` merges two equivalence classes, it writes back the node of the new root using a copy taken before the merge. If the new root is also a parent of the old root, `reinsertParents` may update its `congr` field during the merge, and the write-back reverted this update. In the example, merging `p = false ∨ q = false` with `q = false` makes it congruent to `p = false ∨ (p = false ∨ q = false)`, but its `congr` field kept pointing to itself, so the congruence table and the node disagreed. The root node is now retrieved again before it is updated, as was already done for the old root. Closes #15871 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.