Copyright | (c) Galois Inc 2015-2020 |
---|---|
License | BSD3 |
Maintainer | Rob Dockins <rdockins@galois.com> |
Safe Haskell | None |
Language | Haskell2010 |
The module reexports the most commonly used types and operations for interacting with solvers.
Synopsis
- data SolverAdapter st = SolverAdapter {
- solver_adapter_name :: !String
- solver_adapter_config_options :: ![ConfigDesc]
- solver_adapter_check_sat :: !(forall t fs a. ExprBuilder t st fs -> LogData -> [BoolExpr t] -> (SatResult (GroundEvalFn t, Maybe (ExprRangeBindings t)) () -> IO a) -> IO a)
- solver_adapter_write_smt2 :: !(forall t fs. ExprBuilder t st fs -> Handle -> [BoolExpr t] -> IO ())
- type ExprRangeBindings t = RealExpr t -> IO (Maybe Rational, Maybe Rational)
- defaultSolverAdapter :: ConfigOption (BaseStringType Unicode)
- solverAdapterOptions :: [SolverAdapter st] -> IO ([ConfigDesc], IO (SolverAdapter st))
- data LogData = LogData {}
- logCallback :: LogData -> String -> IO ()
- defaultLogData :: LogData
- smokeTest :: ExprBuilder t st fs -> SolverAdapter st -> IO (Maybe SomeException)
- module What4.SatResult
- data ExternalABC = ExternalABC
- externalABCAdapter :: SolverAdapter st
- abcPath :: ConfigOption (BaseStringType Unicode)
- abcOptions :: [ConfigDesc]
- runExternalABCInOverride :: ExprBuilder t st fs -> LogData -> [BoolExpr t] -> (SatResult (GroundEvalFn t, Maybe (ExprRangeBindings t)) () -> IO a) -> IO a
- writeABCSMT2File :: ExprBuilder t st fs -> Handle -> [BoolExpr t] -> IO ()
- data Boolector = Boolector
- boolectorAdapter :: SolverAdapter st
- boolectorPath :: ConfigOption (BaseStringType Unicode)
- runBoolectorInOverride :: ExprBuilder t st fs -> LogData -> [BoolExpr t] -> (SatResult (GroundEvalFn t, Maybe (ExprRangeBindings t)) () -> IO a) -> IO a
- withBoolector :: ExprBuilder t st fs -> FilePath -> LogData -> (Session t Boolector -> IO a) -> IO a
- boolectorOptions :: [ConfigDesc]
- boolectorFeatures :: ProblemFeatures
- data CVC4 = CVC4
- cvc4Adapter :: SolverAdapter st
- cvc4Path :: ConfigOption (BaseStringType Unicode)
- runCVC4InOverride :: ExprBuilder t st fs -> LogData -> [BoolExpr t] -> (SatResult (GroundEvalFn t, Maybe (ExprRangeBindings t)) () -> IO a) -> IO a
- writeCVC4SMT2File :: ExprBuilder t st fs -> Handle -> [BoolExpr t] -> IO ()
- withCVC4 :: ExprBuilder t st fs -> FilePath -> LogData -> (Session t CVC4 -> IO a) -> IO a
- cvc4Options :: [ConfigDesc]
- cvc4Features :: ProblemFeatures
- data DReal = DReal
- type DRealBindings = Map Text (Either Bool (Maybe Rational, Maybe Rational))
- drealAdapter :: SolverAdapter st
- drealPath :: ConfigOption (BaseStringType Unicode)
- runDRealInOverride :: ExprBuilder t st fs -> LogData -> [BoolExpr t] -> (SatResult (WriterConn t (Writer DReal), DRealBindings) () -> IO a) -> IO a
- writeDRealSMT2File :: ExprBuilder t st fs -> Handle -> [BoolExpr t] -> IO ()
- data STP = STP
- stpAdapter :: SolverAdapter st
- stpPath :: ConfigOption (BaseStringType Unicode)
- runSTPInOverride :: ExprBuilder t st fs -> LogData -> [BoolExpr t] -> (SatResult (GroundEvalFn t, Maybe (ExprRangeBindings t)) () -> IO a) -> IO a
- withSTP :: ExprBuilder t st fs -> FilePath -> LogData -> (Session t STP -> IO a) -> IO a
- stpOptions :: [ConfigDesc]
- stpFeatures :: ProblemFeatures
- yicesAdapter :: SolverAdapter t
- yicesPath :: ConfigOption (BaseStringType Unicode)
- runYicesInOverride :: ExprBuilder t st fs -> LogData -> [BoolExpr t] -> (SatResult (GroundEvalFn t) () -> IO a) -> IO a
- writeYicesFile :: ExprBuilder t st fs -> FilePath -> BoolExpr t -> IO ()
- yicesOptions :: [ConfigDesc]
- yicesDefaultFeatures :: ProblemFeatures
- data Z3 = Z3
- z3Path :: ConfigOption (BaseStringType Unicode)
- z3Adapter :: SolverAdapter st
- runZ3InOverride :: ExprBuilder t st fs -> LogData -> [BoolExpr t] -> (SatResult (GroundEvalFn t, Maybe (ExprRangeBindings t)) () -> IO a) -> IO a
- withZ3 :: ExprBuilder t st fs -> FilePath -> LogData -> (Session t Z3 -> IO a) -> IO a
- z3Options :: [ConfigDesc]
- z3Features :: ProblemFeatures
Solver Adapters
data SolverAdapter st Source #
The main interface for interacting with a solver in an "offline" fashion, which means that a new solver process is started for each query.
SolverAdapter | |
|
Instances
Eq (SolverAdapter st) Source # | |
Defined in What4.Solver.Adapter (==) :: SolverAdapter st -> SolverAdapter st -> Bool # (/=) :: SolverAdapter st -> SolverAdapter st -> Bool # | |
Ord (SolverAdapter st) Source # | |
Defined in What4.Solver.Adapter compare :: SolverAdapter st -> SolverAdapter st -> Ordering # (<) :: SolverAdapter st -> SolverAdapter st -> Bool # (<=) :: SolverAdapter st -> SolverAdapter st -> Bool # (>) :: SolverAdapter st -> SolverAdapter st -> Bool # (>=) :: SolverAdapter st -> SolverAdapter st -> Bool # max :: SolverAdapter st -> SolverAdapter st -> SolverAdapter st # min :: SolverAdapter st -> SolverAdapter st -> SolverAdapter st # | |
Show (SolverAdapter st) Source # | |
Defined in What4.Solver.Adapter showsPrec :: Int -> SolverAdapter st -> ShowS # show :: SolverAdapter st -> String # showList :: [SolverAdapter st] -> ShowS # |
type ExprRangeBindings t = RealExpr t -> IO (Maybe Rational, Maybe Rational) Source #
Function that calculates upper and lower bounds for real-valued elements. This type is used for solvers (e.g., dReal) that give only approximate solutions.
solverAdapterOptions :: [SolverAdapter st] -> IO ([ConfigDesc], IO (SolverAdapter st)) Source #
A collection of operations for producing output from solvers.
Solvers can produce messages at varying verbosity levels that
might be appropriate for user output by using the logCallbackVerbose
operation. If a logHandle
is provided, the entire interaction
sequence with the solver will be mirrored into that handle.
smokeTest :: ExprBuilder t st fs -> SolverAdapter st -> IO (Maybe SomeException) Source #
Test the ability to interact with a solver by peforming a check-sat query on a trivially unsatisfiable problem.
module What4.SatResult
ABC (external, via SMT-Lib2)
data ExternalABC Source #
Instances
abcPath :: ConfigOption (BaseStringType Unicode) Source #
Path to ABC
abcOptions :: [ConfigDesc] Source #
runExternalABCInOverride :: ExprBuilder t st fs -> LogData -> [BoolExpr t] -> (SatResult (GroundEvalFn t, Maybe (ExprRangeBindings t)) () -> IO a) -> IO a Source #
writeABCSMT2File :: ExprBuilder t st fs -> Handle -> [BoolExpr t] -> IO () Source #
Boolector
Instances
boolectorAdapter :: SolverAdapter st Source #
boolectorPath :: ConfigOption (BaseStringType Unicode) Source #
Path to boolector
runBoolectorInOverride :: ExprBuilder t st fs -> LogData -> [BoolExpr t] -> (SatResult (GroundEvalFn t, Maybe (ExprRangeBindings t)) () -> IO a) -> IO a Source #
:: ExprBuilder t st fs | |
-> FilePath | Path to Boolector executable |
-> LogData | |
-> (Session t Boolector -> IO a) | Action to run |
-> IO a |
Run Boolector in a session. Boolector will be configured to produce models, but otherwise left with the default configuration.
CVC4
Instances
cvc4Adapter :: SolverAdapter st Source #
cvc4Path :: ConfigOption (BaseStringType Unicode) Source #
Path to cvc4
runCVC4InOverride :: ExprBuilder t st fs -> LogData -> [BoolExpr t] -> (SatResult (GroundEvalFn t, Maybe (ExprRangeBindings t)) () -> IO a) -> IO a Source #
writeCVC4SMT2File :: ExprBuilder t st fs -> Handle -> [BoolExpr t] -> IO () Source #
:: ExprBuilder t st fs | |
-> FilePath | Path to CVC4 executable |
-> LogData | |
-> (Session t CVC4 -> IO a) | Action to run |
-> IO a |
Run CVC4 in a session. CVC4 will be configured to produce models, but otherwise left with the default configuration.
cvc4Options :: [ConfigDesc] Source #
DReal
Instances
Show DReal Source # | |
SMTLib2Tweaks DReal Source # | |
Defined in What4.Solver.DReal smtlib2tweaks :: DReal Source # smtlib2exitCommand :: Maybe Command Source # smtlib2arrayType :: [Sort] -> Sort -> Sort Source # smtlib2arrayConstant :: Maybe ([Sort] -> Sort -> Term -> Term) Source # smtlib2arraySelect :: Term -> [Term] -> Term Source # smtlib2arrayUpdate :: Term -> [Term] -> Term -> Term Source # smtlib2StringSort :: Sort Source # smtlib2StringTerm :: ByteString -> Term Source # smtlib2StringLength :: Term -> Term Source # smtlib2StringAppend :: [Term] -> Term Source # smtlib2StringContains :: Term -> Term -> Term Source # smtlib2StringIndexOf :: Term -> Term -> Term -> Term Source # smtlib2StringIsPrefixOf :: Term -> Term -> Term Source # smtlib2StringIsSuffixOf :: Term -> Term -> Term Source # smtlib2StringSubstring :: Term -> Term -> Term -> Term Source # smtlib2StructSort :: [Sort] -> Sort Source # smtlib2StructCtor :: [Term] -> Term Source # |
drealAdapter :: SolverAdapter st Source #
drealPath :: ConfigOption (BaseStringType Unicode) Source #
Path to dReal
:: ExprBuilder t st fs | |
-> LogData | |
-> [BoolExpr t] | propositions to check |
-> (SatResult (WriterConn t (Writer DReal), DRealBindings) () -> IO a) | |
-> IO a |
writeDRealSMT2File :: ExprBuilder t st fs -> Handle -> [BoolExpr t] -> IO () Source #
STP
Instances
stpAdapter :: SolverAdapter st Source #
stpPath :: ConfigOption (BaseStringType Unicode) Source #
Path to stp
runSTPInOverride :: ExprBuilder t st fs -> LogData -> [BoolExpr t] -> (SatResult (GroundEvalFn t, Maybe (ExprRangeBindings t)) () -> IO a) -> IO a Source #
:: ExprBuilder t st fs | |
-> FilePath | Path to STP executable |
-> LogData | |
-> (Session t STP -> IO a) | Action to run |
-> IO a |
Run STP in a session. STP will be configured to produce models, buth otherwise left with the default configuration.
stpOptions :: [ConfigDesc] Source #
Yices
yicesAdapter :: SolverAdapter t Source #
yicesPath :: ConfigOption (BaseStringType Unicode) Source #
Path to yices
runYicesInOverride :: ExprBuilder t st fs -> LogData -> [BoolExpr t] -> (SatResult (GroundEvalFn t) () -> IO a) -> IO a Source #
Run writer and get a yices result.
:: ExprBuilder t st fs | Builder for getting current bindings. |
-> FilePath | Path to file |
-> BoolExpr t | Predicate to check |
-> IO () |
Write a yices file that checks the satisfiability of the given predicate.
yicesOptions :: [ConfigDesc] Source #
Z3
Instances
z3Path :: ConfigOption (BaseStringType Unicode) Source #
Path to Z3
z3Adapter :: SolverAdapter st Source #
runZ3InOverride :: ExprBuilder t st fs -> LogData -> [BoolExpr t] -> (SatResult (GroundEvalFn t, Maybe (ExprRangeBindings t)) () -> IO a) -> IO a Source #
:: ExprBuilder t st fs | |
-> FilePath | Path to Z3 executable |
-> LogData | |
-> (Session t Z3 -> IO a) | Action to run |
-> IO a |
Run Z3 in a session. Z3 will be configured to produce models, but otherwise left with the default configuration.
z3Options :: [ConfigDesc] Source #