Download src/Proof/Produce.hs from Snapkitty/pure-validity: direct link, hf CLI and curl.
- Browser
- Download file 864 Bytes
-
https://huggingface.co/Snapkitty/pure-validity/resolve/main/src/Proof/Produce.hs
- Command line
-
hf download hf://Snapkitty/pure-validity/src/Proof/Produce.hs
-
curl -L -o Produce.hs https://huggingface.co/Snapkitty/pure-validity/resolve/main/src/Proof/Produce.hs
864 Bytes
| 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 | |