fix: revisit `grind` match conditions when nested subterms gain a constructor This PR fixes `grind` missing a `match`-expression condition when a constructor for a nested subterm arrives after the outer merge. For example, given `h : ∀ n, v = .lit (.nat n) → False`, `grind` closed the goal from `l = .nat m` and `v = .lit l` only when the facts arrived in that order. The same issue prevented conditions of `match` equations from becoming true, e.g., `f v = 2` for `f` with the alternatives `.lit (.nat _) => 1 | _ => 2`, given `v = .lit l` and `l = .str s` from a case split. The root cause was that `internalizeMatchCond` registers a `Grind.MatchCond` as a parent of the left-hand sides of its equations only, but `isSatisfied` and `tryToProveFalse` also inspect the fields of the constructor applications at the roots of their equivalence classes. In the example above, merging `l` with `.nat m` changes the equivalence class of `l`, not of `v`, so the condition was never revisited. The fix makes `isSatisfied` register the condition as a parent of each nested subterm blocking the decision: a subterm whose root is neither a constructor application nor a literal value, at a position where the pattern is not a pattern variable. Since `isSatisfied` runs on every visit of the condition, this covers both propagators. The `grind.debug` invariant checker now accepts these nested parents. Closes #15697 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.