| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Language.Hasmtlib.Type.MonadSMT
Synopsis
- class MonadState s m => MonadSMT s m where
- var :: forall t s m. (KnownSMTSort t, MonadSMT s m) => m (Expr t)
- smtvar :: forall t s m. (KnownSMTSort t, MonadSMT s m) => m (SMTVar t)
- constant :: KnownSMTSort t => HaskellType t -> Expr t
- quantify :: MonadSMT s m => Expr t -> m (Expr t)
- class MonadSMT s m => MonadIncrSMT s m | m -> s where
- solve :: (MonadIncrSMT s m, MonadIO m) => m (Result, Solution)
Documentation
class MonadState s m => MonadSMT s m where Source #
A MonadState that holds an SMT-Problem.
Methods
smtvar' :: forall t. KnownSMTSort t => Proxy t -> m (SMTVar t) Source #
Construct a variable.
x :: SMTVar RealType <- smtvar' (Proxy @RealType)
var' :: forall t. KnownSMTSort t => Proxy t -> m (Expr t) Source #
Construct a variable as expression.
x :: Expr RealType <- var' (Proxy @RealType)
assert :: Expr BoolSort -> m () Source #
Assert a boolean expression.
x :: Expr IntType <- var @IntType assert $ x + 5 === 42
setOption :: SMTOption -> m () Source #
Set an SMT-Solver-Option.
setOption $ Incremental True
setLogic :: String -> m () Source #
Set the logic for the SMT-Solver to use.
setLogic QF_LRA
Instances
| (MonadState Pipe m, MonadIO m) => MonadSMT Pipe m Source # | |
Defined in Language.Hasmtlib.Type.Pipe | |
| MonadState SMT m => MonadSMT SMT m Source # | |
Defined in Language.Hasmtlib.Type.SMT | |
constant :: KnownSMTSort t => HaskellType t -> Expr t Source #
Create a constant.
>>>constant TrueConstant (BoolValue True)
>>>let x :: Integer = 10 ; constant xConstant (IntValue 10)
>>>constant @IntType 5Constant (IntValue 5)
>>>constant @(BvType 8) 5Constant (BvValue 0000101)
quantify :: MonadSMT s m => Expr t -> m (Expr t) Source #
Assign quantified variables to all quantified subexpressions of an expression. This shall only be used internally. Usually before rendering an assert.
class MonadSMT s m => MonadIncrSMT s m | m -> s where Source #
A MonadSMT that allows incremental solving.
Methods
Push a new context (one) to the solvers context-stack.
Pop the solvers context-stack by one.
Run check-sat on the current problem.
getModel :: m Solution Source #
Run get-model on the current problem. This can be used to decode temporary models within the SMT-Problem.
x <- var RealSort
y <- var RealSort
assert $ x >? y && y <? (-1)
res <- checkSat
case checkSat of
Unsat -> print "Unsat. Cannot get model."
r -> do
model <- getModel
liftIO $ print $ decode model x
getValue :: KnownSMTSort t => Expr t -> m (Maybe (Decoded (Expr t))) Source #
Instances
| (MonadState Pipe m, MonadIO m) => MonadIncrSMT Pipe m Source # | |