Copyright | (c) 2020 Galois Inc. |
---|---|
License | BSD3 |
Maintainer | cryptol@galois.com |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data What4 sym = What4 sym
- type Value sym = GenValue (What4 sym)
- newtype W4Eval sym a = W4Eval {
- evalPartial :: W4Conn sym (W4Result sym a)
- newtype W4Conn sym a = W4Conn {}
- data W4Defs sym a = W4Defs {}
- data W4Result sym a
- w4Eval :: W4Eval sym a -> sym -> Eval (W4Defs sym (W4Result sym a))
- w4Thunk :: Eval (W4Defs sym (W4Result sym a)) -> W4Eval sym a
- doEval :: IsExprBuilder sym => Eval a -> W4Conn sym a
- total :: IsExprBuilder sym => W4Conn sym a -> W4Eval sym a
- getSym :: IsExprBuilder sym => W4Conn sym sym
- addDef :: Pred sym -> W4Conn sym ()
- w4And :: IsExprBuilder sym => Pred sym -> Pred sym -> W4Conn sym (Pred sym)
- w4Not :: IsExprBuilder sym => Pred sym -> W4Conn sym (Pred sym)
- w4ITE :: IsExprBuilder sym => Pred sym -> Pred sym -> Pred sym -> W4Conn sym (Pred sym)
- addDefEqn :: IsExprBuilder sym => Pred sym -> W4Eval sym ()
- addSafety :: IsExprBuilder sym => Pred sym -> W4Eval sym ()
- evalError :: IsExprBuilder sym => EvalError -> W4Eval sym a
- assertBVDivisor :: IsExprBuilder sym => sym -> SWord sym -> W4Eval sym ()
- assertIntDivisor :: IsExprBuilder sym => sym -> SymInteger sym -> W4Eval sym ()
- sModAdd :: IsExprBuilder sym => sym -> Integer -> SymInteger sym -> SymInteger sym -> IO (SymInteger sym)
- sModSub :: IsExprBuilder sym => sym -> Integer -> SymInteger sym -> SymInteger sym -> IO (SymInteger sym)
- sModMult :: IsExprBuilder sym => sym -> Integer -> SymInteger sym -> SymInteger sym -> IO (SymInteger sym)
- sModNegate :: IsExprBuilder sym => sym -> Integer -> SymInteger sym -> IO (SymInteger sym)
- sLg2 :: IsExprBuilder 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
- indexFront_int :: IsExprBuilder sym => sym -> Nat' -> TValue -> SeqMap (What4 sym) -> TValue -> SInteger (What4 sym) -> SEval (What4 sym) (Value sym)
- indexBack_int :: IsExprBuilder sym => sym -> Nat' -> TValue -> SeqMap (What4 sym) -> TValue -> SInteger (What4 sym) -> SEval (What4 sym) (Value sym)
- indexFront_word :: IsExprBuilder sym => sym -> Nat' -> TValue -> SeqMap (What4 sym) -> TValue -> SWord (What4 sym) -> SEval (What4 sym) (Value sym)
- indexBack_word :: IsExprBuilder sym => sym -> Nat' -> TValue -> SeqMap (What4 sym) -> TValue -> SWord (What4 sym) -> SEval (What4 sym) (Value sym)
- indexFront_bits :: forall sym. IsExprBuilder sym => sym -> Nat' -> TValue -> SeqMap (What4 sym) -> TValue -> [SBit (What4 sym)] -> SEval (What4 sym) (Value sym)
- indexBack_bits :: IsExprBuilder sym => sym -> Nat' -> TValue -> SeqMap (What4 sym) -> TValue -> [SBit (What4 sym)] -> SEval (What4 sym) (Value sym)
- wordValueEqualsInteger :: forall sym. IsExprBuilder sym => sym -> WordValue (What4 sym) -> Integer -> W4Eval sym (Pred sym)
- updateFrontSym :: IsExprBuilder sym => sym -> Nat' -> TValue -> SeqMap (What4 sym) -> Either (SInteger (What4 sym)) (WordValue (What4 sym)) -> SEval (What4 sym) (Value sym) -> SEval (What4 sym) (SeqMap (What4 sym))
- updateBackSym :: IsExprBuilder sym => sym -> Nat' -> TValue -> SeqMap (What4 sym) -> Either (SInteger (What4 sym)) (WordValue (What4 sym)) -> SEval (What4 sym) (Value sym) -> SEval (What4 sym) (SeqMap (What4 sym))
- updateFrontSym_word :: IsExprBuilder sym => sym -> Nat' -> TValue -> WordValue (What4 sym) -> Either (SInteger (What4 sym)) (WordValue (What4 sym)) -> SEval (What4 sym) (GenValue (What4 sym)) -> SEval (What4 sym) (WordValue (What4 sym))
- updateBackSym_word :: IsExprBuilder sym => sym -> Nat' -> TValue -> WordValue (What4 sym) -> Either (SInteger (What4 sym)) (WordValue (What4 sym)) -> SEval (What4 sym) (GenValue (What4 sym)) -> SEval (What4 sym) (WordValue (What4 sym))
- sshrV :: IsExprBuilder sym => sym -> Value sym
- w4bvShl :: IsExprBuilder sym => sym -> SWord sym -> SWord sym -> W4Eval sym (SWord sym)
- w4bvLshr :: IsExprBuilder sym => sym -> SWord sym -> SWord sym -> W4Eval sym (SWord sym)
- w4bvAshr :: IsExprBuilder sym => sym -> SWord sym -> SWord sym -> W4Eval sym (SWord sym)
- w4bvRol :: IsExprBuilder sym => sym -> SWord sym -> SWord sym -> W4Eval sym (SWord sym)
- w4bvRor :: IsExprBuilder sym => sym -> SWord sym -> SWord sym -> W4Eval sym (SWord sym)
- fpRoundingMode :: IsExprBuilder sym => What4 sym -> SWord (What4 sym) -> SEval (What4 sym) RoundingMode
- fpBinArith :: IsExprBuilder sym => SFloatBinArith sym -> What4 sym -> SWord (What4 sym) -> SFloat (What4 sym) -> SFloat (What4 sym) -> SEval (What4 sym) (SFloat (What4 sym))
- fpCvtToInteger :: (IsExprBuilder 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 :: (IsExprBuilder sy, sym ~ What4 sy) => sym -> Integer -> Integer -> SWord sym -> SRational sym -> SEval sym (SFloat sym)
Documentation
What4 sym |
Instances
This is the monad used for symbolic evaluation. It adds to
aspects to Eval'
keeps track of the backend and collects
definitional predicates, and W4Eval
adds support for partially
defined values
W4Eval | |
|
Instances
IsExprBuilder sym => Monad (W4Eval sym) Source # | |
IsExprBuilder sym => Functor (W4Eval sym) Source # | |
IsExprBuilder sym => Applicative (W4Eval sym) Source # | |
Defined in Cryptol.Eval.What4.Value | |
IsExprBuilder sym => MonadIO (W4Eval sym) Source # | |
Defined in Cryptol.Eval.What4.Value |
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
IsExprBuilder sym => Monad (W4Conn sym) Source # | |
IsExprBuilder sym => Functor (W4Conn sym) Source # | |
IsExprBuilder sym => Applicative (W4Conn sym) Source # | |
Defined in Cryptol.Eval.What4.Value | |
IsExprBuilder sym => MonadIO (W4Conn sym) Source # | |
Defined in Cryptol.Eval.What4.Value |
Keep track of a value and a context defining uninterpeted vairables.
The symbolic value we computed.
getSym :: IsExprBuilder sym => W4Conn sym sym Source #
Access the symbolic back-end
w4And :: IsExprBuilder sym => Pred sym -> Pred sym -> W4Conn sym (Pred sym) Source #
Compute conjunction.
w4ITE :: IsExprBuilder sym => Pred sym -> Pred sym -> Pred sym -> W4Conn sym (Pred sym) Source #
Compute if-then-else.
addDefEqn :: IsExprBuilder sym => Pred sym -> W4Eval sym () Source #
Add a definitional equation. This will always be asserted when we make queries to the solver.
evalError :: IsExprBuilder sym => EvalError -> W4Eval sym a Source #
A fully undefined symbolic value
assertBVDivisor :: IsExprBuilder sym => sym -> SWord sym -> W4Eval sym () Source #
assertIntDivisor :: IsExprBuilder sym => sym -> SymInteger sym -> W4Eval sym () Source #
sModAdd :: IsExprBuilder sym => sym -> Integer -> SymInteger sym -> SymInteger sym -> IO (SymInteger sym) Source #
sModSub :: IsExprBuilder sym => sym -> Integer -> SymInteger sym -> SymInteger sym -> IO (SymInteger sym) Source #
sModMult :: IsExprBuilder sym => sym -> Integer -> SymInteger sym -> SymInteger sym -> IO (SymInteger sym) Source #
sModNegate :: IsExprBuilder sym => sym -> Integer -> SymInteger sym -> IO (SymInteger sym) Source #
sLg2 :: IsExprBuilder 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 #
indexFront_int :: IsExprBuilder sym => sym -> Nat' -> TValue -> SeqMap (What4 sym) -> TValue -> SInteger (What4 sym) -> SEval (What4 sym) (Value sym) Source #
indexBack_int :: IsExprBuilder sym => sym -> Nat' -> TValue -> SeqMap (What4 sym) -> TValue -> SInteger (What4 sym) -> SEval (What4 sym) (Value sym) Source #
indexFront_word :: IsExprBuilder sym => sym -> Nat' -> TValue -> SeqMap (What4 sym) -> TValue -> SWord (What4 sym) -> SEval (What4 sym) (Value sym) Source #
indexBack_word :: IsExprBuilder sym => sym -> Nat' -> TValue -> SeqMap (What4 sym) -> TValue -> SWord (What4 sym) -> SEval (What4 sym) (Value sym) Source #
indexFront_bits :: forall sym. IsExprBuilder sym => sym -> Nat' -> TValue -> SeqMap (What4 sym) -> TValue -> [SBit (What4 sym)] -> SEval (What4 sym) (Value sym) Source #
indexBack_bits :: IsExprBuilder sym => sym -> Nat' -> TValue -> SeqMap (What4 sym) -> TValue -> [SBit (What4 sym)] -> SEval (What4 sym) (Value sym) Source #
wordValueEqualsInteger :: forall sym. IsExprBuilder sym => sym -> WordValue (What4 sym) -> Integer -> W4Eval sym (Pred sym) Source #
Compare a symbolic word value with a concrete integer.
updateFrontSym :: IsExprBuilder sym => sym -> Nat' -> TValue -> SeqMap (What4 sym) -> Either (SInteger (What4 sym)) (WordValue (What4 sym)) -> SEval (What4 sym) (Value sym) -> SEval (What4 sym) (SeqMap (What4 sym)) Source #
updateBackSym :: IsExprBuilder sym => sym -> Nat' -> TValue -> SeqMap (What4 sym) -> Either (SInteger (What4 sym)) (WordValue (What4 sym)) -> SEval (What4 sym) (Value sym) -> SEval (What4 sym) (SeqMap (What4 sym)) Source #
updateFrontSym_word :: IsExprBuilder sym => sym -> Nat' -> TValue -> WordValue (What4 sym) -> Either (SInteger (What4 sym)) (WordValue (What4 sym)) -> SEval (What4 sym) (GenValue (What4 sym)) -> SEval (What4 sym) (WordValue (What4 sym)) Source #
updateBackSym_word :: IsExprBuilder sym => sym -> Nat' -> TValue -> WordValue (What4 sym) -> Either (SInteger (What4 sym)) (WordValue (What4 sym)) -> SEval (What4 sym) (GenValue (What4 sym)) -> SEval (What4 sym) (WordValue (What4 sym)) Source #
sshrV :: IsExprBuilder sym => sym -> Value sym Source #
fpRoundingMode :: IsExprBuilder sym => What4 sym -> SWord (What4 sym) -> SEval (What4 sym) RoundingMode Source #
fpBinArith :: IsExprBuilder sym => SFloatBinArith sym -> What4 sym -> SWord (What4 sym) -> SFloat (What4 sym) -> SFloat (What4 sym) -> SEval (What4 sym) (SFloat (What4 sym)) Source #
fpCvtToInteger :: (IsExprBuilder 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 #