ufmg-smite / lean-smt

Tactics for discharging Lean goals into SMT solvers.
Apache License 2.0
89 stars 18 forks source link

`Iff` is translated as an uninterpreted function, leading to wrong results #121

Open dranov opened 2 months ago

dranov commented 2 months ago
import Smt

set_option trace.smt true
set_option trace.smt.solve true

variable {node : Type} [Nonempty node]

theorem wrong (a : node → Prop)
: ∀ n, a n ↔ a n := by smt

The generated query is:

(set-logic ALL)
(declare-sort node 0)
(declare-fun a (node) Bool)
(declare-fun Iff (Bool Bool) Bool)
(assert (not (forall ((n node)) (Iff (a n) (a n)))))
(check-sat) 

which returns sat

dranov commented 1 month ago

The change in PR #122 seems sufficient.

abdoo8080 commented 1 month ago

Hi @dranov! Thanks for filing the bug and working on a fix. While your PR is sound, the proof reconstruction part of the tactic is not aware of the change, which might cause Lean to reject the reconstructed proof. To avoid confusion, it's better to eliminate Iff in a pre-processing step. PR #123 addresses this for the most part, though there may still be some corner cases. We'll have a proper solution once we start integrating lean-smt with lean-auto.

dranov commented 1 month ago

That makes sense. Thank you for the quick fix!