fix: stale congruence table entries in `grind` for `MatchCond` and `ite` nodes

This PR fixes two ways a `grind` congruence table entry could go stale, which made `grind.debug` fail nondeterministically on goals with `match` conditions, and adds a deterministic invariant check for the table.

`MatchCond` nodes are not meant to be in the congruence table, but `reinsertParents` added them when a match-condition lhs merged, hashed on the root of their argument, of which they are not a registered parent. `ite` nodes are hashed on all their arguments but were registered as a parent of the condition only, so a branch internalized through another term and merged left the entry stale. `MatchCond` nodes are now excluded from reinsertion, `ite` nodes are registered as parents of all their arguments, and `grind.debug` checks that every table entry is a congruence root found by its own key.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
5 files changed