File size: 864 Bytes
56de343 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | module Proof.Produce (proveValidity, proveUNSAT) where
import IR.Boolean
import SAT.CNF
import SAT.DPLL (dpll)
import qualified SAT.DPLL as DPLL
import Proof.Certificate
import qualified Data.Map.Strict as Map
proveValidity :: String -> BExpr -> ProofCertificate
proveValidity name expr =
let negated = BNand expr expr
cnf = tseitin negated
in case dpll cnf of
DPLL.UNSAT ->
emptyProof name Valid
DPLL.SAT counterexample ->
let ce = Map.toList counterexample
in (emptyProof name (CounterExample ce))
{ proofSteps = [Assumption [Neg 0]] }
proveUNSAT :: String -> BExpr -> ProofCertificate
proveUNSAT name expr =
let cnf = tseitin expr
in case dpll cnf of
DPLL.UNSAT ->
emptyProof name Unsatisfiable
DPLL.SAT _ ->
emptyProof name Valid
|