Compare commits

...

3 Commits

Author SHA1 Message Date
Leonardo de Moura
acb77d37d2 test: 2025-05-10 22:22:12 +01:00
Leonardo de Moura
fedcc7b108 fix: incorrect condition
We now have implies_congr
2025-05-10 22:21:45 +01:00
Leonardo de Moura
b341e188b8 fix: missing check 2025-05-10 22:15:50 +01:00
3 changed files with 14 additions and 5 deletions

View File

@@ -37,6 +37,12 @@ where
proof? := proofNew?
}
/--
Returns `true` if the parent is relevant for congruence closure.
-/
private def isCongrRelevant (parent : Expr) : Bool :=
parent.isApp || parent.isArrow
/--
Removes `root` parents from the congruence table.
This is an auxiliary function performed while merging equivalence classes.
@@ -45,7 +51,7 @@ private def removeParents (root : Expr) : GoalM ParentSet := do
let parents getParents root
for parent in parents do
-- Recall that we may have `Expr.forallE` in `parents` because of `ForallProp.lean`
if ( pure parent.isApp <&&> isCongrRoot parent) then
if ( pure (isCongrRelevant parent) <&&> isCongrRoot parent) then
trace_goal[grind.debug.parent] "remove: {parent}"
modify fun s => { s with congrTable := s.congrTable.erase { e := parent } }
return parents
@@ -56,7 +62,7 @@ This is an auxiliary function performed while merging equivalence classes.
-/
private def reinsertParents (parents : ParentSet) : GoalM Unit := do
for parent in parents do
if ( pure parent.isApp <&&> isCongrRoot parent) then
if ( pure (isCongrRelevant parent) <&&> isCongrRoot parent) then
trace_goal[grind.debug.parent] "reinsert: {parent}"
addCongrTable parent

View File

@@ -37,13 +37,13 @@ def propagateForallPropUp (e : Expr) : GoalM Unit := do
where
propagateImpliesUp (a b : Expr) : GoalM Unit := do
unless ( alreadyInternalized b) do return ()
if ( isEqFalse a) then
if ( isEqFalse a <&&> isProp b) then
-- a = False → (a → b) = True
pushEqTrue e <| mkApp3 (mkConst ``Grind.imp_eq_of_eq_false_left) a b ( mkEqFalseProof a)
else if ( isEqTrue a) then
else if ( isEqTrue a <&&> isProp b) then
-- a = True → (a → b) = b
pushEq e b <| mkApp3 (mkConst ``Grind.imp_eq_of_eq_true_left) a b ( mkEqTrueProof a)
else if ( isEqTrue b) then
else if ( isEqTrue b <&&> isProp a) then
-- b = True → (a → b) = True
pushEqTrue e <| mkApp3 (mkConst ``Grind.imp_eq_of_eq_true_right) a b ( mkEqTrueProof b)
else if ( isEqFalse b <&&> isEqTrue e <&&> isProp a) then

View File

@@ -47,3 +47,6 @@ example (a b c d e v : Nat) : f v = c → f (g b) = d → a = e → b = e → v
-- arrow congruence test
example : α = α' α'' = α' β' = β (α β) = (α'' β') := by
grind
example (a b c : Nat) (h₁ : a = c) (h₂ : b = c) : (a = b Nat) = (b = a Nat) := by
grind