Copyright | (c) 2020 Galois Inc. |
---|---|
License | BSD3 |
Maintainer | cryptol@galois.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- data What4 sym = What4 {}
- type What4FunCache sym = Map Text (SomeSymFn sym)
- data SomeSymFn sym = forall args ret. SomeSymFn (SymFn sym args ret)
- newtype W4Eval sym a = W4Eval {
- evalPartial :: W4Conn sym (W4Result sym a)
- newtype W4Conn sym a = W4Conn {}
- data W4Result sym a
- = W4Error !EvalErrorEx
- | W4Result !(Pred sym) !a
- w4Eval :: W4Eval sym a -> sym -> Eval (W4Result sym a)
- w4Thunk :: Eval (W4Result sym a) -> W4Eval sym a
- doEval :: IsSymExprBuilder sym => Eval a -> W4Conn sym a
- total :: IsSymExprBuilder sym => W4Conn sym a -> W4Eval sym a
- getSym :: W4Conn sym sym
- w4And :: IsSymExprBuilder sym => Pred sym -> Pred sym -> W4Conn sym (Pred sym)
- w4Not :: IsSymExprBuilder sym => Pred sym -> W4Conn sym (Pred sym)
- w4ITE :: IsSymExprBuilder sym => Pred sym -> Pred sym -> Pred sym -> W4Conn sym (Pred sym)
- addDefEqn :: IsSymExprBuilder sym => What4 sym -> Pred sym -> W4Eval sym ()
- addSafety :: IsSymExprBuilder sym => Pred sym -> W4Eval sym ()
- evalError :: IsSymExprBuilder sym => EvalError -> W4Eval sym a
- assertBVDivisor :: IsSymExprBuilder sym => What4 sym -> SWord sym -> W4Eval sym ()
- assertIntDivisor :: IsSymExprBuilder sym => What4 sym -> SymInteger sym -> W4Eval sym ()
- sModAdd :: IsSymExprBuilder sym => sym -> Integer -> SymInteger sym -> SymInteger sym -> IO (SymInteger sym)
- sModSub :: IsSymExprBuilder sym => sym -> Integer -> SymInteger sym -> SymInteger sym -> IO (SymInteger sym)
- sModMult :: IsSymExprBuilder sym => sym -> Integer -> SymInteger sym -> SymInteger sym -> IO (SymInteger sym)
- sModNegate :: IsSymExprBuilder sym => sym -> Integer -> SymInteger sym -> IO (SymInteger sym)
- sLg2 :: IsSymExprBuilder sym => sym -> SWord sym -> SEval (What4 sym) (SWord sym)
- evalPanic :: String -> [String] -> a
- lazyIte :: (IsExpr p, Monad m) => (p BaseBoolType -> a -> a -> m a) -> p BaseBoolType -> m a -> m a -> m a
- w4bvShl :: IsSymExprBuilder sym => sym -> SWord sym -> SWord sym -> W4Eval sym (SWord sym)
- w4bvLshr :: IsSymExprBuilder sym => sym -> SWord sym -> SWord sym -> W4Eval sym (SWord sym)
- w4bvAshr :: IsSymExprBuilder sym => sym -> SWord sym -> SWord sym -> W4Eval sym (SWord sym)
- w4bvRol :: IsSymExprBuilder sym => sym -> SWord sym -> SWord sym -> W4Eval sym (SWord sym)
- w4bvRor :: IsSymExprBuilder sym => sym -> SWord sym -> SWord sym -> W4Eval sym (SWord sym)
- fpRoundingMode :: IsSymExprBuilder sym => What4 sym -> SWord (What4 sym) -> SEval (What4 sym) RoundingMode
- fpBinArith :: IsSymExprBuilder sym => SFloatBinArith sym -> What4 sym -> SWord (What4 sym) -> SFloat (What4 sym) -> SFloat (What4 sym) -> SEval (What4 sym) (SFloat (What4 sym))
- fpCvtToInteger :: (IsSymExprBuilder sy, sym ~ What4 sy) => sym -> String -> SWord sym -> SFloat sym -> SEval sym (SInteger sym)
- fpCvtToRational :: (IsSymExprBuilder sy, sym ~ What4 sy) => sym -> SFloat sym -> SEval sym (SRational sym)
- fpCvtFromRational :: (IsSymExprBuilder sy, sym ~ What4 sy) => sym -> Integer -> Integer -> SWord sym -> SRational sym -> SEval sym (SFloat sym)
- sModRecip :: IsSymExprBuilder sym => What4 sym -> Integer -> SymInteger sym -> W4Eval sym (SymInteger sym)
Documentation
Instances
This is the monad used for symbolic evaluation. It adds to
aspects to Eval
---WConn
keeps track of the backend and collects
definitional predicates, and W4Eval
adds support for partially
defined values
W4Eval | |
|
Instances
IsSymExprBuilder sym => MonadIO (W4Eval sym) Source # | |
Defined in Cryptol.Backend.What4 | |
IsSymExprBuilder sym => Applicative (W4Eval sym) Source # | |
Defined in Cryptol.Backend.What4 | |
IsSymExprBuilder sym => Functor (W4Eval sym) Source # | |
IsSymExprBuilder sym => Monad (W4Eval sym) Source # | |
This layer has the symbolic back-end, and can keep track of definitional predicates used when working with uninterpreted constants defined via a property.
Instances
IsSymExprBuilder sym => MonadIO (W4Conn sym) Source # | |
Defined in Cryptol.Backend.What4 | |
IsSymExprBuilder sym => Applicative (W4Conn sym) Source # | |
Defined in Cryptol.Backend.What4 | |
IsSymExprBuilder sym => Functor (W4Conn sym) Source # | |
IsSymExprBuilder sym => Monad (W4Conn sym) Source # | |
The symbolic value we computed.
W4Error !EvalErrorEx | A malformed value |
W4Result !(Pred sym) !a | safety predicate and result: the result only makes sense when the predicate holds. |
w4And :: IsSymExprBuilder sym => Pred sym -> Pred sym -> W4Conn sym (Pred sym) Source #
Record a definition. addDef :: W4.Pred sym -> W4Conn sym () addDef p = W4Conn _ -> pure W4Defs { w4Defs = p, w4Result = () }
Compute conjunction.
w4ITE :: IsSymExprBuilder sym => Pred sym -> Pred sym -> Pred sym -> W4Conn sym (Pred sym) Source #
Compute if-then-else.
addDefEqn :: IsSymExprBuilder sym => What4 sym -> Pred sym -> W4Eval sym () Source #
Add a definitional equation. This will always be asserted when we make queries to the solver.
evalError :: IsSymExprBuilder sym => EvalError -> W4Eval sym a Source #
A fully undefined symbolic value
assertBVDivisor :: IsSymExprBuilder sym => What4 sym -> SWord sym -> W4Eval sym () Source #
assertIntDivisor :: IsSymExprBuilder sym => What4 sym -> SymInteger sym -> W4Eval sym () Source #
sModAdd :: IsSymExprBuilder sym => sym -> Integer -> SymInteger sym -> SymInteger sym -> IO (SymInteger sym) Source #
sModSub :: IsSymExprBuilder sym => sym -> Integer -> SymInteger sym -> SymInteger sym -> IO (SymInteger sym) Source #
sModMult :: IsSymExprBuilder sym => sym -> Integer -> SymInteger sym -> SymInteger sym -> IO (SymInteger sym) Source #
sModNegate :: IsSymExprBuilder sym => sym -> Integer -> SymInteger sym -> IO (SymInteger sym) Source #
sLg2 :: IsSymExprBuilder sym => sym -> SWord sym -> SEval (What4 sym) (SWord sym) Source #
Try successive powers of 2 to find the first that dominates the input. We could perhaps reduce to using CLZ instead...
lazyIte :: (IsExpr p, Monad m) => (p BaseBoolType -> a -> a -> m a) -> p BaseBoolType -> m a -> m a -> m a Source #
w4bvLshr :: IsSymExprBuilder sym => sym -> SWord sym -> SWord sym -> W4Eval sym (SWord sym) Source #
w4bvAshr :: IsSymExprBuilder sym => sym -> SWord sym -> SWord sym -> W4Eval sym (SWord sym) Source #
fpRoundingMode :: IsSymExprBuilder sym => What4 sym -> SWord (What4 sym) -> SEval (What4 sym) RoundingMode Source #
fpBinArith :: IsSymExprBuilder sym => SFloatBinArith sym -> What4 sym -> SWord (What4 sym) -> SFloat (What4 sym) -> SFloat (What4 sym) -> SEval (What4 sym) (SFloat (What4 sym)) Source #
fpCvtToInteger :: (IsSymExprBuilder sy, sym ~ What4 sy) => sym -> String -> SWord sym -> SFloat sym -> SEval sym (SInteger sym) Source #
fpCvtToRational :: (IsSymExprBuilder sy, sym ~ What4 sy) => sym -> SFloat sym -> SEval sym (SRational sym) Source #
fpCvtFromRational :: (IsSymExprBuilder sy, sym ~ What4 sy) => sym -> Integer -> Integer -> SWord sym -> SRational sym -> SEval sym (SFloat sym) Source #
sModRecip :: IsSymExprBuilder sym => What4 sym -> Integer -> SymInteger sym -> W4Eval sym (SymInteger sym) Source #