sbv-7.13: SMT Based Verification: Symbolic Haskell theorem prover using SMT solving.

Copyright | (c) Levent Erkok
License | BSD3
Maintainer | erkokl@gmail.com
Stability | experimental
Safe Haskell | None
Language | Haskell2010

Data.SBV

Contents

- Symbolic types
  - Booleans
    - The Boolean class
    - Logical operations
  - Bit-vectors
    - Unsigned bit-vectors
    - Signed bit-vectors
  - Unbounded integers
  - Floating point numbers
  - Algebraic reals
  - Characters, Strings and Regular Expressions
  - Symbolic lists
- Arrays of symbolic values
- Creating symbolic values
  - Single value
  - List of values
- Symbolic Equality and Comparisons
- Conditionals: Mergeable values
- Symbolic integral numbers
- Division and Modulus
- Bit-vector operations
  - Conversions
  - Shifts and rotates
  - Finite bit-vector operations
  - Splitting, joining, and extending
  - Exponentiation
- IEEE-floating point numbers
  - Rounding modes
  - Conversion to/from floats
  - Bit-pattern conversions
- Enumerations
- Uninterpreted sorts, constants, and functions
- Properties, proofs, and satisfiability
- Constraints
  - Constraint Vacuity
  - Named constraints and attributes
  - Unsat cores
  - Cardinality constraints
- Checking safety
- Quick-checking
- Optimization
  - Multiple optimization goals
  - Objectives
  - Soft assertions
  - Field extensions
- Model extraction
  - Inspecting proof results
  - Observing expressions
  - Programmable model extraction
- SMT Interface
  - Controlling verbosity
  - Solvers
  - Configurations
  - SBV exceptions
- Abstract SBV type
- Module exports
- Orphan instances

Description

(The sbv library is hosted at http://github.com/LeventErkok/sbv. Comments, bug reports, and patches are always welcome.)

SBV: SMT Based Verification

Express properties about Haskell programs and automatically prove them using SMT solvers.

    >>> prove $ \x -> x `shiftL` 2 .== 4 * (x :: SWord8)
    Q.E.D.

    >>> prove $ \x -> x `shiftL` 2 .== 2 * (x :: SWord8)
    Falsifiable. Counter-example:
      s0 = 64 :: Word8

The function `prove` has the following type:

        prove :: Provable a => a -> IO ThmResult

The class `Provable` comes with instances for n-ary predicates, for arbitrary n. The predicates are just regular Haskell functions over symbolic types listed below. Functions for checking satisfiability (`sat` and `allSat`) are also provided.

The sbv library introduces the following symbolic types:

- `SBool`: Symbolic Booleans (bits).
- `SWord8`, `SWord16`, `SWord32`, `SWord64`: Symbolic Words (unsigned).
- `SInt8`, `SInt16`, `SInt32`, `SInt64`: Symbolic Ints (signed).
- `SInteger`: Unbounded signed integers.
- `SReal`: Algebraic-real numbers
- `SFloat`: IEEE-754 single-precision floating point values
- `SDouble`: IEEE-754 double-precision floating point values
- `SChar`, `SString`, `RegExp`: Characters, strings and regular expressions
- `SList`: Symbolic lists (which can be nested)
- `SArray`, `SFunArray`: Flat arrays of symbolic values.
- Symbolic polynomials over GF(2^n), polynomial arithmetic, and CRCs.
- Uninterpreted constants and functions over symbolic values, with user defined SMT-Lib axioms.
- Uninterpreted sorts, and proofs over such sorts, potentially with axioms.

The user can construct ordinary Haskell programs using these types, which behave very similar to their concrete counterparts. In particular these types belong to the standard classes `Num`, `Bits`, custom versions of `Eq` (`EqSymbolic`) and `Ord` (`OrdSymbolic`), along with several other custom classes for simplifying programming with symbolic values. The framework takes full advantage of Haskell's type inference to avoid many common mistakes.

Furthermore, predicates (i.e., functions that return `SBool`) built out of these types can also be:

- proven correct via an external SMT solver (the `prove` function)
- checked for satisfiability (the `sat`, `allSat` functions)
- used in synthesis (the `sat` function with existentials)
- quick-checked

If a predicate is not valid, `prove` will return a counterexample: An assignment to inputs such that the predicate fails. The `sat` function will return a satisfying assignment, if there is one. The `allSat` function returns all satisfying assignments.

The sbv library uses third-party SMT solvers via the standard SMT-Lib interface: http://smtlib.cs.uiowa.edu/

The SBV library is designed to work with any SMT-Lib compliant SMT-solver. Currently, we support the following SMT-Solvers out-of-the box:

- ABC from University of Berkeley: http://www.eecs.berkeley.edu/~alanmi/abc/
- CVC4 from Stanford: http://cvc4.cs.stanford.edu/web/
- Boolector from Johannes Kepler University: http://fmv.jku.at/boolector/
- MathSAT from Fondazione Bruno Kessler and DISI-University of Trento: http://mathsat.fbk.eu/
- Yices from SRI: http://yices.csl.sri.com/
- Z3 from Microsoft: http://github.com/Z3Prover/z3/wiki

SBV requires recent versions of these solvers; please see the file `SMTSolverVersions.md` in the source distribution for specifics.

SBV also allows calling these solvers in parallel, either getting results from multiple solvers or returning the fastest one. (See `proveWithAll`, `proveWithAny`, etc.)

Support for other compliant solvers can be added relatively easily, please get in touch if there is a solver you'd like to see included.

Synopsis

- type SBool = SBV Bool
- oneIf :: (Num a, SymWord a) => SBool -> SBV a
- class Boolean b where
  - true :: b
  - false :: b
  - bnot :: b -> b
  - (&&&) :: b -> b -> b
  - (|||) :: b -> b -> b
  - (~&) :: b -> b -> b
  - (~|) :: b -> b -> b
  - (<+>) :: b -> b -> b
  - (==>) :: b -> b -> b
  - (<=>) :: b -> b -> b
  - fromBool :: Bool -> b
- bAnd :: Boolean b => [b] -> b
- bOr :: Boolean b => [b] -> b
- bAny :: Boolean b => (a -> b) -> [a] -> b
- bAll :: Boolean b => (a -> b) -> [a] -> b
- type SWord8 = SBV Word8
- type SWord16 = SBV Word16
- type SWord32 = SBV Word32
- type SWord64 = SBV Word64
- type SInt8 = SBV Int8
- type SInt16 = SBV Int16
- type SInt32 = SBV Int32
- type SInt64 = SBV Int64
- type SInteger = SBV Integer
- type SFloat = SBV Float
- type SDouble = SBV Double
- type SReal = SBV AlgReal
- data AlgReal
- sRealToSInteger :: SReal -> SInteger
- type SChar = SBV Char
- type SString = SBV String
- type SList a = SBV [a]
- class SymArray array where
  - newArray_ :: (HasKind a, HasKind b) => Maybe (SBV b) -> Symbolic (array a b)
  - newArray :: (HasKind a, HasKind b) => String -> Maybe (SBV b) -> Symbolic (array a b)
  - readArray :: array a b -> SBV a -> SBV b
  - writeArray :: SymWord b => array a b -> SBV a -> SBV b -> array a b
- data SArray a b
- data SFunArray a b
- sBool :: String -> Symbolic SBool
- sWord8 :: String -> Symbolic SWord8
- sWord16 :: String -> Symbolic SWord16
- sWord32 :: String -> Symbolic SWord32
- sWord64 :: String -> Symbolic SWord64
- sInt8 :: String -> Symbolic SInt8
- sInt16 :: String -> Symbolic SInt16
- sInt32 :: String -> Symbolic SInt32
- sInt64 :: String -> Symbolic SInt64
- sInteger :: String -> Symbolic SInteger
- sReal :: String -> Symbolic SReal
- sFloat :: String -> Symbolic SFloat
- sDouble :: String -> Symbolic SDouble
- sChar :: String -> Symbolic SChar
- sString :: String -> Symbolic SString
- sList :: forall a. SymWord a => String -> Symbolic (SList a)
- sBools :: [String] -> Symbolic [SBool]
- sWord8s :: [String] -> Symbolic [SWord8]
- sWord16s :: [String] -> Symbolic [SWord16]
- sWord32s :: [String] -> Symbolic [SWord32]
- sWord64s :: [String] -> Symbolic [SWord64]
- sInt8s :: [String] -> Symbolic [SInt8]
- sInt16s :: [String] -> Symbolic [SInt16]
- sInt32s :: [String] -> Symbolic [SInt32]
- sInt64s :: [String] -> Symbolic [SInt64]
- sIntegers :: [String] -> Symbolic [SInteger]
- sReals :: [String] -> Symbolic [SReal]
- sFloats :: [String] -> Symbolic [SFloat]
- sDoubles :: [String] -> Symbolic [SDouble]
- sChars :: [String] -> Symbolic [SChar]
- sStrings :: [String] -> Symbolic [SString]
- sLists :: forall a. SymWord a => [String] -> Symbolic [SList a]
- class EqSymbolic a where
  - (.==) :: a -> a -> SBool
  - (./=) :: a -> a -> SBool
  - distinct :: [a] -> SBool
  - allEqual :: [a] -> SBool
  - sElem :: a -> [a] -> SBool
- class (Mergeable a, EqSymbolic a) => OrdSymbolic a where
  - (.<) :: a -> a -> SBool
  - (.<=) :: a -> a -> SBool
  - (.>) :: a -> a -> SBool
  - (.>=) :: a -> a -> SBool
  - smin :: a -> a -> a
  - smax :: a -> a -> a
  - inRange :: a -> (a, a) -> SBool
- class Equality a where
  - (===) :: a -> a -> IO ThmResult
- class Mergeable a where
  - symbolicMerge :: Bool -> SBool -> a -> a -> a
  - select :: (SymWord b, Num b) => [a] -> a -> SBV b -> a
- ite :: Mergeable a => SBool -> a -> a -> a
- iteLazy :: Mergeable a => SBool -> a -> a -> a
- class (SymWord a, Num a, Bits a, Integral a) => SIntegral a
- class SDivisible a where
  - sQuotRem :: a -> a -> (a, a)
  - sDivMod :: a -> a -> (a, a)
  - sQuot :: a -> a -> a
  - sRem :: a -> a -> a
  - sDiv :: a -> a -> a
  - sMod :: a -> a -> a
- sFromIntegral :: forall a b. (Integral a, HasKind a, Num a, SymWord a, HasKind b, Num b, SymWord b) => SBV a -> SBV b
- sShiftLeft :: (SIntegral a, SIntegral b) => SBV a -> SBV b -> SBV a
- sShiftRight :: (SIntegral a, SIntegral b) => SBV a -> SBV b -> SBV a
- sRotateLeft :: (SIntegral a, SIntegral b, SDivisible (SBV b)) => SBV a -> SBV b -> SBV a
- sRotateRight :: (SIntegral a, SIntegral b, SDivisible (SBV b)) => SBV a -> SBV b -> SBV a
- sSignedShiftArithRight :: (SFiniteBits a, SIntegral b) => SBV a -> SBV b -> SBV a
- class (SymWord a, Num a, Bits a) => SFiniteBits a where
  - sFiniteBitSize :: SBV a -> Int
  - lsb :: SBV a -> SBool
  - msb :: SBV a -> SBool
  - blastBE :: SBV a -> [SBool]
  - blastLE :: SBV a -> [SBool]
  - fromBitsBE :: [SBool] -> SBV a
  - fromBitsLE :: [SBool] -> SBV a
  - sTestBit :: SBV a -> Int -> SBool
  - sExtractBits :: SBV a -> [Int] -> [SBool]
  - sPopCount :: SBV a -> SWord8
  - setBitTo :: SBV a -> Int -> SBool -> SBV a
  - fullAdder :: SBV a -> SBV a -> (SBool, SBV a)
  - fullMultiplier :: SBV a -> SBV a -> (SBV a, SBV a)
  - sCountLeadingZeros :: SBV a -> SWord8
  - sCountTrailingZeros :: SBV a -> SWord8
- class Splittable a b | b -> a where
  - split :: a -> (b, b)
  - (#) :: b -> b -> a
  - extend :: b -> a
- (.^) :: (Mergeable b, Num b, SIntegral e) => b -> SBV e -> b
- class (SymWord a, RealFloat a) => IEEEFloating a where
  - fpAbs :: SBV a -> SBV a
  - fpNeg :: SBV a -> SBV a
  - fpAdd :: SRoundingMode -> SBV a -> SBV a -> SBV a
  - fpSub :: SRoundingMode -> SBV a -> SBV a -> SBV a
  - fpMul :: SRoundingMode -> SBV a -> SBV a -> SBV a
  - fpDiv :: SRoundingMode -> SBV a -> SBV a -> SBV a
  - fpFMA :: SRoundingMode -> SBV a -> SBV a -> SBV a -> SBV a
  - fpSqrt :: SRoundingMode -> SBV a -> SBV a
  - fpRem :: SBV a -> SBV a -> SBV a
  - fpRoundToIntegral :: SRoundingMode -> SBV a -> SBV a
  - fpMin :: SBV a -> SBV a -> SBV a
  - fpMax :: SBV a -> SBV a -> SBV a
  - fpIsEqualObject :: SBV a -> SBV a -> SBool
  - fpIsNormal :: SBV a -> SBool
  - fpIsSubnormal :: SBV a -> SBool
  - fpIsZero :: SBV a -> SBool
  - fpIsInfinite :: SBV a -> SBool
  - fpIsNaN :: SBV a -> SBool
  - fpIsNegative :: SBV a -> SBool
  - fpIsPositive :: SBV a -> SBool
  - fpIsNegativeZero :: SBV a -> SBool
  - fpIsPositiveZero :: SBV a -> SBool
  - fpIsPoint :: SBV a -> SBool
- data RoundingMode
  - = RoundNearestTiesToEven
  - | RoundNearestTiesToAway
  - | RoundTowardPositive
  - | RoundTowardNegative
  - | RoundTowardZero
- type SRoundingMode = SBV RoundingMode
- nan :: Floating a => a
- infinity :: Floating a => a
- sNaN :: (Floating a, SymWord a) => SBV a
- sInfinity :: (Floating a, SymWord a) => SBV a
- sRoundNearestTiesToEven :: SRoundingMode
- sRoundNearestTiesToAway :: SRoundingMode
- sRoundTowardPositive :: SRoundingMode
- sRoundTowardNegative :: SRoundingMode
- sRoundTowardZero :: SRoundingMode
- sRNE :: SRoundingMode
- sRNA :: SRoundingMode
- sRTP :: SRoundingMode
- sRTN :: SRoundingMode
- sRTZ :: SRoundingMode
- class IEEEFloatConvertable a where
  - fromSFloat :: SRoundingMode -> SFloat -> SBV a
  - toSFloat :: SRoundingMode -> SBV a -> SFloat
  - fromSDouble :: SRoundingMode -> SDouble -> SBV a
  - toSDouble :: SRoundingMode -> SBV a -> SDouble
- sFloatAsSWord32 :: SFloat -> SWord32
- sWord32AsSFloat :: SWord32 -> SFloat
- sDoubleAsSWord64 :: SDouble -> SWord64
- sWord64AsSDouble :: SWord64 -> SDouble
- blastSFloat :: SFloat -> (SBool, [SBool], [SBool])
- blastSDouble :: SDouble -> (SBool, [SBool], [SBool])
- mkSymbolicEnumeration :: Name -> Q [Dec]
- class Uninterpreted a where
  - uninterpret :: String -> a
  - cgUninterpret :: String -> [String] -> a -> a
  - sbvUninterpret :: Maybe ([String], a) -> String -> a
- addAxiom :: String -> [String] -> Symbolic ()
- type Predicate = Symbolic SBool
- type Goal = Symbolic ()
- class Provable a where
  - forAll_ :: a -> Predicate
  - forAll :: [String] -> a -> Predicate
  - forSome_ :: a -> Predicate
  - forSome :: [String] -> a -> Predicate
  - prove :: a -> IO ThmResult
  - proveWith :: SMTConfig -> a -> IO ThmResult
  - sat :: a -> IO SatResult
  - satWith :: SMTConfig -> a -> IO SatResult
  - allSat :: a -> IO AllSatResult
  - allSatWith :: SMTConfig -> a -> IO AllSatResult
  - optimize :: OptimizeStyle -> a -> IO OptimizeResult
  - optimizeWith :: SMTConfig -> OptimizeStyle -> a -> IO OptimizeResult
  - isVacuous :: a -> IO Bool
  - isVacuousWith :: SMTConfig -> a -> IO Bool
  - isTheorem :: a -> IO Bool
  - isTheoremWith :: SMTConfig -> a -> IO Bool
  - isSatisfiable :: a -> IO Bool
  - isSatisfiableWith :: SMTConfig -> a -> IO Bool
  - proveWithAll :: [SMTConfig] -> a -> IO [(Solver, NominalDiffTime, ThmResult)]
  - proveWithAny :: [SMTConfig] -> a -> IO (Solver, NominalDiffTime, ThmResult)
  - satWithAll :: [SMTConfig] -> a -> IO [(Solver, NominalDiffTime, SatResult)]
  - satWithAny :: [SMTConfig] -> a -> IO (Solver, NominalDiffTime, SatResult)
  - generateSMTBenchmark :: Bool -> a -> IO String
- solve :: [SBool] -> Symbolic SBool
- constrain :: SolverContext m => SBool -> m ()
- softConstrain :: SolverContext m => SBool -> m ()
- namedConstraint :: SolverContext m => String -> SBool -> m ()
- constrainWithAttribute :: SolverContext m => [(String, String)] -> SBool -> m ()
- pbAtMost :: [SBool] -> Int -> SBool
- pbAtLeast :: [SBool] -> Int -> SBool
- pbExactly :: [SBool] -> Int -> SBool
- pbLe :: [(Int, SBool)] -> Int -> SBool
- pbGe :: [(Int, SBool)] -> Int -> SBool
- pbEq :: [(Int, SBool)] -> Int -> SBool
- pbMutexed :: [SBool] -> SBool
- pbStronglyMutexed :: [SBool] -> SBool
- sAssert :: Maybe CallStack -> String -> SBool -> SBV a -> SBV a
- isSafe :: SafeResult -> Bool
- class SExecutable a where
  - sName_ :: a -> Symbolic ()
  - sName :: [String] -> a -> Symbolic ()
  - safe :: a -> IO [SafeResult]
  - safeWith :: SMTConfig -> a -> IO [SafeResult]
- sbvQuickCheck :: Symbolic SBool -> IO Bool
- data OptimizeStyle
  - = Lexicographic
  - | Independent
  - | Pareto (Maybe Int)
- data Objective a
  - = Minimize String a
  - | Maximize String a
  - | AssertWithPenalty String a Penalty
- class Metric a where
  - minimize :: String -> a -> Symbolic ()
  - maximize :: String -> a -> Symbolic ()
- assertWithPenalty :: String -> SBool -> Penalty -> Symbolic ()
- data Penalty
  - = DefaultPenalty
  - | Penalty Rational (Maybe String)
- data ExtCW
  - = Infinite Kind
  - | Epsilon Kind
  - | Interval ExtCW ExtCW
  - | BoundedCW CW
  - | AddExtCW ExtCW ExtCW
  - | MulExtCW ExtCW ExtCW
- data GeneralizedCW
  - = ExtendedCW ExtCW
  - | RegularCW CW
- newtype ThmResult = ThmResult SMTResult
- newtype SatResult = SatResult SMTResult
- newtype AllSatResult = AllSatResult (Bool, Bool, [SMTResult])
- newtype SafeResult = SafeResult (Maybe String, String, SMTResult)
- data OptimizeResult
  - = LexicographicResult SMTResult
  - | ParetoResult (Bool, [SMTResult])
  - | IndependentResult [(String, SMTResult)]
- data SMTResult
  - = Unsatisfiable SMTConfig (Maybe [String])
  - | Satisfiable SMTConfig SMTModel
  - | SatExtField SMTConfig SMTModel
  - | Unknown SMTConfig SMTReasonUnknown
  - | ProofError SMTConfig [String]
- data SMTReasonUnknown
  - = UnknownMemOut
  - | UnknownIncomplete
  - | UnknownTimeOut
  - | UnknownOther String
- observe :: SymWord a => String -> SBV a -> SBV a
- class SatModel a where
  - parseCWs :: [CW] -> Maybe (a, [CW])
  - cvtModel :: (a -> Maybe b) -> Maybe (a, [CW]) -> Maybe (b, [CW])
- class Modelable a where
  - modelExists :: a -> Bool
  - getModelAssignment :: SatModel b => a -> Either String (Bool, b)
  - getModelDictionary :: a -> Map String CW
  - getModelValue :: SymWord b => String -> a -> Maybe b
  - getModelUninterpretedValue :: String -> a -> Maybe String
  - extractModel :: SatModel b => a -> Maybe b
  - getModelObjectives :: a -> Map String GeneralizedCW
  - getModelObjectiveValue :: String -> a -> Maybe GeneralizedCW
- displayModels :: SatModel a => (Int -> (Bool, a) -> IO ()) -> AllSatResult -> IO Int
- extractModels :: SatModel a => AllSatResult -> [a]
- getModelDictionaries :: AllSatResult -> [Map String CW]
- getModelValues :: SymWord b => String -> AllSatResult -> [Maybe b]
- getModelUninterpretedValues :: String -> AllSatResult -> [Maybe String]
- data SMTConfig = SMTConfig {
  - verbose :: Bool
  - timing :: Timing
  - printBase :: Int
  - printRealPrec :: Int
  - satCmd :: String
  - allSatMaxModelCount :: Maybe Int
  - isNonModelVar :: String -> Bool
  - transcript :: Maybe FilePath
  - smtLibVersion :: SMTLibVersion
  - solver :: SMTSolver
  - roundingMode :: RoundingMode
  - solverSetOptions :: [SMTOption]
  - ignoreExitCode :: Bool
  - redirectVerbose :: Maybe FilePath
  }
- data Timing
  - = NoTiming
  - | PrintTiming
  - | SaveTiming (IORef NominalDiffTime)
- data SMTLibVersion = SMTLib2
- data Solver
  - = Z3
  - | Yices
  - | Boolector
  - | CVC4
  - | MathSAT
  - | ABC
- data SMTSolver = SMTSolver {
  - name :: Solver
  - executable :: String
  - options :: SMTConfig -> [String]
  - engine :: SMTEngine
  - capabilities :: SolverCapabilities
  }
- boolector :: SMTConfig
- cvc4 :: SMTConfig
- yices :: SMTConfig
- z3 :: SMTConfig
- mathSAT :: SMTConfig
- abc :: SMTConfig
- defaultSolverConfig :: Solver -> SMTConfig
- defaultSMTCfg :: SMTConfig
- sbvCheckSolverInstallation :: SMTConfig -> IO Bool
- sbvAvailableSolvers :: IO [SMTConfig]
- setLogic :: SolverContext m => Logic -> m ()
- data Logic
  - = AUFLIA
  - | AUFLIRA
  - | AUFNIRA
  - | LRA
  - | QF_ABV
  - | QF_AUFBV
  - | QF_AUFLIA
  - | QF_AX
  - | QF_BV
  - | QF_IDL
  - | QF_LIA
  - | QF_LRA
  - | QF_NIA
  - | QF_NRA
  - | QF_RDL
  - | QF_UF
  - | QF_UFBV
  - | QF_UFIDL
  - | QF_UFLIA
  - | QF_UFLRA
  - | QF_UFNRA
  - | QF_UFNIRA
  - | UFLRA
  - | UFNIA
  - | QF_FPBV
  - | QF_FP
  - | QF_FD
  - | QF_S
  - | Logic_ALL
  - | Logic_NONE
  - | CustomLogic String
- setOption :: SolverContext m => SMTOption -> m ()
- setInfo :: SolverContext m => String -> [String] -> m ()
- setTimeOut :: SolverContext m => Integer -> m ()
- data SBVException = SBVException {
  - sbvExceptionDescription :: String
  - sbvExceptionSent :: Maybe String
  - sbvExceptionExpected :: Maybe String
  - sbvExceptionReceived :: Maybe String
  - sbvExceptionStdOut :: Maybe String
  - sbvExceptionStdErr :: Maybe String
  - sbvExceptionExitCode :: Maybe ExitCode
  - sbvExceptionConfig :: SMTConfig
  - sbvExceptionReason :: Maybe [String]
  - sbvExceptionHint :: Maybe [String]
  }
- data SBV a
- class HasKind a where
  - kindOf :: a -> Kind
  - hasSign :: a -> Bool
  - intSizeOf :: a -> Int
  - isBoolean :: a -> Bool
  - isBounded :: a -> Bool
  - isReal :: a -> Bool
  - isFloat :: a -> Bool
  - isDouble :: a -> Bool
  - isInteger :: a -> Bool
  - isUninterpreted :: a -> Bool
  - isChar :: a -> Bool
  - isString :: a -> Bool
  - isList :: a -> Bool
  - showType :: a -> String
- data Kind
  - = KBool
  - | KBounded !Bool !Int
  - | KUnbounded
  - | KReal
  - | KUserSort String (Either String [String])
  - | KFloat
  - | KDouble
  - | KChar
  - | KString
  - | KList Kind
- class (HasKind a, Ord a, Typeable a) => SymWord a where
  - forall :: String -> Symbolic (SBV a)
  - forall_ :: Symbolic (SBV a)
  - mkForallVars :: Int -> Symbolic [SBV a]
  - exists :: String -> Symbolic (SBV a)
  - exists_ :: Symbolic (SBV a)
  - mkExistVars :: Int -> Symbolic [SBV a]
  - free :: String -> Symbolic (SBV a)
  - free_ :: Symbolic (SBV a)
  - mkFreeVars :: Int -> Symbolic [SBV a]
  - symbolic :: String -> Symbolic (SBV a)
  - symbolics :: [String] -> Symbolic [SBV a]
  - literal :: a -> SBV a
  - unliteral :: SBV a -> Maybe a
  - fromCW :: CW -> a
  - isConcrete :: SBV a -> Bool
  - isSymbolic :: SBV a -> Bool
  - isConcretely :: SBV a -> (a -> Bool) -> Bool
  - mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV a)
- data Symbolic a
- label :: SymWord a => String -> SBV a -> SBV a
- output :: Outputtable a => a -> Symbolic a
- runSMT :: Symbolic a -> IO a
- runSMTWith :: SMTConfig -> Symbolic a -> IO a
- module Data.Bits
- module Data.Word
- module Data.Int
- module Data.Ratio

# Documentation

The SBV library is really two things:

- A framework for writing symbolic programs in Haskell, i.e., programs operating on symbolic values along with the usual concrete counterparts.
- A framework for proving properties of such programs using SMT solvers.

The programming goal of SBV is to provide a seamless experience, i.e., let people program in the usual Haskell style without distractions of symbolic coding. While Haskell helps in some aspects (the `Num` and `Bits` classes simplify coding), it makes life harder in others. For instance, `if-then-else` only takes `Bool` as a test in Haskell, and comparisons (`>` etc.) only return `Bool`s. Clearly we would like these values to be symbolic (i.e., `SBool`), thus stopping us from using some native Haskell constructs. When symbolic versions of operators are needed, they are typically obtained by prepending a dot, for instance `==` becomes `.==`. Care has been taken to make the transition painless. In particular, any Haskell program you build out of symbolic components is fully concretely executable within Haskell, without the need for any custom interpreters. (They are truly Haskell programs, not AST's built out of pieces of syntax.) This provides for an integrated feel of the system, one of the original design goals for SBV.

Incremental query mode: SBV provides a wide variety of ways to utilize SMT-solvers, without requiring the user to deal with the solvers themselves. While this mode is convenient, advanced users might need access to the underlying solver at a lower level. For such use cases, SBV allows users to have an interactive session: The user can issue commands to the solver, inspect the values/results, and formulate new constraints. This advanced feature is available through the Data.SBV.Control module, where most SMTLib features are made available via a typed-API.

# Symbolic types

## Booleans

type SBool = SBV Bool Source #

A symbolic boolean/bit

oneIf :: (Num a, SymWord a) => SBool -> SBV a Source #

Returns 1 if the boolean is true, otherwise 0.

### The Boolean class

class Boolean b where Source #

The `Boolean` class: a generalization of Haskell's `Bool` type Haskell `Bool` and SBV's `SBool` are instances of this class, unifying the treatment of boolean values.

Minimal complete definition: `true`, `bnot`, `&&&` However, it's advisable to define `false`, and `|||` as well (typically), for clarity.

Minimal complete definition

true, bnot, (&&&)

Methods

true :: b Source #

logical true

false :: b Source #

logical false

bnot :: b -> b Source #

complement

(&&&) :: b -> b -> b infixr 3 Source #

and

(|||) :: b -> b -> b infixr 2 Source #

or

(~&) :: b -> b -> b infixr 3 Source #

nand

(~|) :: b -> b -> b infixr 2 Source #

nor

(<+>) :: b -> b -> b infixl 6 Source #

xor

(==>) :: b -> b -> b infixr 1 Source #

implies

(<=>) :: b -> b -> b infixr 1 Source #

equivalence

fromBool :: Bool -> b Source #

cast from Bool

Instances

Boolean Bool Source # |

Instance details

Defined in Data.SBV.Utils.Boolean

Methods

true :: Bool Source #

false :: Bool Source #

bnot :: Bool -> Bool Source #

(&&&) :: Bool -> Bool -> Bool Source #

(|||) :: Bool -> Bool -> Bool Source #

(~&) :: Bool -> Bool -> Bool Source #

(~|) :: Bool -> Bool -> Bool Source #

(<+>) :: Bool -> Bool -> Bool Source #

(==>) :: Bool -> Bool -> Bool Source #

(<=>) :: Bool -> Bool -> Bool Source #

fromBool :: Bool -> Bool Source #

Boolean SBool Source # |

Instance details

Defined in Data.SBV.Core.Data

Methods

true :: SBool Source #

false :: SBool Source #

bnot :: SBool -> SBool Source #

(&&&) :: SBool -> SBool -> SBool Source #

(|||) :: SBool -> SBool -> SBool Source #

(~&) :: SBool -> SBool -> SBool Source #

(~|) :: SBool -> SBool -> SBool Source #

(<+>) :: SBool -> SBool -> SBool Source #

(==>) :: SBool -> SBool -> SBool Source #

(<=>) :: SBool -> SBool -> SBool Source #

fromBool :: Bool -> SBool Source #

### Logical operations

bAnd :: Boolean b => [b] -> b Source #

Generalization of `and`

bOr :: Boolean b => [b] -> b Source #

Generalization of `or`

bAny :: Boolean b => (a -> b) -> [a] -> b Source #

Generalization of `any`

bAll :: Boolean b => (a -> b) -> [a] -> b Source #

Generalization of `all`

## Bit-vectors

### Unsigned bit-vectors

type SWord8 = SBV Word8 Source #

8-bit unsigned symbolic value

type SWord16 = SBV Word16 Source #

16-bit unsigned symbolic value

type SWord32 = SBV Word32 Source #

32-bit unsigned symbolic value

type SWord64 = SBV Word64 Source #

64-bit unsigned symbolic value

### Signed bit-vectors

type SInt8 = SBV Int8 Source #

8-bit signed symbolic value, 2's complement representation

type SInt16 = SBV Int16 Source #

16-bit signed symbolic value, 2's complement representation

type SInt32 = SBV Int32 Source #

32-bit signed symbolic value, 2's complement representation

type SInt64 = SBV Int64 Source #

64-bit signed symbolic value, 2's complement representation

## Unbounded integers

The SBV library supports unbounded signed integers with the type `SInteger`, which are not subject to overflow/underflow as it is the case with the bounded types, such as `SWord8`, `SInt16`, etc. However, some bit-vector based operations are not supported for the `SInteger` type while in the verification mode. That is, you can use these operations on `SInteger` values during normal programming/simulation. but the SMT translation will not support these operations since there corresponding operations are not supported in SMT-Lib. Note that this should rarely be a problem in practice, as these operations are mostly meaningful on fixed-size bit-vectors. The operations that are restricted to bounded word/int sizes are:

- Rotations and shifts: `rotateL`, `rotateR`, `shiftL`, `shiftR`
- Bitwise logical ops: `.&.`, `.|.`, `xor`, `complement`
- Extraction and concatenation: `split`, `#`, and `extend` (see the `Splittable` class)

Usual arithmetic (`+`, `-`, `*`, `sQuotRem`, `sQuot`, `sRem`, `sDivMod`, `sDiv`, `sMod`) and logical operations (`.<`, `.<=`, `.>`, `.>=`, `.==`, `./=`) operations are supported for `SInteger` fully, both in programming and verification modes.

type SInteger = SBV Integer Source #

Infinite precision signed symbolic value

## Floating point numbers

Floating point numbers are defined by the IEEE-754 standard; and correspond to Haskell's `Float` and `Double` types. For SMT support with floating-point numbers, see the paper by Rummer and Wahl: http://www.philipp.ruemmer.org/publications/smt-fpa.pdf.

type SFloat = SBV Float Source #

IEEE-754 single-precision floating point numbers

type SDouble = SBV Double Source #

IEEE-754 double-precision floating point numbers

## Algebraic reals

Algebraic reals are roots of single-variable polynomials with rational coefficients. (See http://en.wikipedia.org/wiki/Algebraic_number.) Note that algebraic reals are infinite precision numbers, but they do not cover all real numbers. (In particular, they cannot represent transcendentals.) Some irrational numbers are algebraic (such as `sqrt 2`), while others are not (such as pi and e).

SBV can deal with real numbers just fine, since the theory of reals is decidable. (See http://smtlib.cs.uiowa.edu/theories-Reals.shtml.) In addition, by leveraging backend solver capabilities, SBV can also represent and solve non-linear equations involving real-variables. (For instance, the Z3 SMT solver, supports polynomial constraints on reals starting with v4.0.)

type SReal = SBV AlgReal Source #

Infinite precision symbolic algebraic real value

data AlgReal Source #

Algebraic reals. Note that the representation is left abstract. We represent rational results explicitly, while the roots-of-polynomials are represented implicitly by their defining equation

Instances

Eq AlgReal Source # |
Instance details Defined in Data.SBV.Core.AlgReals Methods (==) :: AlgReal -> AlgReal -> Bool Source # (/=) :: AlgReal -> AlgReal -> Bool Source #
Fractional AlgReal Source # | NB: Following the other types we have, we require `a/0` to be `0` for all a.
Instance details Defined in Data.SBV.Core.AlgReals Methods (/) :: AlgReal -> AlgReal -> AlgReal Source # recip :: AlgReal -> AlgReal Source # fromRational :: Rational -> AlgReal Source #
Num AlgReal Source # |
Instance details Defined in Data.SBV.Core.AlgReals Methods (+) :: AlgReal -> AlgReal -> AlgReal Source # (-) :: AlgReal -> AlgReal -> AlgReal Source # (*) :: AlgReal -> AlgReal -> AlgReal Source # negate :: AlgReal -> AlgReal Source # abs :: AlgReal -> AlgReal Source # signum :: AlgReal -> AlgReal Source # fromInteger :: Integer -> AlgReal Source #
Ord AlgReal Source # |
Instance details Defined in Data.SBV.Core.AlgReals Methods compare :: AlgReal -> AlgReal -> Ordering Source # (<) :: AlgReal -> AlgReal -> Bool Source # (<=) :: AlgReal -> AlgReal -> Bool Source # (>) :: AlgReal -> AlgReal -> Bool Source # (>=) :: AlgReal -> AlgReal -> Bool Source # max :: AlgReal -> AlgReal -> AlgReal Source # min :: AlgReal -> AlgReal -> AlgReal Source #
Real AlgReal Source # |
Instance details Defined in Data.SBV.Core.AlgReals Methods toRational :: AlgReal -> Rational Source #
Show AlgReal Source # |
Instance details Defined in Data.SBV.Core.AlgReals Methods showsPrec :: Int -> AlgReal -> ShowS Source # show :: AlgReal -> String Source # showList :: [AlgReal] -> ShowS Source #
Arbitrary AlgReal Source # |
Instance details Defined in Data.SBV.Core.AlgReals Methods arbitrary :: Gen AlgReal Source # shrink :: AlgReal -> [AlgReal] Source #
Random AlgReal Source # |
Instance details Defined in Data.SBV.Core.AlgReals Methods randomR :: RandomGen g => (AlgReal, AlgReal) -> g -> (AlgReal, g) Source # random :: RandomGen g => g -> (AlgReal, g) Source # randomRs :: RandomGen g => (AlgReal, AlgReal) -> g -> [AlgReal] Source # randoms :: RandomGen g => g -> [AlgReal] Source # randomRIO :: (AlgReal, AlgReal) -> IO AlgReal Source # randomIO :: IO AlgReal Source #
HasKind AlgReal Source # |

Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: AlgReal -> Kind Source #

hasSign :: AlgReal -> Bool Source #

intSizeOf :: AlgReal -> Int Source #

isBoolean :: AlgReal -> Bool Source #

isBounded :: AlgReal -> Bool Source #

isReal :: AlgReal -> Bool Source #

isFloat :: AlgReal -> Bool Source #

isDouble :: AlgReal -> Bool Source #

isInteger :: AlgReal -> Bool Source #

isUninterpreted :: AlgReal -> Bool Source #

isChar :: AlgReal -> Bool Source #

isString :: AlgReal -> Bool Source #

isList :: AlgReal -> Bool Source #

showType :: AlgReal -> String Source #

SymWord AlgReal Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

forall :: String -> Symbolic (SBV AlgReal) Source #

forall_ :: Symbolic (SBV AlgReal) Source #

mkForallVars :: Int -> Symbolic [SBV AlgReal] Source #

exists :: String -> Symbolic (SBV AlgReal) Source #

exists_ :: Symbolic (SBV AlgReal) Source #

mkExistVars :: Int -> Symbolic [SBV AlgReal] Source #

free :: String -> Symbolic (SBV AlgReal) Source #

free_ :: Symbolic (SBV AlgReal) Source #

mkFreeVars :: Int -> Symbolic [SBV AlgReal] Source #

symbolic :: String -> Symbolic (SBV AlgReal) Source #

symbolics :: [String] -> Symbolic [SBV AlgReal] Source #

literal :: AlgReal -> SBV AlgReal Source #

unliteral :: SBV AlgReal -> Maybe AlgReal Source #

fromCW :: CW -> AlgReal Source #

isConcrete :: SBV AlgReal -> Bool Source #

isSymbolic :: SBV AlgReal -> Bool Source #

isConcretely :: SBV AlgReal -> (AlgReal -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV AlgReal) Source #

SatModel AlgReal Source # | `AlgReal` as extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe (AlgReal, [CW]) Source # cvtModel :: (AlgReal -> Maybe b) -> Maybe (AlgReal, [CW]) -> Maybe (b, [CW]) Source #
SMTValue AlgReal Source # |
Instance details Defined in Data.SBV.Control.Utils Methods sexprToVal :: SExpr -> Maybe AlgReal Source #
Metric SReal Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SReal -> Symbolic () Source # maximize :: String -> SReal -> Symbolic () Source #
IEEEFloatConvertable AlgReal Source # |
Instance details Defined in Data.SBV.Core.Floating Methods fromSFloat :: SRoundingMode -> SFloat -> SBV AlgReal Source # toSFloat :: SRoundingMode -> SBV AlgReal -> SFloat Source # fromSDouble :: SRoundingMode -> SDouble -> SBV AlgReal Source # toSDouble :: SRoundingMode -> SBV AlgReal -> SDouble Source #

sRealToSInteger :: SReal -> SInteger Source #

Convert an SReal to an SInteger. That is, it computes the largest integer `n` that satisfies `sIntegerToSReal n <= r` essentially giving us the `floor`.

For instance, `1.3` will be `1`, but `-1.3` will be `-2`.

## Characters, Strings and Regular Expressions

Support for characters, strings, and regular expressions (intial version contributed by Joel Burget) adds support for QF_S logic, described here: http://smtlib.cs.uiowa.edu/theories-UnicodeStrings.shtml and here: http://rise4fun.com/z3/tutorialcontent/sequences. Note that this logic is still not part of official SMTLib (as of March 2018), so it should be considered experimental.

See Data.SBV.Char, Data.SBV.String, Data.SBV.RegExp for related functions.

type SChar = SBV Char Source #

A symbolic character. Note that, as far as SBV's symbolic strings are concerned, a character is currently an 8-bit unsigned value, corresponding to the ISO-8859-1 (Latin-1) character set: http://en.wikipedia.org/wiki/ISO/IEC_8859-1. A Haskell `Char`, on the other hand, is based on unicode. Therefore, there isn't a 1-1 correspondence between a Haskell character and an SBV character for the time being. This limitation is due to the SMT-solvers only supporting this particular subset. However, there is a pending proposal to add support for unicode, and SBV will track these changes to have full unicode support as solvers become available. For details, see: http://smtlib.cs.uiowa.edu/theories-UnicodeStrings.shtml

type SString = SBV String Source #

A symbolic string. Note that a symbolic string is not a list of symbolic characters, that is, it is not the case that `SString = [SChar]`, unlike what one might expect following Haskell strings. An `SString` is a symbolic value of its own, of possibly arbitrary but finite length, and internally processed as one unit as opposed to a fixed-length list of characters.

## Symbolic lists

Support for symbolic lists (intial version contributed by Joel Burget) adds support for sequence support, described here: http://rise4fun.com/z3/tutorialcontent/sequences. Note that this logic is still not part of official SMTLib (as of March 2018), so it should be considered experimental.

See Data.SBV.List for related functions.

type SList a = SBV [a] Source #

A symbolic list of items. Note that a symbolic list is not a list of symbolic items, that is, it is not the case that `SList a = [a]`, unlike what one might expect following haskell lists/sequences. An `SList` is a symbolic value of its own, of possibly arbitrary but finite length, and internally processed as one unit as opposed to a fixed-length list of items. Note that lists can be nested, i.e., we do allow lists of lists of ... items.

# Arrays of symbolic values

class SymArray array where Source #

Flat arrays of symbolic values An `array a b` is an array indexed by the type ``SBV` a`, with elements of type ``SBV` b`.

If a default value is supplied, then all the array elements will be initialized to this value. Otherwise, they will be left unspecified, i.e., a read from an unwritten location will produce an uninterpreted constant.

While it's certainly possible for user to create instances of `SymArray`, the `SArray` and `SFunArray` instances already provided should cover most use cases in practice. Note that there are a few differences between these two models in terms of use models:

- `SArray` produces SMTLib arrays, and requires a solver that understands the array theory. `SFunArray` is internally handled, and thus can be used with any solver. (Note that all solvers except `abc` support arrays, so this isn't a big decision factor.)
- For both arrays, if a default value is supplied, then reading from uninitialized cell will return that value. If the default is not given, then reading from uninitialized cells is still OK for both arrays, and will produce an uninterpreted constant in both cases.
- Only `SArray` supports checking equality of arrays. (That is, checking if an entire array is equivalent to another.) `SFunArray`s cannot be checked for equality. In general, checking wholesale equality of arrays is a difficult decision problem and should be avoided if possible.
- Only `SFunArray` supports compilation to C. Programs using `SArray` will not be accepted by the C-code generator.
- You cannot use quickcheck on programs that contain these arrays. (Neither `SArray` nor `SFunArray`.)
- With `SArray`, SBV transfers all array-processing to the SMT-solver. So, it can generate programs more quickly, but they might end up being too hard for the solver to handle. With `SFunArray`, SBV only generates code for individual elements and the array itself never shows up in the resulting SMTLib program. This puts more onus on the SBV side and might have some performance impacts, but it might generate problems that are easier for the SMT solvers to handle.

As a rule of thumb, try `SArray` first. These should generate compact code. However, if the backend solver has hard time solving the generated problems, switch to `SFunArray`. If you still have issues, please report so we can see what the problem might be!

Minimal complete definition

readArray, writeArray, mergeArrays, newArrayInState

Methods

newArray_ :: (HasKind a, HasKind b) => Maybe (SBV b) -> Symbolic (array a b) Source #

Create a new anonymous array, possibly with a default initial value.

newArray :: (HasKind a, HasKind b) => String -> Maybe (SBV b) -> Symbolic (array a b) Source #

Create a named new array, possibly with a default initial value.

readArray :: array a b -> SBV a -> SBV b Source #

Read the array element at `a`

writeArray :: SymWord b => array a b -> SBV a -> SBV b -> array a b Source #

Update the element at `a` to be `b`

Instances

SymArray SFunArray Source # |

Instance details

Defined in Data.SBV.Core.Data

Methods

newArray_ :: (HasKind a, HasKind b) => Maybe (SBV b) -> Symbolic (SFunArray a b) Source #

newArray :: (HasKind a, HasKind b) => String -> Maybe (SBV b) -> Symbolic (SFunArray a b) Source #

readArray :: SFunArray a b -> SBV a -> SBV b Source #

writeArray :: SymWord b => SFunArray a b -> SBV a -> SBV b -> SFunArray a b Source #

mergeArrays :: SymWord b => SBV Bool -> SFunArray a b -> SFunArray a b -> SFunArray a b Source #

newArrayInState :: (HasKind a, HasKind b) => Maybe String -> Maybe (SBV b) -> State -> IO (SFunArray a b) Source #

SymArray SArray Source # |

Instance details

Defined in Data.SBV.Core.Data

Methods

newArray_ :: (HasKind a, HasKind b) => Maybe (SBV b) -> Symbolic (SArray a b) Source #

newArray :: (HasKind a, HasKind b) => String -> Maybe (SBV b) -> Symbolic (SArray a b) Source #

readArray :: SArray a b -> SBV a -> SBV b Source #

writeArray :: SymWord b => SArray a b -> SBV a -> SBV b -> SArray a b Source #

mergeArrays :: SymWord b => SBV Bool -> SArray a b -> SArray a b -> SArray a b Source #

newArrayInState :: (HasKind a, HasKind b) => Maybe String -> Maybe (SBV b) -> State -> IO (SArray a b) Source #

data SArray a b Source #

Arrays implemented in terms of SMT-arrays: http://smtlib.cs.uiowa.edu/theories-ArraysEx.shtml

- Maps directly to SMT-lib arrays
- Reading from an unintialized value is OK. If the default value is given in `newArray`, it will be the result. Otherwise, the read yields an uninterpreted constant.
- Can check for equality of these arrays
- Cannot be used in code-generation (i.e., compilation to C)
- Cannot quick-check theorems using `SArray` values
- Typically slower as it heavily relies on SMT-solving for the array theory

Instances

SymArray SArray Source # |

Instance details

Defined in Data.SBV.Core.Data

Methods

newArray_ :: (HasKind a, HasKind b) => Maybe (SBV b) -> Symbolic (SArray a b) Source #

newArray :: (HasKind a, HasKind b) => String -> Maybe (SBV b) -> Symbolic (SArray a b) Source #

readArray :: SArray a b -> SBV a -> SBV b Source #

writeArray :: SymWord b => SArray a b -> SBV a -> SBV b -> SArray a b Source #

mergeArrays :: SymWord b => SBV Bool -> SArray a b -> SArray a b -> SArray a b Source #

newArrayInState :: (HasKind a, HasKind b) => Maybe String -> Maybe (SBV b) -> State -> IO (SArray a b) Source #

(HasKind a, HasKind b) => Show (SArray a b) Source # |
Instance details Defined in Data.SBV.Core.Data Methods showsPrec :: Int -> SArray a b -> ShowS Source # show :: SArray a b -> String Source # showList :: [SArray a b] -> ShowS Source #
(HasKind a, HasKind b, Provable p) => Provable (SArray a b -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: (SArray a b -> p) -> Predicate Source #

forAll :: [String] -> (SArray a b -> p) -> Predicate Source #

forSome_ :: (SArray a b -> p) -> Predicate Source #

forSome :: [String] -> (SArray a b -> p) -> Predicate Source #

prove :: (SArray a b -> p) -> IO ThmResult Source #

proveWith :: SMTConfig -> (SArray a b -> p) -> IO ThmResult Source #

sat :: (SArray a b -> p) -> IO SatResult Source #

satWith :: SMTConfig -> (SArray a b -> p) -> IO SatResult Source #

allSat :: (SArray a b -> p) -> IO AllSatResult Source #

allSatWith :: SMTConfig -> (SArray a b -> p) -> IO AllSatResult Source #

optimize :: OptimizeStyle -> (SArray a b -> p) -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> (SArray a b -> p) -> IO OptimizeResult Source #

isVacuous :: (SArray a b -> p) -> IO Bool Source #

isVacuousWith :: SMTConfig -> (SArray a b -> p) -> IO Bool Source #

isTheorem :: (SArray a b -> p) -> IO Bool Source #

isTheoremWith :: SMTConfig -> (SArray a b -> p) -> IO Bool Source #

isSatisfiable :: (SArray a b -> p) -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> (SArray a b -> p) -> IO Bool Source #

proveWithAll :: [SMTConfig] -> (SArray a b -> p) -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> (SArray a b -> p) -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> (SArray a b -> p) -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> (SArray a b -> p) -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> (SArray a b -> p) -> IO String Source #

SymWord b => Mergeable (SArray a b) Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> SArray a b -> SArray a b -> SArray a b Source # select :: (SymWord b0, Num b0) => [SArray a b] -> SArray a b -> SBV b0 -> SArray a b Source #
EqSymbolic (SArray a b) Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.==) :: SArray a b -> SArray a b -> SBool Source # (./=) :: SArray a b -> SArray a b -> SBool Source # distinct :: [SArray a b] -> SBool Source # allEqual :: [SArray a b] -> SBool Source # sElem :: SArray a b -> [SArray a b] -> SBool Source #

data SFunArray a b Source #

Arrays implemented internally, without translating to SMT-Lib functions:

- Internally handled by the library and not mapped to SMT-Lib, hence can be used with solvers that don't support arrays. (Such as abc.)
- Reading from an unintialized value is OK. If the default value is given in `newArray`, it will be the result. Otherwise, the read yields an uninterpreted constant.
- Cannot check for equality of arrays.
- Can be used in code-generation (i.e., compilation to C).
- Can not quick-check theorems using `SFunArray` values
- Typically faster as it gets compiled away during translation.

Instances

SymArray SFunArray Source # |

Instance details

Defined in Data.SBV.Core.Data

Methods

newArray_ :: (HasKind a, HasKind b) => Maybe (SBV b) -> Symbolic (SFunArray a b) Source #

newArray :: (HasKind a, HasKind b) => String -> Maybe (SBV b) -> Symbolic (SFunArray a b) Source #

readArray :: SFunArray a b -> SBV a -> SBV b Source #

writeArray :: SymWord b => SFunArray a b -> SBV a -> SBV b -> SFunArray a b Source #

mergeArrays :: SymWord b => SBV Bool -> SFunArray a b -> SFunArray a b -> SFunArray a b Source #

newArrayInState :: (HasKind a, HasKind b) => Maybe String -> Maybe (SBV b) -> State -> IO (SFunArray a b) Source #

(HasKind a, HasKind b) => Show (SFunArray a b) Source # |
Instance details Defined in Data.SBV.Core.Data Methods showsPrec :: Int -> SFunArray a b -> ShowS Source # show :: SFunArray a b -> String Source # showList :: [SFunArray a b] -> ShowS Source #
(HasKind a, HasKind b, Provable p) => Provable (SFunArray a b -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: (SFunArray a b -> p) -> Predicate Source #

forAll :: [String] -> (SFunArray a b -> p) -> Predicate Source #

forSome_ :: (SFunArray a b -> p) -> Predicate Source #

forSome :: [String] -> (SFunArray a b -> p) -> Predicate Source #

prove :: (SFunArray a b -> p) -> IO ThmResult Source #

proveWith :: SMTConfig -> (SFunArray a b -> p) -> IO ThmResult Source #

sat :: (SFunArray a b -> p) -> IO SatResult Source #

satWith :: SMTConfig -> (SFunArray a b -> p) -> IO SatResult Source #

allSat :: (SFunArray a b -> p) -> IO AllSatResult Source #

allSatWith :: SMTConfig -> (SFunArray a b -> p) -> IO AllSatResult Source #

optimize :: OptimizeStyle -> (SFunArray a b -> p) -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> (SFunArray a b -> p) -> IO OptimizeResult Source #

isVacuous :: (SFunArray a b -> p) -> IO Bool Source #

isVacuousWith :: SMTConfig -> (SFunArray a b -> p) -> IO Bool Source #

isTheorem :: (SFunArray a b -> p) -> IO Bool Source #

isTheoremWith :: SMTConfig -> (SFunArray a b -> p) -> IO Bool Source #

isSatisfiable :: (SFunArray a b -> p) -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> (SFunArray a b -> p) -> IO Bool Source #

proveWithAll :: [SMTConfig] -> (SFunArray a b -> p) -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> (SFunArray a b -> p) -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> (SFunArray a b -> p) -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> (SFunArray a b -> p) -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> (SFunArray a b -> p) -> IO String Source #

SymWord b => Mergeable (SFunArray a b) Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> SFunArray a b -> SFunArray a b -> SFunArray a b Source # select :: (SymWord b0, Num b0) => [SFunArray a b] -> SFunArray a b -> SBV b0 -> SFunArray a b Source #

# Creating symbolic values

## Single value

These functions simplify declaring symbolic variables of various types. Strictly speaking, they are just synonyms for `free` (specialized at the given type), but they might be easier to use.

sBool :: String -> Symbolic SBool Source #

Declare an `SBool`

sWord8 :: String -> Symbolic SWord8 Source #

Declare an `SWord8`

sWord16 :: String -> Symbolic SWord16 Source #

Declare an `SWord16`

sWord32 :: String -> Symbolic SWord32 Source #

Declare an `SWord32`

sWord64 :: String -> Symbolic SWord64 Source #

Declare an `SWord64`

sInt8 :: String -> Symbolic SInt8 Source #

Declare an `SInt8`

sInt16 :: String -> Symbolic SInt16 Source #

Declare an `SInt16`

sInt32 :: String -> Symbolic SInt32 Source #

Declare an `SInt32`

sInt64 :: String -> Symbolic SInt64 Source #

Declare an `SInt64`

sInteger :: String -> Symbolic SInteger Source #

Declare an `SInteger`

sReal :: String -> Symbolic SReal Source #

Declare an `SReal`

sFloat :: String -> Symbolic SFloat Source #

Declare an `SFloat`

sDouble :: String -> Symbolic SDouble Source #

Declare an `SDouble`

sChar :: String -> Symbolic SChar Source #

Declare an `SChar`

sString :: String -> Symbolic SString Source #

Declare an `SString`

sList :: forall a. SymWord a => String -> Symbolic (SList a) Source #

Declare an `SList`

## List of values

These functions simplify declaring a sequence symbolic variables of various types. Strictly speaking, they are just synonyms for `mapM` `free` (specialized at the given type), but they might be easier to use.

sBools :: [String] -> Symbolic [SBool] Source #

Declare a list of `SBool`s

sWord8s :: [String] -> Symbolic [SWord8] Source #

Declare a list of `SWord8`s

sWord16s :: [String] -> Symbolic [SWord16] Source #

Declare a list of `SWord16`s

sWord32s :: [String] -> Symbolic [SWord32] Source #

Declare a list of `SWord32`s

sWord64s :: [String] -> Symbolic [SWord64] Source #

Declare a list of `SWord64`s

sInt8s :: [String] -> Symbolic [SInt8] Source #

Declare a list of `SInt8`s

sInt16s :: [String] -> Symbolic [SInt16] Source #

Declare a list of `SInt16`s

sInt32s :: [String] -> Symbolic [SInt32] Source #

Declare a list of `SInt32`s

sInt64s :: [String] -> Symbolic [SInt64] Source #

Declare a list of `SInt64`s

sIntegers :: [String] -> Symbolic [SInteger] Source #

Declare a list of `SInteger`s

sReals :: [String] -> Symbolic [SReal] Source #

Declare a list of `SReal`s

sFloats :: [String] -> Symbolic [SFloat] Source #

Declare a list of `SFloat`s

sDoubles :: [String] -> Symbolic [SDouble] Source #

Declare a list of `SDouble`s

sChars :: [String] -> Symbolic [SChar] Source #

Declare a list of `SChar`s

sStrings :: [String] -> Symbolic [SString] Source #

Declare a list of `SString`s

sLists :: forall a. SymWord a => [String] -> Symbolic [SList a] Source #

Declare a list of `SList`s

# Symbolic Equality and Comparisons

class EqSymbolic a where Source #

Symbolic Equality. Note that we can't use Haskell's `Eq` class since Haskell insists on returning Bool Comparing symbolic values will necessarily return a symbolic value.

Minimal complete definition

(.==)

Methods

(.==) :: a -> a -> SBool infix 4 Source #

Symbolic equality.

(./=) :: a -> a -> SBool infix 4 Source #

Symbolic inequality.

distinct :: [a] -> SBool Source #

Returns (symbolic) true if all the elements of the given list are different.

allEqual :: [a] -> SBool Source #

Returns (symbolic) true if all the elements of the given list are the same.

sElem :: a -> [a] -> SBool Source #

Symbolic membership test.

Instances

EqSymbolic Bool Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.==) :: Bool -> Bool -> SBool Source # (./=) :: Bool -> Bool -> SBool Source # distinct :: [Bool] -> SBool Source # allEqual :: [Bool] -> SBool Source # sElem :: Bool -> [Bool] -> SBool Source #
EqSymbolic a => EqSymbolic [a] Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.==) :: [a] -> [a] -> SBool Source # (./=) :: [a] -> [a] -> SBool Source # distinct :: [[a]] -> SBool Source # allEqual :: [[a]] -> SBool Source # sElem :: [a] -> [[a]] -> SBool Source #
EqSymbolic a => EqSymbolic (Maybe a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.==) :: Maybe a -> Maybe a -> SBool Source # (./=) :: Maybe a -> Maybe a -> SBool Source # distinct :: [Maybe a] -> SBool Source # allEqual :: [Maybe a] -> SBool Source # sElem :: Maybe a -> [Maybe a] -> SBool Source #
EqSymbolic (SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.==) :: SBV a -> SBV a -> SBool Source # (./=) :: SBV a -> SBV a -> SBool Source # distinct :: [SBV a] -> SBool Source # allEqual :: [SBV a] -> SBool Source # sElem :: SBV a -> [SBV a] -> SBool Source #
(EqSymbolic a, EqSymbolic b) => EqSymbolic (Either a b) Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.==) :: Either a b -> Either a b -> SBool Source # (./=) :: Either a b -> Either a b -> SBool Source # distinct :: [Either a b] -> SBool Source # allEqual :: [Either a b] -> SBool Source # sElem :: Either a b -> [Either a b] -> SBool Source #
(EqSymbolic a, EqSymbolic b) => EqSymbolic (a, b) Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.==) :: (a, b) -> (a, b) -> SBool Source # (./=) :: (a, b) -> (a, b) -> SBool Source # distinct :: [(a, b)] -> SBool Source # allEqual :: [(a, b)] -> SBool Source # sElem :: (a, b) -> [(a, b)] -> SBool Source #
EqSymbolic (SArray a b) Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.==) :: SArray a b -> SArray a b -> SBool Source # (./=) :: SArray a b -> SArray a b -> SBool Source # distinct :: [SArray a b] -> SBool Source # allEqual :: [SArray a b] -> SBool Source # sElem :: SArray a b -> [SArray a b] -> SBool Source #
(EqSymbolic a, EqSymbolic b, EqSymbolic c) => EqSymbolic (a, b, c) Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.==) :: (a, b, c) -> (a, b, c) -> SBool Source # (./=) :: (a, b, c) -> (a, b, c) -> SBool Source # distinct :: [(a, b, c)] -> SBool Source # allEqual :: [(a, b, c)] -> SBool Source # sElem :: (a, b, c) -> [(a, b, c)] -> SBool Source #
(EqSymbolic a, EqSymbolic b, EqSymbolic c, EqSymbolic d) => EqSymbolic (a, b, c, d) Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.==) :: (a, b, c, d) -> (a, b, c, d) -> SBool Source # (./=) :: (a, b, c, d) -> (a, b, c, d) -> SBool Source # distinct :: [(a, b, c, d)] -> SBool Source # allEqual :: [(a, b, c, d)] -> SBool Source # sElem :: (a, b, c, d) -> [(a, b, c, d)] -> SBool Source #
(EqSymbolic a, EqSymbolic b, EqSymbolic c, EqSymbolic d, EqSymbolic e) => EqSymbolic (a, b, c, d, e) Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.==) :: (a, b, c, d, e) -> (a, b, c, d, e) -> SBool Source # (./=) :: (a, b, c, d, e) -> (a, b, c, d, e) -> SBool Source # distinct :: [(a, b, c, d, e)] -> SBool Source # allEqual :: [(a, b, c, d, e)] -> SBool Source # sElem :: (a, b, c, d, e) -> [(a, b, c, d, e)] -> SBool Source #
(EqSymbolic a, EqSymbolic b, EqSymbolic c, EqSymbolic d, EqSymbolic e, EqSymbolic f) => EqSymbolic (a, b, c, d, e, f) Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.==) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> SBool Source # (./=) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> SBool Source # distinct :: [(a, b, c, d, e, f)] -> SBool Source # allEqual :: [(a, b, c, d, e, f)] -> SBool Source # sElem :: (a, b, c, d, e, f) -> [(a, b, c, d, e, f)] -> SBool Source #
(EqSymbolic a, EqSymbolic b, EqSymbolic c, EqSymbolic d, EqSymbolic e, EqSymbolic f, EqSymbolic g) => EqSymbolic (a, b, c, d, e, f, g) Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.==) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> SBool Source # (./=) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> SBool Source # distinct :: [(a, b, c, d, e, f, g)] -> SBool Source # allEqual :: [(a, b, c, d, e, f, g)] -> SBool Source # sElem :: (a, b, c, d, e, f, g) -> [(a, b, c, d, e, f, g)] -> SBool Source #

class (Mergeable a, EqSymbolic a) => OrdSymbolic a where Source #

Symbolic Comparisons. Similar to `Eq`, we cannot implement Haskell's `Ord` class since there is no way to return an `Ordering` value from a symbolic comparison. Furthermore, `OrdSymbolic` requires `Mergeable` to implement if-then-else, for the benefit of implementing symbolic versions of `max` and `min` functions.

Minimal complete definition

(.<)

Methods

(.<) :: a -> a -> SBool infix 4 Source #

Symbolic less than.

(.<=) :: a -> a -> SBool infix 4 Source #

Symbolic less than or equal to.

(.>) :: a -> a -> SBool infix 4 Source #

Symbolic greater than.

(.>=) :: a -> a -> SBool infix 4 Source #

Symbolic greater than or equal to.

smin :: a -> a -> a Source #

Symbolic minimum.

smax :: a -> a -> a Source #

Symbolic maximum.

inRange :: a -> (a, a) -> SBool Source #

Is the value withing the allowed inclusive range?

Instances

OrdSymbolic a => OrdSymbolic [a] Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.<) :: [a] -> [a] -> SBool Source # (.<=) :: [a] -> [a] -> SBool Source # (.>) :: [a] -> [a] -> SBool Source # (.>=) :: [a] -> [a] -> SBool Source # smin :: [a] -> [a] -> [a] Source # smax :: [a] -> [a] -> [a] Source # inRange :: [a] -> ([a], [a]) -> SBool Source #
OrdSymbolic a => OrdSymbolic (Maybe a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.<) :: Maybe a -> Maybe a -> SBool Source # (.<=) :: Maybe a -> Maybe a -> SBool Source # (.>) :: Maybe a -> Maybe a -> SBool Source # (.>=) :: Maybe a -> Maybe a -> SBool Source # smin :: Maybe a -> Maybe a -> Maybe a Source # smax :: Maybe a -> Maybe a -> Maybe a Source # inRange :: Maybe a -> (Maybe a, Maybe a) -> SBool Source #
SymWord a => OrdSymbolic (SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.<) :: SBV a -> SBV a -> SBool Source # (.<=) :: SBV a -> SBV a -> SBool Source # (.>) :: SBV a -> SBV a -> SBool Source # (.>=) :: SBV a -> SBV a -> SBool Source # smin :: SBV a -> SBV a -> SBV a Source # smax :: SBV a -> SBV a -> SBV a Source # inRange :: SBV a -> (SBV a, SBV a) -> SBool Source #
(OrdSymbolic a, OrdSymbolic b) => OrdSymbolic (Either a b) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

(.<) :: Either a b -> Either a b -> SBool Source #

(.<=) :: Either a b -> Either a b -> SBool Source #

(.>) :: Either a b -> Either a b -> SBool Source #

(.>=) :: Either a b -> Either a b -> SBool Source #

smin :: Either a b -> Either a b -> Either a b Source #

smax :: Either a b -> Either a b -> Either a b Source #

inRange :: Either a b -> (Either a b, Either a b) -> SBool Source #

(OrdSymbolic a, OrdSymbolic b) => OrdSymbolic (a, b) Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.<) :: (a, b) -> (a, b) -> SBool Source # (.<=) :: (a, b) -> (a, b) -> SBool Source # (.>) :: (a, b) -> (a, b) -> SBool Source # (.>=) :: (a, b) -> (a, b) -> SBool Source # smin :: (a, b) -> (a, b) -> (a, b) Source # smax :: (a, b) -> (a, b) -> (a, b) Source # inRange :: (a, b) -> ((a, b), (a, b)) -> SBool Source #
(OrdSymbolic a, OrdSymbolic b, OrdSymbolic c) => OrdSymbolic (a, b, c) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

(.<) :: (a, b, c) -> (a, b, c) -> SBool Source #

(.<=) :: (a, b, c) -> (a, b, c) -> SBool Source #

(.>) :: (a, b, c) -> (a, b, c) -> SBool Source #

(.>=) :: (a, b, c) -> (a, b, c) -> SBool Source #

smin :: (a, b, c) -> (a, b, c) -> (a, b, c) Source #

smax :: (a, b, c) -> (a, b, c) -> (a, b, c) Source #

inRange :: (a, b, c) -> ((a, b, c), (a, b, c)) -> SBool Source #

(OrdSymbolic a, OrdSymbolic b, OrdSymbolic c, OrdSymbolic d) => OrdSymbolic (a, b, c, d) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

(.<) :: (a, b, c, d) -> (a, b, c, d) -> SBool Source #

(.<=) :: (a, b, c, d) -> (a, b, c, d) -> SBool Source #

(.>) :: (a, b, c, d) -> (a, b, c, d) -> SBool Source #

(.>=) :: (a, b, c, d) -> (a, b, c, d) -> SBool Source #

smin :: (a, b, c, d) -> (a, b, c, d) -> (a, b, c, d) Source #

smax :: (a, b, c, d) -> (a, b, c, d) -> (a, b, c, d) Source #

inRange :: (a, b, c, d) -> ((a, b, c, d), (a, b, c, d)) -> SBool Source #

(OrdSymbolic a, OrdSymbolic b, OrdSymbolic c, OrdSymbolic d, OrdSymbolic e) => OrdSymbolic (a, b, c, d, e) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

(.<) :: (a, b, c, d, e) -> (a, b, c, d, e) -> SBool Source #

(.<=) :: (a, b, c, d, e) -> (a, b, c, d, e) -> SBool Source #

(.>) :: (a, b, c, d, e) -> (a, b, c, d, e) -> SBool Source #

(.>=) :: (a, b, c, d, e) -> (a, b, c, d, e) -> SBool Source #

smin :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) Source #

smax :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) Source #

inRange :: (a, b, c, d, e) -> ((a, b, c, d, e), (a, b, c, d, e)) -> SBool Source #

(OrdSymbolic a, OrdSymbolic b, OrdSymbolic c, OrdSymbolic d, OrdSymbolic e, OrdSymbolic f) => OrdSymbolic (a, b, c, d, e, f) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

(.<) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> SBool Source #

(.<=) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> SBool Source #

(.>) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> SBool Source #

(.>=) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> SBool Source #

smin :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) Source #

smax :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) Source #

inRange :: (a, b, c, d, e, f) -> ((a, b, c, d, e, f), (a, b, c, d, e, f)) -> SBool Source #

(OrdSymbolic a, OrdSymbolic b, OrdSymbolic c, OrdSymbolic d, OrdSymbolic e, OrdSymbolic f, OrdSymbolic g) => OrdSymbolic (a, b, c, d, e, f, g) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

(.<) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> SBool Source #

(.<=) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> SBool Source #

(.>) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> SBool Source #

(.>=) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> SBool Source #

smin :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) Source #

smax :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) Source #

inRange :: (a, b, c, d, e, f, g) -> ((a, b, c, d, e, f, g), (a, b, c, d, e, f, g)) -> SBool Source #

class Equality a where Source #

Equality as a proof method. Allows for very concise construction of equivalence proofs, which is very typical in bit-precise proofs.

Methods

(===) :: a -> a -> IO ThmResult infix 4 Source #

Instances

(SymWord a, SymWord b, EqSymbolic z) => Equality ((SBV a, SBV b) -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: ((SBV a, SBV b) -> z) -> ((SBV a, SBV b) -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c) -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: ((SBV a, SBV b, SBV c) -> z) -> ((SBV a, SBV b, SBV c) -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, SymWord d, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c, SBV d) -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: ((SBV a, SBV b, SBV c, SBV d) -> z) -> ((SBV a, SBV b, SBV c, SBV d) -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c, SBV d, SBV e) -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> z) -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> z) -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, SymWord g, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> z) -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, SymWord g, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> SBV f -> SBV g -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> SBV f -> SBV g -> z) -> (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> SBV f -> SBV g -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> SBV f -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> SBV f -> z) -> (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> SBV f -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> z) -> (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, SymWord d, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> SBV d -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: (SBV a -> SBV b -> SBV c -> SBV d -> z) -> (SBV a -> SBV b -> SBV c -> SBV d -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: (SBV a -> SBV b -> SBV c -> z) -> (SBV a -> SBV b -> SBV c -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, EqSymbolic z) => Equality (SBV a -> SBV b -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: (SBV a -> SBV b -> z) -> (SBV a -> SBV b -> z) -> IO ThmResult Source #
(SymWord a, EqSymbolic z) => Equality (SBV a -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: (SBV a -> z) -> (SBV a -> z) -> IO ThmResult Source #

# Conditionals: Mergeable values

class Mergeable a where Source #

Symbolic conditionals are modeled by the `Mergeable` class, describing how to merge the results of an if-then-else call with a symbolic test. SBV provides all basic types as instances of this class, so users only need to declare instances for custom data-types of their programs as needed.

A `Mergeable` instance may be automatically derived for a custom data-type with a single constructor where the type of each field is an instance of `Mergeable`, such as a record of symbolic values. Users only need to add `Generic` and `Mergeable` to the `deriving` clause for the data-type. See `Status` for an example and an illustration of what the instance would look like if written by hand.

The function `select` is a total-indexing function out of a list of choices with a default value, simulating array/list indexing. It's an n-way generalization of the `ite` function.

Minimal complete definition: None, if the type is instance of `Generic`. Otherwise `symbolicMerge`. Note that most types subject to merging are likely to be trivial instances of `Generic`.

Minimal complete definition

Nothing

Methods

symbolicMerge :: Bool -> SBool -> a -> a -> a Source #

Merge two values based on the condition. The first argument states whether we force the then-and-else branches before the merging, at the word level. This is an efficiency concern; one that we'd rather not make but unfortunately necessary for getting symbolic simulation working efficiently.

select :: (SymWord b, Num b) => [a] -> a -> SBV b -> a Source #

Total indexing operation. `select xs default index` is intuitively the same as `xs !! index`, except it evaluates to `default` if `index` underflows/overflows.

symbolicMerge :: (Generic a, GMergeable (Rep a)) => Bool -> SBool -> a -> a -> a Source #

Merge two values based on the condition. The first argument states whether we force the then-and-else branches before the merging, at the word level. This is an efficiency concern; one that we'd rather not make but unfortunately necessary for getting symbolic simulation working efficiently.

Instances

Mergeable () Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> () -> () -> () Source # select :: (SymWord b, Num b) => [()] -> () -> SBV b -> () Source #
Mergeable Mostek Source # |
Instance details Defined in Documentation.SBV.Examples.BitPrecise.Legato Methods symbolicMerge :: Bool -> SBool -> Mostek -> Mostek -> Mostek Source # select :: (SymWord b, Num b) => [Mostek] -> Mostek -> SBV b -> Mostek Source #
Mergeable Status Source # |
Instance details Defined in Documentation.SBV.Examples.Puzzles.U2Bridge Methods symbolicMerge :: Bool -> SBool -> Status -> Status -> Status Source # select :: (SymWord b, Num b) => [Status] -> Status -> SBV b -> Status Source #
Mergeable a => Mergeable [a] Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> [a] -> [a] -> [a] Source # select :: (SymWord b, Num b) => [[a]] -> [a] -> SBV b -> [a] Source #
Mergeable a => Mergeable (Maybe a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> Maybe a -> Maybe a -> Maybe a Source # select :: (SymWord b, Num b) => [Maybe a] -> Maybe a -> SBV b -> Maybe a Source #
Mergeable a => Mergeable (ZipList a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> ZipList a -> ZipList a -> ZipList a Source # select :: (SymWord b, Num b) => [ZipList a] -> ZipList a -> SBV b -> ZipList a Source #
SymWord a => Mergeable (SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> SBV a -> SBV a -> SBV a Source # select :: (SymWord b, Num b) => [SBV a] -> SBV a -> SBV b -> SBV a Source #
Mergeable a => Mergeable (Move a) Source # | Mergeable instance for `Move` simply pushes the merging the data after run of each branch starting from the same state.
Instance details Defined in Documentation.SBV.Examples.Puzzles.U2Bridge Methods symbolicMerge :: Bool -> SBool -> Move a -> Move a -> Move a Source # select :: (SymWord b, Num b) => [Move a] -> Move a -> SBV b -> Move a Source #
Mergeable b => Mergeable (a -> b) Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> (a -> b) -> (a -> b) -> a -> b Source # select :: (SymWord b0, Num b0) => [a -> b] -> (a -> b) -> SBV b0 -> a -> b Source #
(Mergeable a, Mergeable b) => Mergeable (Either a b) Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> Either a b -> Either a b -> Either a b Source # select :: (SymWord b0, Num b0) => [Either a b] -> Either a b -> SBV b0 -> Either a b Source #
(Mergeable a, Mergeable b) => Mergeable (a, b) Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> (a, b) -> (a, b) -> (a, b) Source # select :: (SymWord b0, Num b0) => [(a, b)] -> (a, b) -> SBV b0 -> (a, b) Source #
(Ix a, Mergeable b) => Mergeable (Array a b) Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> Array a b -> Array a b -> Array a b Source # select :: (SymWord b0, Num b0) => [Array a b] -> Array a b -> SBV b0 -> Array a b Source #
SymWord b => Mergeable (SFunArray a b) Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> SFunArray a b -> SFunArray a b -> SFunArray a b Source # select :: (SymWord b0, Num b0) => [SFunArray a b] -> SFunArray a b -> SBV b0 -> SFunArray a b Source #
SymWord b => Mergeable (SArray a b) Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> SArray a b -> SArray a b -> SArray a b Source # select :: (SymWord b0, Num b0) => [SArray a b] -> SArray a b -> SBV b0 -> SArray a b Source #
SymWord e => Mergeable (STree i e) Source # |
Instance details Defined in Data.SBV.Tools.STree Methods symbolicMerge :: Bool -> SBool -> STree i e -> STree i e -> STree i e Source # select :: (SymWord b, Num b) => [STree i e] -> STree i e -> SBV b -> STree i e Source #
(Mergeable a, Mergeable b, Mergeable c) => Mergeable (a, b, c) Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> (a, b, c) -> (a, b, c) -> (a, b, c) Source # select :: (SymWord b0, Num b0) => [(a, b, c)] -> (a, b, c) -> SBV b0 -> (a, b, c) Source #
(Mergeable a, Mergeable b, Mergeable c, Mergeable d) => Mergeable (a, b, c, d) Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> (a, b, c, d) -> (a, b, c, d) -> (a, b, c, d) Source # select :: (SymWord b0, Num b0) => [(a, b, c, d)] -> (a, b, c, d) -> SBV b0 -> (a, b, c, d) Source #
(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e) => Mergeable (a, b, c, d, e) Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) Source # select :: (SymWord b0, Num b0) => [(a, b, c, d, e)] -> (a, b, c, d, e) -> SBV b0 -> (a, b, c, d, e) Source #
(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f) => Mergeable (a, b, c, d, e, f) Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) Source # select :: (SymWord b0, Num b0) => [(a, b, c, d, e, f)] -> (a, b, c, d, e, f) -> SBV b0 -> (a, b, c, d, e, f) Source #
(Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g) => Mergeable (a, b, c, d, e, f, g) Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) Source # select :: (SymWord b0, Num b0) => [(a, b, c, d, e, f, g)] -> (a, b, c, d, e, f, g) -> SBV b0 -> (a, b, c, d, e, f, g) Source #

ite :: Mergeable a => SBool -> a -> a -> a Source #

If-then-else. This is by definition `symbolicMerge` with both branches forced. This is typically the desired behavior, but also see `iteLazy` should you need more laziness.

iteLazy :: Mergeable a => SBool -> a -> a -> a Source #

A Lazy version of ite, which does not force its arguments. This might cause issues for symbolic simulation with large thunks around, so use with care.

# Symbolic integral numbers

class (SymWord a, Num a, Bits a, Integral a) => SIntegral a Source #

Symbolic Numbers. This is a simple class that simply incorporates all number like base types together, simplifying writing polymorphic type-signatures that work for all symbolic numbers, such as `SWord8`, `SInt8` etc. For instance, we can write a generic list-minimum function as follows:

       mm :: SIntegral a => [SBV a] -> SBV a
       mm = foldr1 (a b -> ite (a .<= b) a b)

It is similar to the standard `Integral` class, except ranging over symbolic instances.

Instances

SIntegral Int8 Source # |
Instance details Defined in Data.SBV.Core.Model
SIntegral Int16 Source # |
Instance details Defined in Data.SBV.Core.Model
SIntegral Int32 Source # |
Instance details Defined in Data.SBV.Core.Model
SIntegral Int64 Source # |
Instance details Defined in Data.SBV.Core.Model
SIntegral Integer Source # |
Instance details Defined in Data.SBV.Core.Model
SIntegral Word8 Source # |
Instance details Defined in Data.SBV.Core.Model
SIntegral Word16 Source # |
Instance details Defined in Data.SBV.Core.Model
SIntegral Word32 Source # |
Instance details Defined in Data.SBV.Core.Model
SIntegral Word64 Source # |
Instance details Defined in Data.SBV.Core.Model
SIntegral Word4 Source # | SIntegral instance, using default methods
Instance details Defined in Documentation.SBV.Examples.Misc.Word4

# Division and Modulus

class SDivisible a where Source #

The `SDivisible` class captures the essence of division. Unfortunately we cannot use Haskell's `Integral` class since the `Real` and `Enum` superclasses are not implementable for symbolic bit-vectors. However, `quotRem` and `divMod` both make perfect sense, and the `SDivisible` class captures this operation. One issue is how division by 0 behaves. The verification technology requires total functions, and there are several design choices here. We follow Isabelle/HOL approach of assigning the value 0 for division by 0. Therefore, we impose the following pair of laws:

         x sQuotRem 0 = (0, x)
         x sDivMod  0 = (0, x)

Note that our instances implement this law even when `x` is `0` itself.

NB. `quot` truncates toward zero, while `div` truncates toward negative infinity.

Minimal complete definition: `sQuotRem`, `sDivMod`

Minimal complete definition

sQuotRem, sDivMod

Methods

sQuotRem :: a -> a -> (a, a) Source #

sDivMod :: a -> a -> (a, a) Source #

sQuot :: a -> a -> a Source #

sRem :: a -> a -> a Source #

sDiv :: a -> a -> a Source #

sMod :: a -> a -> a Source #

Instances

SDivisible Int8 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: Int8 -> Int8 -> (Int8, Int8) Source # sDivMod :: Int8 -> Int8 -> (Int8, Int8) Source # sQuot :: Int8 -> Int8 -> Int8 Source # sRem :: Int8 -> Int8 -> Int8 Source # sDiv :: Int8 -> Int8 -> Int8 Source # sMod :: Int8 -> Int8 -> Int8 Source #
SDivisible Int16 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: Int16 -> Int16 -> (Int16, Int16) Source # sDivMod :: Int16 -> Int16 -> (Int16, Int16) Source # sQuot :: Int16 -> Int16 -> Int16 Source # sRem :: Int16 -> Int16 -> Int16 Source # sDiv :: Int16 -> Int16 -> Int16 Source # sMod :: Int16 -> Int16 -> Int16 Source #
SDivisible Int32 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: Int32 -> Int32 -> (Int32, Int32) Source # sDivMod :: Int32 -> Int32 -> (Int32, Int32) Source # sQuot :: Int32 -> Int32 -> Int32 Source # sRem :: Int32 -> Int32 -> Int32 Source # sDiv :: Int32 -> Int32 -> Int32 Source # sMod :: Int32 -> Int32 -> Int32 Source #
SDivisible Int64 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: Int64 -> Int64 -> (Int64, Int64) Source # sDivMod :: Int64 -> Int64 -> (Int64, Int64) Source # sQuot :: Int64 -> Int64 -> Int64 Source # sRem :: Int64 -> Int64 -> Int64 Source # sDiv :: Int64 -> Int64 -> Int64 Source # sMod :: Int64 -> Int64 -> Int64 Source #
SDivisible Integer Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: Integer -> Integer -> (Integer, Integer) Source # sDivMod :: Integer -> Integer -> (Integer, Integer) Source # sQuot :: Integer -> Integer -> Integer Source # sRem :: Integer -> Integer -> Integer Source # sDiv :: Integer -> Integer -> Integer Source # sMod :: Integer -> Integer -> Integer Source #
SDivisible Word8 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: Word8 -> Word8 -> (Word8, Word8) Source # sDivMod :: Word8 -> Word8 -> (Word8, Word8) Source # sQuot :: Word8 -> Word8 -> Word8 Source # sRem :: Word8 -> Word8 -> Word8 Source # sDiv :: Word8 -> Word8 -> Word8 Source # sMod :: Word8 -> Word8 -> Word8 Source #
SDivisible Word16 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: Word16 -> Word16 -> (Word16, Word16) Source # sDivMod :: Word16 -> Word16 -> (Word16, Word16) Source # sQuot :: Word16 -> Word16 -> Word16 Source # sRem :: Word16 -> Word16 -> Word16 Source # sDiv :: Word16 -> Word16 -> Word16 Source # sMod :: Word16 -> Word16 -> Word16 Source #
SDivisible Word32 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: Word32 -> Word32 -> (Word32, Word32) Source # sDivMod :: Word32 -> Word32 -> (Word32, Word32) Source # sQuot :: Word32 -> Word32 -> Word32 Source # sRem :: Word32 -> Word32 -> Word32 Source # sDiv :: Word32 -> Word32 -> Word32 Source # sMod :: Word32 -> Word32 -> Word32 Source #
SDivisible Word64 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: Word64 -> Word64 -> (Word64, Word64) Source # sDivMod :: Word64 -> Word64 -> (Word64, Word64) Source # sQuot :: Word64 -> Word64 -> Word64 Source # sRem :: Word64 -> Word64 -> Word64 Source # sDiv :: Word64 -> Word64 -> Word64 Source # sMod :: Word64 -> Word64 -> Word64 Source #
SDivisible CW Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: CW -> CW -> (CW, CW) Source # sDivMod :: CW -> CW -> (CW, CW) Source # sQuot :: CW -> CW -> CW Source # sRem :: CW -> CW -> CW Source # sDiv :: CW -> CW -> CW Source # sMod :: CW -> CW -> CW Source #
SDivisible SInteger Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: SInteger -> SInteger -> (SInteger, SInteger) Source # sDivMod :: SInteger -> SInteger -> (SInteger, SInteger) Source # sQuot :: SInteger -> SInteger -> SInteger Source # sRem :: SInteger -> SInteger -> SInteger Source # sDiv :: SInteger -> SInteger -> SInteger Source # sMod :: SInteger -> SInteger -> SInteger Source #
SDivisible SInt64 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: SInt64 -> SInt64 -> (SInt64, SInt64) Source # sDivMod :: SInt64 -> SInt64 -> (SInt64, SInt64) Source # sQuot :: SInt64 -> SInt64 -> SInt64 Source # sRem :: SInt64 -> SInt64 -> SInt64 Source # sDiv :: SInt64 -> SInt64 -> SInt64 Source # sMod :: SInt64 -> SInt64 -> SInt64 Source #
SDivisible SInt32 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: SInt32 -> SInt32 -> (SInt32, SInt32) Source # sDivMod :: SInt32 -> SInt32 -> (SInt32, SInt32) Source # sQuot :: SInt32 -> SInt32 -> SInt32 Source # sRem :: SInt32 -> SInt32 -> SInt32 Source # sDiv :: SInt32 -> SInt32 -> SInt32 Source # sMod :: SInt32 -> SInt32 -> SInt32 Source #
SDivisible SInt16 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: SInt16 -> SInt16 -> (SInt16, SInt16) Source # sDivMod :: SInt16 -> SInt16 -> (SInt16, SInt16) Source # sQuot :: SInt16 -> SInt16 -> SInt16 Source # sRem :: SInt16 -> SInt16 -> SInt16 Source # sDiv :: SInt16 -> SInt16 -> SInt16 Source # sMod :: SInt16 -> SInt16 -> SInt16 Source #
SDivisible SInt8 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: SInt8 -> SInt8 -> (SInt8, SInt8) Source # sDivMod :: SInt8 -> SInt8 -> (SInt8, SInt8) Source # sQuot :: SInt8 -> SInt8 -> SInt8 Source # sRem :: SInt8 -> SInt8 -> SInt8 Source # sDiv :: SInt8 -> SInt8 -> SInt8 Source # sMod :: SInt8 -> SInt8 -> SInt8 Source #
SDivisible SWord64 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: SWord64 -> SWord64 -> (SWord64, SWord64) Source # sDivMod :: SWord64 -> SWord64 -> (SWord64, SWord64) Source # sQuot :: SWord64 -> SWord64 -> SWord64 Source # sRem :: SWord64 -> SWord64 -> SWord64 Source # sDiv :: SWord64 -> SWord64 -> SWord64 Source # sMod :: SWord64 -> SWord64 -> SWord64 Source #
SDivisible SWord32 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: SWord32 -> SWord32 -> (SWord32, SWord32) Source # sDivMod :: SWord32 -> SWord32 -> (SWord32, SWord32) Source # sQuot :: SWord32 -> SWord32 -> SWord32 Source # sRem :: SWord32 -> SWord32 -> SWord32 Source # sDiv :: SWord32 -> SWord32 -> SWord32 Source # sMod :: SWord32 -> SWord32 -> SWord32 Source #
SDivisible SWord16 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: SWord16 -> SWord16 -> (SWord16, SWord16) Source # sDivMod :: SWord16 -> SWord16 -> (SWord16, SWord16) Source # sQuot :: SWord16 -> SWord16 -> SWord16 Source # sRem :: SWord16 -> SWord16 -> SWord16 Source # sDiv :: SWord16 -> SWord16 -> SWord16 Source # sMod :: SWord16 -> SWord16 -> SWord16 Source #
SDivisible SWord8 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: SWord8 -> SWord8 -> (SWord8, SWord8) Source # sDivMod :: SWord8 -> SWord8 -> (SWord8, SWord8) Source # sQuot :: SWord8 -> SWord8 -> SWord8 Source # sRem :: SWord8 -> SWord8 -> SWord8 Source # sDiv :: SWord8 -> SWord8 -> SWord8 Source # sMod :: SWord8 -> SWord8 -> SWord8 Source #
SDivisible SWord4 Source # | SDvisible instance, using default methods
Instance details Defined in Documentation.SBV.Examples.Misc.Word4 Methods sQuotRem :: SWord4 -> SWord4 -> (SWord4, SWord4) Source # sDivMod :: SWord4 -> SWord4 -> (SWord4, SWord4) Source # sQuot :: SWord4 -> SWord4 -> SWord4 Source # sRem :: SWord4 -> SWord4 -> SWord4 Source # sDiv :: SWord4 -> SWord4 -> SWord4 Source # sMod :: SWord4 -> SWord4 -> SWord4 Source #
SDivisible Word4 Source # | SDvisible instance, using 0-extension
Instance details Defined in Documentation.SBV.Examples.Misc.Word4 Methods sQuotRem :: Word4 -> Word4 -> (Word4, Word4) Source # sDivMod :: Word4 -> Word4 -> (Word4, Word4) Source # sQuot :: Word4 -> Word4 -> Word4 Source # sRem :: Word4 -> Word4 -> Word4 Source # sDiv :: Word4 -> Word4 -> Word4 Source # sMod :: Word4 -> Word4 -> Word4 Source #

# Bit-vector operations

## Conversions

sFromIntegral :: forall a b. (Integral a, HasKind a, Num a, SymWord a, HasKind b, Num b, SymWord b) => SBV a -> SBV b Source #

Conversion between integral-symbolic values, akin to Haskell's `fromIntegral`

## Shifts and rotates

Symbolic words (both signed and unsigned) are an instance of Haskell's `Bits` class, so regular bitwise operations are automatically available for them. Shifts and rotates, however, require specialized type-signatures since Haskell insists on an `Int` second argument for them.

sShiftLeft :: (SIntegral a, SIntegral b) => SBV a -> SBV b -> SBV a Source #

Generalization of `shiftL`, when the shift-amount is symbolic. Since Haskell's `shiftL` only takes an `Int` as the shift amount, it cannot be used when we have a symbolic amount to shift with.

sShiftRight :: (SIntegral a, SIntegral b) => SBV a -> SBV b -> SBV a Source #

Generalization of `shiftR`, when the shift-amount is symbolic. Since Haskell's `shiftR` only takes an `Int` as the shift amount, it cannot be used when we have a symbolic amount to shift with.

NB. If the shiftee is signed, then this is an arithmetic shift; otherwise it's logical, following the usual Haskell convention. See `sSignedShiftArithRight` for a variant that explicitly uses the msb as the sign bit, even for unsigned underlying types.

sRotateLeft :: (SIntegral a, SIntegral b, SDivisible (SBV b)) => SBV a -> SBV b -> SBV a Source #

Generalization of `rotateL`, when the shift-amount is symbolic. Since Haskell's `rotateL` only takes an `Int` as the shift amount, it cannot be used when we have a symbolic amount to shift with. The first argument should be a bounded quantity.

sRotateRight :: (SIntegral a, SIntegral b, SDivisible (SBV b)) => SBV a -> SBV b -> SBV a Source #

Generalization of `rotateR`, when the shift-amount is symbolic. Since Haskell's `rotateR` only takes an `Int` as the shift amount, it cannot be used when we have a symbolic amount to shift with. The first argument should be a bounded quantity.

sSignedShiftArithRight :: (SFiniteBits a, SIntegral b) => SBV a -> SBV b -> SBV a Source #

Arithmetic shift-right with a symbolic unsigned shift amount. This is equivalent to `sShiftRight` when the argument is signed. However, if the argument is unsigned, then it explicitly treats its msb as a sign-bit, and uses it as the bit that gets shifted in. Useful when using the underlying unsigned bit representation to implement custom signed operations. Note that there is no direct Haskell analogue of this function.

## Finite bit-vector operations

class (SymWord a, Num a, Bits a) => SFiniteBits a where Source #

Finite bit-length symbolic values. Essentially the same as `SIntegral`, but further leaves out `Integer`. Loosely based on Haskell's `FiniteBits` class, but with more methods defined and structured differently to fit into the symbolic world view. Minimal complete definition: `sFiniteBitSize`.

Minimal complete definition

sFiniteBitSize

Methods

sFiniteBitSize :: SBV a -> Int Source #

Bit size.

lsb :: SBV a -> SBool Source #

Least significant bit of a word, always stored at index 0.

msb :: SBV a -> SBool Source #

Most significant bit of a word, always stored at the last position.

blastBE :: SBV a -> [SBool] Source #

Big-endian blasting of a word into its bits.

blastLE :: SBV a -> [SBool] Source #

Little-endian blasting of a word into its bits.

fromBitsBE :: [SBool] -> SBV a Source #

Reconstruct from given bits, given in little-endian.

fromBitsLE :: [SBool] -> SBV a Source #

Reconstruct from given bits, given in little-endian.

sTestBit :: SBV a -> Int -> SBool Source #

Replacement for `testBit`, returning `SBool` instead of `Bool`.

sExtractBits :: SBV a -> [Int] -> [SBool] Source #

Variant of `sTestBit`, where we want to extract multiple bit positions.

sPopCount :: SBV a -> SWord8 Source #

Variant of `popCount`, returning a symbolic value.

setBitTo :: SBV a -> Int -> SBool -> SBV a Source #

A combo of `setBit` and `clearBit`, when the bit to be set is symbolic.

fullAdder :: SBV a -> SBV a -> (SBool, SBV a) Source #

Full adder, returns carry-out from the addition. Only for unsigned quantities.

fullMultiplier :: SBV a -> SBV a -> (SBV a, SBV a) Source #

Full multipler, returns both high and low-order bits. Only for unsigned quantities.

sCountLeadingZeros :: SBV a -> SWord8 Source #

Count leading zeros in a word, big-endian interpretation.

sCountTrailingZeros :: SBV a -> SWord8 Source #

Count trailing zeros in a word, big-endian interpretation.

Instances

SFiniteBits Int8 Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

sFiniteBitSize :: SBV Int8 -> Int Source #

lsb :: SBV Int8 -> SBool Source #

msb :: SBV Int8 -> SBool Source #

blastBE :: SBV Int8 -> [SBool] Source #

blastLE :: SBV Int8 -> [SBool] Source #

fromBitsBE :: [SBool] -> SBV Int8 Source #

fromBitsLE :: [SBool] -> SBV Int8 Source #

sTestBit :: SBV Int8 -> Int -> SBool Source #

sExtractBits :: SBV Int8 -> [Int] -> [SBool] Source #

sPopCount :: SBV Int8 -> SWord8 Source #

setBitTo :: SBV Int8 -> Int -> SBool -> SBV Int8 Source #

fullAdder :: SBV Int8 -> SBV Int8 -> (SBool, SBV Int8) Source #

fullMultiplier :: SBV Int8 -> SBV Int8 -> (SBV Int8, SBV Int8) Source #

sCountLeadingZeros :: SBV Int8 -> SWord8 Source #

sCountTrailingZeros :: SBV Int8 -> SWord8 Source #

SFiniteBits Int16 Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

sFiniteBitSize :: SBV Int16 -> Int Source #

lsb :: SBV Int16 -> SBool Source #

msb :: SBV Int16 -> SBool Source #

blastBE :: SBV Int16 -> [SBool] Source #

blastLE :: SBV Int16 -> [SBool] Source #

fromBitsBE :: [SBool] -> SBV Int16 Source #

fromBitsLE :: [SBool] -> SBV Int16 Source #

sTestBit :: SBV Int16 -> Int -> SBool Source #

sExtractBits :: SBV Int16 -> [Int] -> [SBool] Source #

sPopCount :: SBV Int16 -> SWord8 Source #

setBitTo :: SBV Int16 -> Int -> SBool -> SBV Int16 Source #

fullAdder :: SBV Int16 -> SBV Int16 -> (SBool, SBV Int16) Source #

fullMultiplier :: SBV Int16 -> SBV Int16 -> (SBV Int16, SBV Int16) Source #

sCountLeadingZeros :: SBV Int16 -> SWord8 Source #

sCountTrailingZeros :: SBV Int16 -> SWord8 Source #

SFiniteBits Int32 Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

sFiniteBitSize :: SBV Int32 -> Int Source #

lsb :: SBV Int32 -> SBool Source #

msb :: SBV Int32 -> SBool Source #

blastBE :: SBV Int32 -> [SBool] Source #

blastLE :: SBV Int32 -> [SBool] Source #

fromBitsBE :: [SBool] -> SBV Int32 Source #

fromBitsLE :: [SBool] -> SBV Int32 Source #

sTestBit :: SBV Int32 -> Int -> SBool Source #

sExtractBits :: SBV Int32 -> [Int] -> [SBool] Source #

sPopCount :: SBV Int32 -> SWord8 Source #

setBitTo :: SBV Int32 -> Int -> SBool -> SBV Int32 Source #

fullAdder :: SBV Int32 -> SBV Int32 -> (SBool, SBV Int32) Source #

fullMultiplier :: SBV Int32 -> SBV Int32 -> (SBV Int32, SBV Int32) Source #

sCountLeadingZeros :: SBV Int32 -> SWord8 Source #

sCountTrailingZeros :: SBV Int32 -> SWord8 Source #

SFiniteBits Int64 Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

sFiniteBitSize :: SBV Int64 -> Int Source #

lsb :: SBV Int64 -> SBool Source #

msb :: SBV Int64 -> SBool Source #

blastBE :: SBV Int64 -> [SBool] Source #

blastLE :: SBV Int64 -> [SBool] Source #

fromBitsBE :: [SBool] -> SBV Int64 Source #

fromBitsLE :: [SBool] -> SBV Int64 Source #

sTestBit :: SBV Int64 -> Int -> SBool Source #

sExtractBits :: SBV Int64 -> [Int] -> [SBool] Source #

sPopCount :: SBV Int64 -> SWord8 Source #

setBitTo :: SBV Int64 -> Int -> SBool -> SBV Int64 Source #

fullAdder :: SBV Int64 -> SBV Int64 -> (SBool, SBV Int64) Source #

fullMultiplier :: SBV Int64 -> SBV Int64 -> (SBV Int64, SBV Int64) Source #

sCountLeadingZeros :: SBV Int64 -> SWord8 Source #

sCountTrailingZeros :: SBV Int64 -> SWord8 Source #

SFiniteBits Word8 Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

sFiniteBitSize :: SBV Word8 -> Int Source #

lsb :: SBV Word8 -> SBool Source #

msb :: SBV Word8 -> SBool Source #

blastBE :: SBV Word8 -> [SBool] Source #

blastLE :: SBV Word8 -> [SBool] Source #

fromBitsBE :: [SBool] -> SBV Word8 Source #

fromBitsLE :: [SBool] -> SBV Word8 Source #

sTestBit :: SBV Word8 -> Int -> SBool Source #

sExtractBits :: SBV Word8 -> [Int] -> [SBool] Source #

sPopCount :: SBV Word8 -> SWord8 Source #

setBitTo :: SBV Word8 -> Int -> SBool -> SBV Word8 Source #

fullAdder :: SBV Word8 -> SBV Word8 -> (SBool, SBV Word8) Source #

fullMultiplier :: SBV Word8 -> SBV Word8 -> (SBV Word8, SBV Word8) Source #

sCountLeadingZeros :: SBV Word8 -> SWord8 Source #

sCountTrailingZeros :: SBV Word8 -> SWord8 Source #

SFiniteBits Word16 Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

sFiniteBitSize :: SBV Word16 -> Int Source #

lsb :: SBV Word16 -> SBool Source #

msb :: SBV Word16 -> SBool Source #

blastBE :: SBV Word16 -> [SBool] Source #

blastLE :: SBV Word16 -> [SBool] Source #

fromBitsBE :: [SBool] -> SBV Word16 Source #

fromBitsLE :: [SBool] -> SBV Word16 Source #

sTestBit :: SBV Word16 -> Int -> SBool Source #

sExtractBits :: SBV Word16 -> [Int] -> [SBool] Source #

sPopCount :: SBV Word16 -> SWord8 Source #

setBitTo :: SBV Word16 -> Int -> SBool -> SBV Word16 Source #

fullAdder :: SBV Word16 -> SBV Word16 -> (SBool, SBV Word16) Source #

fullMultiplier :: SBV Word16 -> SBV Word16 -> (SBV Word16, SBV Word16) Source #

sCountLeadingZeros :: SBV Word16 -> SWord8 Source #

sCountTrailingZeros :: SBV Word16 -> SWord8 Source #

SFiniteBits Word32 Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

sFiniteBitSize :: SBV Word32 -> Int Source #

lsb :: SBV Word32 -> SBool Source #

msb :: SBV Word32 -> SBool Source #

blastBE :: SBV Word32 -> [SBool] Source #

blastLE :: SBV Word32 -> [SBool] Source #

fromBitsBE :: [SBool] -> SBV Word32 Source #

fromBitsLE :: [SBool] -> SBV Word32 Source #

sTestBit :: SBV Word32 -> Int -> SBool Source #

sExtractBits :: SBV Word32 -> [Int] -> [SBool] Source #

sPopCount :: SBV Word32 -> SWord8 Source #

setBitTo :: SBV Word32 -> Int -> SBool -> SBV Word32 Source #

fullAdder :: SBV Word32 -> SBV Word32 -> (SBool, SBV Word32) Source #

fullMultiplier :: SBV Word32 -> SBV Word32 -> (SBV Word32, SBV Word32) Source #

sCountLeadingZeros :: SBV Word32 -> SWord8 Source #

sCountTrailingZeros :: SBV Word32 -> SWord8 Source #

SFiniteBits Word64 Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

sFiniteBitSize :: SBV Word64 -> Int Source #

lsb :: SBV Word64 -> SBool Source #

msb :: SBV Word64 -> SBool Source #

blastBE :: SBV Word64 -> [SBool] Source #

blastLE :: SBV Word64 -> [SBool] Source #

fromBitsBE :: [SBool] -> SBV Word64 Source #

fromBitsLE :: [SBool] -> SBV Word64 Source #

sTestBit :: SBV Word64 -> Int -> SBool Source #

sExtractBits :: SBV Word64 -> [Int] -> [SBool] Source #

sPopCount :: SBV Word64 -> SWord8 Source #

setBitTo :: SBV Word64 -> Int -> SBool -> SBV Word64 Source #

fullAdder :: SBV Word64 -> SBV Word64 -> (SBool, SBV Word64) Source #

fullMultiplier :: SBV Word64 -> SBV Word64 -> (SBV Word64, SBV Word64) Source #

sCountLeadingZeros :: SBV Word64 -> SWord8 Source #

sCountTrailingZeros :: SBV Word64 -> SWord8 Source #

## Splitting, joining, and extending

class Splittable a b | b -> a where Source #

Splitting an `a` into two `b`'s and joining back. Intuitively, `a` is a larger bit-size word than `b`, typically double. The `extend` operation captures embedding of a `b` value into an `a` without changing its semantic value.

Minimal complete definition: All, no defaults.

Methods

split :: a -> (b, b) Source #

(#) :: b -> b -> a infixr 5 Source #

extend :: b -> a Source #

Instances

Splittable Word8 Word4 Source # | Joiningsplitting tofrom Word8
Instance details Defined in Documentation.SBV.Examples.Misc.Word4 Methods split :: Word8 -> (Word4, Word4) Source # (#) :: Word4 -> Word4 -> Word8 Source # extend :: Word4 -> Word8 Source #
Splittable Word16 Word8 Source # |
Instance details Defined in Data.SBV.Core.Splittable Methods split :: Word16 -> (Word8, Word8) Source # (#) :: Word8 -> Word8 -> Word16 Source # extend :: Word8 -> Word16 Source #
Splittable Word32 Word16 Source # |
Instance details Defined in Data.SBV.Core.Splittable Methods split :: Word32 -> (Word16, Word16) Source # (#) :: Word16 -> Word16 -> Word32 Source # extend :: Word16 -> Word32 Source #
Splittable Word64 Word32 Source # |
Instance details Defined in Data.SBV.Core.Splittable Methods split :: Word64 -> (Word32, Word32) Source # (#) :: Word32 -> Word32 -> Word64 Source # extend :: Word32 -> Word64 Source #
Splittable SWord64 SWord32 Source # |
Instance details Defined in Data.SBV.Core.Splittable Methods split :: SWord64 -> (SWord32, SWord32) Source # (#) :: SWord32 -> SWord32 -> SWord64 Source # extend :: SWord32 -> SWord64 Source #
Splittable SWord32 SWord16 Source # |
Instance details Defined in Data.SBV.Core.Splittable Methods split :: SWord32 -> (SWord16, SWord16) Source # (#) :: SWord16 -> SWord16 -> SWord32 Source # extend :: SWord16 -> SWord32 Source #
Splittable SWord16 SWord8 Source # |
Instance details Defined in Data.SBV.Core.Splittable Methods split :: SWord16 -> (SWord8, SWord8) Source # (#) :: SWord8 -> SWord8 -> SWord16 Source # extend :: SWord8 -> SWord16 Source #

## Exponentiation

(.^) :: (Mergeable b, Num b, SIntegral e) => b -> SBV e -> b Source #

Symbolic exponentiation using bit blasting and repeated squaring.

N.B. The exponent must be unsigned/bounded if symbolic. Signed exponents will be rejected.

# IEEE-floating point numbers

class (SymWord a, RealFloat a) => IEEEFloating a where Source #

A class of floating-point (IEEE754) operations, some of which behave differently based on rounding modes. Note that unless the rounding mode is concretely RoundNearestTiesToEven, we will not concretely evaluate these, but rather pass down to the SMT solver.

Minimal complete definition

Nothing

Methods

fpAbs :: SBV a -> SBV a Source #

Compute the floating point absolute value.

fpNeg :: SBV a -> SBV a Source #

Compute the unary negation. Note that `0 - x` is not equivalent to `-x` for floating-point, since `-0` and `0` are different.

fpAdd :: SRoundingMode -> SBV a -> SBV a -> SBV a Source #

Add two floating point values, using the given rounding mode

fpSub :: SRoundingMode -> SBV a -> SBV a -> SBV a Source #

Subtract two floating point values, using the given rounding mode

fpMul :: SRoundingMode -> SBV a -> SBV a -> SBV a Source #

Multiply two floating point values, using the given rounding mode

fpDiv :: SRoundingMode -> SBV a -> SBV a -> SBV a Source #

Divide two floating point values, using the given rounding mode

fpFMA :: SRoundingMode -> SBV a -> SBV a -> SBV a -> SBV a Source #

Fused-multiply-add three floating point values, using the given rounding mode. `fpFMA x y z = x*y+z` but with only one rounding done for the whole operation; not two. Note that we will never concretely evaluate this function since Haskell lacks an FMA implementation.

fpSqrt :: SRoundingMode -> SBV a -> SBV a Source #

Compute the square-root of a float, using the given rounding mode

fpRem :: SBV a -> SBV a -> SBV a Source #

Compute the remainder: `x - y * n`, where `n` is the truncated integer nearest to x/y. The rounding mode is implicitly assumed to be `RoundNearestTiesToEven`.

fpRoundToIntegral :: SRoundingMode -> SBV a -> SBV a Source #

Round to the nearest integral value, using the given rounding mode.

fpMin :: SBV a -> SBV a -> SBV a Source #

Compute the minimum of two floats, respects `infinity` and `NaN` values

fpMax :: SBV a -> SBV a -> SBV a Source #

Compute the maximum of two floats, respects `infinity` and `NaN` values

fpIsEqualObject :: SBV a -> SBV a -> SBool Source #

Are the two given floats exactly the same. That is, `NaN` will compare equal to itself, `+0` will not compare equal to `-0` etc. This is the object level equality, as opposed to the semantic equality. (For the latter, just use `.==`.)

fpIsNormal :: SBV a -> SBool Source #

Is the floating-point number a normal value. (i.e., not denormalized.)

fpIsSubnormal :: SBV a -> SBool Source #

Is the floating-point number a subnormal value. (Also known as denormal.)

fpIsZero :: SBV a -> SBool Source #

Is the floating-point number 0? (Note that both +0 and -0 will satisfy this predicate.)

fpIsInfinite :: SBV a -> SBool Source #

Is the floating-point number infinity? (Note that both +oo and -oo will satisfy this predicate.)

fpIsNaN :: SBV a -> SBool Source #

Is the floating-point number a NaN value?

fpIsNegative :: SBV a -> SBool Source #

Is the floating-point number negative? Note that -0 satisfies this predicate but +0 does not.

fpIsPositive :: SBV a -> SBool Source #

Is the floating-point number positive? Note that +0 satisfies this predicate but -0 does not.

fpIsNegativeZero :: SBV a -> SBool Source #

Is the floating point number -0?

fpIsPositiveZero :: SBV a -> SBool Source #

Is the floating point number +0?

fpIsPoint :: SBV a -> SBool Source #

Is the floating-point number a regular floating point, i.e., not NaN, nor +oo, nor -oo. Normals or denormals are allowed.

Instances

IEEEFloating Double Source # | SDouble instance

Instance details

Defined in Data.SBV.Core.Floating

Methods

fpAbs :: SBV Double -> SBV Double Source #

fpNeg :: SBV Double -> SBV Double Source #

fpAdd :: SRoundingMode -> SBV Double -> SBV Double -> SBV Double Source #

fpSub :: SRoundingMode -> SBV Double -> SBV Double -> SBV Double Source #

fpMul :: SRoundingMode -> SBV Double -> SBV Double -> SBV Double Source #

fpDiv :: SRoundingMode -> SBV Double -> SBV Double -> SBV Double Source #

fpFMA :: SRoundingMode -> SBV Double -> SBV Double -> SBV Double -> SBV Double Source #

fpSqrt :: SRoundingMode -> SBV Double -> SBV Double Source #

fpRem :: SBV Double -> SBV Double -> SBV Double Source #

fpRoundToIntegral :: SRoundingMode -> SBV Double -> SBV Double Source #

fpMin :: SBV Double -> SBV Double -> SBV Double Source #

fpMax :: SBV Double -> SBV Double -> SBV Double Source #

fpIsEqualObject :: SBV Double -> SBV Double -> SBool Source #

fpIsNormal :: SBV Double -> SBool Source #

fpIsSubnormal :: SBV Double -> SBool Source #

fpIsZero :: SBV Double -> SBool Source #

fpIsInfinite :: SBV Double -> SBool Source #

fpIsNaN :: SBV Double -> SBool Source #

fpIsNegative :: SBV Double -> SBool Source #

fpIsPositive :: SBV Double -> SBool Source #

fpIsNegativeZero :: SBV Double -> SBool Source #

fpIsPositiveZero :: SBV Double -> SBool Source #

fpIsPoint :: SBV Double -> SBool Source #

IEEEFloating Float Source # | SFloat instance

Instance details

Defined in Data.SBV.Core.Floating

Methods

fpAbs :: SBV Float -> SBV Float Source #

fpNeg :: SBV Float -> SBV Float Source #

fpAdd :: SRoundingMode -> SBV Float -> SBV Float -> SBV Float Source #

fpSub :: SRoundingMode -> SBV Float -> SBV Float -> SBV Float Source #

fpMul :: SRoundingMode -> SBV Float -> SBV Float -> SBV Float Source #

fpDiv :: SRoundingMode -> SBV Float -> SBV Float -> SBV Float Source #

fpFMA :: SRoundingMode -> SBV Float -> SBV Float -> SBV Float -> SBV Float Source #

fpSqrt :: SRoundingMode -> SBV Float -> SBV Float Source #

fpRem :: SBV Float -> SBV Float -> SBV Float Source #

fpRoundToIntegral :: SRoundingMode -> SBV Float -> SBV Float Source #

fpMin :: SBV Float -> SBV Float -> SBV Float Source #

fpMax :: SBV Float -> SBV Float -> SBV Float Source #

fpIsEqualObject :: SBV Float -> SBV Float -> SBool Source #

fpIsNormal :: SBV Float -> SBool Source #

fpIsSubnormal :: SBV Float -> SBool Source #

fpIsZero :: SBV Float -> SBool Source #

fpIsInfinite :: SBV Float -> SBool Source #

fpIsNaN :: SBV Float -> SBool Source #

fpIsNegative :: SBV Float -> SBool Source #

fpIsPositive :: SBV Float -> SBool Source #

fpIsNegativeZero :: SBV Float -> SBool Source #

fpIsPositiveZero :: SBV Float -> SBool Source #

fpIsPoint :: SBV Float -> SBool Source #

data RoundingMode Source #

Rounding mode to be used for the IEEE floating-point operations. Note that Haskell's default is `RoundNearestTiesToEven`. If you use a different rounding mode, then the counter-examples you get may not match what you observe in Haskell.

Constructors

RoundNearestTiesToEven | Round to nearest representable floating point value. If precisely at half-way, pick the even number. (In this context, even means the lowest-order bit is zero.)
RoundNearestTiesToAway | Round to nearest representable floating point value. If precisely at half-way, pick the number further away from 0. (That is, for positive values, pick the greater; for negative values, pick the smaller.)
RoundTowardPositive | Round towards positive infinity. (Also known as rounding-up or ceiling.)
RoundTowardNegative | Round towards negative infinity. (Also known as rounding-down or floor.)
RoundTowardZero | Round towards zero. (Also known as truncation.)

Instances

Bounded RoundingMode Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods minBound :: RoundingMode Source # maxBound :: RoundingMode Source #
Enum RoundingMode Source # |

Instance details

Defined in Data.SBV.Core.Symbolic

Methods

succ :: RoundingMode -> RoundingMode Source #

pred :: RoundingMode -> RoundingMode Source #

toEnum :: Int -> RoundingMode Source #

fromEnum :: RoundingMode -> Int Source #

enumFrom :: RoundingMode -> [RoundingMode] Source #

enumFromThen :: RoundingMode -> RoundingMode -> [RoundingMode] Source #

enumFromTo :: RoundingMode -> RoundingMode -> [RoundingMode] Source #

enumFromThenTo :: RoundingMode -> RoundingMode -> RoundingMode -> [RoundingMode] Source #

Eq RoundingMode Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods (==) :: RoundingMode -> RoundingMode -> Bool Source # (/=) :: RoundingMode -> RoundingMode -> Bool Source #
Data RoundingMode Source # |

Instance details

Defined in Data.SBV.Core.Symbolic

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RoundingMode -> c RoundingMode Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RoundingMode Source #

toConstr :: RoundingMode -> Constr Source #

dataTypeOf :: RoundingMode -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c RoundingMode) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RoundingMode) Source #

gmapT :: (forall b. Data b => b -> b) -> RoundingMode -> RoundingMode Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RoundingMode -> r Source #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RoundingMode -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> RoundingMode -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> RoundingMode -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> RoundingMode -> m RoundingMode Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RoundingMode -> m RoundingMode Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RoundingMode -> m RoundingMode Source #

Ord RoundingMode Source # |

Instance details

Defined in Data.SBV.Core.Symbolic

Methods

compare :: RoundingMode -> RoundingMode -> Ordering Source #

(<) :: RoundingMode -> RoundingMode -> Bool Source #

(<=) :: RoundingMode -> RoundingMode -> Bool Source #

(>) :: RoundingMode -> RoundingMode -> Bool Source #

(>=) :: RoundingMode -> RoundingMode -> Bool Source #

max :: RoundingMode -> RoundingMode -> RoundingMode Source #

min :: RoundingMode -> RoundingMode -> RoundingMode Source #

Read RoundingMode Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods readsPrec :: Int -> ReadS RoundingMode Source # readList :: ReadS [RoundingMode] Source # readPrec :: ReadPrec RoundingMode Source # readListPrec :: ReadPrec [RoundingMode] Source #
Show RoundingMode Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods showsPrec :: Int -> RoundingMode -> ShowS Source # show :: RoundingMode -> String Source # showList :: [RoundingMode] -> ShowS Source #
HasKind RoundingMode Source # | `RoundingMode` kind

Instance details

Defined in Data.SBV.Core.Symbolic

Methods

kindOf :: RoundingMode -> Kind Source #

hasSign :: RoundingMode -> Bool Source #

intSizeOf :: RoundingMode -> Int Source #

isBoolean :: RoundingMode -> Bool Source #

isBounded :: RoundingMode -> Bool Source #

isReal :: RoundingMode -> Bool Source #

isFloat :: RoundingMode -> Bool Source #

isDouble :: RoundingMode -> Bool Source #

isInteger :: RoundingMode -> Bool Source #

isUninterpreted :: RoundingMode -> Bool Source #

isChar :: RoundingMode -> Bool Source #

isString :: RoundingMode -> Bool Source #

isList :: RoundingMode -> Bool Source #

showType :: RoundingMode -> String Source #

SymWord RoundingMode Source # | `RoundingMode` can be used symbolically

Instance details

Defined in Data.SBV.Core.Data

Methods

forall :: String -> Symbolic (SBV RoundingMode) Source #

forall_ :: Symbolic (SBV RoundingMode) Source #

mkForallVars :: Int -> Symbolic [SBV RoundingMode] Source #

exists :: String -> Symbolic (SBV RoundingMode) Source #

exists_ :: Symbolic (SBV RoundingMode) Source #

mkExistVars :: Int -> Symbolic [SBV RoundingMode] Source #

free :: String -> Symbolic (SBV RoundingMode) Source #

free_ :: Symbolic (SBV RoundingMode) Source #

mkFreeVars :: Int -> Symbolic [SBV RoundingMode] Source #

symbolic :: String -> Symbolic (SBV RoundingMode) Source #

symbolics :: [String] -> Symbolic [SBV RoundingMode] Source #

literal :: RoundingMode -> SBV RoundingMode Source #

unliteral :: SBV RoundingMode -> Maybe RoundingMode Source #

fromCW :: CW -> RoundingMode Source #

isConcrete :: SBV RoundingMode -> Bool Source #

isSymbolic :: SBV RoundingMode -> Bool Source #

isConcretely :: SBV RoundingMode -> (RoundingMode -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV RoundingMode) Source #

SatModel RoundingMode Source # | A rounding mode, extracted from a model. (Default definition suffices)
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe (RoundingMode, [CW]) Source # cvtModel :: (RoundingMode -> Maybe b) -> Maybe (RoundingMode, [CW]) -> Maybe (b, [CW]) Source #

type SRoundingMode = SBV RoundingMode Source #

The symbolic variant of `RoundingMode`

nan :: Floating a => a Source #

Not-A-Number for `Double` and `Float`. Surprisingly, Haskell Prelude doesn't have this value defined, so we provide it here.

infinity :: Floating a => a Source #

Infinity for `Double` and `Float`. Surprisingly, Haskell Prelude doesn't have this value defined, so we provide it here.

sNaN :: (Floating a, SymWord a) => SBV a Source #

Symbolic variant of Not-A-Number. This value will inhabit both `SDouble` and `SFloat`.

sInfinity :: (Floating a, SymWord a) => SBV a Source #

Symbolic variant of infinity. This value will inhabit both `SDouble` and `SFloat`.

## Rounding modes

sRoundNearestTiesToEven :: SRoundingMode Source #

Symbolic variant of `RoundNearestTiesToEven`

sRoundNearestTiesToAway :: SRoundingMode Source #

Symbolic variant of `RoundNearestTiesToAway`

sRoundTowardPositive :: SRoundingMode Source #

Symbolic variant of `RoundTowardPositive`

sRoundTowardNegative :: SRoundingMode Source #

Symbolic variant of `RoundTowardNegative`

sRoundTowardZero :: SRoundingMode Source #

Symbolic variant of `RoundTowardZero`

sRNE :: SRoundingMode Source #

Alias for `sRoundNearestTiesToEven`

sRNA :: SRoundingMode Source #

Alias for `sRoundNearestTiesToAway`

sRTP :: SRoundingMode Source #

Alias for `sRoundTowardPositive`

sRTN :: SRoundingMode Source #

Alias for `sRoundTowardNegative`

sRTZ :: SRoundingMode Source #

Alias for `sRoundTowardZero`

## Conversion to/from floats

class IEEEFloatConvertable a where Source #

Capture convertability from/to FloatingPoint representations NB. `fromSFloat` and `fromSDouble` are underspecified when given when given a `NaN`, `+oo`, or `-oo` value that cannot be represented in the target domain. For these inputs, we define the result to be +0, arbitrarily.

Methods

fromSFloat :: SRoundingMode -> SFloat -> SBV a Source #

toSFloat :: SRoundingMode -> SBV a -> SFloat Source #

fromSDouble :: SRoundingMode -> SDouble -> SBV a Source #

toSDouble :: SRoundingMode -> SBV a -> SDouble Source #

Instances

IEEEFloatConvertable Double Source # |
Instance details Defined in Data.SBV.Core.Floating Methods fromSFloat :: SRoundingMode -> SFloat -> SBV Double Source # toSFloat :: SRoundingMode -> SBV Double -> SFloat Source # fromSDouble :: SRoundingMode -> SDouble -> SBV Double Source # toSDouble :: SRoundingMode -> SBV Double -> SDouble Source #
IEEEFloatConvertable Float Source # |
Instance details Defined in Data.SBV.Core.Floating Methods fromSFloat :: SRoundingMode -> SFloat -> SBV Float Source # toSFloat :: SRoundingMode -> SBV Float -> SFloat Source # fromSDouble :: SRoundingMode -> SDouble -> SBV Float Source # toSDouble :: SRoundingMode -> SBV Float -> SDouble Source #
IEEEFloatConvertable Int8 Source # |
Instance details Defined in Data.SBV.Core.Floating Methods fromSFloat :: SRoundingMode -> SFloat -> SBV Int8 Source # toSFloat :: SRoundingMode -> SBV Int8 -> SFloat Source # fromSDouble :: SRoundingMode -> SDouble -> SBV Int8 Source # toSDouble :: SRoundingMode -> SBV Int8 -> SDouble Source #
IEEEFloatConvertable Int16 Source # |
Instance details Defined in Data.SBV.Core.Floating Methods fromSFloat :: SRoundingMode -> SFloat -> SBV Int16 Source # toSFloat :: SRoundingMode -> SBV Int16 -> SFloat Source # fromSDouble :: SRoundingMode -> SDouble -> SBV Int16 Source # toSDouble :: SRoundingMode -> SBV Int16 -> SDouble Source #
IEEEFloatConvertable Int32 Source # |
Instance details Defined in Data.SBV.Core.Floating Methods fromSFloat :: SRoundingMode -> SFloat -> SBV Int32 Source # toSFloat :: SRoundingMode -> SBV Int32 -> SFloat Source # fromSDouble :: SRoundingMode -> SDouble -> SBV Int32 Source # toSDouble :: SRoundingMode -> SBV Int32 -> SDouble Source #
IEEEFloatConvertable Int64 Source # |
Instance details Defined in Data.SBV.Core.Floating Methods fromSFloat :: SRoundingMode -> SFloat -> SBV Int64 Source # toSFloat :: SRoundingMode -> SBV Int64 -> SFloat Source # fromSDouble :: SRoundingMode -> SDouble -> SBV Int64 Source # toSDouble :: SRoundingMode -> SBV Int64 -> SDouble Source #
IEEEFloatConvertable Integer Source # |
Instance details Defined in Data.SBV.Core.Floating Methods fromSFloat :: SRoundingMode -> SFloat -> SBV Integer Source # toSFloat :: SRoundingMode -> SBV Integer -> SFloat Source # fromSDouble :: SRoundingMode -> SDouble -> SBV Integer Source # toSDouble :: SRoundingMode -> SBV Integer -> SDouble Source #
IEEEFloatConvertable Word8 Source # |
Instance details Defined in Data.SBV.Core.Floating Methods fromSFloat :: SRoundingMode -> SFloat -> SBV Word8 Source # toSFloat :: SRoundingMode -> SBV Word8 -> SFloat Source # fromSDouble :: SRoundingMode -> SDouble -> SBV Word8 Source # toSDouble :: SRoundingMode -> SBV Word8 -> SDouble Source #
IEEEFloatConvertable Word16 Source # |
Instance details Defined in Data.SBV.Core.Floating Methods fromSFloat :: SRoundingMode -> SFloat -> SBV Word16 Source # toSFloat :: SRoundingMode -> SBV Word16 -> SFloat Source # fromSDouble :: SRoundingMode -> SDouble -> SBV Word16 Source # toSDouble :: SRoundingMode -> SBV Word16 -> SDouble Source #
IEEEFloatConvertable Word32 Source # |
Instance details Defined in Data.SBV.Core.Floating Methods fromSFloat :: SRoundingMode -> SFloat -> SBV Word32 Source # toSFloat :: SRoundingMode -> SBV Word32 -> SFloat Source # fromSDouble :: SRoundingMode -> SDouble -> SBV Word32 Source # toSDouble :: SRoundingMode -> SBV Word32 -> SDouble Source #
IEEEFloatConvertable Word64 Source # |
Instance details Defined in Data.SBV.Core.Floating Methods fromSFloat :: SRoundingMode -> SFloat -> SBV Word64 Source # toSFloat :: SRoundingMode -> SBV Word64 -> SFloat Source # fromSDouble :: SRoundingMode -> SDouble -> SBV Word64 Source # toSDouble :: SRoundingMode -> SBV Word64 -> SDouble Source #
IEEEFloatConvertable AlgReal Source # |
Instance details Defined in Data.SBV.Core.Floating Methods fromSFloat :: SRoundingMode -> SFloat -> SBV AlgReal Source # toSFloat :: SRoundingMode -> SBV AlgReal -> SFloat Source # fromSDouble :: SRoundingMode -> SDouble -> SBV AlgReal Source # toSDouble :: SRoundingMode -> SBV AlgReal -> SDouble Source #

## Bit-pattern conversions

sFloatAsSWord32 :: SFloat -> SWord32 Source #

Convert an `SFloat` to an `SWord32`, preserving the bit-correspondence. Note that since the representation for `NaN`s are not unique, this function will return a symbolic value when given a concrete `NaN`.

Implementation note: Since there's no corresponding function in SMTLib for conversion to bit-representation due to partiality, we use a translation trick by allocating a new word variable, converting it to float, and requiring it to be equivalent to the input. In code-generation mode, we simply map it to a simple conversion.

sWord32AsSFloat :: SWord32 -> SFloat Source #

Reinterpret the bits in a 32-bit word as a single-precision floating point number

sDoubleAsSWord64 :: SDouble -> SWord64 Source #

Convert an `SDouble` to an `SWord64`, preserving the bit-correspondence. Note that since the representation for `NaN`s are not unique, this function will return a symbolic value when given a concrete `NaN`.

See the implementation note for `sFloatAsSWord32`, as it applies here as well.

sWord64AsSDouble :: SWord64 -> SDouble Source #

Reinterpret the bits in a 32-bit word as a single-precision floating point number

blastSFloat :: SFloat -> (SBool, [SBool], [SBool]) Source #

Extract the sign/exponent/mantissa of a single-precision float. The output will have 8 bits in the second argument for exponent, and 23 in the third for the mantissa.

blastSDouble :: SDouble -> (SBool, [SBool], [SBool]) Source #

Extract the sign/exponent/mantissa of a single-precision float. The output will have 11 bits in the second argument for exponent, and 52 in the third for the mantissa.

# Enumerations

If the uninterpreted sort definition takes the form of an enumeration (i.e., a simple data type with all nullary constructors), then SBV will actually translate that as just such a data-type to SMT-Lib, and will use the constructors as the inhabitants of the said sort. A simple example is:

        data X = A | B | C
        mkSymbolicEnumeration ''X

Note the magic incantation `mkSymbolicEnumeration ''X`. For this to work, you need to have the following options turned on:

      LANGUAGE TemplateHaskell
      LANGUAGE StandaloneDeriving
      LANGUAGE DeriveDataTypeable
      LANGUAGE DeriveAnyClass

Now, the user can define

        type SX = SBV X

and treat `SX` as a regular symbolic type ranging over the values `A`, `B`, and `C`. Such values can be compared for equality, and with the usual other comparison operators, such as `.==`, `./=`, `.>`, `.>=`, `<`, and `<=`.

Note that in this latter case the type is no longer uninterpreted, but is properly represented as a simple enumeration of the said elements. A simple query would look like:

         allSat $ x -> x .== (x :: SX)

which would list all three elements of this domain as satisfying solutions.

         Solution #1:
           s0 = A :: X
         Solution #2:
           s0 = B :: X
         Solution #3:
           s0 = C :: X
         Found 3 different solutions.

Note that the result is properly typed as `X` elements; these are not mere strings. So, in a `getModelAssignment` scenario, the user can recover actual elements of the domain and program further with those values as usual.

See Documentation.SBV.Examples.Misc.Enumerate for an extended example on how to use symbolic enumerations.

mkSymbolicEnumeration :: Name -> Q [Dec] Source #

Make an enumeration a symbolic type.

# Uninterpreted sorts, constants, and functions

Users can introduce new uninterpreted sorts simply by defining a data-type in Haskell and registering it as such. The following example demonstrates:

        data B = B () deriving (Eq, Ord, Show, Read, Data, SymWord, HasKind, SatModel)

(Note that you'll also need to use the language pragmas `DeriveDataTypeable`, `DeriveAnyClass`, and import `Data.Generics` for the above to work.)

This is all it takes to introduce `B` as an uninterpreted sort in SBV, which makes the type `SBV B` automagically become available as the type of symbolic values that ranges over `B` values. Note that the `()` argument is important to distinguish it from enumerations, which will be translated to proper SMT data-types.

Uninterpreted functions over both uninterpreted and regular sorts can be declared using the facilities introduced by the `Uninterpreted` class.

class Uninterpreted a where Source #

Uninterpreted constants and functions. An uninterpreted constant is a value that is indexed by its name. The only property the prover assumes about these values are that they are equivalent to themselves; i.e., (for functions) they return the same results when applied to same arguments. We support uninterpreted-functions as a general means of black-box'ing operations that are irrelevant for the purposes of the proof; i.e., when the proofs can be performed without any knowledge about the function itself.

Minimal complete definition: `sbvUninterpret`. However, most instances in practice are already provided by SBV, so end-users should not need to define their own instances.

Minimal complete definition

sbvUninterpret

Methods

uninterpret :: String -> a Source #

Uninterpret a value, receiving an object that can be used instead. Use this version when you do not need to add an axiom about this value.

cgUninterpret :: String -> [String] -> a -> a Source #

Uninterpret a value, only for the purposes of code-generation. For execution and verification the value is used as is. For code-generation, the alternate definition is used. This is useful when we want to take advantage of native libraries on the target languages.

sbvUninterpret :: Maybe ([String], a) -> String -> a Source #

Most generalized form of uninterpretation, this function should not be needed by end-user-code, but is rather useful for the library development.

Instances

HasKind a => Uninterpreted (SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods uninterpret :: String -> SBV a Source # cgUninterpret :: String -> [String] -> SBV a -> SBV a Source # sbvUninterpret :: Maybe ([String], SBV a) -> String -> SBV a Source #
(SymWord c, SymWord b, HasKind a) => Uninterpreted ((SBV c, SBV b) -> SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods uninterpret :: String -> (SBV c, SBV b) -> SBV a Source # cgUninterpret :: String -> [String] -> ((SBV c, SBV b) -> SBV a) -> (SBV c, SBV b) -> SBV a Source # sbvUninterpret :: Maybe ([String], (SBV c, SBV b) -> SBV a) -> String -> (SBV c, SBV b) -> SBV a Source #
(SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted ((SBV d, SBV c, SBV b) -> SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods uninterpret :: String -> (SBV d, SBV c, SBV b) -> SBV a Source # cgUninterpret :: String -> [String] -> ((SBV d, SBV c, SBV b) -> SBV a) -> (SBV d, SBV c, SBV b) -> SBV a Source # sbvUninterpret :: Maybe ([String], (SBV d, SBV c, SBV b) -> SBV a) -> String -> (SBV d, SBV c, SBV b) -> SBV a Source #
(SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted ((SBV e, SBV d, SBV c, SBV b) -> SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods uninterpret :: String -> (SBV e, SBV d, SBV c, SBV b) -> SBV a Source # cgUninterpret :: String -> [String] -> ((SBV e, SBV d, SBV c, SBV b) -> SBV a) -> (SBV e, SBV d, SBV c, SBV b) -> SBV a Source # sbvUninterpret :: Maybe ([String], (SBV e, SBV d, SBV c, SBV b) -> SBV a) -> String -> (SBV e, SBV d, SBV c, SBV b) -> SBV a Source #
(SymWord f, SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted ((SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

uninterpret :: String -> (SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

cgUninterpret :: String -> [String] -> ((SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) -> (SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

sbvUninterpret :: Maybe ([String], (SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) -> String -> (SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

(SymWord g, SymWord f, SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted ((SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

uninterpret :: String -> (SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

cgUninterpret :: String -> [String] -> ((SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) -> (SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

sbvUninterpret :: Maybe ([String], (SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) -> String -> (SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

(SymWord h, SymWord g, SymWord f, SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted ((SBV h, SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

uninterpret :: String -> (SBV h, SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

cgUninterpret :: String -> [String] -> ((SBV h, SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) -> (SBV h, SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

sbvUninterpret :: Maybe ([String], (SBV h, SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) -> String -> (SBV h, SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

(SymWord h, SymWord g, SymWord f, SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted (SBV h -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

uninterpret :: String -> SBV h -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

cgUninterpret :: String -> [String] -> (SBV h -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> SBV h -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

sbvUninterpret :: Maybe ([String], SBV h -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> String -> SBV h -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

(SymWord g, SymWord f, SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted (SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

uninterpret :: String -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

cgUninterpret :: String -> [String] -> (SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

sbvUninterpret :: Maybe ([String], SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> String -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

(SymWord f, SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted (SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

uninterpret :: String -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

cgUninterpret :: String -> [String] -> (SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

sbvUninterpret :: Maybe ([String], SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> String -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

(SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted (SBV e -> SBV d -> SBV c -> SBV b -> SBV a) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

uninterpret :: String -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

cgUninterpret :: String -> [String] -> (SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

sbvUninterpret :: Maybe ([String], SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> String -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

(SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted (SBV d -> SBV c -> SBV b -> SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods uninterpret :: String -> SBV d -> SBV c -> SBV b -> SBV a Source # cgUninterpret :: String -> [String] -> (SBV d -> SBV c -> SBV b -> SBV a) -> SBV d -> SBV c -> SBV b -> SBV a Source # sbvUninterpret :: Maybe ([String], SBV d -> SBV c -> SBV b -> SBV a) -> String -> SBV d -> SBV c -> SBV b -> SBV a Source #
(SymWord c, SymWord b, HasKind a) => Uninterpreted (SBV c -> SBV b -> SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods uninterpret :: String -> SBV c -> SBV b -> SBV a Source # cgUninterpret :: String -> [String] -> (SBV c -> SBV b -> SBV a) -> SBV c -> SBV b -> SBV a Source # sbvUninterpret :: Maybe ([String], SBV c -> SBV b -> SBV a) -> String -> SBV c -> SBV b -> SBV a Source #
(SymWord b, HasKind a) => Uninterpreted (SBV b -> SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods uninterpret :: String -> SBV b -> SBV a Source # cgUninterpret :: String -> [String] -> (SBV b -> SBV a) -> SBV b -> SBV a Source # sbvUninterpret :: Maybe ([String], SBV b -> SBV a) -> String -> SBV b -> SBV a Source #

addAxiom :: String -> [String] -> Symbolic () Source #

Add a user specified axiom to the generated SMT-Lib file. The first argument is a mere string, use for commenting purposes. The second argument is intended to hold the multiple-lines of the axiom text as expressed in SMT-Lib notation. Note that we perform no checks on the axiom itself, to see whether it's actually well-formed or is sensical by any means. A separate formalization of SMT-Lib would be very useful here.

# Properties, proofs, and satisfiability

The SBV library provides a "push-button" verification system via automated SMT solving. The design goal is to let SMT solvers be used without any knowledge of how SMT solvers work or how different logics operate. The details are hidden behind the SBV framework, providing Haskell programmers with a clean API that is unencumbered by the details of individual solvers. To that end, we use the SMT-Lib standard (http://smtlib.cs.uiowa.edu/) to communicate with arbitrary SMT solvers.

### A note on reasoning in the presence of quantifers

Note that SBV allows reasoning with quantifiers: Inputs can be existentially or universally quantified. Predicates can be built with arbitrary nesting of such quantifiers as well. However, SBV always assumes that the input is in prenex-normal form: http://en.wikipedia.org/wiki/Prenex_normal_form. That is, all the input declarations are treated as happening at the beginning of a predicate, followed by the actual formula. Unfortunately, the way predicates are written can be misleading at times, since symbolic inputs can be created at arbitrary points; interleaving them with other code. The rule is simple, however: All inputs are assumed at the top, in the order declared, regardless of their quantifiers. SBV will apply skolemization to get rid of existentials before sending predicates to backend solvers. However, if you do want nested quantification, you will manually have to first convert to prenex-normal form (which produces an equisatisfiable but not necessarily equivalent formula), and code that explicitly in SBV. See http://github.com/LeventErkok/sbv/issues/256 for a detailed discussion of this issue.

### Using multiple solvers

On a multi-core machine, it might be desirable to try a given property using multiple SMT solvers, using parallel threads. Even with machines with single-cores, threading can be helpful if you want to try out multiple-solvers but do not know which one would work the best for the problem at hand ahead of time.

SBV allows proving/satisfiability-checking with multiple backends at the same time. Each function comes in two variants, one that returns the results from all solvers, the other that returns the fastest one.

The `All` variants, (i.e., `proveWithAll`, `satWithAll`) run all solvers and return all the results. SBV internally makes sure that the result is lazily generated; so, the order of solvers given does not matter. In other words, the order of results will follow the order of the solvers as they finish, not as given by the user. These variants are useful when you want to make sure multiple-solvers agree (or disagree!) on a given problem.

The `Any` variants, (i.e., `proveWithAny`, `satWithAny`) will run all the solvers in parallel, and return the results of the first one finishing. The other threads will then be killed. These variants are useful when you do not care if the solvers produce the same result, but rather want to get the solution as quickly as possible, taking advantage of modern many-core machines.

Note that the function `sbvAvailableSolvers` will return all the installed solvers, which can be used as the first argument to all these functions, if you simply want to try all available solvers on a machine.

type Predicate = Symbolic SBool Source #

A predicate is a symbolic program that returns a (symbolic) boolean value. For all intents and purposes, it can be treated as an n-ary function from symbolic-values to a boolean. The `Symbolic` monad captures the underlying representation, and can/should be ignored by the users of the library, unless you are building further utilities on top of SBV itself. Instead, simply use the `Predicate` type when necessary.

type Goal = Symbolic () Source #

A goal is a symbolic program that returns no values. The idea is that the constraints/min-max goals will serve as appropriate directives for sat/prove calls.

class Provable a where Source #

A type `a` is provable if we can turn it into a predicate. Note that a predicate can be made from a curried function of arbitrary arity, where each element is either a symbolic type or up-to a 7-tuple of symbolic-types. So predicates can be constructed from almost arbitrary Haskell functions that have arbitrary shapes. (See the instance declarations below.)

Minimal complete definition

forAll_, forAll, forSome_, forSome

Methods

forAll_ :: a -> Predicate Source #

Turns a value into a universally quantified predicate, internally naming the inputs. In this case the sbv library will use names of the form `s1, s2`, etc. to name these variables Example:

     forAll_ $ \(x::SWord8) y -> x `shiftL` 2 .== y

is a predicate with two arguments, captured using an ordinary Haskell function. Internally, `x` will be named `s0` and `y` will be named `s1`.

forAll :: [String] -> a -> Predicate Source #

Turns a value into a predicate, allowing users to provide names for the inputs. If the user does not provide enough number of names for the variables, the remaining ones will be internally generated. Note that the names are only used for printing models and has no other significance; in particular, we do not check that they are unique. Example:

     forAll ["x", "y"] $ \(x::SWord8) y -> x `shiftL` 2 .== y

This is the same as above, except the variables will be named `x` and `y` respectively, simplifying the counter-examples when they are printed.

forSome_ :: a -> Predicate Source #

Turns a value into an existentially quantified predicate. (Indeed, `exists` would have been a better choice here for the name, but alas it's already taken.)

forSome :: [String] -> a -> Predicate Source #

Version of `forSome` that allows user defined names.

prove :: a -> IO ThmResult Source #

Prove a predicate, using the default solver.

proveWith :: SMTConfig -> a -> IO ThmResult Source #

Prove the predicate using the given SMT-solver.

sat :: a -> IO SatResult Source #

Find a satisfying assignment for a predicate, using the default solver.

satWith :: SMTConfig -> a -> IO SatResult Source #

Find a satisfying assignment using the given SMT-solver.

allSat :: a -> IO AllSatResult Source #

Find all satisfying assignments, using the default solver. See `allSatWith` for details.

allSatWith :: SMTConfig -> a -> IO AllSatResult Source #

Return all satisfying assignments for a predicate, equivalent to ``allSatWith` `defaultSMTCfg``. Note that this call will block until all satisfying assignments are found. If you have a problem with infinitely many satisfying models (consider `SInteger`) or a very large number of them, you might have to wait for a long time. To avoid such cases, use the `allSatMaxModelCount` parameter in the configuration.

NB. Uninterpreted constant/function values and counter-examples for array values are ignored for the purposes of `allSat`. That is, only the satisfying assignments modulo uninterpreted functions and array inputs will be returned. This is due to the limitation of not having a robust means of getting a function counter-example back from the SMT solver. Find all satisfying assignments using the given SMT-solver

optimize :: OptimizeStyle -> a -> IO OptimizeResult Source #

Optimize a given collection of `Objective`s

optimizeWith :: SMTConfig -> OptimizeStyle -> a -> IO OptimizeResult Source #

Optimizes the objectives using the given SMT-solver.

isVacuous :: a -> IO Bool Source #

Check if the constraints given are consistent, using the default solver.

isVacuousWith :: SMTConfig -> a -> IO Bool Source #

Determine if the constraints are vacuous using the given SMT-solver.

isTheorem :: a -> IO Bool Source #

Checks theoremhood using the default solver.

isTheoremWith :: SMTConfig -> a -> IO Bool Source #

Check whether a given property is a theorem.

isSatisfiable :: a -> IO Bool Source #

Checks satisfiability using the default solver.

isSatisfiableWith :: SMTConfig -> a -> IO Bool Source #

Check whether a given property is satisfiable.

proveWithAll :: [SMTConfig] -> a -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

Prove a property with multiple solvers, running them in separate threads. The results will be returned in the order produced.

proveWithAny :: [SMTConfig] -> a -> IO (Solver, NominalDiffTime, ThmResult) Source #

Prove a property with multiple solvers, running them in separate threads. Only the result of the first one to finish will be returned, remaining threads will be killed. Note that we send a `ThreadKilled` to the losing processes, but we do *not* actually wait for them to finish. In rare cases this can lead to zombie processes. In previous experiments, we found that some processes take their time to terminate. So, this solution favors quick turnaround.

satWithAll :: [SMTConfig] -> a -> IO [(Solver, NominalDiffTime, SatResult)] Source #

Find a satisfying assignment to a property with multiple solvers, running them in separate threads. The results will be returned in the order produced.

satWithAny :: [SMTConfig] -> a -> IO (Solver, NominalDiffTime, SatResult) Source #

Find a satisfying assignment to a property with multiple solvers, running them in separate threads. Only the result of the first one to finish will be returned, remaining threads will be killed. Note that we send a `ThreadKilled` to the losing processes, but we do *not* actually wait for them to finish. In rare cases this can lead to zombie processes. In previous experiments, we found that some processes take their time to terminate. So, this solution favors quick turnaround.

generateSMTBenchmark :: Bool -> a -> IO String Source #

Create an SMT-Lib2 benchmark. The `Bool` argument controls whether this is a SAT instance, i.e., translate the query directly, or a PROVE instance, i.e., translate the negated query.

Instances

Provable SBool Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: SBool -> Predicate Source #

forAll :: [String] -> SBool -> Predicate Source #

forSome_ :: SBool -> Predicate Source #

forSome :: [String] -> SBool -> Predicate Source #

prove :: SBool -> IO ThmResult Source #

proveWith :: SMTConfig -> SBool -> IO ThmResult Source #

sat :: SBool -> IO SatResult Source #

satWith :: SMTConfig -> SBool -> IO SatResult Source #

allSat :: SBool -> IO AllSatResult Source #

allSatWith :: SMTConfig -> SBool -> IO AllSatResult Source #

optimize :: OptimizeStyle -> SBool -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> SBool -> IO OptimizeResult Source #

isVacuous :: SBool -> IO Bool Source #

isVacuousWith :: SMTConfig -> SBool -> IO Bool Source #

isTheorem :: SBool -> IO Bool Source #

isTheoremWith :: SMTConfig -> SBool -> IO Bool Source #

isSatisfiable :: SBool -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> SBool -> IO Bool Source #

proveWithAll :: [SMTConfig] -> SBool -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> SBool -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> SBool -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> SBool -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> SBool -> IO String Source #

Provable Goal Source # |

Instance details

Defined in Data.SBV

Methods

forAll_ :: Goal -> Predicate Source #

forAll :: [String] -> Goal -> Predicate Source #

forSome_ :: Goal -> Predicate Source #

forSome :: [String] -> Goal -> Predicate Source #

prove :: Goal -> IO ThmResult Source #

proveWith :: SMTConfig -> Goal -> IO ThmResult Source #

sat :: Goal -> IO SatResult Source #

satWith :: SMTConfig -> Goal -> IO SatResult Source #

allSat :: Goal -> IO AllSatResult Source #

allSatWith :: SMTConfig -> Goal -> IO AllSatResult Source #

optimize :: OptimizeStyle -> Goal -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> Goal -> IO OptimizeResult Source #

isVacuous :: Goal -> IO Bool Source #

isVacuousWith :: SMTConfig -> Goal -> IO Bool Source #

isTheorem :: Goal -> IO Bool Source #

isTheoremWith :: SMTConfig -> Goal -> IO Bool Source #

isSatisfiable :: Goal -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> Goal -> IO Bool Source #

proveWithAll :: [SMTConfig] -> Goal -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> Goal -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> Goal -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> Goal -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> Goal -> IO String Source #

Provable Predicate Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: Predicate -> Predicate Source #

forAll :: [String] -> Predicate -> Predicate Source #

forSome_ :: Predicate -> Predicate Source #

forSome :: [String] -> Predicate -> Predicate Source #

prove :: Predicate -> IO ThmResult Source #

proveWith :: SMTConfig -> Predicate -> IO ThmResult Source #

sat :: Predicate -> IO SatResult Source #

satWith :: SMTConfig -> Predicate -> IO SatResult Source #

allSat :: Predicate -> IO AllSatResult Source #

allSatWith :: SMTConfig -> Predicate -> IO AllSatResult Source #

optimize :: OptimizeStyle -> Predicate -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> Predicate -> IO OptimizeResult Source #

isVacuous :: Predicate -> IO Bool Source #

isVacuousWith :: SMTConfig -> Predicate -> IO Bool Source #

isTheorem :: Predicate -> IO Bool Source #

isTheoremWith :: SMTConfig -> Predicate -> IO Bool Source #

isSatisfiable :: Predicate -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> Predicate -> IO Bool Source #

proveWithAll :: [SMTConfig] -> Predicate -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> Predicate -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> Predicate -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> Predicate -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> Predicate -> IO String Source #

(SymWord a, SymWord b, Provable p) => Provable ((SBV a, SBV b) -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: ((SBV a, SBV b) -> p) -> Predicate Source #

forAll :: [String] -> ((SBV a, SBV b) -> p) -> Predicate Source #

forSome_ :: ((SBV a, SBV b) -> p) -> Predicate Source #

forSome :: [String] -> ((SBV a, SBV b) -> p) -> Predicate Source #

prove :: ((SBV a, SBV b) -> p) -> IO ThmResult Source #

proveWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> IO ThmResult Source #

sat :: ((SBV a, SBV b) -> p) -> IO SatResult Source #

satWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> IO SatResult Source #

allSat :: ((SBV a, SBV b) -> p) -> IO AllSatResult Source #

allSatWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> IO AllSatResult Source #

optimize :: OptimizeStyle -> ((SBV a, SBV b) -> p) -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> ((SBV a, SBV b) -> p) -> IO OptimizeResult Source #

isVacuous :: ((SBV a, SBV b) -> p) -> IO Bool Source #

isVacuousWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> IO Bool Source #

isTheorem :: ((SBV a, SBV b) -> p) -> IO Bool Source #

isTheoremWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> IO Bool Source #

isSatisfiable :: ((SBV a, SBV b) -> p) -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> IO Bool Source #

proveWithAll :: [SMTConfig] -> ((SBV a, SBV b) -> p) -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> ((SBV a, SBV b) -> p) -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> ((SBV a, SBV b) -> p) -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> ((SBV a, SBV b) -> p) -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> ((SBV a, SBV b) -> p) -> IO String Source #

(SymWord a, SymWord b, SymWord c, Provable p) => Provable ((SBV a, SBV b, SBV c) -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: ((SBV a, SBV b, SBV c) -> p) -> Predicate Source #

forAll :: [String] -> ((SBV a, SBV b, SBV c) -> p) -> Predicate Source #

forSome_ :: ((SBV a, SBV b, SBV c) -> p) -> Predicate Source #

forSome :: [String] -> ((SBV a, SBV b, SBV c) -> p) -> Predicate Source #

prove :: ((SBV a, SBV b, SBV c) -> p) -> IO ThmResult Source #

proveWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> IO ThmResult Source #

sat :: ((SBV a, SBV b, SBV c) -> p) -> IO SatResult Source #

satWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> IO SatResult Source #

allSat :: ((SBV a, SBV b, SBV c) -> p) -> IO AllSatResult Source #

allSatWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> IO AllSatResult Source #

optimize :: OptimizeStyle -> ((SBV a, SBV b, SBV c) -> p) -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> ((SBV a, SBV b, SBV c) -> p) -> IO OptimizeResult Source #

isVacuous :: ((SBV a, SBV b, SBV c) -> p) -> IO Bool Source #

isVacuousWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> IO Bool Source #

isTheorem :: ((SBV a, SBV b, SBV c) -> p) -> IO Bool Source #

isTheoremWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> IO Bool Source #

isSatisfiable :: ((SBV a, SBV b, SBV c) -> p) -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> IO Bool Source #

proveWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c) -> p) -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c) -> p) -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c) -> p) -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c) -> p) -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> ((SBV a, SBV b, SBV c) -> p) -> IO String Source #

(SymWord a, SymWord b, SymWord c, SymWord d, Provable p) => Provable ((SBV a, SBV b, SBV c, SBV d) -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> Predicate Source #

forAll :: [String] -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> Predicate Source #

forSome_ :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> Predicate Source #

forSome :: [String] -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> Predicate Source #

prove :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO ThmResult Source #

proveWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO ThmResult Source #

sat :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO SatResult Source #

satWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO SatResult Source #

allSat :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO AllSatResult Source #

allSatWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO AllSatResult Source #

optimize :: OptimizeStyle -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO OptimizeResult Source #

isVacuous :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO Bool Source #

isVacuousWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO Bool Source #

isTheorem :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO Bool Source #

isTheoremWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO Bool Source #

isSatisfiable :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO Bool Source #

proveWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO String Source #

(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, Provable p) => Provable ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> Predicate Source #

forAll :: [String] -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> Predicate Source #

forSome_ :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> Predicate Source #

forSome :: [String] -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> Predicate Source #

prove :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO ThmResult Source #

proveWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO ThmResult Source #

sat :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO SatResult Source #

satWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO SatResult Source #

allSat :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO AllSatResult Source #

allSatWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO AllSatResult Source #

optimize :: OptimizeStyle -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO OptimizeResult Source #

isVacuous :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO Bool Source #

isVacuousWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO Bool Source #

isTheorem :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO Bool Source #

isTheoremWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO Bool Source #

isSatisfiable :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO Bool Source #

proveWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO String Source #

(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, Provable p) => Provable ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> Predicate Source #

forAll :: [String] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> Predicate Source #

forSome_ :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> Predicate Source #

forSome :: [String] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> Predicate Source #

prove :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO ThmResult Source #

proveWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO ThmResult Source #

sat :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO SatResult Source #

satWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO SatResult Source #

allSat :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO AllSatResult Source #

allSatWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO AllSatResult Source #

optimize :: OptimizeStyle -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO OptimizeResult Source #

isVacuous :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO Bool Source #

isVacuousWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO Bool Source #

isTheorem :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO Bool Source #

isTheoremWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO Bool Source #

isSatisfiable :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO Bool Source #

proveWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO String Source #

(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, SymWord g, Provable p) => Provable ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> Predicate Source #

forAll :: [String] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> Predicate Source #

forSome_ :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> Predicate Source #

forSome :: [String] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> Predicate Source #

prove :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO ThmResult Source #

proveWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO ThmResult Source #

sat :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO SatResult Source #

satWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO SatResult Source #

allSat :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO AllSatResult Source #

allSatWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO AllSatResult Source #

optimize :: OptimizeStyle -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO OptimizeResult Source #

isVacuous :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO Bool Source #

isVacuousWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO Bool Source #

isTheorem :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO Bool Source #

isTheoremWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO Bool Source #

isSatisfiable :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO Bool Source #

proveWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO String Source #

(HasKind a, HasKind b, Provable p) => Provable (SFunArray a b -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: (SFunArray a b -> p) -> Predicate Source #

forAll :: [String] -> (SFunArray a b -> p) -> Predicate Source #

forSome_ :: (SFunArray a b -> p) -> Predicate Source #

forSome :: [String] -> (SFunArray a b -> p) -> Predicate Source #

prove :: (SFunArray a b -> p) -> IO ThmResult Source #

proveWith :: SMTConfig -> (SFunArray a b -> p) -> IO ThmResult Source #

sat :: (SFunArray a b -> p) -> IO SatResult Source #

satWith :: SMTConfig -> (SFunArray a b -> p) -> IO SatResult Source #

allSat :: (SFunArray a b -> p) -> IO AllSatResult Source #

allSatWith :: SMTConfig -> (SFunArray a b -> p) -> IO AllSatResult Source #

optimize :: OptimizeStyle -> (SFunArray a b -> p) -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> (SFunArray a b -> p) -> IO OptimizeResult Source #

isVacuous :: (SFunArray a b -> p) -> IO Bool Source #

isVacuousWith :: SMTConfig -> (SFunArray a b -> p) -> IO Bool Source #

isTheorem :: (SFunArray a b -> p) -> IO Bool Source #

isTheoremWith :: SMTConfig -> (SFunArray a b -> p) -> IO Bool Source #

isSatisfiable :: (SFunArray a b -> p) -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> (SFunArray a b -> p) -> IO Bool Source #

proveWithAll :: [SMTConfig] -> (SFunArray a b -> p) -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> (SFunArray a b -> p) -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> (SFunArray a b -> p) -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> (SFunArray a b -> p) -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> (SFunArray a b -> p) -> IO String Source #

(HasKind a, HasKind b, Provable p) => Provable (SArray a b -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: (SArray a b -> p) -> Predicate Source #

forAll :: [String] -> (SArray a b -> p) -> Predicate Source #

forSome_ :: (SArray a b -> p) -> Predicate Source #

forSome :: [String] -> (SArray a b -> p) -> Predicate Source #

prove :: (SArray a b -> p) -> IO ThmResult Source #

proveWith :: SMTConfig -> (SArray a b -> p) -> IO ThmResult Source #

sat :: (SArray a b -> p) -> IO SatResult Source #

satWith :: SMTConfig -> (SArray a b -> p) -> IO SatResult Source #

allSat :: (SArray a b -> p) -> IO AllSatResult Source #

allSatWith :: SMTConfig -> (SArray a b -> p) -> IO AllSatResult Source #

optimize :: OptimizeStyle -> (SArray a b -> p) -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> (SArray a b -> p) -> IO OptimizeResult Source #

isVacuous :: (SArray a b -> p) -> IO Bool Source #

isVacuousWith :: SMTConfig -> (SArray a b -> p) -> IO Bool Source #

isTheorem :: (SArray a b -> p) -> IO Bool Source #

isTheoremWith :: SMTConfig -> (SArray a b -> p) -> IO Bool Source #

isSatisfiable :: (SArray a b -> p) -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> (SArray a b -> p) -> IO Bool Source #

proveWithAll :: [SMTConfig] -> (SArray a b -> p) -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> (SArray a b -> p) -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> (SArray a b -> p) -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> (SArray a b -> p) -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> (SArray a b -> p) -> IO String Source #

(SymWord a, Provable p) => Provable (SBV a -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: (SBV a -> p) -> Predicate Source #

forAll :: [String] -> (SBV a -> p) -> Predicate Source #

forSome_ :: (SBV a -> p) -> Predicate Source #

forSome :: [String] -> (SBV a -> p) -> Predicate Source #

prove :: (SBV a -> p) -> IO ThmResult Source #

proveWith :: SMTConfig -> (SBV a -> p) -> IO ThmResult Source #

sat :: (SBV a -> p) -> IO SatResult Source #

satWith :: SMTConfig -> (SBV a -> p) -> IO SatResult Source #

allSat :: (SBV a -> p) -> IO AllSatResult Source #

allSatWith :: SMTConfig -> (SBV a -> p) -> IO AllSatResult Source #

optimize :: OptimizeStyle -> (SBV a -> p) -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> (SBV a -> p) -> IO OptimizeResult Source #

isVacuous :: (SBV a -> p) -> IO Bool Source #

isVacuousWith :: SMTConfig -> (SBV a -> p) -> IO Bool Source #

isTheorem :: (SBV a -> p) -> IO Bool Source #

isTheoremWith :: SMTConfig -> (SBV a -> p) -> IO Bool Source #

isSatisfiable :: (SBV a -> p) -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> (SBV a -> p) -> IO Bool Source #

proveWithAll :: [SMTConfig] -> (SBV a -> p) -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> (SBV a -> p) -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> (SBV a -> p) -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> (SBV a -> p) -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> (SBV a -> p) -> IO String Source #

solve :: [SBool] -> Symbolic SBool Source #

Form the symbolic conjunction of a given list of boolean conditions. Useful in expressing problems with constraints, like the following:

      sat $ do [x, y, z] <- sIntegers ["x", "y", "z"]
               solve [x .> 5, y + z .< x]

# Constraints

A constraint is a means for restricting the input domain of a formula. Here's a simple example:

       do x <- exists "x"
          y <- exists "y"
          constrain $ x .> y
          constrain $ x + y .>= 12
          constrain $ y .>= 3
          ...

The first constraint requires `x` to be larger than `y`. The scond one says that sum of `x` and `y` must be at least `12`, and the final one says that `y` to be at least `3`. Constraints provide an easy way to assert additional properties on the input domain, right at the point of the introduction of variables.

Note that the proper reading of a constraint depends on the context:

- In a `sat` (or `allSat`) call: The constraint added is asserted conjunctively. That is, the resulting satisfying model (if any) will always satisfy all the constraints given.
- In a `prove` call: In this case, the constraint acts as an implication. The property is proved under the assumption that the constraint holds. In other words, the constraint says that we only care about the input space that satisfies the constraint.
- In a `quickCheck` call: The constraint acts as a filter for `quickCheck`; if the constraint does not hold, then the input value is considered to be irrelevant and is skipped. Note that this is similar to `prove`, but is stronger: We do not accept a test case to be valid just because the constraints fail on them, although semantically the implication does hold. We simply skip that test case as a bad test vector.
- In a `genTest` call: Similar to `quickCheck` and `prove`: If a constraint does not hold, the input value is ignored and is not included in the test set.

A good use case (in fact the motivating use case) for `constrain` is attaching a constraint to a `forall` or `exists` variable at the time of its creation. Also, the conjunctive semantics for `sat` and the implicative semantics for `prove` simplify programming by choosing the correct interpretation automatically. However, one should be aware of the semantic difference. For instance, in the presence of constraints, formulas that are provable are not necessarily satisfiable. To wit, consider:

       do x <- exists "x"
          constrain $ x .< x
          return $ x .< (x :: SWord8)

This predicate is unsatisfiable since no element of `SWord8` is less than itself. But it's (vacuously) true, since it excludes the entire domain of values, thus making the proof trivial. Hence, this predicate is provable, but is not satisfiable. To make sure the given constraints are not vacuous, the functions `isVacuous` (and `isVacuousWith`) can be used.

Also note that this semantics imply that test case generation (`genTest`) and quick-check can take arbitrarily long in the presence of constraints, if the random input values generated rarely satisfy the constraints. (As an extreme case, consider ``constrain` `false``.)

constrain :: SolverContext m => SBool -> m () Source #

Add a constraint, any satisfying instance must satisfy this condition

softConstrain :: SolverContext m => SBool -> m () Source #

Add a soft constraint. The solver will try to satisfy this condition if possible, but won't if it cannot

## Constraint Vacuity

When adding constraints, one has to be careful about making sure they are not inconsistent. The function `isVacuous` can be use for this purpose. Here is an example. Consider the following predicate:

    >>> let pred = do { x <- free "x"; constrain $ x .< x; return $ x .>= (5 :: SWord8) }

This predicate asserts that all 8-bit values are larger than 5, subject to the constraint that the values considered satisfy `x .< x`, i.e., they are less than themselves. Since there are no values that satisfy this constraint, the proof will pass vacuously:

    >>> prove pred
    Q.E.D.

We can use `isVacuous` to make sure to see that the pass was vacuous:

    >>> isVacuous pred
    True

While the above example is trivial, things can get complicated if there are multiple constraints with non-straightforward relations; so if constraints are used one should make sure to check the predicate is not vacuously true. Here's an example that is not vacuous:

    >>> let pred' = do { x <- free "x"; constrain $ x .> 6; return $ x .>= (5 :: SWord8) }

This time the proof passes as expected:

    >>> prove pred'
    Q.E.D.

And the proof is not vacuous:

    >>> isVacuous pred'
    False

## Named constraints and attributes

Constraints can be given names:

     namedConstraint "a is at least 5" $ a .>= 5

Similarly, arbitrary term attributes can also be associated:

     constrainWithAttribute [(":solver-specific-attribute", "value")] $ a .>= 5

Note that a `namedConstraint` is equivalent to a `constrainWithAttribute` call, setting the `":named"' attribute.

namedConstraint :: SolverContext m => String -> SBool -> m () Source #

Add a named constraint. The name is used in unsat-core extraction.

constrainWithAttribute :: SolverContext m => [(String, String)] -> SBool -> m () Source #

Add a constraint, with arbitrary attributes. Used in interpolant generation.

## Unsat cores

Named constraints are useful when used in conjunction with `getUnsatCore` function where the backend solver can be queried to obtain an unsat core in case the constraints are unsatisfiable. See `getUnsatCore` for details and Documentation.SBV.Examples.Queries.UnsatCore for an example use case.

## Cardinality constraints

A pseudo-boolean function (http://en.wikipedia.org/wiki/Pseudo-Boolean_function) is a function from booleans to reals, basically treating `True` as `1` and `False` as `0`. They are typically expressed in polynomial form. Such functions can be used to express cardinality constraints, where we want to count how many things satisfy a certain condition.

One can code such constraints using regular SBV programming: Simply walk over the booleans and the corresponding coefficients, and assert the required relation. For instance:

    [b0, b1, b2, b3] `pbAtMost` 2

is precisely equivalent to:

    sum (map (\b -> ite b 1 0) [b0, b1, b2, b3]) .<= 2

and they both express that at most two of `b0`, `b1`, `b2`, and `b3` can be `true`. However, the equivalent forms give rise to long formulas and the cardinality constraint can get lost in the translation. The idea here is that if you use these functions instead, SBV will produce better translations to SMTLib for more efficient solving of cardinality constraints, assuming the backend solver supports them. Currently, only Z3 supports pseudo-booleans directly. For all other solvers, SBV will translate these to equivalent terms that do not require special functions.

pbAtMost :: [SBool] -> Int -> SBool Source #

`true` if at most `k` of the input arguments are `true`

pbAtLeast :: [SBool] -> Int -> SBool Source #

`true` if at least `k` of the input arguments are `true`

pbExactly :: [SBool] -> Int -> SBool Source #

`true` if exactly `k` of the input arguments are `true`

pbLe :: [(Int, SBool)] -> Int -> SBool Source #

`true` if the sum of coefficients for `true` elements is at most `k`. Generalizes `pbAtMost`.

pbGe :: [(Int, SBool)] -> Int -> SBool Source #

`true` if the sum of coefficients for `true` elements is at least `k`. Generalizes `pbAtLeast`.

pbEq :: [(Int, SBool)] -> Int -> SBool Source #

`true` if the sum of coefficients for `true` elements is exactly least `k`. Useful for coding exactly K-of-N constraints, and in particular mutex constraints.

pbMutexed :: [SBool] -> SBool Source #

`true` if there is at most one set bit

pbStronglyMutexed :: [SBool] -> SBool Source #

`true` if there is exactly one set bit

# Checking safety

The `sAssert` function allows users to introduce invariants to make sure certain properties hold at all times. This is another mechanism to provide further documentation/contract info into SBV code. The functions `safe` and `safeWith` can be used to statically discharge these proof assumptions. If a violation is found, SBV will print a model showing which inputs lead to the invariant being violated.

Here's a simple example. Let's assume we have a function that does subtraction, and requires its first argument to be larger than the second:

    >>> let sub x y = sAssert Nothing "sub: x >= y must hold!" (x .>= y) (x - y)

Clearly, this function is not safe, as there's nothing that stops us from passing it a larger second argument. We can use `safe` to statically see if such a violation is possible before we use this function elsewhere.

    >>> safe (sub :: SInt8 -> SInt8 -> SInt8)
    [sub: x >= y must hold!: Violated. Model:
      s0 = 6 :: Int8
      s1 = 8 :: Int8]

What happens if we make sure to arrange for this invariant? Consider this version:

    >>> let safeSub x y = ite (x .>= y) (sub x y) 0

Clearly, `safeSub` must be safe. And indeed, SBV can prove that:

    >>> safe (safeSub :: SInt8 -> SInt8 -> SInt8)
    [sub: x >= y must hold!: No violations detected]

Note how we used `sub` and `safeSub` polymorphically. We only need to monomorphise our types when a proof attempt is done, as we did in the `safe` calls.

If required, the user can pass a `CallStack` through the first argument to `sAssert`, which will be used by SBV to print a diagnostic info to pinpoint the failure.

Also see Documentation.SBV.Examples.Misc.NoDiv0 for the classic div-by-zero example.

sAssert :: Maybe CallStack -> String -> SBool -> SBV a -> SBV a Source #

Symbolic assert. Check that the given boolean condition is always true in the given path. The optional first argument can be used to provide call-stack info via GHC's location facilities.

isSafe :: SafeResult -> Bool Source #

Check if a safe-call was safe or not, turning a `SafeResult` to a Bool.

class SExecutable a where Source #

Symbolically executable program fragments. This class is mainly used for `safe` calls, and is sufficently populated internally to cover most use cases. Users can extend it as they wish to allow `safe` checks for SBV programs that return/take types that are user-defined.

Minimal complete definition

sName_, sName

Methods

sName_ :: a -> Symbolic () Source #

sName :: [String] -> a -> Symbolic () Source #

safe :: a -> IO [SafeResult] Source #

Check safety using the default solver.

safeWith :: SMTConfig -> a -> IO [SafeResult] Source #

Check if any of the `sAssert` calls can be violated.

Instances

SExecutable () Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: () -> Symbolic () Source # sName :: [String] -> () -> Symbolic () Source # safe :: () -> IO [SafeResult] Source # safeWith :: SMTConfig -> () -> IO [SafeResult] Source #
SExecutable [SBV a] Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: [SBV a] -> Symbolic () Source # sName :: [String] -> [SBV a] -> Symbolic () Source # safe :: [SBV a] -> IO [SafeResult] Source # safeWith :: SMTConfig -> [SBV a] -> IO [SafeResult] Source #
NFData a => SExecutable (Symbolic a) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: Symbolic a -> Symbolic () Source # sName :: [String] -> Symbolic a -> Symbolic () Source # safe :: Symbolic a -> IO [SafeResult] Source # safeWith :: SMTConfig -> Symbolic a -> IO [SafeResult] Source #
SExecutable (SBV a) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: SBV a -> Symbolic () Source # sName :: [String] -> SBV a -> Symbolic () Source # safe :: SBV a -> IO [SafeResult] Source # safeWith :: SMTConfig -> SBV a -> IO [SafeResult] Source #
(SymWord a, SymWord b, SExecutable p) => SExecutable ((SBV a, SBV b) -> p) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: ((SBV a, SBV b) -> p) -> Symbolic () Source # sName :: [String] -> ((SBV a, SBV b) -> p) -> Symbolic () Source # safe :: ((SBV a, SBV b) -> p) -> IO [SafeResult] Source # safeWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> IO [SafeResult] Source #
(SymWord a, SymWord b, SymWord c, SExecutable p) => SExecutable ((SBV a, SBV b, SBV c) -> p) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: ((SBV a, SBV b, SBV c) -> p) -> Symbolic () Source # sName :: [String] -> ((SBV a, SBV b, SBV c) -> p) -> Symbolic () Source # safe :: ((SBV a, SBV b, SBV c) -> p) -> IO [SafeResult] Source # safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> IO [SafeResult] Source #
(SymWord a, SymWord b, SymWord c, SymWord d, SExecutable p) => SExecutable ((SBV a, SBV b, SBV c, SBV d) -> p) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> Symbolic () Source # sName :: [String] -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> Symbolic () Source # safe :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO [SafeResult] Source # safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO [SafeResult] Source #
(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SExecutable p) => SExecutable ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> Symbolic () Source # sName :: [String] -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> Symbolic () Source # safe :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO [SafeResult] Source # safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO [SafeResult] Source #
(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, SExecutable p) => SExecutable ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName_ :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> Symbolic () Source #

sName :: [String] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> Symbolic () Source #

safe :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO [SafeResult] Source #

safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO [SafeResult] Source #

(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, SymWord g, SExecutable p) => SExecutable ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName_ :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> Symbolic () Source #

sName :: [String] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> Symbolic () Source #

safe :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO [SafeResult] Source #

safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO [SafeResult] Source #

(SymWord a, SExecutable p) => SExecutable (SBV a -> p) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: (SBV a -> p) -> Symbolic () Source # sName :: [String] -> (SBV a -> p) -> Symbolic () Source # safe :: (SBV a -> p) -> IO [SafeResult] Source # safeWith :: SMTConfig -> (SBV a -> p) -> IO [SafeResult] Source #
(NFData a, SymWord a, NFData b, SymWord b) => SExecutable (SBV a, SBV b) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: (SBV a, SBV b) -> Symbolic () Source # sName :: [String] -> (SBV a, SBV b) -> Symbolic () Source # safe :: (SBV a, SBV b) -> IO [SafeResult] Source # safeWith :: SMTConfig -> (SBV a, SBV b) -> IO [SafeResult] Source #
(NFData a, SymWord a, NFData b, SymWord b, NFData c, SymWord c) => SExecutable (SBV a, SBV b, SBV c) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: (SBV a, SBV b, SBV c) -> Symbolic () Source # sName :: [String] -> (SBV a, SBV b, SBV c) -> Symbolic () Source # safe :: (SBV a, SBV b, SBV c) -> IO [SafeResult] Source # safeWith :: SMTConfig -> (SBV a, SBV b, SBV c) -> IO [SafeResult] Source #
(NFData a, SymWord a, NFData b, SymWord b, NFData c, SymWord c, NFData d, SymWord d) => SExecutable (SBV a, SBV b, SBV c, SBV d) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: (SBV a, SBV b, SBV c, SBV d) -> Symbolic () Source # sName :: [String] -> (SBV a, SBV b, SBV c, SBV d) -> Symbolic () Source # safe :: (SBV a, SBV b, SBV c, SBV d) -> IO [SafeResult] Source # safeWith :: SMTConfig -> (SBV a, SBV b, SBV c, SBV d) -> IO [SafeResult] Source #
(NFData a, SymWord a, NFData b, SymWord b, NFData c, SymWord c, NFData d, SymWord d, NFData e, SymWord e) => SExecutable (SBV a, SBV b, SBV c, SBV d, SBV e) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: (SBV a, SBV b, SBV c, SBV d, SBV e) -> Symbolic () Source # sName :: [String] -> (SBV a, SBV b, SBV c, SBV d, SBV e) -> Symbolic () Source # safe :: (SBV a, SBV b, SBV c, SBV d, SBV e) -> IO [SafeResult] Source # safeWith :: SMTConfig -> (SBV a, SBV b, SBV c, SBV d, SBV e) -> IO [SafeResult] Source #
(NFData a, SymWord a, NFData b, SymWord b, NFData c, SymWord c, NFData d, SymWord d, NFData e, SymWord e, NFData f, SymWord f) => SExecutable (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> Symbolic () Source # sName :: [String] -> (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> Symbolic () Source # safe :: (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> IO [SafeResult] Source # safeWith :: SMTConfig -> (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> IO [SafeResult] Source #
(NFData a, SymWord a, NFData b, SymWord b, NFData c, SymWord c, NFData d, SymWord d, NFData e, SymWord e, NFData f, SymWord f, NFData g, SymWord g) => SExecutable (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName_ :: (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> Symbolic () Source #

sName :: [String] -> (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> Symbolic () Source #

safe :: (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> IO [SafeResult] Source #

safeWith :: SMTConfig -> (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> IO [SafeResult] Source #

# Quick-checking

sbvQuickCheck :: Symbolic SBool -> IO Bool Source #

Quick check an SBV property. Note that a regular `quickCheck` call will work just as well. Use this variant if you want to receive the boolean result.

# Optimization

SBV can optimize metric functions, i.e., those that generate both bounded `SIntN`, `SWordN`, and unbounded `SInteger` types, along with those produce `SReal`s. That is, it can find models satisfying all the constraints while minimizing or maximizing user given metrics. Currently, optimization requires the use of the z3 SMT solver as the backend, and a good review of these features is given in this paper: http://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/nbjorner-scss2014.pdf.

Goals can be lexicographically (default), independently, or pareto-front optimized. The relevant functions are:

- `minimize`: Minimize a given arithmetic goal
- `maximize`: Minimize a given arithmetic goal

Goals can be optimized at a regular or an extended value: An extended value is either positive or negative infinity (for unbounded integers and reals) or positive or negative epsilon differential from a real value (for reals).

For instance, a call of the form

     minimize "name-of-goal" $ x + 2*y

minimizes the arithmetic goal `x+2*y`, where `x` and `y` can be signed/unsigned bit-vectors, reals, or integers.

## A simple example

Here's an optimization example in action:

    >>> optimize Lexicographic $ \x y -> minimize "goal" (x+2*(y::SInteger))
    Optimal in an extension field:
      goal = -oo :: Integer

We will describe the role of the constructor `Lexicographic` shortly.

Of course, this becomes more useful when the result is not in an extension field:

    >>> :{
        optimize Lexicographic $ do
                      x <- sInteger "x"
                      y <- sInteger "y"
                      constrain $ x .> 0
                      constrain $ x .< 6
                      constrain $ y .> 2
                      constrain $ y .< 12
                      minimize "goal" $ x + 2 * y
        :}
    Optimal model:
      x    = 1 :: Integer
      y    = 3 :: Integer
      goal = 7 :: Integer

As usual, the programmatic API can be used to extract the values of objectives and model-values (`getModelObjectives`, `getModelAssignment`, etc.) to access these values and program with them further.

The following examples illustrate the use of basic optimization routines:

- Documentation.SBV.Examples.Optimization.LinearOpt: Simple linear-optimization example.
- Documentation.SBV.Examples.Optimization.Production: Scheduling machines in a shop
- Documentation.SBV.Examples.Optimization.VM: Scheduling virtual-machines in a data-center

## Multiple optimization goals

Multiple goals can be specified, using the same syntax. In this case, the user gets to pick what style of optimization to perform, by passing the relevant `OptimizeStyle` as the first argument to `optimize`.

- [`Lexicographic`]. The solver will optimize the goals in the given order, optimizing the latter ones under the model that optimizes the previous ones.
- [`Independent`]. The solver will optimize the goals independently of each other. In this case the user will be presented a model for each goal given.
- [`Pareto`]. Finally, the user can query for pareto-fronts. A pareto front is an model such that no goal can be made "better" without making some other goal "worse."

Pareto fronts only make sense when the objectives are bounded. If there are unbounded objective values, then the backend solver can loop infinitely. (This is what z3 does currently.) If you are not sure the objectives are bounded, you should first use `Independent` mode to ensure the objectives are bounded, and then switch to pareto-mode to extract them further.

The optional number argument to `Pareto` specifies the maximum number of pareto-fronts the user is asking to get. If `Nothing`, SBV will query for all pareto-fronts. Note that pareto-fronts can be really large, so if `Nothing` is used, there is a potential for waiting indefinitely for the SBV-solver interaction to finish. (If you suspect this might be the case, run in `verbose` mode to see the interaction and put a limiting factor appropriately.)

data OptimizeStyle Source #

Style of optimization. Note that in the pareto case the user is allowed to specify a max number of fronts to query the solver for, since there might potentially be an infinite number of them and there is no way to know exactly how many ahead of time. If `Nothing` is given, SBV will possibly loop forever if the number is really infinite.

Constructors

Lexicographic | Objectives are optimized in the order given, earlier objectives have higher priority.
Independent | Each objective is optimized independently.
Pareto (Maybe Int) | Objectives are optimized according to pareto front: That is, no objective can be made better without making some other worse.

Instances

Eq OptimizeStyle Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods (==) :: OptimizeStyle -> OptimizeStyle -> Bool Source # (/=) :: OptimizeStyle -> OptimizeStyle -> Bool Source #
Show OptimizeStyle Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods showsPrec :: Int -> OptimizeStyle -> ShowS Source # show :: OptimizeStyle -> String Source # showList :: [OptimizeStyle] -> ShowS Source #
NFData OptimizeStyle Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods rnf :: OptimizeStyle -> () Source #

## Objectives

data Objective a Source #

Objective of optimization. We can minimize, maximize, or give a soft assertion with a penalty for not satisfying it.

Constructors

Minimize String a | Minimize this metric
Maximize String a | Maximize this metric
AssertWithPenalty String a Penalty | A soft assertion, with an associated penalty

Instances

Functor Objective Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods fmap :: (a -> b) -> Objective a -> Objective b Source # (<$) :: a -> Objective b -> Objective a Source #
Show a => Show (Objective a) Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods showsPrec :: Int -> Objective a -> ShowS Source # show :: Objective a -> String Source # showList :: [Objective a] -> ShowS Source #
NFData a => NFData (Objective a) Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods rnf :: Objective a -> () Source #

class Metric a where Source #

Class of metrics we can optimize for. Currently, bounded signed/unsigned bit-vectors, unbounded integers, and algebraic reals can be optimized. (But not, say, SFloat, SDouble, or SBool.) Minimal complete definition: minimize/maximize.

A good reference on these features is given in the following paper: http://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/nbjorner-scss2014.pdf.

Methods

minimize :: String -> a -> Symbolic () Source #

Minimize a named metric

maximize :: String -> a -> Symbolic () Source #

Maximize a named metric

Instances

Metric SReal Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SReal -> Symbolic () Source # maximize :: String -> SReal -> Symbolic () Source #
Metric SInteger Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SInteger -> Symbolic () Source # maximize :: String -> SInteger -> Symbolic () Source #
Metric SInt64 Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SInt64 -> Symbolic () Source # maximize :: String -> SInt64 -> Symbolic () Source #
Metric SInt32 Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SInt32 -> Symbolic () Source # maximize :: String -> SInt32 -> Symbolic () Source #
Metric SInt16 Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SInt16 -> Symbolic () Source # maximize :: String -> SInt16 -> Symbolic () Source #
Metric SInt8 Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SInt8 -> Symbolic () Source # maximize :: String -> SInt8 -> Symbolic () Source #
Metric SWord64 Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SWord64 -> Symbolic () Source # maximize :: String -> SWord64 -> Symbolic () Source #
Metric SWord32 Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SWord32 -> Symbolic () Source # maximize :: String -> SWord32 -> Symbolic () Source #
Metric SWord16 Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SWord16 -> Symbolic () Source # maximize :: String -> SWord16 -> Symbolic () Source #
Metric SWord8 Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SWord8 -> Symbolic () Source # maximize :: String -> SWord8 -> Symbolic () Source #

## Soft assertions

Related to optimization, SBV implements soft-asserts via `assertWithPenalty` calls. A soft assertion is a hint to the SMT solver that we would like a particular condition to hold if **possible*. That is, if there is a solution satisfying it, then we would like it to hold, but it can be violated if there is no way to satisfy it. Each soft-assertion can be associated with a numeric penalty for not satisfying it, hence turning it into an optimization problem.

Note that `assertWithPenalty` works well with optimization goals ('minimize'/'maximize' etc.), and are most useful when we are optimizing a metric and thus some of the constraints can be relaxed with a penalty to obtain a good solution. Again see http://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/nbjorner-scss2014.pdf for a good overview of the features in Z3 that SBV is providing the bridge for.

A soft assertion can be specified in one of the following three main ways:

             assertWithPenalty "bounded_x" (x .< 5) DefaultPenalty
             assertWithPenalty "bounded_x" (x .< 5) (Penalty 2.3 Nothing)
             assertWithPenalty "bounded_x" (x .< 5) (Penalty 4.7 (Just "group-1"))

In the first form, we are saying that the constraint `x .< 5` must be satisfied, if possible, but if this constraint can not be satisfied to find a model, it can be violated with the default penalty of 1.

In the second case, we are associating a penalty value of `2.3`.

Finally in the third case, we are also associating this constraint with a group. The group name is only needed if we have classes of soft-constraints that should be considered together.

assertWithPenalty :: String -> SBool -> Penalty -> Symbolic () Source #

Introduce a soft assertion, with an optional penalty

data Penalty Source #

Penalty for a soft-assertion. The default penalty is `1`, with all soft-assertions belonging to the same objective goal. A positive weight and an optional group can be provided by using the `Penalty` constructor.

Constructors

DefaultPenalty | Default: Penalty of `1` and no group attached
Penalty Rational (Maybe String) | Penalty with a weight and an optional group

Instances

Show Penalty Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods showsPrec :: Int -> Penalty -> ShowS Source # show :: Penalty -> String Source # showList :: [Penalty] -> ShowS Source #
NFData Penalty Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods rnf :: Penalty -> () Source #

## Field extensions

If an optimization results in an infinity/epsilon value, the returned `CW` value will be in the corresponding extension field.

data ExtCW Source #

A simple expression type over extendent values, covering infinity, epsilon and intervals.

Constructors

Infinite Kind |
Epsilon Kind |
Interval ExtCW ExtCW |
BoundedCW CW |
AddExtCW ExtCW ExtCW |
MulExtCW ExtCW ExtCW |

Instances

Show ExtCW Source # | Show instance, shows with the kind
Instance details Defined in Data.SBV.Core.Concrete Methods showsPrec :: Int -> ExtCW -> ShowS Source # show :: ExtCW -> String Source # showList :: [ExtCW] -> ShowS Source #
HasKind ExtCW Source # | Kind instance for Extended CW

Instance details

Defined in Data.SBV.Core.Concrete

Methods

kindOf :: ExtCW -> Kind Source #

hasSign :: ExtCW -> Bool Source #

intSizeOf :: ExtCW -> Int Source #

isBoolean :: ExtCW -> Bool Source #

isBounded :: ExtCW -> Bool Source #

isReal :: ExtCW -> Bool Source #

isFloat :: ExtCW -> Bool Source #

isDouble :: ExtCW -> Bool Source #

isInteger :: ExtCW -> Bool Source #

isUninterpreted :: ExtCW -> Bool Source #

isChar :: ExtCW -> Bool Source #

isString :: ExtCW -> Bool Source #

isList :: ExtCW -> Bool Source #

showType :: ExtCW -> String Source #

data GeneralizedCW Source #

A generalized CW allows for expressions involving infinite and epsilon values/intervals Used in optimization problems.

Constructors

ExtendedCW ExtCW |
RegularCW CW |

Instances

Show GeneralizedCW Source # | Show instance for Generalized `CW`
Instance details Defined in Data.SBV.Core.Concrete Methods showsPrec :: Int -> GeneralizedCW -> ShowS Source # show :: GeneralizedCW -> String Source # showList :: [GeneralizedCW] -> ShowS Source #
NFData GeneralizedCW Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods rnf :: GeneralizedCW -> () Source #
HasKind GeneralizedCW Source # | `Kind` instance for generalized CW

Instance details

Defined in Data.SBV.Core.Concrete

Methods

kindOf :: GeneralizedCW -> Kind Source #

hasSign :: GeneralizedCW -> Bool Source #

intSizeOf :: GeneralizedCW -> Int Source #

isBoolean :: GeneralizedCW -> Bool Source #

isBounded :: GeneralizedCW -> Bool Source #

isReal :: GeneralizedCW -> Bool Source #

isFloat :: GeneralizedCW -> Bool Source #

isDouble :: GeneralizedCW -> Bool Source #

isInteger :: GeneralizedCW -> Bool Source #

isUninterpreted :: GeneralizedCW -> Bool Source #

isChar :: GeneralizedCW -> Bool Source #

isString :: GeneralizedCW -> Bool Source #

isList :: GeneralizedCW -> Bool Source #

showType :: GeneralizedCW -> String Source #

# Model extraction

The default `Show` instances for prover calls provide all the counter-example information in a human-readable form and should be sufficient for most casual uses of sbv. However, tools built on top of sbv will inevitably need to look into the constructed models more deeply, programmatically extracting their results and performing actions based on them. The API provided in this section aims at simplifying this task.

## Inspecting proof results

`ThmResult`, `SatResult`, and `AllSatResult` are simple newtype wrappers over `SMTResult`. Their main purpose is so that we can provide custom `Show` instances to print results accordingly.

newtype ThmResult Source #

A `prove` call results in a `ThmResult`

Constructors

ThmResult SMTResult |

Instances

Show ThmResult Source # |
Instance details Defined in Data.SBV.SMT.SMT Methods showsPrec :: Int -> ThmResult -> ShowS Source # show :: ThmResult -> String Source # showList :: [ThmResult] -> ShowS Source #
NFData ThmResult Source # |
Instance details Defined in Data.SBV.SMT.SMT Methods rnf :: ThmResult -> () Source #
Modelable ThmResult Source # | `ThmResult` as a generic model provider

Instance details

Defined in Data.SBV.SMT.SMT

Methods

modelExists :: ThmResult -> Bool Source #

getModelAssignment :: SatModel b => ThmResult -> Either String (Bool, b) Source #

getModelDictionary :: ThmResult -> Map String CW Source #

getModelValue :: SymWord b => String -> ThmResult -> Maybe b Source #

getModelUninterpretedValue :: String -> ThmResult -> Maybe String Source #

extractModel :: SatModel b => ThmResult -> Maybe b Source #

getModelObjectives :: ThmResult -> Map String GeneralizedCW Source #

getModelObjectiveValue :: String -> ThmResult -> Maybe GeneralizedCW Source #

newtype SatResult Source #

A `sat` call results in a `SatResult` The reason for having a separate `SatResult` is to have a more meaningful `Show` instance.

Constructors

SatResult SMTResult |

Instances

Show SatResult Source # |
Instance details Defined in Data.SBV.SMT.SMT Methods showsPrec :: Int -> SatResult -> ShowS Source # show :: SatResult -> String Source # showList :: [SatResult] -> ShowS Source #
NFData SatResult Source # |
Instance details Defined in Data.SBV.SMT.SMT Methods rnf :: SatResult -> () Source #
Modelable SatResult Source # | `SatResult` as a generic model provider

Instance details

Defined in Data.SBV.SMT.SMT

Methods

modelExists :: SatResult -> Bool Source #

getModelAssignment :: SatModel b => SatResult -> Either String (Bool, b) Source #

getModelDictionary :: SatResult -> Map String CW Source #

getModelValue :: SymWord b => String -> SatResult -> Maybe b Source #

getModelUninterpretedValue :: String -> SatResult -> Maybe String Source #

extractModel :: SatModel b => SatResult -> Maybe b Source #

getModelObjectives :: SatResult -> Map String GeneralizedCW Source #

getModelObjectiveValue :: String -> SatResult -> Maybe GeneralizedCW Source #

newtype AllSatResult Source #

An `allSat` call results in a `AllSatResult`. The first boolean says whether we hit the max-model limit as we searched. The second boolean says whether there were prefix-existentials.

Constructors

AllSatResult (Bool, Bool, [SMTResult]) |

Instances

Show AllSatResult Source # |
Instance details Defined in Data.SBV.SMT.SMT Methods showsPrec :: Int -> AllSatResult -> ShowS Source # show :: AllSatResult -> String Source # showList :: [AllSatResult] -> ShowS Source #

newtype SafeResult Source #

A `safe` call results in a `SafeResult`

Constructors

SafeResult (Maybe String, String, SMTResult) |

Instances

Show SafeResult Source # |
Instance details Defined in Data.SBV.SMT.SMT Methods showsPrec :: Int -> SafeResult -> ShowS Source # show :: SafeResult -> String Source # showList :: [SafeResult] -> ShowS Source #

data OptimizeResult Source #

An `optimize` call results in a `OptimizeResult`. In the `ParetoResult` case, the boolean is `True` if we reached pareto-query limit and so there might be more unqueried results remaining. If `False`, it means that we have all the pareto fronts returned. See the `Pareto` `OptimizeStyle` for details.

Constructors

LexicographicResult SMTResult |
ParetoResult (Bool, [SMTResult]) |
IndependentResult [(String, SMTResult)] |

Instances

Show OptimizeResult Source # |
Instance details Defined in Data.SBV.SMT.SMT Methods showsPrec :: Int -> OptimizeResult -> ShowS Source # show :: OptimizeResult -> String Source # showList :: [OptimizeResult] -> ShowS Source #

data SMTResult Source #

The result of an SMT solver call. Each constructor is tagged with the `SMTConfig` that created it so that further tools can inspect it and build layers of results, if needed. For ordinary uses of the library, this type should not be needed, instead use the accessor functions on it. (Custom Show instances and model extractors.)

Constructors

Unsatisfiable SMTConfig (Maybe [String]) | Unsatisfiable. If unsat-cores are enabled, they will be returned in the second parameter.
Satisfiable SMTConfig SMTModel | Satisfiable with model
SatExtField SMTConfig SMTModel | Prover returned a model, but in an extension field containing Infinite/epsilon
Unknown SMTConfig SMTReasonUnknown | Prover returned unknown, with the given reason
ProofError SMTConfig [String] | Prover errored out

Instances

NFData SMTResult Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods rnf :: SMTResult -> () Source #
Modelable SMTResult Source # | `SMTResult` as a generic model provider

Instance details

Defined in Data.SBV.SMT.SMT

Methods

modelExists :: SMTResult -> Bool Source #

getModelAssignment :: SatModel b => SMTResult -> Either String (Bool, b) Source #

getModelDictionary :: SMTResult -> Map String CW Source #

getModelValue :: SymWord b => String -> SMTResult -> Maybe b Source #

getModelUninterpretedValue :: String -> SMTResult -> Maybe String Source #

extractModel :: SatModel b => SMTResult -> Maybe b Source #

getModelObjectives :: SMTResult -> Map String GeneralizedCW Source #

getModelObjectiveValue :: String -> SMTResult -> Maybe GeneralizedCW Source #

data SMTReasonUnknown Source #

Reason for reporting unknown.

Constructors

UnknownMemOut |
UnknownIncomplete |
UnknownTimeOut |
UnknownOther String |

Instances

Show SMTReasonUnknown Source # | Show instance for unknown
Instance details Defined in Data.SBV.Control.Types Methods showsPrec :: Int -> SMTReasonUnknown -> ShowS Source # show :: SMTReasonUnknown -> String Source # showList :: [SMTReasonUnknown] -> ShowS Source #
Generic SMTReasonUnknown Source # |
Instance details Defined in Data.SBV.Control.Types Associated Types type Rep SMTReasonUnknown :: Type -> Type Source # Methods from :: SMTReasonUnknown -> Rep SMTReasonUnknown x Source # to :: Rep SMTReasonUnknown x -> SMTReasonUnknown Source #
NFData SMTReasonUnknown Source # |
Instance details Defined in Data.SBV.Control.Types Methods rnf :: SMTReasonUnknown -> () Source #
type Rep SMTReasonUnknown Source # |

Instance details

Defined in Data.SBV.Control.Types

type Rep SMTReasonUnknown = D1 (MetaData "SMTReasonUnknown" "Data.SBV.Control.Types" "sbv-7.13-G8ZmOEcTGWs4ZWy733U7C5" False) ((C1 (MetaCons "UnknownMemOut" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "UnknownIncomplete" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "UnknownTimeOut" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "UnknownOther" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String))))

## Observing expressions

The `observe` command can be used to trace values of arbitrary expressions during a `sat`, `prove`, or perhaps more importantly, in a `quickCheck` call. This is useful for, for instance, recording expected/obtained expressions as a symbolic program is executing.

    >>> :{
    prove $ do a1 <- free "i1"
               a2 <- free "i2"
               let spec, res :: SWord8
                   spec = a1 + a2
                   res  = ite (a1 .== 12 &&& a2 .== 22)   -- insert a malicious bug!
                              1
                              (a1 + a2)
               return $ observe "Expected" spec .== observe "Result" res
    :}
    Falsifiable. Counter-example:
      i1       = 12 :: Word8
      i2       = 22 :: Word8
      Expected = 34 :: Word8
      Result   =  1 :: Word8

observe :: SymWord a => String -> SBV a -> SBV a Source #

Observe the value of an expression. Such values are useful in model construction, as they are printed part of a satisfying model, or a counter-example. The same works for quick-check as well. Useful when we want to see intermediate values, or expected/obtained pairs in a particular run. Note that an observed expression is always symbolic, i.e., it won't be constant folded. Compare this to `label` which is used for putting a label in the generated SMTLib-C code.

## Programmable model extraction

While default `Show` instances are sufficient for most use cases, it is sometimes desirable (especially for library construction) that the SMT-models are reinterpreted in terms of domain types. Programmable extraction allows getting arbitrarily typed models out of SMT models.

class SatModel a where Source #

Instances of `SatModel` can be automatically extracted from models returned by the solvers. The idea is that the sbv infrastructure provides a stream of CW's (constant-words) coming from the solver, and the type `a` is interpreted based on these constants. Many typical instances are already provided, so new instances can be declared with relative ease.

Minimum complete definition: `parseCWs`

Minimal complete definition

Nothing

Methods

parseCWs :: [CW] -> Maybe (a, [CW]) Source #

Given a sequence of constant-words, extract one instance of the type `a`, returning the remaining elements untouched. If the next element is not what's expected for this type you should return `Nothing`

cvtModel :: (a -> Maybe b) -> Maybe (a, [CW]) -> Maybe (b, [CW]) Source #

Given a parsed model instance, transform it using `f`, and return the result. The default definition for this method should be sufficient in most use cases.

parseCWs :: Read a => [CW] -> Maybe (a, [CW]) Source #

Given a sequence of constant-words, extract one instance of the type `a`, returning the remaining elements untouched. If the next element is not what's expected for this type you should return `Nothing`

Instances

SatModel Bool Source # | `Bool` as extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe (Bool, [CW]) Source # cvtModel :: (Bool -> Maybe b) -> Maybe (Bool, [CW]) -> Maybe (b, [CW]) Source #
SatModel Double Source # | `Double` as extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe (Double, [CW]) Source # cvtModel :: (Double -> Maybe b) -> Maybe (Double, [CW]) -> Maybe (b, [CW]) Source #
SatModel Float Source # | `Float` as extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe (Float, [CW]) Source # cvtModel :: (Float -> Maybe b) -> Maybe (Float, [CW]) -> Maybe (b, [CW]) Source #
SatModel Int8 Source # | `Int8` as extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe (Int8, [CW]) Source # cvtModel :: (Int8 -> Maybe b) -> Maybe (Int8, [CW]) -> Maybe (b, [CW]) Source #
SatModel Int16 Source # | `Int16` as extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe (Int16, [CW]) Source # cvtModel :: (Int16 -> Maybe b) -> Maybe (Int16, [CW]) -> Maybe (b, [CW]) Source #
SatModel Int32 Source # | `Int32` as extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe (Int32, [CW]) Source # cvtModel :: (Int32 -> Maybe b) -> Maybe (Int32, [CW]) -> Maybe (b, [CW]) Source #
SatModel Int64 Source # | `Int64` as extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe (Int64, [CW]) Source # cvtModel :: (Int64 -> Maybe b) -> Maybe (Int64, [CW]) -> Maybe (b, [CW]) Source #
SatModel Integer Source # | `Integer` as extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe (Integer, [CW]) Source # cvtModel :: (Integer -> Maybe b) -> Maybe (Integer, [CW]) -> Maybe (b, [CW]) Source #
SatModel Word8 Source # | `Word8` as extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe (Word8, [CW]) Source # cvtModel :: (Word8 -> Maybe b) -> Maybe (Word8, [CW]) -> Maybe (b, [CW]) Source #
SatModel Word16 Source # | `Word16` as extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe (Word16, [CW]) Source # cvtModel :: (Word16 -> Maybe b) -> Maybe (Word16, [CW]) -> Maybe (b, [CW]) Source #
SatModel Word32 Source # | `Word32` as extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe (Word32, [CW]) Source # cvtModel :: (Word32 -> Maybe b) -> Maybe (Word32, [CW]) -> Maybe (b, [CW]) Source #
SatModel Word64 Source # | `Word64` as extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe (Word64, [CW]) Source # cvtModel :: (Word64 -> Maybe b) -> Maybe (Word64, [CW]) -> Maybe (b, [CW]) Source #
SatModel () Source # | Base case for `SatModel` at unit type. Comes in handy if there are no real variables.
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe ((), [CW]) Source # cvtModel :: (() -> Maybe b) -> Maybe ((), [CW]) -> Maybe (b, [CW]) Source #
SatModel AlgReal Source # | `AlgReal` as extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe (AlgReal, [CW]) Source # cvtModel :: (AlgReal -> Maybe b) -> Maybe (AlgReal, [CW]) -> Maybe (b, [CW]) Source #
SatModel CW Source # | `CW` as extracted from a model; trivial definition
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe (CW, [CW]) Source # cvtModel :: (CW -> Maybe b) -> Maybe (CW, [CW]) -> Maybe (b, [CW]) Source #
SatModel RoundingMode Source # | A rounding mode, extracted from a model. (Default definition suffices)
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe (RoundingMode, [CW]) Source # cvtModel :: (RoundingMode -> Maybe b) -> Maybe (RoundingMode, [CW]) -> Maybe (b, [CW]) Source #
SatModel State Source # | Make `State` a symbolic enumeration
Instance details Defined in Documentation.SBV.Examples.Lists.BoundedMutex Methods parseCWs :: [CW] -> Maybe (State, [CW]) Source # cvtModel :: (State -> Maybe b) -> Maybe (State, [CW]) -> Maybe (b, [CW]) Source #
SatModel E Source # | Make `E` a symbolic value.
Instance details Defined in Documentation.SBV.Examples.Misc.Enumerate Methods parseCWs :: [CW] -> Maybe (E, [CW]) Source # cvtModel :: (E -> Maybe b) -> Maybe (E, [CW]) -> Maybe (b, [CW]) Source #
SatModel Word4 Source # | SatModel instance, merely uses the generic parsing method.
Instance details Defined in Documentation.SBV.Examples.Misc.Word4 Methods parseCWs :: [CW] -> Maybe (Word4, [CW]) Source # cvtModel :: (Word4 -> Maybe b) -> Maybe (Word4, [CW]) -> Maybe (b, [CW]) Source #
SatModel Color Source # | Make `Color` a symbolic value.
Instance details Defined in Documentation.SBV.Examples.Puzzles.Fish Methods parseCWs :: [CW] -> Maybe (Color, [CW]) Source # cvtModel :: (Color -> Maybe b) -> Maybe (Color, [CW]) -> Maybe (b, [CW]) Source #
SatModel Nationality Source # | Make `Nationality` a symbolic value.
Instance details Defined in Documentation.SBV.Examples.Puzzles.Fish Methods parseCWs :: [CW] -> Maybe (Nationality, [CW]) Source # cvtModel :: (Nationality -> Maybe b) -> Maybe (Nationality, [CW]) -> Maybe (b, [CW]) Source #
SatModel Beverage Source # | Make `Beverage` a symbolic value.
Instance details Defined in Documentation.SBV.Examples.Puzzles.Fish Methods parseCWs :: [CW] -> Maybe (Beverage, [CW]) Source # cvtModel :: (Beverage -> Maybe b) -> Maybe (Beverage, [CW]) -> Maybe (b, [CW]) Source #
SatModel Pet Source # | Make `Pet` a symbolic value.
Instance details Defined in Documentation.SBV.Examples.Puzzles.Fish Methods parseCWs :: [CW] -> Maybe (Pet, [CW]) Source # cvtModel :: (Pet -> Maybe b) -> Maybe (Pet, [CW]) -> Maybe (b, [CW]) Source #
SatModel Sport Source # | Make `Sport` a symbolic value.
Instance details Defined in Documentation.SBV.Examples.Puzzles.Fish Methods parseCWs :: [CW] -> Maybe (Sport, [CW]) Source # cvtModel :: (Sport -> Maybe b) -> Maybe (Sport, [CW]) -> Maybe (b, [CW]) Source #
SatModel Color Source # | Make `Color` a symbolic value.
Instance details Defined in Documentation.SBV.Examples.Puzzles.Garden Methods parseCWs :: [CW] -> Maybe (Color, [CW]) Source # cvtModel :: (Color -> Maybe b) -> Maybe (Color, [CW]) -> Maybe (b, [CW]) Source #
SatModel Color Source # | Make `Color` a symbolic value.
Instance details Defined in Documentation.SBV.Examples.Puzzles.HexPuzzle Methods parseCWs :: [CW] -> Maybe (Color, [CW]) Source # cvtModel :: (Color -> Maybe b) -> Maybe (Color, [CW]) -> Maybe (b, [CW]) Source #
SatModel U2Member Source # | Make `U2Member` a symbolic value.
Instance details Defined in Documentation.SBV.Examples.Puzzles.U2Bridge Methods parseCWs :: [CW] -> Maybe (U2Member, [CW]) Source # cvtModel :: (U2Member -> Maybe b) -> Maybe (U2Member, [CW]) -> Maybe (b, [CW]) Source #
SatModel Location Source # | Make `Location` a symbolic value.
Instance details Defined in Documentation.SBV.Examples.Puzzles.U2Bridge Methods parseCWs :: [CW] -> Maybe (Location, [CW]) Source # cvtModel :: (Location -> Maybe b) -> Maybe (Location, [CW]) -> Maybe (b, [CW]) Source #
SatModel Day Source # | Make `Day` a symbolic value.
Instance details Defined in Documentation.SBV.Examples.Queries.Enums Methods parseCWs :: [CW] -> Maybe (Day, [CW]) Source # cvtModel :: (Day -> Maybe b) -> Maybe (Day, [CW]) -> Maybe (b, [CW]) Source #
SatModel BinOp Source # | Make `BinOp` a symbolic value.
Instance details Defined in Documentation.SBV.Examples.Queries.FourFours Methods parseCWs :: [CW] -> Maybe (BinOp, [CW]) Source # cvtModel :: (BinOp -> Maybe b) -> Maybe (BinOp, [CW]) -> Maybe (b, [CW]) Source #
SatModel UnOp Source # | Make `UnOp` a symbolic value.
Instance details Defined in Documentation.SBV.Examples.Queries.FourFours Methods parseCWs :: [CW] -> Maybe (UnOp, [CW]) Source # cvtModel :: (UnOp -> Maybe b) -> Maybe (UnOp, [CW]) -> Maybe (b, [CW]) Source #
SatModel a => SatModel [a] Source # | A list of values as extracted from a model. When reading a list, we go as long as we can (maximal-munch). Note that this never fails, as we can always return the empty list!
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe ([a], [CW]) Source # cvtModel :: ([a] -> Maybe b) -> Maybe ([a], [CW]) -> Maybe (b, [CW]) Source #
(SatModel a, SatModel b) => SatModel (a, b) Source # | Tuples extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe ((a, b), [CW]) Source # cvtModel :: ((a, b) -> Maybe b0) -> Maybe ((a, b), [CW]) -> Maybe (b0, [CW]) Source #
(SatModel a, SatModel b, SatModel c) => SatModel (a, b, c) Source # | 3-Tuples extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe ((a, b, c), [CW]) Source # cvtModel :: ((a, b, c) -> Maybe b0) -> Maybe ((a, b, c), [CW]) -> Maybe (b0, [CW]) Source #
(SatModel a, SatModel b, SatModel c, SatModel d) => SatModel (a, b, c, d) Source # | 4-Tuples extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe ((a, b, c, d), [CW]) Source # cvtModel :: ((a, b, c, d) -> Maybe b0) -> Maybe ((a, b, c, d), [CW]) -> Maybe (b0, [CW]) Source #
(SatModel a, SatModel b, SatModel c, SatModel d, SatModel e) => SatModel (a, b, c, d, e) Source # | 5-Tuples extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe ((a, b, c, d, e), [CW]) Source # cvtModel :: ((a, b, c, d, e) -> Maybe b0) -> Maybe ((a, b, c, d, e), [CW]) -> Maybe (b0, [CW]) Source #
(SatModel a, SatModel b, SatModel c, SatModel d, SatModel e, SatModel f) => SatModel (a, b, c, d, e, f) Source # | 6-Tuples extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe ((a, b, c, d, e, f), [CW]) Source # cvtModel :: ((a, b, c, d, e, f) -> Maybe b0) -> Maybe ((a, b, c, d, e, f), [CW]) -> Maybe (b0, [CW]) Source #
(SatModel a, SatModel b, SatModel c, SatModel d, SatModel e, SatModel f, SatModel g) => SatModel (a, b, c, d, e, f, g) Source # | 7-Tuples extracted from a model
Instance details Defined in Data.SBV.SMT.SMT Methods parseCWs :: [CW] -> Maybe ((a, b, c, d, e, f, g), [CW]) Source # cvtModel :: ((a, b, c, d, e, f, g) -> Maybe b0) -> Maybe ((a, b, c, d, e, f, g), [CW]) -> Maybe (b0, [CW]) Source #

class Modelable a where Source #

Various SMT results that we can extract models out of.

Minimal complete definition

modelExists, getModelAssignment, getModelDictionary, getModelObjectives

Methods

modelExists :: a -> Bool Source #

Is there a model?

getModelAssignment :: SatModel b => a -> Either String (Bool, b) Source #

Extract assignments of a model, the result is a tuple where the first argument (if True) indicates whether the model was "probable". (i.e., if the solver returned unknown.)

getModelDictionary :: a -> Map String CW Source #

Extract a model dictionary. Extract a dictionary mapping the variables to their respective values as returned by the SMT solver. Also see `getModelDictionaries`.

getModelValue :: SymWord b => String -> a -> Maybe b Source #

Extract a model value for a given element. Also see `getModelValues`.

getModelUninterpretedValue :: String -> a -> Maybe String Source #

Extract a representative name for the model value of an uninterpreted kind. This is supposed to correspond to the value as computed internally by the SMT solver; and is unportable from solver to solver. Also see `getModelUninterpretedValues`.

extractModel :: SatModel b => a -> Maybe b Source #

A simpler variant of `getModelAssignment` to get a model out without the fuss.

getModelObjectives :: a -> Map String GeneralizedCW Source #

Extract model objective values, for all optimization goals.

getModelObjectiveValue :: String -> a -> Maybe GeneralizedCW Source #

Extract the value of an objective

Instances

Modelable SMTResult Source # | `SMTResult` as a generic model provider

Instance details

Defined in Data.SBV.SMT.SMT

Methods

modelExists :: SMTResult -> Bool Source #

getModelAssignment :: SatModel b => SMTResult -> Either String (Bool, b) Source #

getModelDictionary :: SMTResult -> Map String CW Source #

getModelValue :: SymWord b => String -> SMTResult -> Maybe b Source #

getModelUninterpretedValue :: String -> SMTResult -> Maybe String Source #

extractModel :: SatModel b => SMTResult -> Maybe b Source #

getModelObjectives :: SMTResult -> Map String GeneralizedCW Source #

getModelObjectiveValue :: String -> SMTResult -> Maybe GeneralizedCW Source #

Modelable SatResult Source # | `SatResult` as a generic model provider

Instance details

Defined in Data.SBV.SMT.SMT

Methods

modelExists :: SatResult -> Bool Source #

getModelAssignment :: SatModel b => SatResult -> Either String (Bool, b) Source #

getModelDictionary :: SatResult -> Map String CW Source #

getModelValue :: SymWord b => String -> SatResult -> Maybe b Source #

getModelUninterpretedValue :: String -> SatResult -> Maybe String Source #

extractModel :: SatModel b => SatResult -> Maybe b Source #

getModelObjectives :: SatResult -> Map String GeneralizedCW Source #

getModelObjectiveValue :: String -> SatResult -> Maybe GeneralizedCW Source #

Modelable ThmResult Source # | `ThmResult` as a generic model provider

Instance details

Defined in Data.SBV.SMT.SMT

Methods

modelExists :: ThmResult -> Bool Source #

getModelAssignment :: SatModel b => ThmResult -> Either String (Bool, b) Source #

getModelDictionary :: ThmResult -> Map String CW Source #

getModelValue :: SymWord b => String -> ThmResult -> Maybe b Source #

getModelUninterpretedValue :: String -> ThmResult -> Maybe String Source #

extractModel :: SatModel b => ThmResult -> Maybe b Source #

getModelObjectives :: ThmResult -> Map String GeneralizedCW Source #

getModelObjectiveValue :: String -> ThmResult -> Maybe GeneralizedCW Source #

displayModels :: SatModel a => (Int -> (Bool, a) -> IO ()) -> AllSatResult -> IO Int Source #

Given an `allSat` call, we typically want to iterate over it and print the results in sequence. The `displayModels` function automates this task by calling `disp` on each result, consecutively. The first `Int` argument to `disp` 'is the current model number. The second argument is a tuple, where the first element indicates whether the model is alleged (i.e., if the solver is not sure, returing Unknown)

extractModels :: SatModel a => AllSatResult -> [a] Source #

Return all the models from an `allSat` call, similar to `extractModel` but is suitable for the case of multiple results.

getModelDictionaries :: AllSatResult -> [Map String CW] Source #

Get dictionaries from an all-sat call. Similar to `getModelDictionary`.

getModelValues :: SymWord b => String -> AllSatResult -> [Maybe b] Source #

Extract value of a variable from an all-sat call. Similar to `getModelValue`.

getModelUninterpretedValues :: String -> AllSatResult -> [Maybe String] Source #

Extract value of an uninterpreted variable from an all-sat call. Similar to `getModelUninterpretedValue`.

# SMT Interface

data SMTConfig Source #

Solver configuration. See also `z3`, `yices`, `cvc4`, `boolector`, `mathSAT`, etc. which are instantiations of this type for those solvers, with reasonable defaults. In particular, custom configuration can be created by varying those values. (Such as `z3{verbose=True}`.)

Most fields are self explanatory. The notion of precision for printing algebraic reals stems from the fact that such values does not necessarily have finite decimal representations, and hence we have to stop printing at some depth. It is important to emphasize that such values always have infinite precision internally. The issue is merely with how we print such an infinite precision value on the screen. The field `printRealPrec` controls the printing precision, by specifying the number of digits after the decimal point. The default value is 16, but it can be set to any positive integer.

When printing, SBV will add the suffix `...` at the and of a real-value, if the given bound is not sufficient to represent the real-value exactly. Otherwise, the number will be written out in standard decimal notation. Note that SBV will always print the whole value if it is precise (i.e., if it fits in a finite number of digits), regardless of the precision limit. The limit only applies if the representation of the real value is not finite, i.e., if it is not rational.

The `printBase` field can be used to print numbers in base 2, 10, or 16. If base 2 or 16 is used, then floating-point values will be printed in their internal memory-layout format as well, which can come in handy for bit-precise analysis.

Constructors

SMTConfig |

Fields

- verbose :: Bool

  Debug mode

- timing :: Timing

  Print timing information on how long different phases took (construction, solving, etc.)

- printBase :: Int

  Print integral literals in this base (2, 10, and 16 are supported.)

- printRealPrec :: Int

  Print algebraic real values with this precision. (SReal, default: 16)

- satCmd :: String

  Usually "(check-sat)". However, users might tweak it based on solver characteristics.

- allSatMaxModelCount :: Maybe Int

  In an allSat call, return at most this many models. If nothing, return all.

- isNonModelVar :: String -> Bool

  When constructing a model, ignore variables whose name satisfy this predicate. (Default: (const False), i.e., don't ignore anything)

- transcript :: Maybe FilePath

  If Just, the entire interaction will be recorded as a playable file (for debugging purposes mostly)

- smtLibVersion :: SMTLibVersion

  What version of SMT-lib we use for the tool

- solver :: SMTSolver

  The actual SMT solver.

- roundingMode :: RoundingMode

  Rounding mode to use for floating-point conversions

- solverSetOptions :: [SMTOption]

  Options to set as we start the solver

- ignoreExitCode :: Bool

  If true, we shall ignore the exit code upon exit. Otherwise we require ExitSuccess.

- redirectVerbose :: Maybe FilePath

  Redirect the verbose output to this file if given. If Nothing, stdout is implied.

Instances

NFData SMTConfig Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods rnf :: SMTConfig -> () Source #

data Timing Source #

Specify how to save timing information, if at all.

Constructors

NoTiming |
PrintTiming |
SaveTiming (IORef NominalDiffTime) |

data SMTLibVersion Source #

Representation of SMTLib Program versions. As of June 2015, we're dropping support for SMTLib1, and supporting SMTLib2 only. We keep this data-type around in case SMTLib3 comes along and we want to support 2 and 3 simultaneously.

Constructors

SMTLib2 |

Instances

Bounded SMTLibVersion Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods minBound :: SMTLibVersion Source # maxBound :: SMTLibVersion Source #
Enum SMTLibVersion Source # |

Instance details

Defined in Data.SBV.Core.Symbolic

Methods

succ :: SMTLibVersion -> SMTLibVersion Source #

pred :: SMTLibVersion -> SMTLibVersion Source #

toEnum :: Int -> SMTLibVersion Source #

fromEnum :: SMTLibVersion -> Int Source #

enumFrom :: SMTLibVersion -> [SMTLibVersion] Source #

enumFromThen :: SMTLibVersion -> SMTLibVersion -> [SMTLibVersion] Source #

enumFromTo :: SMTLibVersion -> SMTLibVersion -> [SMTLibVersion] Source #

enumFromThenTo :: SMTLibVersion -> SMTLibVersion -> SMTLibVersion -> [SMTLibVersion] Source #

Eq SMTLibVersion Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods (==) :: SMTLibVersion -> SMTLibVersion -> Bool Source # (/=) :: SMTLibVersion -> SMTLibVersion -> Bool Source #
Show SMTLibVersion Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods showsPrec :: Int -> SMTLibVersion -> ShowS Source # show :: SMTLibVersion -> String Source # showList :: [SMTLibVersion] -> ShowS Source #
NFData SMTLibVersion Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods rnf :: SMTLibVersion -> () Source #

data Solver Source #

Solvers that SBV is aware of

Constructors

Z3 |
Yices |
Boolector |
CVC4 |
MathSAT |
ABC |

Instances

Bounded Solver Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods minBound :: Solver Source # maxBound :: Solver Source #
Enum Solver Source # |

Instance details

Defined in Data.SBV.Core.Symbolic

Methods

succ :: Solver -> Solver Source #

pred :: Solver -> Solver Source #

toEnum :: Int -> Solver Source #

fromEnum :: Solver -> Int Source #

enumFrom :: Solver -> [Solver] Source #

enumFromThen :: Solver -> Solver -> [Solver] Source #

enumFromTo :: Solver -> Solver -> [Solver] Source #

enumFromThenTo :: Solver -> Solver -> Solver -> [Solver] Source #

Show Solver Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods showsPrec :: Int -> Solver -> ShowS Source # show :: Solver -> String Source # showList :: [Solver] -> ShowS Source #

data SMTSolver Source #

An SMT solver

Constructors

SMTSolver |

Fields

- name :: Solver

  The solver in use

- executable :: String

  The path to its executable

- options :: SMTConfig -> [String]

  Options to provide to the solver

- engine :: SMTEngine

  The solver engine, responsible for interpreting solver output

- capabilities :: SolverCapabilities

  Various capabilities of the solver

## Controlling verbosity

SBV provides various levels of verbosity to aid in debugging, by using the `SMTConfig` fields:

- [`verbose`] Print on stdout a shortened account of what is sent/received. This is specifically trimmed to reduce noise and is good for quick debugging. The output is not supposed to be machine-readable.
- [`redirectVerbose`] Send the verbose output to a file. Note that you still have to set `verbose=True` for redirection to take effect. Otherwise, the output is the same as what you would see in `verbose`.
- [`transcript`] Produce a file that is valid SMTLib2 format, containing everything sent and received. In particular, one can directly feed this file to the SMT-solver outside of the SBV since it is machine-readable. This is good for offline analysis situations, where you want to have a full account of what happened. For instance, it will print time-stamps at every interaction point, so you can see how long each command took.

## Solvers

boolector :: SMTConfig Source #

Default configuration for the Boolector SMT solver

cvc4 :: SMTConfig Source #

Default configuration for the CVC4 SMT Solver.

yices :: SMTConfig Source #

Default configuration for the Yices SMT Solver.

z3 :: SMTConfig Source #

Default configuration for the Z3 SMT solver

mathSAT :: SMTConfig Source #

Default configuration for the MathSAT SMT solver

abc :: SMTConfig Source #

Default configuration for the ABC synthesis and verification tool.

## Configurations

defaultSolverConfig :: Solver -> SMTConfig Source #

The default configs corresponding to supported SMT solvers

defaultSMTCfg :: SMTConfig Source #

The default solver used by SBV. This is currently set to z3.

sbvCheckSolverInstallation :: SMTConfig -> IO Bool Source #

Check whether the given solver is installed and is ready to go. This call does a simple call to the solver to ensure all is well.

sbvAvailableSolvers :: IO [SMTConfig] Source #

Return the known available solver configs, installed on your machine.

setLogic :: SolverContext m => Logic -> m () Source #

Set the logic.

data Logic Source #

SMT-Lib logics. If left unspecified SBV will pick the logic based on what it determines is needed. However, the user can override this choice using a call to `setLogic` This is especially handy if one is experimenting with custom logics that might be supported on new solvers. See http://smtlib.cs.uiowa.edu/logics.shtml for the official list.

Constructors

AUFLIA | Formulas over the theory of linear integer arithmetic and arrays extended with free sort and function symbols but restricted to arrays with integer indices and values.
AUFLIRA | Linear formulas with free sort and function symbols over one- and two-dimentional arrays of integer index and real value.
AUFNIRA | Formulas with free function and predicate symbols over a theory of arrays of arrays of integer index and real value.
LRA | Linear formulas in linear real arithmetic.
QF_ABV | Quantifier-free formulas over the theory of bitvectors and bitvector arrays.
QF_AUFBV | Quantifier-free formulas over the theory of bitvectors and bitvector arrays extended with free sort and function symbols.
QF_AUFLIA | Quantifier-free linear formulas over the theory of integer arrays extended with free sort and function symbols.
QF_AX | Quantifier-free formulas over the theory of arrays with extensionality.
QF_BV | Quantifier-free formulas over the theory of fixed-size bitvectors.
QF_IDL | Difference Logic over the integers. Boolean combinations of inequations of the form x - y < b where x and y are integer variables and b is an integer constant.
QF_LIA | Unquantified linear integer arithmetic. In essence, Boolean combinations of inequations between linear polynomials over integer variables.
QF_LRA | Unquantified linear real arithmetic. In essence, Boolean combinations of inequations between linear polynomials over real variables.
QF_NIA | Quantifier-free integer arithmetic.
QF_NRA | Quantifier-free real arithmetic.
QF_RDL | Difference Logic over the reals. In essence, Boolean combinations of inequations of the form x - y < b where x and y are real variables and b is a rational constant.
QF_UF | Unquantified formulas built over a signature of uninterpreted (i.e., free) sort and function symbols.
QF_UFBV | Unquantified formulas over bitvectors with uninterpreted sort function and symbols.
QF_UFIDL | Difference Logic over the integers (in essence) but with uninterpreted sort and function symbols.
QF_UFLIA | Unquantified linear integer arithmetic with uninterpreted sort and function symbols.
QF_UFLRA | Unquantified linear real arithmetic with uninterpreted sort and function symbols.
QF_UFNRA | Unquantified non-linear real arithmetic with uninterpreted sort and function symbols.
QF_UFNIRA | Unquantified non-linear real integer arithmetic with uninterpreted sort and function symbols.
UFLRA | Linear real arithmetic with uninterpreted sort and function symbols.
UFNIA | Non-linear integer arithmetic with uninterpreted sort and function symbols.
QF_FPBV | Quantifier-free formulas over the theory of floating point numbers, arrays, and bit-vectors.
QF_FP | Quantifier-free formulas over the theory of floating point numbers.
QF_FD | Quantifier-free finite domains.
QF_S | Quantifier-free formulas over the theory of strings.
Logic_ALL | The catch-all value.
Logic_NONE | Use this value when you want SBV to simply not set the logic.
CustomLogic String | In case you need a really custom string!

Instances

Show Logic Source # |
Instance details Defined in Data.SBV.Control.Types Methods showsPrec :: Int -> Logic -> ShowS Source # show :: Logic -> String Source # showList :: [Logic] -> ShowS Source #
Generic Logic Source # |
Instance details Defined in Data.SBV.Control.Types Associated Types type Rep Logic :: Type -> Type Source # Methods from :: Logic -> Rep Logic x Source # to :: Rep Logic x -> Logic Source #
NFData Logic Source # |
Instance details Defined in Data.SBV.Control.Types Methods rnf :: Logic -> () Source #
GShow Logic Source # |
Instance details Defined in Data.SBV.Control.Types Methods gshowsPrec :: Int -> Logic -> ShowS Source # gshows :: Logic -> ShowS Source # gshow :: Logic -> String Source # gshowList :: [Logic] -> ShowS Source #
type Rep Logic Source # |

Instance details

Defined in Data.SBV.Control.Types

type Rep Logic = D1 (MetaData "Logic" "Data.SBV.Control.Types" "sbv-7.13-G8ZmOEcTGWs4ZWy733U7C5" False) ((((C1 (MetaCons "AUFLIA" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "AUFLIRA" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "AUFNIRA" PrefixI False) (U1 :: Type -> Type))) :+: ((C1 (MetaCons "LRA" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "QF_ABV" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "QF_AUFBV" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "QF_AUFLIA" PrefixI False) (U1 :: Type -> Type)))) :+: (((C1 (MetaCons "QF_AX" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "QF_BV" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "QF_IDL" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "QF_LIA" PrefixI False) (U1 :: Type -> Type))) :+: ((C1 (MetaCons "QF_LRA" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "QF_NIA" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "QF_NRA" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "QF_RDL" PrefixI False) (U1 :: Type -> Type))))) :+: ((((C1 (MetaCons "QF_UF" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "QF_UFBV" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "QF_UFIDL" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "QF_UFLIA" PrefixI False) (U1 :: Type -> Type))) :+: ((C1 (MetaCons "QF_UFLRA" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "QF_UFNRA" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "QF_UFNIRA" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "UFLRA" PrefixI False) (U1 :: Type -> Type)))) :+: (((C1 (MetaCons "UFNIA" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "QF_FPBV" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "QF_FP" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "QF_FD" PrefixI False) (U1 :: Type -> Type))) :+: ((C1 (MetaCons "QF_S" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Logic_ALL" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "Logic_NONE" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "CustomLogic" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)))))))

setOption :: SolverContext m => SMTOption -> m () Source #

Set an option.

setInfo :: SolverContext m => String -> [String] -> m () Source #

Set info. Example: `setInfo ":status" ["unsat"]`.

setTimeOut :: SolverContext m => Integer -> m () Source #

Set a solver time-out value, in milli-seconds. This function essentially translates to the SMTLib call `(set-info :timeout val)`, and your backend solver may or may not support it! The amount given is in milliseconds. Also see the function `timeOut` for finer level control of time-outs, directly from SBV.

## SBV exceptions

data SBVException Source #

An exception thrown from SBV. If the solver ever responds with a non-success value for a command, SBV will throw an `SBVException`, it so the user can process it as required. The provided `Show` instance will render the failure nicely. Note that if you ever catch this exception, the solver is no longer alive: You should either -- throw the exception up, or do other proper clean-up before continuing.

Constructors

SBVException |

Fields

- sbvExceptionDescription :: String
- sbvExceptionSent :: Maybe String
- sbvExceptionExpected :: Maybe String
- sbvExceptionReceived :: Maybe String
- sbvExceptionStdOut :: Maybe String
- sbvExceptionStdErr :: Maybe String
- sbvExceptionExitCode :: Maybe ExitCode
- sbvExceptionConfig :: SMTConfig
- sbvExceptionReason :: Maybe [String]
- sbvExceptionHint :: Maybe [String]

Instances

Show SBVException Source # | A fairly nice rendering of the exception, for display purposes.
Instance details Defined in Data.SBV.SMT.Utils Methods showsPrec :: Int -> SBVException -> ShowS Source # show :: SBVException -> String Source # showList :: [SBVException] -> ShowS Source #
Exception SBVException Source # | SBVExceptions are throwable. A simple "show" will render this exception nicely though of course you can inspect the individual fields as necessary.
Instance details Defined in Data.SBV.SMT.Utils Methods toException :: SBVException -> SomeException Source # fromException :: SomeException -> Maybe SBVException Source # displayException :: SBVException -> String Source #

# Abstract SBV type

data SBV a Source #

The Symbolic value. The parameter `a` is phantom, but is extremely important in keeping the user interface strongly typed.

Instances

IsString SString Source # |
Instance details Defined in Data.SBV.Core.Model Methods fromString :: String -> SString Source #
Testable SBool Source # |
Instance details Defined in Data.SBV.Core.Model Methods property :: SBool -> Property Source #
Boolean SBool Source # |

Instance details

Defined in Data.SBV.Core.Data

Methods

true :: SBool Source #

false :: SBool Source #

bnot :: SBool -> SBool Source #

(&&&) :: SBool -> SBool -> SBool Source #

(|||) :: SBool -> SBool -> SBool Source #

(~&) :: SBool -> SBool -> SBool Source #

(~|) :: SBool -> SBool -> SBool Source #

(<+>) :: SBool -> SBool -> SBool Source #

(==>) :: SBool -> SBool -> SBool Source #

(<=>) :: SBool -> SBool -> SBool Source #

fromBool :: Bool -> SBool Source #

Provable SBool Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: SBool -> Predicate Source #

forAll :: [String] -> SBool -> Predicate Source #

forSome_ :: SBool -> Predicate Source #

forSome :: [String] -> SBool -> Predicate Source #

prove :: SBool -> IO ThmResult Source #

proveWith :: SMTConfig -> SBool -> IO ThmResult Source #

sat :: SBool -> IO SatResult Source #

satWith :: SMTConfig -> SBool -> IO SatResult Source #

allSat :: SBool -> IO AllSatResult Source #

allSatWith :: SMTConfig -> SBool -> IO AllSatResult Source #

optimize :: OptimizeStyle -> SBool -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> SBool -> IO OptimizeResult Source #

isVacuous :: SBool -> IO Bool Source #

isVacuousWith :: SMTConfig -> SBool -> IO Bool Source #

isTheorem :: SBool -> IO Bool Source #

isTheoremWith :: SMTConfig -> SBool -> IO Bool Source #

isSatisfiable :: SBool -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> SBool -> IO Bool Source #

proveWithAll :: [SMTConfig] -> SBool -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> SBool -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> SBool -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> SBool -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> SBool -> IO String Source #

Provable Predicate Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: Predicate -> Predicate Source #

forAll :: [String] -> Predicate -> Predicate Source #

forSome_ :: Predicate -> Predicate Source #

forSome :: [String] -> Predicate -> Predicate Source #

prove :: Predicate -> IO ThmResult Source #

proveWith :: SMTConfig -> Predicate -> IO ThmResult Source #

sat :: Predicate -> IO SatResult Source #

satWith :: SMTConfig -> Predicate -> IO SatResult Source #

allSat :: Predicate -> IO AllSatResult Source #

allSatWith :: SMTConfig -> Predicate -> IO AllSatResult Source #

optimize :: OptimizeStyle -> Predicate -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> Predicate -> IO OptimizeResult Source #

isVacuous :: Predicate -> IO Bool Source #

isVacuousWith :: SMTConfig -> Predicate -> IO Bool Source #

isTheorem :: Predicate -> IO Bool Source #

isTheoremWith :: SMTConfig -> Predicate -> IO Bool Source #

isSatisfiable :: Predicate -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> Predicate -> IO Bool Source #

proveWithAll :: [SMTConfig] -> Predicate -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> Predicate -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> Predicate -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> Predicate -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> Predicate -> IO String Source #

Metric SReal Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SReal -> Symbolic () Source # maximize :: String -> SReal -> Symbolic () Source #
Metric SInteger Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SInteger -> Symbolic () Source # maximize :: String -> SInteger -> Symbolic () Source #
Metric SInt64 Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SInt64 -> Symbolic () Source # maximize :: String -> SInt64 -> Symbolic () Source #
Metric SInt32 Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SInt32 -> Symbolic () Source # maximize :: String -> SInt32 -> Symbolic () Source #
Metric SInt16 Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SInt16 -> Symbolic () Source # maximize :: String -> SInt16 -> Symbolic () Source #
Metric SInt8 Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SInt8 -> Symbolic () Source # maximize :: String -> SInt8 -> Symbolic () Source #
Metric SWord64 Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SWord64 -> Symbolic () Source # maximize :: String -> SWord64 -> Symbolic () Source #
Metric SWord32 Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SWord32 -> Symbolic () Source # maximize :: String -> SWord32 -> Symbolic () Source #
Metric SWord16 Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SWord16 -> Symbolic () Source # maximize :: String -> SWord16 -> Symbolic () Source #
Metric SWord8 Source # |
Instance details Defined in Data.SBV.Core.Model Methods minimize :: String -> SWord8 -> Symbolic () Source # maximize :: String -> SWord8 -> Symbolic () Source #
SDivisible SInteger Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: SInteger -> SInteger -> (SInteger, SInteger) Source # sDivMod :: SInteger -> SInteger -> (SInteger, SInteger) Source # sQuot :: SInteger -> SInteger -> SInteger Source # sRem :: SInteger -> SInteger -> SInteger Source # sDiv :: SInteger -> SInteger -> SInteger Source # sMod :: SInteger -> SInteger -> SInteger Source #
SDivisible SInt64 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: SInt64 -> SInt64 -> (SInt64, SInt64) Source # sDivMod :: SInt64 -> SInt64 -> (SInt64, SInt64) Source # sQuot :: SInt64 -> SInt64 -> SInt64 Source # sRem :: SInt64 -> SInt64 -> SInt64 Source # sDiv :: SInt64 -> SInt64 -> SInt64 Source # sMod :: SInt64 -> SInt64 -> SInt64 Source #
SDivisible SInt32 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: SInt32 -> SInt32 -> (SInt32, SInt32) Source # sDivMod :: SInt32 -> SInt32 -> (SInt32, SInt32) Source # sQuot :: SInt32 -> SInt32 -> SInt32 Source # sRem :: SInt32 -> SInt32 -> SInt32 Source # sDiv :: SInt32 -> SInt32 -> SInt32 Source # sMod :: SInt32 -> SInt32 -> SInt32 Source #
SDivisible SInt16 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: SInt16 -> SInt16 -> (SInt16, SInt16) Source # sDivMod :: SInt16 -> SInt16 -> (SInt16, SInt16) Source # sQuot :: SInt16 -> SInt16 -> SInt16 Source # sRem :: SInt16 -> SInt16 -> SInt16 Source # sDiv :: SInt16 -> SInt16 -> SInt16 Source # sMod :: SInt16 -> SInt16 -> SInt16 Source #
SDivisible SInt8 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: SInt8 -> SInt8 -> (SInt8, SInt8) Source # sDivMod :: SInt8 -> SInt8 -> (SInt8, SInt8) Source # sQuot :: SInt8 -> SInt8 -> SInt8 Source # sRem :: SInt8 -> SInt8 -> SInt8 Source # sDiv :: SInt8 -> SInt8 -> SInt8 Source # sMod :: SInt8 -> SInt8 -> SInt8 Source #
SDivisible SWord64 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: SWord64 -> SWord64 -> (SWord64, SWord64) Source # sDivMod :: SWord64 -> SWord64 -> (SWord64, SWord64) Source # sQuot :: SWord64 -> SWord64 -> SWord64 Source # sRem :: SWord64 -> SWord64 -> SWord64 Source # sDiv :: SWord64 -> SWord64 -> SWord64 Source # sMod :: SWord64 -> SWord64 -> SWord64 Source #
SDivisible SWord32 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: SWord32 -> SWord32 -> (SWord32, SWord32) Source # sDivMod :: SWord32 -> SWord32 -> (SWord32, SWord32) Source # sQuot :: SWord32 -> SWord32 -> SWord32 Source # sRem :: SWord32 -> SWord32 -> SWord32 Source # sDiv :: SWord32 -> SWord32 -> SWord32 Source # sMod :: SWord32 -> SWord32 -> SWord32 Source #
SDivisible SWord16 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: SWord16 -> SWord16 -> (SWord16, SWord16) Source # sDivMod :: SWord16 -> SWord16 -> (SWord16, SWord16) Source # sQuot :: SWord16 -> SWord16 -> SWord16 Source # sRem :: SWord16 -> SWord16 -> SWord16 Source # sDiv :: SWord16 -> SWord16 -> SWord16 Source # sMod :: SWord16 -> SWord16 -> SWord16 Source #
SDivisible SWord8 Source # |
Instance details Defined in Data.SBV.Core.Model Methods sQuotRem :: SWord8 -> SWord8 -> (SWord8, SWord8) Source # sDivMod :: SWord8 -> SWord8 -> (SWord8, SWord8) Source # sQuot :: SWord8 -> SWord8 -> SWord8 Source # sRem :: SWord8 -> SWord8 -> SWord8 Source # sDiv :: SWord8 -> SWord8 -> SWord8 Source # sMod :: SWord8 -> SWord8 -> SWord8 Source #
SDivisible SWord4 Source # | SDvisible instance, using default methods
Instance details Defined in Documentation.SBV.Examples.Misc.Word4 Methods sQuotRem :: SWord4 -> SWord4 -> (SWord4, SWord4) Source # sDivMod :: SWord4 -> SWord4 -> (SWord4, SWord4) Source # sQuot :: SWord4 -> SWord4 -> SWord4 Source # sRem :: SWord4 -> SWord4 -> SWord4 Source # sDiv :: SWord4 -> SWord4 -> SWord4 Source # sMod :: SWord4 -> SWord4 -> SWord4 Source #
Polynomial SWord64 Source # |

Instance details

Defined in Data.SBV.Tools.Polynomial

Methods

polynomial :: [Int] -> SWord64 Source #

pAdd :: SWord64 -> SWord64 -> SWord64 Source #

pMult :: (SWord64, SWord64, [Int]) -> SWord64 Source #

pDiv :: SWord64 -> SWord64 -> SWord64 Source #

pMod :: SWord64 -> SWord64 -> SWord64 Source #

pDivMod :: SWord64 -> SWord64 -> (SWord64, SWord64) Source #

showPoly :: SWord64 -> String Source #

showPolynomial :: Bool -> SWord64 -> String Source #

Polynomial SWord32 Source # |

Instance details

Defined in Data.SBV.Tools.Polynomial

Methods

polynomial :: [Int] -> SWord32 Source #

pAdd :: SWord32 -> SWord32 -> SWord32 Source #

pMult :: (SWord32, SWord32, [Int]) -> SWord32 Source #

pDiv :: SWord32 -> SWord32 -> SWord32 Source #

pMod :: SWord32 -> SWord32 -> SWord32 Source #

pDivMod :: SWord32 -> SWord32 -> (SWord32, SWord32) Source #

showPoly :: SWord32 -> String Source #

showPolynomial :: Bool -> SWord32 -> String Source #

Polynomial SWord16 Source # |

Instance details

Defined in Data.SBV.Tools.Polynomial

Methods

polynomial :: [Int] -> SWord16 Source #

pAdd :: SWord16 -> SWord16 -> SWord16 Source #

pMult :: (SWord16, SWord16, [Int]) -> SWord16 Source #

pDiv :: SWord16 -> SWord16 -> SWord16 Source #

pMod :: SWord16 -> SWord16 -> SWord16 Source #

pDivMod :: SWord16 -> SWord16 -> (SWord16, SWord16) Source #

showPoly :: SWord16 -> String Source #

showPolynomial :: Bool -> SWord16 -> String Source #

Polynomial SWord8 Source # |

Instance details

Defined in Data.SBV.Tools.Polynomial

Methods

polynomial :: [Int] -> SWord8 Source #

pAdd :: SWord8 -> SWord8 -> SWord8 Source #

pMult :: (SWord8, SWord8, [Int]) -> SWord8 Source #

pDiv :: SWord8 -> SWord8 -> SWord8 Source #

pMod :: SWord8 -> SWord8 -> SWord8 Source #

pDivMod :: SWord8 -> SWord8 -> (SWord8, SWord8) Source #

showPoly :: SWord8 -> String Source #

showPolynomial :: Bool -> SWord8 -> String Source #

ArithOverflow SInt64 Source # |
Instance details Defined in Data.SBV.Tools.Overflow Methods bvAddO :: SInt64 -> SInt64 -> (SBool, SBool) Source # bvSubO :: SInt64 -> SInt64 -> (SBool, SBool) Source # bvMulO :: SInt64 -> SInt64 -> (SBool, SBool) Source # bvMulOFast :: SInt64 -> SInt64 -> (SBool, SBool) Source # bvDivO :: SInt64 -> SInt64 -> (SBool, SBool) Source # bvNegO :: SInt64 -> (SBool, SBool) Source #
ArithOverflow SInt32 Source # |
Instance details Defined in Data.SBV.Tools.Overflow Methods bvAddO :: SInt32 -> SInt32 -> (SBool, SBool) Source # bvSubO :: SInt32 -> SInt32 -> (SBool, SBool) Source # bvMulO :: SInt32 -> SInt32 -> (SBool, SBool) Source # bvMulOFast :: SInt32 -> SInt32 -> (SBool, SBool) Source # bvDivO :: SInt32 -> SInt32 -> (SBool, SBool) Source # bvNegO :: SInt32 -> (SBool, SBool) Source #
ArithOverflow SInt16 Source # |
Instance details Defined in Data.SBV.Tools.Overflow Methods bvAddO :: SInt16 -> SInt16 -> (SBool, SBool) Source # bvSubO :: SInt16 -> SInt16 -> (SBool, SBool) Source # bvMulO :: SInt16 -> SInt16 -> (SBool, SBool) Source # bvMulOFast :: SInt16 -> SInt16 -> (SBool, SBool) Source # bvDivO :: SInt16 -> SInt16 -> (SBool, SBool) Source # bvNegO :: SInt16 -> (SBool, SBool) Source #
ArithOverflow SInt8 Source # |
Instance details Defined in Data.SBV.Tools.Overflow Methods bvAddO :: SInt8 -> SInt8 -> (SBool, SBool) Source # bvSubO :: SInt8 -> SInt8 -> (SBool, SBool) Source # bvMulO :: SInt8 -> SInt8 -> (SBool, SBool) Source # bvMulOFast :: SInt8 -> SInt8 -> (SBool, SBool) Source # bvDivO :: SInt8 -> SInt8 -> (SBool, SBool) Source # bvNegO :: SInt8 -> (SBool, SBool) Source #
ArithOverflow SWord64 Source # |
Instance details Defined in Data.SBV.Tools.Overflow Methods bvAddO :: SWord64 -> SWord64 -> (SBool, SBool) Source # bvSubO :: SWord64 -> SWord64 -> (SBool, SBool) Source # bvMulO :: SWord64 -> SWord64 -> (SBool, SBool) Source # bvMulOFast :: SWord64 -> SWord64 -> (SBool, SBool) Source # bvDivO :: SWord64 -> SWord64 -> (SBool, SBool) Source # bvNegO :: SWord64 -> (SBool, SBool) Source #
ArithOverflow SWord32 Source # |
Instance details Defined in Data.SBV.Tools.Overflow Methods bvAddO :: SWord32 -> SWord32 -> (SBool, SBool) Source # bvSubO :: SWord32 -> SWord32 -> (SBool, SBool) Source # bvMulO :: SWord32 -> SWord32 -> (SBool, SBool) Source # bvMulOFast :: SWord32 -> SWord32 -> (SBool, SBool) Source # bvDivO :: SWord32 -> SWord32 -> (SBool, SBool) Source # bvNegO :: SWord32 -> (SBool, SBool) Source #
ArithOverflow SWord16 Source # |
Instance details Defined in Data.SBV.Tools.Overflow Methods bvAddO :: SWord16 -> SWord16 -> (SBool, SBool) Source # bvSubO :: SWord16 -> SWord16 -> (SBool, SBool) Source # bvMulO :: SWord16 -> SWord16 -> (SBool, SBool) Source # bvMulOFast :: SWord16 -> SWord16 -> (SBool, SBool) Source # bvDivO :: SWord16 -> SWord16 -> (SBool, SBool) Source # bvNegO :: SWord16 -> (SBool, SBool) Source #
ArithOverflow SWord8 Source # |
Instance details Defined in Data.SBV.Tools.Overflow Methods bvAddO :: SWord8 -> SWord8 -> (SBool, SBool) Source # bvSubO :: SWord8 -> SWord8 -> (SBool, SBool) Source # bvMulO :: SWord8 -> SWord8 -> (SBool, SBool) Source # bvMulOFast :: SWord8 -> SWord8 -> (SBool, SBool) Source # bvDivO :: SWord8 -> SWord8 -> (SBool, SBool) Source # bvNegO :: SWord8 -> (SBool, SBool) Source #
RegExpMatchable SString Source # | Matching symbolic strings.
Instance details Defined in Data.SBV.RegExp Methods match :: SString -> RegExp -> SBool Source #
RegExpMatchable SChar Source # | Matching a character simply means the singleton string matches the regex.
Instance details Defined in Data.SBV.RegExp Methods match :: SChar -> RegExp -> SBool Source #
Splittable SWord64 SWord32 Source # |
Instance details Defined in Data.SBV.Core.Splittable Methods split :: SWord64 -> (SWord32, SWord32) Source # (#) :: SWord32 -> SWord32 -> SWord64 Source # extend :: SWord32 -> SWord64 Source #
Splittable SWord32 SWord16 Source # |
Instance details Defined in Data.SBV.Core.Splittable Methods split :: SWord32 -> (SWord16, SWord16) Source # (#) :: SWord16 -> SWord16 -> SWord32 Source # extend :: SWord16 -> SWord32 Source #
Splittable SWord16 SWord8 Source # |
Instance details Defined in Data.SBV.Core.Splittable Methods split :: SWord16 -> (SWord8, SWord8) Source # (#) :: SWord8 -> SWord8 -> SWord16 Source # extend :: SWord8 -> SWord16 Source #
SymWord [a] => IsList (SList a) Source # | IsList instance allows list literals to be written compactly.
Instance details Defined in Data.SBV.Core.Data Associated Types type Item (SList a) :: Type Source # Methods fromList :: [Item (SList a)] -> SList a Source # fromListN :: Int -> [Item (SList a)] -> SList a Source # toList :: SList a -> [Item (SList a)] Source #
(SymWord a, Bounded a) => Bounded (SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods minBound :: SBV a Source # maxBound :: SBV a Source #
(Show a, Bounded a, Integral a, Num a, SymWord a) => Enum (SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods succ :: SBV a -> SBV a Source # pred :: SBV a -> SBV a Source # toEnum :: Int -> SBV a Source # fromEnum :: SBV a -> Int Source # enumFrom :: SBV a -> [SBV a] Source # enumFromThen :: SBV a -> SBV a -> [SBV a] Source # enumFromTo :: SBV a -> SBV a -> [SBV a] Source # enumFromThenTo :: SBV a -> SBV a -> SBV a -> [SBV a] Source #
Eq (SBV a) Source # | This instance is only defined so that we can define an instance for `Bits`. `==` and `/=` simply throw an error. Use `EqSymbolic` instead.
Instance details Defined in Data.SBV.Core.Data Methods (==) :: SBV a -> SBV a -> Bool Source # (/=) :: SBV a -> SBV a -> Bool Source #
(SymWord a, Fractional a, Floating a) => Floating (SBV a) Source # | Define Floating instance on SBV's; only for base types that are already floating; i.e., SFloat and SDouble Note that most of the fields are "undefined" for symbolic values, we add methods as they are supported by SMTLib. Currently, the only symbolicly available function in this class is sqrt.

Instance details

Defined in Data.SBV.Core.Model

Methods

pi :: SBV a Source #

exp :: SBV a -> SBV a Source #

log :: SBV a -> SBV a Source #

sqrt :: SBV a -> SBV a Source #

(**) :: SBV a -> SBV a -> SBV a Source #

logBase :: SBV a -> SBV a -> SBV a Source #

sin :: SBV a -> SBV a Source #

cos :: SBV a -> SBV a Source #

tan :: SBV a -> SBV a Source #

asin :: SBV a -> SBV a Source #

acos :: SBV a -> SBV a Source #

atan :: SBV a -> SBV a Source #

sinh :: SBV a -> SBV a Source #

cosh :: SBV a -> SBV a Source #

tanh :: SBV a -> SBV a Source #

asinh :: SBV a -> SBV a Source #

acosh :: SBV a -> SBV a Source #

atanh :: SBV a -> SBV a Source #

log1p :: SBV a -> SBV a Source #

expm1 :: SBV a -> SBV a Source #

log1pexp :: SBV a -> SBV a Source #

log1mexp :: SBV a -> SBV a Source #

(SymWord a, Fractional a) => Fractional (SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods (/) :: SBV a -> SBV a -> SBV a Source # recip :: SBV a -> SBV a Source # fromRational :: Rational -> SBV a Source #
(Ord a, Num a, SymWord a) => Num (SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods (+) :: SBV a -> SBV a -> SBV a Source # (-) :: SBV a -> SBV a -> SBV a Source # (*) :: SBV a -> SBV a -> SBV a Source # negate :: SBV a -> SBV a Source # abs :: SBV a -> SBV a Source # signum :: SBV a -> SBV a Source # fromInteger :: Integer -> SBV a Source #
Show (SBV a) Source # | A `Show` instance is not particularly "desirable," when the value is symbolic, but we do need this instance as otherwise we cannot simply evaluate Haskell functions that return symbolic values and have their constant values printed easily!
Instance details Defined in Data.SBV.Core.Data Methods showsPrec :: Int -> SBV a -> ShowS Source # show :: SBV a -> String Source # showList :: [SBV a] -> ShowS Source #
Generic (SBV a) Source # |
Instance details Defined in Data.SBV.Core.Data Associated Types type Rep (SBV a) :: Type -> Type Source # Methods from :: SBV a -> Rep (SBV a) x Source # to :: Rep (SBV a) x -> SBV a Source #
Testable (Symbolic SBool) Source # |
Instance details Defined in Data.SBV.Core.Model Methods property :: Symbolic SBool -> Property Source #
(SymWord a, Arbitrary a) => Arbitrary (SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods arbitrary :: Gen (SBV a) Source # shrink :: SBV a -> [SBV a] Source #
(Num a, Bits a, SymWord a) => Bits (SBV a) Source # | Using `popCount` or `testBit` on non-concrete values will result in an error. Use `sPopCount` or `sTestBit` instead.

Instance details

Defined in Data.SBV.Core.Model

Methods

(.&.) :: SBV a -> SBV a -> SBV a Source #

(.|.) :: SBV a -> SBV a -> SBV a Source #

xor :: SBV a -> SBV a -> SBV a Source #

complement :: SBV a -> SBV a Source #

shift :: SBV a -> Int -> SBV a Source #

rotate :: SBV a -> Int -> SBV a Source #

zeroBits :: SBV a Source #

bit :: Int -> SBV a Source #

setBit :: SBV a -> Int -> SBV a Source #

clearBit :: SBV a -> Int -> SBV a Source #

complementBit :: SBV a -> Int -> SBV a Source #

testBit :: SBV a -> Int -> Bool Source #

bitSizeMaybe :: SBV a -> Maybe Int Source #

bitSize :: SBV a -> Int Source #

isSigned :: SBV a -> Bool Source #

shiftL :: SBV a -> Int -> SBV a Source #

unsafeShiftL :: SBV a -> Int -> SBV a Source #

shiftR :: SBV a -> Int -> SBV a Source #

unsafeShiftR :: SBV a -> Int -> SBV a Source #

rotateL :: SBV a -> Int -> SBV a Source #

rotateR :: SBV a -> Int -> SBV a Source #

popCount :: SBV a -> Int Source #

NFData (SBV a) Source # |
Instance details Defined in Data.SBV.Core.Data Methods rnf :: SBV a -> () Source #
(Random a, SymWord a) => Random (SBV a) Source # |
Instance details Defined in Data.SBV.Core.Data Methods randomR :: RandomGen g => (SBV a, SBV a) -> g -> (SBV a, g) Source # random :: RandomGen g => g -> (SBV a, g) Source # randomRs :: RandomGen g => (SBV a, SBV a) -> g -> [SBV a] Source # randoms :: RandomGen g => g -> [SBV a] Source # randomRIO :: (SBV a, SBV a) -> IO (SBV a) Source # randomIO :: IO (SBV a) Source #
HasKind (SBV a) Source # |

Instance details

Defined in Data.SBV.Core.Data

Methods

kindOf :: SBV a -> Kind Source #

hasSign :: SBV a -> Bool Source #

intSizeOf :: SBV a -> Int Source #

isBoolean :: SBV a -> Bool Source #

isBounded :: SBV a -> Bool Source #

isReal :: SBV a -> Bool Source #

isFloat :: SBV a -> Bool Source #

isDouble :: SBV a -> Bool Source #

isInteger :: SBV a -> Bool Source #

isUninterpreted :: SBV a -> Bool Source #

isChar :: SBV a -> Bool Source #

isString :: SBV a -> Bool Source #

isList :: SBV a -> Bool Source #

showType :: SBV a -> String Source #

Outputtable (SBV a) Source # |
Instance details Defined in Data.SBV.Core.Data Methods output :: SBV a -> Symbolic (SBV a) Source #
(SymWord a, PrettyNum a) => PrettyNum (SBV a) Source # |
Instance details Defined in Data.SBV.Utils.PrettyNum Methods hexS :: SBV a -> String Source # binS :: SBV a -> String Source # hex :: SBV a -> String Source # bin :: SBV a -> String Source #
SExecutable [SBV a] Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: [SBV a] -> Symbolic () Source # sName :: [String] -> [SBV a] -> Symbolic () Source # safe :: [SBV a] -> IO [SafeResult] Source # safeWith :: SMTConfig -> [SBV a] -> IO [SafeResult] Source #
SExecutable (SBV a) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: SBV a -> Symbolic () Source # sName :: [String] -> SBV a -> Symbolic () Source # safe :: SBV a -> IO [SafeResult] Source # safeWith :: SMTConfig -> SBV a -> IO [SafeResult] Source #
HasKind a => Uninterpreted (SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods uninterpret :: String -> SBV a Source # cgUninterpret :: String -> [String] -> SBV a -> SBV a Source # sbvUninterpret :: Maybe ([String], SBV a) -> String -> SBV a Source #
SymWord a => Mergeable (SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods symbolicMerge :: Bool -> SBool -> SBV a -> SBV a -> SBV a Source # select :: (SymWord b, Num b) => [SBV a] -> SBV a -> SBV b -> SBV a Source #
SymWord a => OrdSymbolic (SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.<) :: SBV a -> SBV a -> SBool Source # (.<=) :: SBV a -> SBV a -> SBool Source # (.>) :: SBV a -> SBV a -> SBool Source # (.>=) :: SBV a -> SBV a -> SBool Source # smin :: SBV a -> SBV a -> SBV a Source # smax :: SBV a -> SBV a -> SBV a Source # inRange :: SBV a -> (SBV a, SBV a) -> SBool Source #
EqSymbolic (SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods (.==) :: SBV a -> SBV a -> SBool Source # (./=) :: SBV a -> SBV a -> SBool Source # distinct :: [SBV a] -> SBool Source # allEqual :: [SBV a] -> SBool Source # sElem :: SBV a -> [SBV a] -> SBool Source #
(SymWord a, SymWord b, SExecutable p) => SExecutable ((SBV a, SBV b) -> p) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: ((SBV a, SBV b) -> p) -> Symbolic () Source # sName :: [String] -> ((SBV a, SBV b) -> p) -> Symbolic () Source # safe :: ((SBV a, SBV b) -> p) -> IO [SafeResult] Source # safeWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> IO [SafeResult] Source #
(SymWord a, SymWord b, SymWord c, SExecutable p) => SExecutable ((SBV a, SBV b, SBV c) -> p) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: ((SBV a, SBV b, SBV c) -> p) -> Symbolic () Source # sName :: [String] -> ((SBV a, SBV b, SBV c) -> p) -> Symbolic () Source # safe :: ((SBV a, SBV b, SBV c) -> p) -> IO [SafeResult] Source # safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> IO [SafeResult] Source #
(SymWord a, SymWord b, SymWord c, SymWord d, SExecutable p) => SExecutable ((SBV a, SBV b, SBV c, SBV d) -> p) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> Symbolic () Source # sName :: [String] -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> Symbolic () Source # safe :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO [SafeResult] Source # safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO [SafeResult] Source #
(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SExecutable p) => SExecutable ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> Symbolic () Source # sName :: [String] -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> Symbolic () Source # safe :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO [SafeResult] Source # safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO [SafeResult] Source #
(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, SExecutable p) => SExecutable ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName_ :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> Symbolic () Source #

sName :: [String] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> Symbolic () Source #

safe :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO [SafeResult] Source #

safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO [SafeResult] Source #

(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, SymWord g, SExecutable p) => SExecutable ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName_ :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> Symbolic () Source #

sName :: [String] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> Symbolic () Source #

safe :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO [SafeResult] Source #

safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO [SafeResult] Source #

(SymWord a, SExecutable p) => SExecutable (SBV a -> p) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: (SBV a -> p) -> Symbolic () Source # sName :: [String] -> (SBV a -> p) -> Symbolic () Source # safe :: (SBV a -> p) -> IO [SafeResult] Source # safeWith :: SMTConfig -> (SBV a -> p) -> IO [SafeResult] Source #
(NFData a, SymWord a, NFData b, SymWord b) => SExecutable (SBV a, SBV b) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: (SBV a, SBV b) -> Symbolic () Source # sName :: [String] -> (SBV a, SBV b) -> Symbolic () Source # safe :: (SBV a, SBV b) -> IO [SafeResult] Source # safeWith :: SMTConfig -> (SBV a, SBV b) -> IO [SafeResult] Source #
(SymWord a, SymWord b, Provable p) => Provable ((SBV a, SBV b) -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: ((SBV a, SBV b) -> p) -> Predicate Source #

forAll :: [String] -> ((SBV a, SBV b) -> p) -> Predicate Source #

forSome_ :: ((SBV a, SBV b) -> p) -> Predicate Source #

forSome :: [String] -> ((SBV a, SBV b) -> p) -> Predicate Source #

prove :: ((SBV a, SBV b) -> p) -> IO ThmResult Source #

proveWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> IO ThmResult Source #

sat :: ((SBV a, SBV b) -> p) -> IO SatResult Source #

satWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> IO SatResult Source #

allSat :: ((SBV a, SBV b) -> p) -> IO AllSatResult Source #

allSatWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> IO AllSatResult Source #

optimize :: OptimizeStyle -> ((SBV a, SBV b) -> p) -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> ((SBV a, SBV b) -> p) -> IO OptimizeResult Source #

isVacuous :: ((SBV a, SBV b) -> p) -> IO Bool Source #

isVacuousWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> IO Bool Source #

isTheorem :: ((SBV a, SBV b) -> p) -> IO Bool Source #

isTheoremWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> IO Bool Source #

isSatisfiable :: ((SBV a, SBV b) -> p) -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> IO Bool Source #

proveWithAll :: [SMTConfig] -> ((SBV a, SBV b) -> p) -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> ((SBV a, SBV b) -> p) -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> ((SBV a, SBV b) -> p) -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> ((SBV a, SBV b) -> p) -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> ((SBV a, SBV b) -> p) -> IO String Source #

(SymWord a, SymWord b, SymWord c, Provable p) => Provable ((SBV a, SBV b, SBV c) -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: ((SBV a, SBV b, SBV c) -> p) -> Predicate Source #

forAll :: [String] -> ((SBV a, SBV b, SBV c) -> p) -> Predicate Source #

forSome_ :: ((SBV a, SBV b, SBV c) -> p) -> Predicate Source #

forSome :: [String] -> ((SBV a, SBV b, SBV c) -> p) -> Predicate Source #

prove :: ((SBV a, SBV b, SBV c) -> p) -> IO ThmResult Source #

proveWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> IO ThmResult Source #

sat :: ((SBV a, SBV b, SBV c) -> p) -> IO SatResult Source #

satWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> IO SatResult Source #

allSat :: ((SBV a, SBV b, SBV c) -> p) -> IO AllSatResult Source #

allSatWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> IO AllSatResult Source #

optimize :: OptimizeStyle -> ((SBV a, SBV b, SBV c) -> p) -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> ((SBV a, SBV b, SBV c) -> p) -> IO OptimizeResult Source #

isVacuous :: ((SBV a, SBV b, SBV c) -> p) -> IO Bool Source #

isVacuousWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> IO Bool Source #

isTheorem :: ((SBV a, SBV b, SBV c) -> p) -> IO Bool Source #

isTheoremWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> IO Bool Source #

isSatisfiable :: ((SBV a, SBV b, SBV c) -> p) -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> IO Bool Source #

proveWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c) -> p) -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c) -> p) -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c) -> p) -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c) -> p) -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> ((SBV a, SBV b, SBV c) -> p) -> IO String Source #

(SymWord a, SymWord b, SymWord c, SymWord d, Provable p) => Provable ((SBV a, SBV b, SBV c, SBV d) -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> Predicate Source #

forAll :: [String] -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> Predicate Source #

forSome_ :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> Predicate Source #

forSome :: [String] -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> Predicate Source #

prove :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO ThmResult Source #

proveWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO ThmResult Source #

sat :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO SatResult Source #

satWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO SatResult Source #

allSat :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO AllSatResult Source #

allSatWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO AllSatResult Source #

optimize :: OptimizeStyle -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO OptimizeResult Source #

isVacuous :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO Bool Source #

isVacuousWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO Bool Source #

isTheorem :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO Bool Source #

isTheoremWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO Bool Source #

isSatisfiable :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO Bool Source #

proveWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> IO String Source #

(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, Provable p) => Provable ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> Predicate Source #

forAll :: [String] -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> Predicate Source #

forSome_ :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> Predicate Source #

forSome :: [String] -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> Predicate Source #

prove :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO ThmResult Source #

proveWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO ThmResult Source #

sat :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO SatResult Source #

satWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO SatResult Source #

allSat :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO AllSatResult Source #

allSatWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO AllSatResult Source #

optimize :: OptimizeStyle -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO OptimizeResult Source #

isVacuous :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO Bool Source #

isVacuousWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO Bool Source #

isTheorem :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO Bool Source #

isTheoremWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO Bool Source #

isSatisfiable :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO Bool Source #

proveWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> IO String Source #

(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, Provable p) => Provable ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> Predicate Source #

forAll :: [String] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> Predicate Source #

forSome_ :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> Predicate Source #

forSome :: [String] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> Predicate Source #

prove :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO ThmResult Source #

proveWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO ThmResult Source #

sat :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO SatResult Source #

satWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO SatResult Source #

allSat :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO AllSatResult Source #

allSatWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO AllSatResult Source #

optimize :: OptimizeStyle -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO OptimizeResult Source #

isVacuous :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO Bool Source #

isVacuousWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO Bool Source #

isTheorem :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO Bool Source #

isTheoremWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO Bool Source #

isSatisfiable :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO Bool Source #

proveWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> IO String Source #

(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, SymWord g, Provable p) => Provable ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> Predicate Source #

forAll :: [String] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> Predicate Source #

forSome_ :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> Predicate Source #

forSome :: [String] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> Predicate Source #

prove :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO ThmResult Source #

proveWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO ThmResult Source #

sat :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO SatResult Source #

satWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO SatResult Source #

allSat :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO AllSatResult Source #

allSatWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO AllSatResult Source #

optimize :: OptimizeStyle -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO OptimizeResult Source #

isVacuous :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO Bool Source #

isVacuousWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO Bool Source #

isTheorem :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO Bool Source #

isTheoremWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO Bool Source #

isSatisfiable :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO Bool Source #

proveWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> IO String Source #

(SymWord a, Provable p) => Provable (SBV a -> p) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: (SBV a -> p) -> Predicate Source #

forAll :: [String] -> (SBV a -> p) -> Predicate Source #

forSome_ :: (SBV a -> p) -> Predicate Source #

forSome :: [String] -> (SBV a -> p) -> Predicate Source #

prove :: (SBV a -> p) -> IO ThmResult Source #

proveWith :: SMTConfig -> (SBV a -> p) -> IO ThmResult Source #

sat :: (SBV a -> p) -> IO SatResult Source #

satWith :: SMTConfig -> (SBV a -> p) -> IO SatResult Source #

allSat :: (SBV a -> p) -> IO AllSatResult Source #

allSatWith :: SMTConfig -> (SBV a -> p) -> IO AllSatResult Source #

optimize :: OptimizeStyle -> (SBV a -> p) -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> (SBV a -> p) -> IO OptimizeResult Source #

isVacuous :: (SBV a -> p) -> IO Bool Source #

isVacuousWith :: SMTConfig -> (SBV a -> p) -> IO Bool Source #

isTheorem :: (SBV a -> p) -> IO Bool Source #

isTheoremWith :: SMTConfig -> (SBV a -> p) -> IO Bool Source #

isSatisfiable :: (SBV a -> p) -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> (SBV a -> p) -> IO Bool Source #

proveWithAll :: [SMTConfig] -> (SBV a -> p) -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> (SBV a -> p) -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> (SBV a -> p) -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> (SBV a -> p) -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> (SBV a -> p) -> IO String Source #

(SymWord c, SymWord b, HasKind a) => Uninterpreted ((SBV c, SBV b) -> SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods uninterpret :: String -> (SBV c, SBV b) -> SBV a Source # cgUninterpret :: String -> [String] -> ((SBV c, SBV b) -> SBV a) -> (SBV c, SBV b) -> SBV a Source # sbvUninterpret :: Maybe ([String], (SBV c, SBV b) -> SBV a) -> String -> (SBV c, SBV b) -> SBV a Source #
(SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted ((SBV d, SBV c, SBV b) -> SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods uninterpret :: String -> (SBV d, SBV c, SBV b) -> SBV a Source # cgUninterpret :: String -> [String] -> ((SBV d, SBV c, SBV b) -> SBV a) -> (SBV d, SBV c, SBV b) -> SBV a Source # sbvUninterpret :: Maybe ([String], (SBV d, SBV c, SBV b) -> SBV a) -> String -> (SBV d, SBV c, SBV b) -> SBV a Source #
(SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted ((SBV e, SBV d, SBV c, SBV b) -> SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods uninterpret :: String -> (SBV e, SBV d, SBV c, SBV b) -> SBV a Source # cgUninterpret :: String -> [String] -> ((SBV e, SBV d, SBV c, SBV b) -> SBV a) -> (SBV e, SBV d, SBV c, SBV b) -> SBV a Source # sbvUninterpret :: Maybe ([String], (SBV e, SBV d, SBV c, SBV b) -> SBV a) -> String -> (SBV e, SBV d, SBV c, SBV b) -> SBV a Source #
(SymWord f, SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted ((SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

uninterpret :: String -> (SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

cgUninterpret :: String -> [String] -> ((SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) -> (SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

sbvUninterpret :: Maybe ([String], (SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) -> String -> (SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

(SymWord g, SymWord f, SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted ((SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

uninterpret :: String -> (SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

cgUninterpret :: String -> [String] -> ((SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) -> (SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

sbvUninterpret :: Maybe ([String], (SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) -> String -> (SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

(SymWord h, SymWord g, SymWord f, SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted ((SBV h, SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

uninterpret :: String -> (SBV h, SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

cgUninterpret :: String -> [String] -> ((SBV h, SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) -> (SBV h, SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

sbvUninterpret :: Maybe ([String], (SBV h, SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) -> String -> (SBV h, SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

(SymWord h, SymWord g, SymWord f, SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted (SBV h -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

uninterpret :: String -> SBV h -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

cgUninterpret :: String -> [String] -> (SBV h -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> SBV h -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

sbvUninterpret :: Maybe ([String], SBV h -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> String -> SBV h -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

(SymWord g, SymWord f, SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted (SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

uninterpret :: String -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

cgUninterpret :: String -> [String] -> (SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

sbvUninterpret :: Maybe ([String], SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> String -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

(SymWord f, SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted (SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

uninterpret :: String -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

cgUninterpret :: String -> [String] -> (SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

sbvUninterpret :: Maybe ([String], SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> String -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

(SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted (SBV e -> SBV d -> SBV c -> SBV b -> SBV a) Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

uninterpret :: String -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

cgUninterpret :: String -> [String] -> (SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

sbvUninterpret :: Maybe ([String], SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> String -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

(SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted (SBV d -> SBV c -> SBV b -> SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods uninterpret :: String -> SBV d -> SBV c -> SBV b -> SBV a Source # cgUninterpret :: String -> [String] -> (SBV d -> SBV c -> SBV b -> SBV a) -> SBV d -> SBV c -> SBV b -> SBV a Source # sbvUninterpret :: Maybe ([String], SBV d -> SBV c -> SBV b -> SBV a) -> String -> SBV d -> SBV c -> SBV b -> SBV a Source #
(SymWord c, SymWord b, HasKind a) => Uninterpreted (SBV c -> SBV b -> SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods uninterpret :: String -> SBV c -> SBV b -> SBV a Source # cgUninterpret :: String -> [String] -> (SBV c -> SBV b -> SBV a) -> SBV c -> SBV b -> SBV a Source # sbvUninterpret :: Maybe ([String], SBV c -> SBV b -> SBV a) -> String -> SBV c -> SBV b -> SBV a Source #
(SymWord b, HasKind a) => Uninterpreted (SBV b -> SBV a) Source # |
Instance details Defined in Data.SBV.Core.Model Methods uninterpret :: String -> SBV b -> SBV a Source # cgUninterpret :: String -> [String] -> (SBV b -> SBV a) -> SBV b -> SBV a Source # sbvUninterpret :: Maybe ([String], SBV b -> SBV a) -> String -> SBV b -> SBV a Source #
SymWord e => Mergeable (STree i e) Source # |
Instance details Defined in Data.SBV.Tools.STree Methods symbolicMerge :: Bool -> SBool -> STree i e -> STree i e -> STree i e Source # select :: (SymWord b, Num b) => [STree i e] -> STree i e -> SBV b -> STree i e Source #
(SymWord a, SymWord b, EqSymbolic z) => Equality ((SBV a, SBV b) -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: ((SBV a, SBV b) -> z) -> ((SBV a, SBV b) -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c) -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: ((SBV a, SBV b, SBV c) -> z) -> ((SBV a, SBV b, SBV c) -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, SymWord d, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c, SBV d) -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: ((SBV a, SBV b, SBV c, SBV d) -> z) -> ((SBV a, SBV b, SBV c, SBV d) -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c, SBV d, SBV e) -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> z) -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> z) -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, SymWord g, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> z) -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, SymWord g, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> SBV f -> SBV g -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> SBV f -> SBV g -> z) -> (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> SBV f -> SBV g -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> SBV f -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> SBV f -> z) -> (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> SBV f -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> z) -> (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, SymWord d, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> SBV d -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: (SBV a -> SBV b -> SBV c -> SBV d -> z) -> (SBV a -> SBV b -> SBV c -> SBV d -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, SymWord c, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: (SBV a -> SBV b -> SBV c -> z) -> (SBV a -> SBV b -> SBV c -> z) -> IO ThmResult Source #
(SymWord a, SymWord b, EqSymbolic z) => Equality (SBV a -> SBV b -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: (SBV a -> SBV b -> z) -> (SBV a -> SBV b -> z) -> IO ThmResult Source #
(SymWord a, EqSymbolic z) => Equality (SBV a -> z) Source # |
Instance details Defined in Data.SBV Methods (===) :: (SBV a -> z) -> (SBV a -> z) -> IO ThmResult Source #
(NFData a, SymWord a, NFData b, SymWord b, NFData c, SymWord c) => SExecutable (SBV a, SBV b, SBV c) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: (SBV a, SBV b, SBV c) -> Symbolic () Source # sName :: [String] -> (SBV a, SBV b, SBV c) -> Symbolic () Source # safe :: (SBV a, SBV b, SBV c) -> IO [SafeResult] Source # safeWith :: SMTConfig -> (SBV a, SBV b, SBV c) -> IO [SafeResult] Source #
(NFData a, SymWord a, NFData b, SymWord b, NFData c, SymWord c, NFData d, SymWord d) => SExecutable (SBV a, SBV b, SBV c, SBV d) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: (SBV a, SBV b, SBV c, SBV d) -> Symbolic () Source # sName :: [String] -> (SBV a, SBV b, SBV c, SBV d) -> Symbolic () Source # safe :: (SBV a, SBV b, SBV c, SBV d) -> IO [SafeResult] Source # safeWith :: SMTConfig -> (SBV a, SBV b, SBV c, SBV d) -> IO [SafeResult] Source #
(NFData a, SymWord a, NFData b, SymWord b, NFData c, SymWord c, NFData d, SymWord d, NFData e, SymWord e) => SExecutable (SBV a, SBV b, SBV c, SBV d, SBV e) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: (SBV a, SBV b, SBV c, SBV d, SBV e) -> Symbolic () Source # sName :: [String] -> (SBV a, SBV b, SBV c, SBV d, SBV e) -> Symbolic () Source # safe :: (SBV a, SBV b, SBV c, SBV d, SBV e) -> IO [SafeResult] Source # safeWith :: SMTConfig -> (SBV a, SBV b, SBV c, SBV d, SBV e) -> IO [SafeResult] Source #
(NFData a, SymWord a, NFData b, SymWord b, NFData c, SymWord c, NFData d, SymWord d, NFData e, SymWord e, NFData f, SymWord f) => SExecutable (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> Symbolic () Source # sName :: [String] -> (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> Symbolic () Source # safe :: (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> IO [SafeResult] Source # safeWith :: SMTConfig -> (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> IO [SafeResult] Source #
(NFData a, SymWord a, NFData b, SymWord b, NFData c, SymWord c, NFData d, SymWord d, NFData e, SymWord e, NFData f, SymWord f, NFData g, SymWord g) => SExecutable (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName_ :: (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> Symbolic () Source #

sName :: [String] -> (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> Symbolic () Source #

safe :: (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> IO [SafeResult] Source #

safeWith :: SMTConfig -> (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> IO [SafeResult] Source #

type Rep (SBV a) Source # |
Instance details Defined in Data.SBV.Core.Data type Rep (SBV a) = D1 (MetaData "SBV" "Data.SBV.Core.Data" "sbv-7.13-G8ZmOEcTGWs4ZWy733U7C5" True) (C1 (MetaCons "SBV" PrefixI True) (S1 (MetaSel (Just "unSBV") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SVal)))
type Item (SList a) Source # |
Instance details Defined in Data.SBV.Core.Data type Item (SList a) = a

class HasKind a where Source #

A class for capturing values that have a sign and a size (finite or infinite) minimal complete definition: kindOf, unless you can take advantage of the default signature: This class can be automatically derived for data-types that have a `Data` instance; this is useful for creating uninterpreted sorts. So, in reality, end users should almost never need to define any methods.

Minimal complete definition

Nothing

Methods

kindOf :: a -> Kind Source #

hasSign :: a -> Bool Source #

intSizeOf :: a -> Int Source #

isBoolean :: a -> Bool Source #

isBounded :: a -> Bool Source #

isReal :: a -> Bool Source #

isFloat :: a -> Bool Source #

isDouble :: a -> Bool Source #

isInteger :: a -> Bool Source #

isUninterpreted :: a -> Bool Source #

isChar :: a -> Bool Source #

isString :: a -> Bool Source #

isList :: a -> Bool Source #

showType :: a -> String Source #

kindOf :: (Read a, Data a) => a -> Kind Source #

Instances

HasKind Bool Source # |

Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: Bool -> Kind Source #

hasSign :: Bool -> Bool Source #

intSizeOf :: Bool -> Int Source #

isBoolean :: Bool -> Bool Source #

isBounded :: Bool -> Bool Source #

isReal :: Bool -> Bool Source #

isFloat :: Bool -> Bool Source #

isDouble :: Bool -> Bool Source #

isInteger :: Bool -> Bool Source #

isUninterpreted :: Bool -> Bool Source #

isChar :: Bool -> Bool Source #

isString :: Bool -> Bool Source #

isList :: Bool -> Bool Source #

showType :: Bool -> String Source #

HasKind Char Source # |

Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: Char -> Kind Source #

hasSign :: Char -> Bool Source #

intSizeOf :: Char -> Int Source #

isBoolean :: Char -> Bool Source #

isBounded :: Char -> Bool Source #

isReal :: Char -> Bool Source #

isFloat :: Char -> Bool Source #

isDouble :: Char -> Bool Source #

isInteger :: Char -> Bool Source #

isUninterpreted :: Char -> Bool Source #

isChar :: Char -> Bool Source #

isString :: Char -> Bool Source #

isList :: Char -> Bool Source #

showType :: Char -> String Source #

HasKind Double Source # |

Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: Double -> Kind Source #

hasSign :: Double -> Bool Source #

intSizeOf :: Double -> Int Source #

isBoolean :: Double -> Bool Source #

isBounded :: Double -> Bool Source #

isReal :: Double -> Bool Source #

isFloat :: Double -> Bool Source #

isDouble :: Double -> Bool Source #

isInteger :: Double -> Bool Source #

isUninterpreted :: Double -> Bool Source #

isChar :: Double -> Bool Source #

isString :: Double -> Bool Source #

isList :: Double -> Bool Source #

showType :: Double -> String Source #

HasKind Float Source # |

Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: Float -> Kind Source #

hasSign :: Float -> Bool Source #

intSizeOf :: Float -> Int Source #

isBoolean :: Float -> Bool Source #

isBounded :: Float -> Bool Source #

isReal :: Float -> Bool Source #

isFloat :: Float -> Bool Source #

isDouble :: Float -> Bool Source #

isInteger :: Float -> Bool Source #

isUninterpreted :: Float -> Bool Source #

isChar :: Float -> Bool Source #

isString :: Float -> Bool Source #

isList :: Float -> Bool Source #

showType :: Float -> String Source #

HasKind Int8 Source # |

Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: Int8 -> Kind Source #

hasSign :: Int8 -> Bool Source #

intSizeOf :: Int8 -> Int Source #

isBoolean :: Int8 -> Bool Source #

isBounded :: Int8 -> Bool Source #

isReal :: Int8 -> Bool Source #

isFloat :: Int8 -> Bool Source #

isDouble :: Int8 -> Bool Source #

isInteger :: Int8 -> Bool Source #

isUninterpreted :: Int8 -> Bool Source #

isChar :: Int8 -> Bool Source #

isString :: Int8 -> Bool Source #

isList :: Int8 -> Bool Source #

showType :: Int8 -> String Source #

HasKind Int16 Source # |

Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: Int16 -> Kind Source #

hasSign :: Int16 -> Bool Source #

intSizeOf :: Int16 -> Int Source #

isBoolean :: Int16 -> Bool Source #

isBounded :: Int16 -> Bool Source #

isReal :: Int16 -> Bool Source #

isFloat :: Int16 -> Bool Source #

isDouble :: Int16 -> Bool Source #

isInteger :: Int16 -> Bool Source #

isUninterpreted :: Int16 -> Bool Source #

isChar :: Int16 -> Bool Source #

isString :: Int16 -> Bool Source #

isList :: Int16 -> Bool Source #

showType :: Int16 -> String Source #

HasKind Int32 Source # |

Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: Int32 -> Kind Source #

hasSign :: Int32 -> Bool Source #

intSizeOf :: Int32 -> Int Source #

isBoolean :: Int32 -> Bool Source #

isBounded :: Int32 -> Bool Source #

isReal :: Int32 -> Bool Source #

isFloat :: Int32 -> Bool Source #

isDouble :: Int32 -> Bool Source #

isInteger :: Int32 -> Bool Source #

isUninterpreted :: Int32 -> Bool Source #

isChar :: Int32 -> Bool Source #

isString :: Int32 -> Bool Source #

isList :: Int32 -> Bool Source #

showType :: Int32 -> String Source #

HasKind Int64 Source # |

Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: Int64 -> Kind Source #

hasSign :: Int64 -> Bool Source #

intSizeOf :: Int64 -> Int Source #

isBoolean :: Int64 -> Bool Source #

isBounded :: Int64 -> Bool Source #

isReal :: Int64 -> Bool Source #

isFloat :: Int64 -> Bool Source #

isDouble :: Int64 -> Bool Source #

isInteger :: Int64 -> Bool Source #

isUninterpreted :: Int64 -> Bool Source #

isChar :: Int64 -> Bool Source #

isString :: Int64 -> Bool Source #

isList :: Int64 -> Bool Source #

showType :: Int64 -> String Source #

HasKind Integer Source # |

Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: Integer -> Kind Source #

hasSign :: Integer -> Bool Source #

intSizeOf :: Integer -> Int Source #

isBoolean :: Integer -> Bool Source #

isBounded :: Integer -> Bool Source #

isReal :: Integer -> Bool Source #

isFloat :: Integer -> Bool Source #

isDouble :: Integer -> Bool Source #

isInteger :: Integer -> Bool Source #

isUninterpreted :: Integer -> Bool Source #

isChar :: Integer -> Bool Source #

isString :: Integer -> Bool Source #

isList :: Integer -> Bool Source #

showType :: Integer -> String Source #

HasKind Word8 Source # |

Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: Word8 -> Kind Source #

hasSign :: Word8 -> Bool Source #

intSizeOf :: Word8 -> Int Source #

isBoolean :: Word8 -> Bool Source #

isBounded :: Word8 -> Bool Source #

isReal :: Word8 -> Bool Source #

isFloat :: Word8 -> Bool Source #

isDouble :: Word8 -> Bool Source #

isInteger :: Word8 -> Bool Source #

isUninterpreted :: Word8 -> Bool Source #

isChar :: Word8 -> Bool Source #

isString :: Word8 -> Bool Source #

isList :: Word8 -> Bool Source #

showType :: Word8 -> String Source #

HasKind Word16 Source # |

Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: Word16 -> Kind Source #

hasSign :: Word16 -> Bool Source #

intSizeOf :: Word16 -> Int Source #

isBoolean :: Word16 -> Bool Source #

isBounded :: Word16 -> Bool Source #

isReal :: Word16 -> Bool Source #

isFloat :: Word16 -> Bool Source #

isDouble :: Word16 -> Bool Source #

isInteger :: Word16 -> Bool Source #

isUninterpreted :: Word16 -> Bool Source #

isChar :: Word16 -> Bool Source #

isString :: Word16 -> Bool Source #

isList :: Word16 -> Bool Source #

showType :: Word16 -> String Source #

HasKind Word32 Source # |

Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: Word32 -> Kind Source #

hasSign :: Word32 -> Bool Source #

intSizeOf :: Word32 -> Int Source #

isBoolean :: Word32 -> Bool Source #

isBounded :: Word32 -> Bool Source #

isReal :: Word32 -> Bool Source #

isFloat :: Word32 -> Bool Source #

isDouble :: Word32 -> Bool Source #

isInteger :: Word32 -> Bool Source #

isUninterpreted :: Word32 -> Bool Source #

isChar :: Word32 -> Bool Source #

isString :: Word32 -> Bool Source #

isList :: Word32 -> Bool Source #

showType :: Word32 -> String Source #

HasKind Word64 Source # |

Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: Word64 -> Kind Source #

hasSign :: Word64 -> Bool Source #

intSizeOf :: Word64 -> Int Source #

isBoolean :: Word64 -> Bool Source #

isBounded :: Word64 -> Bool Source #

isReal :: Word64 -> Bool Source #

isFloat :: Word64 -> Bool Source #

isDouble :: Word64 -> Bool Source #

isInteger :: Word64 -> Bool Source #

isUninterpreted :: Word64 -> Bool Source #

isChar :: Word64 -> Bool Source #

isString :: Word64 -> Bool Source #

isList :: Word64 -> Bool Source #

showType :: Word64 -> String Source #

HasKind () Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

kindOf :: () -> Kind Source #

hasSign :: () -> Bool Source #

intSizeOf :: () -> Int Source #

isBoolean :: () -> Bool Source #

isBounded :: () -> Bool Source #

isReal :: () -> Bool Source #

isFloat :: () -> Bool Source #

isDouble :: () -> Bool Source #

isInteger :: () -> Bool Source #

isUninterpreted :: () -> Bool Source #

isChar :: () -> Bool Source #

isString :: () -> Bool Source #

isList :: () -> Bool Source #

showType :: () -> String Source #

HasKind AlgReal Source # |

Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: AlgReal -> Kind Source #

hasSign :: AlgReal -> Bool Source #

intSizeOf :: AlgReal -> Int Source #

isBoolean :: AlgReal -> Bool Source #

isBounded :: AlgReal -> Bool Source #

isReal :: AlgReal -> Bool Source #

isFloat :: AlgReal -> Bool Source #

isDouble :: AlgReal -> Bool Source #

isInteger :: AlgReal -> Bool Source #

isUninterpreted :: AlgReal -> Bool Source #

isChar :: AlgReal -> Bool Source #

isString :: AlgReal -> Bool Source #

isList :: AlgReal -> Bool Source #

showType :: AlgReal -> String Source #

HasKind Kind Source # |

Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: Kind -> Kind Source #

hasSign :: Kind -> Bool Source #

intSizeOf :: Kind -> Int Source #

isBoolean :: Kind -> Bool Source #

isBounded :: Kind -> Bool Source #

isReal :: Kind -> Bool Source #

isFloat :: Kind -> Bool Source #

isDouble :: Kind -> Bool Source #

isInteger :: Kind -> Bool Source #

isUninterpreted :: Kind -> Bool Source #

isChar :: Kind -> Bool Source #

isString :: Kind -> Bool Source #

isList :: Kind -> Bool Source #

showType :: Kind -> String Source #

HasKind ExtCW Source # | Kind instance for Extended CW

Instance details

Defined in Data.SBV.Core.Concrete

Methods

kindOf :: ExtCW -> Kind Source #

hasSign :: ExtCW -> Bool Source #

intSizeOf :: ExtCW -> Int Source #

isBoolean :: ExtCW -> Bool Source #

isBounded :: ExtCW -> Bool Source #

isReal :: ExtCW -> Bool Source #

isFloat :: ExtCW -> Bool Source #

isDouble :: ExtCW -> Bool Source #

isInteger :: ExtCW -> Bool Source #

isUninterpreted :: ExtCW -> Bool Source #

isChar :: ExtCW -> Bool Source #

isString :: ExtCW -> Bool Source #

isList :: ExtCW -> Bool Source #

showType :: ExtCW -> String Source #

HasKind GeneralizedCW Source # | `Kind` instance for generalized CW

Instance details

Defined in Data.SBV.Core.Concrete

Methods

kindOf :: GeneralizedCW -> Kind Source #

hasSign :: GeneralizedCW -> Bool Source #

intSizeOf :: GeneralizedCW -> Int Source #

isBoolean :: GeneralizedCW -> Bool Source #

isBounded :: GeneralizedCW -> Bool Source #

isReal :: GeneralizedCW -> Bool Source #

isFloat :: GeneralizedCW -> Bool Source #

isDouble :: GeneralizedCW -> Bool Source #

isInteger :: GeneralizedCW -> Bool Source #

isUninterpreted :: GeneralizedCW -> Bool Source #

isChar :: GeneralizedCW -> Bool Source #

isString :: GeneralizedCW -> Bool Source #

isList :: GeneralizedCW -> Bool Source #

showType :: GeneralizedCW -> String Source #

HasKind CW Source # | `Kind` instance for CW

Instance details

Defined in Data.SBV.Core.Concrete

Methods

kindOf :: CW -> Kind Source #

hasSign :: CW -> Bool Source #

intSizeOf :: CW -> Int Source #

isBoolean :: CW -> Bool Source #

isBounded :: CW -> Bool Source #

isReal :: CW -> Bool Source #

isFloat :: CW -> Bool Source #

isDouble :: CW -> Bool Source #

isInteger :: CW -> Bool Source #

isUninterpreted :: CW -> Bool Source #

isChar :: CW -> Bool Source #

isString :: CW -> Bool Source #

isList :: CW -> Bool Source #

showType :: CW -> String Source #

HasKind RoundingMode Source # | `RoundingMode` kind

Instance details

Defined in Data.SBV.Core.Symbolic

Methods

kindOf :: RoundingMode -> Kind Source #

hasSign :: RoundingMode -> Bool Source #

intSizeOf :: RoundingMode -> Int Source #

isBoolean :: RoundingMode -> Bool Source #

isBounded :: RoundingMode -> Bool Source #

isReal :: RoundingMode -> Bool Source #

isFloat :: RoundingMode -> Bool Source #

isDouble :: RoundingMode -> Bool Source #

isInteger :: RoundingMode -> Bool Source #

isUninterpreted :: RoundingMode -> Bool Source #

isChar :: RoundingMode -> Bool Source #

isString :: RoundingMode -> Bool Source #

isList :: RoundingMode -> Bool Source #

showType :: RoundingMode -> String Source #

HasKind SVal Source # |

Instance details

Defined in Data.SBV.Core.Symbolic

Methods

kindOf :: SVal -> Kind Source #

hasSign :: SVal -> Bool Source #

intSizeOf :: SVal -> Int Source #

isBoolean :: SVal -> Bool Source #

isBounded :: SVal -> Bool Source #

isReal :: SVal -> Bool Source #

isFloat :: SVal -> Bool Source #

isDouble :: SVal -> Bool Source #

isInteger :: SVal -> Bool Source #

isUninterpreted :: SVal -> Bool Source #

isChar :: SVal -> Bool Source #

isString :: SVal -> Bool Source #

isList :: SVal -> Bool Source #

showType :: SVal -> String Source #

HasKind SW Source # |

Instance details

Defined in Data.SBV.Core.Symbolic

Methods

kindOf :: SW -> Kind Source #

hasSign :: SW -> Bool Source #

intSizeOf :: SW -> Int Source #

isBoolean :: SW -> Bool Source #

isBounded :: SW -> Bool Source #

isReal :: SW -> Bool Source #

isFloat :: SW -> Bool Source #

isDouble :: SW -> Bool Source #

isInteger :: SW -> Bool Source #

isUninterpreted :: SW -> Bool Source #

isChar :: SW -> Bool Source #

isString :: SW -> Bool Source #

isList :: SW -> Bool Source #

showType :: SW -> String Source #

HasKind State Source # |

Instance details

Defined in Documentation.SBV.Examples.Lists.BoundedMutex

Methods

kindOf :: State -> Kind Source #

hasSign :: State -> Bool Source #

intSizeOf :: State -> Int Source #

isBoolean :: State -> Bool Source #

isBounded :: State -> Bool Source #

isReal :: State -> Bool Source #

isFloat :: State -> Bool Source #

isDouble :: State -> Bool Source #

isInteger :: State -> Bool Source #

isUninterpreted :: State -> Bool Source #

isChar :: State -> Bool Source #

isString :: State -> Bool Source #

isList :: State -> Bool Source #

showType :: State -> String Source #

HasKind E Source # |

Instance details

Defined in Documentation.SBV.Examples.Misc.Enumerate

Methods

kindOf :: E -> Kind Source #

hasSign :: E -> Bool Source #

intSizeOf :: E -> Int Source #

isBoolean :: E -> Bool Source #

isBounded :: E -> Bool Source #

isReal :: E -> Bool Source #

isFloat :: E -> Bool Source #

isDouble :: E -> Bool Source #

isInteger :: E -> Bool Source #

isUninterpreted :: E -> Bool Source #

isChar :: E -> Bool Source #

isString :: E -> Bool Source #

isList :: E -> Bool Source #

showType :: E -> String Source #

HasKind Word4 Source # | HasKind instance; simply returning the underlying kind for the type

Instance details

Defined in Documentation.SBV.Examples.Misc.Word4

Methods

kindOf :: Word4 -> Kind Source #

hasSign :: Word4 -> Bool Source #

intSizeOf :: Word4 -> Int Source #

isBoolean :: Word4 -> Bool Source #

isBounded :: Word4 -> Bool Source #

isReal :: Word4 -> Bool Source #

isFloat :: Word4 -> Bool Source #

isDouble :: Word4 -> Bool Source #

isInteger :: Word4 -> Bool Source #

isUninterpreted :: Word4 -> Bool Source #

isChar :: Word4 -> Bool Source #

isString :: Word4 -> Bool Source #

isList :: Word4 -> Bool Source #

showType :: Word4 -> String Source #

HasKind Color Source # |

Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

Methods

kindOf :: Color -> Kind Source #

hasSign :: Color -> Bool Source #

intSizeOf :: Color -> Int Source #

isBoolean :: Color -> Bool Source #

isBounded :: Color -> Bool Source #

isReal :: Color -> Bool Source #

isFloat :: Color -> Bool Source #

isDouble :: Color -> Bool Source #

isInteger :: Color -> Bool Source #

isUninterpreted :: Color -> Bool Source #

isChar :: Color -> Bool Source #

isString :: Color -> Bool Source #

isList :: Color -> Bool Source #

showType :: Color -> String Source #

HasKind Nationality Source # |

Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

Methods

kindOf :: Nationality -> Kind Source #

hasSign :: Nationality -> Bool Source #

intSizeOf :: Nationality -> Int Source #

isBoolean :: Nationality -> Bool Source #

isBounded :: Nationality -> Bool Source #

isReal :: Nationality -> Bool Source #

isFloat :: Nationality -> Bool Source #

isDouble :: Nationality -> Bool Source #

isInteger :: Nationality -> Bool Source #

isUninterpreted :: Nationality -> Bool Source #

isChar :: Nationality -> Bool Source #

isString :: Nationality -> Bool Source #

isList :: Nationality -> Bool Source #

showType :: Nationality -> String Source #

HasKind Beverage Source # |

Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

Methods

kindOf :: Beverage -> Kind Source #

hasSign :: Beverage -> Bool Source #

intSizeOf :: Beverage -> Int Source #

isBoolean :: Beverage -> Bool Source #

isBounded :: Beverage -> Bool Source #

isReal :: Beverage -> Bool Source #

isFloat :: Beverage -> Bool Source #

isDouble :: Beverage -> Bool Source #

isInteger :: Beverage -> Bool Source #

isUninterpreted :: Beverage -> Bool Source #

isChar :: Beverage -> Bool Source #

isString :: Beverage -> Bool Source #

isList :: Beverage -> Bool Source #

showType :: Beverage -> String Source #

HasKind Pet Source # |

Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

Methods

kindOf :: Pet -> Kind Source #

hasSign :: Pet -> Bool Source #

intSizeOf :: Pet -> Int Source #

isBoolean :: Pet -> Bool Source #

isBounded :: Pet -> Bool Source #

isReal :: Pet -> Bool Source #

isFloat :: Pet -> Bool Source #

isDouble :: Pet -> Bool Source #

isInteger :: Pet -> Bool Source #

isUninterpreted :: Pet -> Bool Source #

isChar :: Pet -> Bool Source #

isString :: Pet -> Bool Source #

isList :: Pet -> Bool Source #

showType :: Pet -> String Source #

HasKind Sport Source # |

Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

Methods

kindOf :: Sport -> Kind Source #

hasSign :: Sport -> Bool Source #

intSizeOf :: Sport -> Int Source #

isBoolean :: Sport -> Bool Source #

isBounded :: Sport -> Bool Source #

isReal :: Sport -> Bool Source #

isFloat :: Sport -> Bool Source #

isDouble :: Sport -> Bool Source #

isInteger :: Sport -> Bool Source #

isUninterpreted :: Sport -> Bool Source #

isChar :: Sport -> Bool Source #

isString :: Sport -> Bool Source #

isList :: Sport -> Bool Source #

showType :: Sport -> String Source #

HasKind Color Source # |

Instance details

Defined in Documentation.SBV.Examples.Puzzles.Garden

Methods

kindOf :: Color -> Kind Source #

hasSign :: Color -> Bool Source #

intSizeOf :: Color -> Int Source #

isBoolean :: Color -> Bool Source #

isBounded :: Color -> Bool Source #

isReal :: Color -> Bool Source #

isFloat :: Color -> Bool Source #

isDouble :: Color -> Bool Source #

isInteger :: Color -> Bool Source #

isUninterpreted :: Color -> Bool Source #

isChar :: Color -> Bool Source #

isString :: Color -> Bool Source #

isList :: Color -> Bool Source #

showType :: Color -> String Source #

HasKind Color Source # |

Instance details

Defined in Documentation.SBV.Examples.Puzzles.HexPuzzle

Methods

kindOf :: Color -> Kind Source #

hasSign :: Color -> Bool Source #

intSizeOf :: Color -> Int Source #

isBoolean :: Color -> Bool Source #

isBounded :: Color -> Bool Source #

isReal :: Color -> Bool Source #

isFloat :: Color -> Bool Source #

isDouble :: Color -> Bool Source #

isInteger :: Color -> Bool Source #

isUninterpreted :: Color -> Bool Source #

isChar :: Color -> Bool Source #

isString :: Color -> Bool Source #

isList :: Color -> Bool Source #

showType :: Color -> String Source #

HasKind U2Member Source # |

Instance details

Defined in Documentation.SBV.Examples.Puzzles.U2Bridge

Methods

kindOf :: U2Member -> Kind Source #

hasSign :: U2Member -> Bool Source #

intSizeOf :: U2Member -> Int Source #

isBoolean :: U2Member -> Bool Source #

isBounded :: U2Member -> Bool Source #

isReal :: U2Member -> Bool Source #

isFloat :: U2Member -> Bool Source #

isDouble :: U2Member -> Bool Source #

isInteger :: U2Member -> Bool Source #

isUninterpreted :: U2Member -> Bool Source #

isChar :: U2Member -> Bool Source #

isString :: U2Member -> Bool Source #

isList :: U2Member -> Bool Source #

showType :: U2Member -> String Source #

HasKind Location Source # |

Instance details

Defined in Documentation.SBV.Examples.Puzzles.U2Bridge

Methods

kindOf :: Location -> Kind Source #

hasSign :: Location -> Bool Source #

intSizeOf :: Location -> Int Source #

isBoolean :: Location -> Bool Source #

isBounded :: Location -> Bool Source #

isReal :: Location -> Bool Source #

isFloat :: Location -> Bool Source #

isDouble :: Location -> Bool Source #

isInteger :: Location -> Bool Source #

isUninterpreted :: Location -> Bool Source #

isChar :: Location -> Bool Source #

isString :: Location -> Bool Source #

isList :: Location -> Bool Source #

showType :: Location -> String Source #

HasKind Day Source # |

Instance details

Defined in Documentation.SBV.Examples.Queries.Enums

Methods

kindOf :: Day -> Kind Source #

hasSign :: Day -> Bool Source #

intSizeOf :: Day -> Int Source #

isBoolean :: Day -> Bool Source #

isBounded :: Day -> Bool Source #

isReal :: Day -> Bool Source #

isFloat :: Day -> Bool Source #

isDouble :: Day -> Bool Source #

isInteger :: Day -> Bool Source #

isUninterpreted :: Day -> Bool Source #

isChar :: Day -> Bool Source #

isString :: Day -> Bool Source #

isList :: Day -> Bool Source #

showType :: Day -> String Source #

HasKind BinOp Source # |

Instance details

Defined in Documentation.SBV.Examples.Queries.FourFours

Methods

kindOf :: BinOp -> Kind Source #

hasSign :: BinOp -> Bool Source #

intSizeOf :: BinOp -> Int Source #

isBoolean :: BinOp -> Bool Source #

isBounded :: BinOp -> Bool Source #

isReal :: BinOp -> Bool Source #

isFloat :: BinOp -> Bool Source #

isDouble :: BinOp -> Bool Source #

isInteger :: BinOp -> Bool Source #

isUninterpreted :: BinOp -> Bool Source #

isChar :: BinOp -> Bool Source #

isString :: BinOp -> Bool Source #

isList :: BinOp -> Bool Source #

showType :: BinOp -> String Source #

HasKind UnOp Source # |

Instance details

Defined in Documentation.SBV.Examples.Queries.FourFours

Methods

kindOf :: UnOp -> Kind Source #

hasSign :: UnOp -> Bool Source #

intSizeOf :: UnOp -> Int Source #

isBoolean :: UnOp -> Bool Source #

isBounded :: UnOp -> Bool Source #

isReal :: UnOp -> Bool Source #

isFloat :: UnOp -> Bool Source #

isDouble :: UnOp -> Bool Source #

isInteger :: UnOp -> Bool Source #

isUninterpreted :: UnOp -> Bool Source #

isChar :: UnOp -> Bool Source #

isString :: UnOp -> Bool Source #

isList :: UnOp -> Bool Source #

showType :: UnOp -> String Source #

HasKind B Source # |

Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.Deduce

Methods

kindOf :: B -> Kind Source #

hasSign :: B -> Bool Source #

intSizeOf :: B -> Int Source #

isBoolean :: B -> Bool Source #

isBounded :: B -> Bool Source #

isReal :: B -> Bool Source #

isFloat :: B -> Bool Source #

isDouble :: B -> Bool Source #

isInteger :: B -> Bool Source #

isUninterpreted :: B -> Bool Source #

isChar :: B -> Bool Source #

isString :: B -> Bool Source #

isList :: B -> Bool Source #

showType :: B -> String Source #

HasKind Q Source # |

Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.Sort

Methods

kindOf :: Q -> Kind Source #

hasSign :: Q -> Bool Source #

intSizeOf :: Q -> Int Source #

isBoolean :: Q -> Bool Source #

isBounded :: Q -> Bool Source #

isReal :: Q -> Bool Source #

isFloat :: Q -> Bool Source #

isDouble :: Q -> Bool Source #

isInteger :: Q -> Bool Source #

isUninterpreted :: Q -> Bool Source #

isChar :: Q -> Bool Source #

isString :: Q -> Bool Source #

isList :: Q -> Bool Source #

showType :: Q -> String Source #

HasKind L Source # | Similarly, `HasKind`s default implementation is sufficient.

Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.UISortAllSat

Methods

kindOf :: L -> Kind Source #

hasSign :: L -> Bool Source #

intSizeOf :: L -> Int Source #

isBoolean :: L -> Bool Source #

isBounded :: L -> Bool Source #

isReal :: L -> Bool Source #

isFloat :: L -> Bool Source #

isDouble :: L -> Bool Source #

isInteger :: L -> Bool Source #

isUninterpreted :: L -> Bool Source #

isChar :: L -> Bool Source #

isString :: L -> Bool Source #

isList :: L -> Bool Source #

showType :: L -> String Source #

(Typeable a, HasKind a) => HasKind [a] Source # |

Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: [a] -> Kind Source #

hasSign :: [a] -> Bool Source #

intSizeOf :: [a] -> Int Source #

isBoolean :: [a] -> Bool Source #

isBounded :: [a] -> Bool Source #

isReal :: [a] -> Bool Source #

isFloat :: [a] -> Bool Source #

isDouble :: [a] -> Bool Source #

isInteger :: [a] -> Bool Source #

isUninterpreted :: [a] -> Bool Source #

isChar :: [a] -> Bool Source #

isString :: [a] -> Bool Source #

isList :: [a] -> Bool Source #

showType :: [a] -> String Source #

HasKind (SBV a) Source # |

Instance details

Defined in Data.SBV.Core.Data

Methods

kindOf :: SBV a -> Kind Source #

hasSign :: SBV a -> Bool Source #

intSizeOf :: SBV a -> Int Source #

isBoolean :: SBV a -> Bool Source #

isBounded :: SBV a -> Bool Source #

isReal :: SBV a -> Bool Source #

isFloat :: SBV a -> Bool Source #

isDouble :: SBV a -> Bool Source #

isInteger :: SBV a -> Bool Source #

isUninterpreted :: SBV a -> Bool Source #

isChar :: SBV a -> Bool Source #

isString :: SBV a -> Bool Source #

isList :: SBV a -> Bool Source #

showType :: SBV a -> String Source #

data Kind Source #

Kind of symbolic value

Constructors

KBool |
KBounded !Bool !Int |
KUnbounded |
KReal |
KUserSort String (Either String [String]) |
KFloat |
KDouble |
KChar |
KString |
KList Kind |

Instances

Eq Kind Source # |
Instance details Defined in Data.SBV.Core.Kind Methods (==) :: Kind -> Kind -> Bool Source # (/=) :: Kind -> Kind -> Bool Source #
Ord Kind Source # |
Instance details Defined in Data.SBV.Core.Kind Methods compare :: Kind -> Kind -> Ordering Source # (<) :: Kind -> Kind -> Bool Source # (<=) :: Kind -> Kind -> Bool Source # (>) :: Kind -> Kind -> Bool Source # (>=) :: Kind -> Kind -> Bool Source # max :: Kind -> Kind -> Kind Source # min :: Kind -> Kind -> Kind Source #
Show Kind Source # | The interesting about the show instance is that it can tell apart two kinds nicely; since it conveniently ignores the enumeration constructors. Also, when we construct a `KUserSort`, we make sure we don't use any of the reserved names; see `constructUKind` for details.
Instance details Defined in Data.SBV.Core.Kind Methods showsPrec :: Int -> Kind -> ShowS Source # show :: Kind -> String Source # showList :: [Kind] -> ShowS Source #
NFData Kind Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods rnf :: Kind -> () Source #
HasKind Kind Source # |

Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: Kind -> Kind Source #

hasSign :: Kind -> Bool Source #

intSizeOf :: Kind -> Int Source #

isBoolean :: Kind -> Bool Source #

isBounded :: Kind -> Bool Source #

isReal :: Kind -> Bool Source #

isFloat :: Kind -> Bool Source #

isDouble :: Kind -> Bool Source #

isInteger :: Kind -> Bool Source #

isUninterpreted :: Kind -> Bool Source #

isChar :: Kind -> Bool Source #

isString :: Kind -> Bool Source #

isList :: Kind -> Bool Source #

showType :: Kind -> String Source #

class (HasKind a, Ord a, Typeable a) => SymWord a where Source #

A `SymWord` is a potential symbolic bitvector that can be created instances of to be fed to a symbolic program. Note that these methods are typically not needed in casual uses with `prove`, `sat`, `allSat` etc, as default instances automatically provide the necessary bits.

Minimal complete definition

Nothing

Methods

forall :: String -> Symbolic (SBV a) Source #

Create a user named input (universal)

forall_ :: Symbolic (SBV a) Source #

Create an automatically named input

mkForallVars :: Int -> Symbolic [SBV a] Source #

Get a bunch of new words

exists :: String -> Symbolic (SBV a) Source #

Create an existential variable

exists_ :: Symbolic (SBV a) Source #

Create an automatically named existential variable

mkExistVars :: Int -> Symbolic [SBV a] Source #

Create a bunch of existentials

free :: String -> Symbolic (SBV a) Source #

Create a free variable, universal in a proof, existential in sat

free_ :: Symbolic (SBV a) Source #

Create an unnamed free variable, universal in proof, existential in sat

mkFreeVars :: Int -> Symbolic [SBV a] Source #

Create a bunch of free vars

symbolic :: String -> Symbolic (SBV a) Source #

Similar to free; Just a more convenient name

symbolics :: [String] -> Symbolic [SBV a] Source #

Similar to mkFreeVars; but automatically gives names based on the strings

literal :: a -> SBV a Source #

Turn a literal constant to symbolic

unliteral :: SBV a -> Maybe a Source #

Extract a literal, if the value is concrete

fromCW :: CW -> a Source #

Extract a literal, from a CW representation

isConcrete :: SBV a -> Bool Source #

Is the symbolic word concrete?

isSymbolic :: SBV a -> Bool Source #

Is the symbolic word really symbolic?

isConcretely :: SBV a -> (a -> Bool) -> Bool Source #

Does it concretely satisfy the given predicate?

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV a) Source #

One stop allocator

literal :: Show a => a -> SBV a Source #

Turn a literal constant to symbolic

fromCW :: Read a => CW -> a Source #

Extract a literal, from a CW representation

mkSymWord :: (Read a, Data a) => Maybe Quantifier -> Maybe String -> Symbolic (SBV a) Source #

One stop allocator

Instances

SymWord Bool Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

forall :: String -> Symbolic (SBV Bool) Source #

forall_ :: Symbolic (SBV Bool) Source #

mkForallVars :: Int -> Symbolic [SBV Bool] Source #

exists :: String -> Symbolic (SBV Bool) Source #

exists_ :: Symbolic (SBV Bool) Source #

mkExistVars :: Int -> Symbolic [SBV Bool] Source #

free :: String -> Symbolic (SBV Bool) Source #

free_ :: Symbolic (SBV Bool) Source #

mkFreeVars :: Int -> Symbolic [SBV Bool] Source #

symbolic :: String -> Symbolic (SBV Bool) Source #

symbolics :: [String] -> Symbolic [SBV Bool] Source #

literal :: Bool -> SBV Bool Source #

unliteral :: SBV Bool -> Maybe Bool Source #

fromCW :: CW -> Bool Source #

isConcrete :: SBV Bool -> Bool Source #

isSymbolic :: SBV Bool -> Bool Source #

isConcretely :: SBV Bool -> (Bool -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Bool) Source #

SymWord Char Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

forall :: String -> Symbolic (SBV Char) Source #

forall_ :: Symbolic (SBV Char) Source #

mkForallVars :: Int -> Symbolic [SBV Char] Source #

exists :: String -> Symbolic (SBV Char) Source #

exists_ :: Symbolic (SBV Char) Source #

mkExistVars :: Int -> Symbolic [SBV Char] Source #

free :: String -> Symbolic (SBV Char) Source #

free_ :: Symbolic (SBV Char) Source #

mkFreeVars :: Int -> Symbolic [SBV Char] Source #

symbolic :: String -> Symbolic (SBV Char) Source #

symbolics :: [String] -> Symbolic [SBV Char] Source #

literal :: Char -> SBV Char Source #

unliteral :: SBV Char -> Maybe Char Source #

fromCW :: CW -> Char Source #

isConcrete :: SBV Char -> Bool Source #

isSymbolic :: SBV Char -> Bool Source #

isConcretely :: SBV Char -> (Char -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Char) Source #

SymWord Double Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

forall :: String -> Symbolic (SBV Double) Source #

forall_ :: Symbolic (SBV Double) Source #

mkForallVars :: Int -> Symbolic [SBV Double] Source #

exists :: String -> Symbolic (SBV Double) Source #

exists_ :: Symbolic (SBV Double) Source #

mkExistVars :: Int -> Symbolic [SBV Double] Source #

free :: String -> Symbolic (SBV Double) Source #

free_ :: Symbolic (SBV Double) Source #

mkFreeVars :: Int -> Symbolic [SBV Double] Source #

symbolic :: String -> Symbolic (SBV Double) Source #

symbolics :: [String] -> Symbolic [SBV Double] Source #

literal :: Double -> SBV Double Source #

unliteral :: SBV Double -> Maybe Double Source #

fromCW :: CW -> Double Source #

isConcrete :: SBV Double -> Bool Source #

isSymbolic :: SBV Double -> Bool Source #

isConcretely :: SBV Double -> (Double -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Double) Source #

SymWord Float Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

forall :: String -> Symbolic (SBV Float) Source #

forall_ :: Symbolic (SBV Float) Source #

mkForallVars :: Int -> Symbolic [SBV Float] Source #

exists :: String -> Symbolic (SBV Float) Source #

exists_ :: Symbolic (SBV Float) Source #

mkExistVars :: Int -> Symbolic [SBV Float] Source #

free :: String -> Symbolic (SBV Float) Source #

free_ :: Symbolic (SBV Float) Source #

mkFreeVars :: Int -> Symbolic [SBV Float] Source #

symbolic :: String -> Symbolic (SBV Float) Source #

symbolics :: [String] -> Symbolic [SBV Float] Source #

literal :: Float -> SBV Float Source #

unliteral :: SBV Float -> Maybe Float Source #

fromCW :: CW -> Float Source #

isConcrete :: SBV Float -> Bool Source #

isSymbolic :: SBV Float -> Bool Source #

isConcretely :: SBV Float -> (Float -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Float) Source #

SymWord Int8 Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

forall :: String -> Symbolic (SBV Int8) Source #

forall_ :: Symbolic (SBV Int8) Source #

mkForallVars :: Int -> Symbolic [SBV Int8] Source #

exists :: String -> Symbolic (SBV Int8) Source #

exists_ :: Symbolic (SBV Int8) Source #

mkExistVars :: Int -> Symbolic [SBV Int8] Source #

free :: String -> Symbolic (SBV Int8) Source #

free_ :: Symbolic (SBV Int8) Source #

mkFreeVars :: Int -> Symbolic [SBV Int8] Source #

symbolic :: String -> Symbolic (SBV Int8) Source #

symbolics :: [String] -> Symbolic [SBV Int8] Source #

literal :: Int8 -> SBV Int8 Source #

unliteral :: SBV Int8 -> Maybe Int8 Source #

fromCW :: CW -> Int8 Source #

isConcrete :: SBV Int8 -> Bool Source #

isSymbolic :: SBV Int8 -> Bool Source #

isConcretely :: SBV Int8 -> (Int8 -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Int8) Source #

SymWord Int16 Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

forall :: String -> Symbolic (SBV Int16) Source #

forall_ :: Symbolic (SBV Int16) Source #

mkForallVars :: Int -> Symbolic [SBV Int16] Source #

exists :: String -> Symbolic (SBV Int16) Source #

exists_ :: Symbolic (SBV Int16) Source #

mkExistVars :: Int -> Symbolic [SBV Int16] Source #

free :: String -> Symbolic (SBV Int16) Source #

free_ :: Symbolic (SBV Int16) Source #

mkFreeVars :: Int -> Symbolic [SBV Int16] Source #

symbolic :: String -> Symbolic (SBV Int16) Source #

symbolics :: [String] -> Symbolic [SBV Int16] Source #

literal :: Int16 -> SBV Int16 Source #

unliteral :: SBV Int16 -> Maybe Int16 Source #

fromCW :: CW -> Int16 Source #

isConcrete :: SBV Int16 -> Bool Source #

isSymbolic :: SBV Int16 -> Bool Source #

isConcretely :: SBV Int16 -> (Int16 -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Int16) Source #

SymWord Int32 Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

forall :: String -> Symbolic (SBV Int32) Source #

forall_ :: Symbolic (SBV Int32) Source #

mkForallVars :: Int -> Symbolic [SBV Int32] Source #

exists :: String -> Symbolic (SBV Int32) Source #

exists_ :: Symbolic (SBV Int32) Source #

mkExistVars :: Int -> Symbolic [SBV Int32] Source #

free :: String -> Symbolic (SBV Int32) Source #

free_ :: Symbolic (SBV Int32) Source #

mkFreeVars :: Int -> Symbolic [SBV Int32] Source #

symbolic :: String -> Symbolic (SBV Int32) Source #

symbolics :: [String] -> Symbolic [SBV Int32] Source #

literal :: Int32 -> SBV Int32 Source #

unliteral :: SBV Int32 -> Maybe Int32 Source #

fromCW :: CW -> Int32 Source #

isConcrete :: SBV Int32 -> Bool Source #

isSymbolic :: SBV Int32 -> Bool Source #

isConcretely :: SBV Int32 -> (Int32 -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Int32) Source #

SymWord Int64 Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

forall :: String -> Symbolic (SBV Int64) Source #

forall_ :: Symbolic (SBV Int64) Source #

mkForallVars :: Int -> Symbolic [SBV Int64] Source #

exists :: String -> Symbolic (SBV Int64) Source #

exists_ :: Symbolic (SBV Int64) Source #

mkExistVars :: Int -> Symbolic [SBV Int64] Source #

free :: String -> Symbolic (SBV Int64) Source #

free_ :: Symbolic (SBV Int64) Source #

mkFreeVars :: Int -> Symbolic [SBV Int64] Source #

symbolic :: String -> Symbolic (SBV Int64) Source #

symbolics :: [String] -> Symbolic [SBV Int64] Source #

literal :: Int64 -> SBV Int64 Source #

unliteral :: SBV Int64 -> Maybe Int64 Source #

fromCW :: CW -> Int64 Source #

isConcrete :: SBV Int64 -> Bool Source #

isSymbolic :: SBV Int64 -> Bool Source #

isConcretely :: SBV Int64 -> (Int64 -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Int64) Source #

SymWord Integer Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

forall :: String -> Symbolic (SBV Integer) Source #

forall_ :: Symbolic (SBV Integer) Source #

mkForallVars :: Int -> Symbolic [SBV Integer] Source #

exists :: String -> Symbolic (SBV Integer) Source #

exists_ :: Symbolic (SBV Integer) Source #

mkExistVars :: Int -> Symbolic [SBV Integer] Source #

free :: String -> Symbolic (SBV Integer) Source #

free_ :: Symbolic (SBV Integer) Source #

mkFreeVars :: Int -> Symbolic [SBV Integer] Source #

symbolic :: String -> Symbolic (SBV Integer) Source #

symbolics :: [String] -> Symbolic [SBV Integer] Source #

literal :: Integer -> SBV Integer Source #

unliteral :: SBV Integer -> Maybe Integer Source #

fromCW :: CW -> Integer Source #

isConcrete :: SBV Integer -> Bool Source #

isSymbolic :: SBV Integer -> Bool Source #

isConcretely :: SBV Integer -> (Integer -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Integer) Source #

SymWord Word8 Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

forall :: String -> Symbolic (SBV Word8) Source #

forall_ :: Symbolic (SBV Word8) Source #

mkForallVars :: Int -> Symbolic [SBV Word8] Source #

exists :: String -> Symbolic (SBV Word8) Source #

exists_ :: Symbolic (SBV Word8) Source #

mkExistVars :: Int -> Symbolic [SBV Word8] Source #

free :: String -> Symbolic (SBV Word8) Source #

free_ :: Symbolic (SBV Word8) Source #

mkFreeVars :: Int -> Symbolic [SBV Word8] Source #

symbolic :: String -> Symbolic (SBV Word8) Source #

symbolics :: [String] -> Symbolic [SBV Word8] Source #

literal :: Word8 -> SBV Word8 Source #

unliteral :: SBV Word8 -> Maybe Word8 Source #

fromCW :: CW -> Word8 Source #

isConcrete :: SBV Word8 -> Bool Source #

isSymbolic :: SBV Word8 -> Bool Source #

isConcretely :: SBV Word8 -> (Word8 -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Word8) Source #

SymWord Word16 Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

forall :: String -> Symbolic (SBV Word16) Source #

forall_ :: Symbolic (SBV Word16) Source #

mkForallVars :: Int -> Symbolic [SBV Word16] Source #

exists :: String -> Symbolic (SBV Word16) Source #

exists_ :: Symbolic (SBV Word16) Source #

mkExistVars :: Int -> Symbolic [SBV Word16] Source #

free :: String -> Symbolic (SBV Word16) Source #

free_ :: Symbolic (SBV Word16) Source #

mkFreeVars :: Int -> Symbolic [SBV Word16] Source #

symbolic :: String -> Symbolic (SBV Word16) Source #

symbolics :: [String] -> Symbolic [SBV Word16] Source #

literal :: Word16 -> SBV Word16 Source #

unliteral :: SBV Word16 -> Maybe Word16 Source #

fromCW :: CW -> Word16 Source #

isConcrete :: SBV Word16 -> Bool Source #

isSymbolic :: SBV Word16 -> Bool Source #

isConcretely :: SBV Word16 -> (Word16 -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Word16) Source #

SymWord Word32 Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

forall :: String -> Symbolic (SBV Word32) Source #

forall_ :: Symbolic (SBV Word32) Source #

mkForallVars :: Int -> Symbolic [SBV Word32] Source #

exists :: String -> Symbolic (SBV Word32) Source #

exists_ :: Symbolic (SBV Word32) Source #

mkExistVars :: Int -> Symbolic [SBV Word32] Source #

free :: String -> Symbolic (SBV Word32) Source #

free_ :: Symbolic (SBV Word32) Source #

mkFreeVars :: Int -> Symbolic [SBV Word32] Source #

symbolic :: String -> Symbolic (SBV Word32) Source #

symbolics :: [String] -> Symbolic [SBV Word32] Source #

literal :: Word32 -> SBV Word32 Source #

unliteral :: SBV Word32 -> Maybe Word32 Source #

fromCW :: CW -> Word32 Source #

isConcrete :: SBV Word32 -> Bool Source #

isSymbolic :: SBV Word32 -> Bool Source #

isConcretely :: SBV Word32 -> (Word32 -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Word32) Source #

SymWord Word64 Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

forall :: String -> Symbolic (SBV Word64) Source #

forall_ :: Symbolic (SBV Word64) Source #

mkForallVars :: Int -> Symbolic [SBV Word64] Source #

exists :: String -> Symbolic (SBV Word64) Source #

exists_ :: Symbolic (SBV Word64) Source #

mkExistVars :: Int -> Symbolic [SBV Word64] Source #

free :: String -> Symbolic (SBV Word64) Source #

free_ :: Symbolic (SBV Word64) Source #

mkFreeVars :: Int -> Symbolic [SBV Word64] Source #

symbolic :: String -> Symbolic (SBV Word64) Source #

symbolics :: [String] -> Symbolic [SBV Word64] Source #

literal :: Word64 -> SBV Word64 Source #

unliteral :: SBV Word64 -> Maybe Word64 Source #

fromCW :: CW -> Word64 Source #

isConcrete :: SBV Word64 -> Bool Source #

isSymbolic :: SBV Word64 -> Bool Source #

isConcretely :: SBV Word64 -> (Word64 -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Word64) Source #

SymWord () Source # | Base type of () allows simple construction for uninterpreted types.

Instance details

Defined in Data.SBV.Core.Model

Methods

forall :: String -> Symbolic (SBV ()) Source #

forall_ :: Symbolic (SBV ()) Source #

mkForallVars :: Int -> Symbolic [SBV ()] Source #

exists :: String -> Symbolic (SBV ()) Source #

exists_ :: Symbolic (SBV ()) Source #

mkExistVars :: Int -> Symbolic [SBV ()] Source #

free :: String -> Symbolic (SBV ()) Source #

free_ :: Symbolic (SBV ()) Source #

mkFreeVars :: Int -> Symbolic [SBV ()] Source #

symbolic :: String -> Symbolic (SBV ()) Source #

symbolics :: [String] -> Symbolic [SBV ()] Source #

literal :: () -> SBV () Source #

unliteral :: SBV () -> Maybe () Source #

fromCW :: CW -> () Source #

isConcrete :: SBV () -> Bool Source #

isSymbolic :: SBV () -> Bool Source #

isConcretely :: SBV () -> (() -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV ()) Source #

SymWord AlgReal Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

forall :: String -> Symbolic (SBV AlgReal) Source #

forall_ :: Symbolic (SBV AlgReal) Source #

mkForallVars :: Int -> Symbolic [SBV AlgReal] Source #

exists :: String -> Symbolic (SBV AlgReal) Source #

exists_ :: Symbolic (SBV AlgReal) Source #

mkExistVars :: Int -> Symbolic [SBV AlgReal] Source #

free :: String -> Symbolic (SBV AlgReal) Source #

free_ :: Symbolic (SBV AlgReal) Source #

mkFreeVars :: Int -> Symbolic [SBV AlgReal] Source #

symbolic :: String -> Symbolic (SBV AlgReal) Source #

symbolics :: [String] -> Symbolic [SBV AlgReal] Source #

literal :: AlgReal -> SBV AlgReal Source #

unliteral :: SBV AlgReal -> Maybe AlgReal Source #

fromCW :: CW -> AlgReal Source #

isConcrete :: SBV AlgReal -> Bool Source #

isSymbolic :: SBV AlgReal -> Bool Source #

isConcretely :: SBV AlgReal -> (AlgReal -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV AlgReal) Source #

SymWord RoundingMode Source # | `RoundingMode` can be used symbolically

Instance details

Defined in Data.SBV.Core.Data

Methods

forall :: String -> Symbolic (SBV RoundingMode) Source #

forall_ :: Symbolic (SBV RoundingMode) Source #

mkForallVars :: Int -> Symbolic [SBV RoundingMode] Source #

exists :: String -> Symbolic (SBV RoundingMode) Source #

exists_ :: Symbolic (SBV RoundingMode) Source #

mkExistVars :: Int -> Symbolic [SBV RoundingMode] Source #

free :: String -> Symbolic (SBV RoundingMode) Source #

free_ :: Symbolic (SBV RoundingMode) Source #

mkFreeVars :: Int -> Symbolic [SBV RoundingMode] Source #

symbolic :: String -> Symbolic (SBV RoundingMode) Source #

symbolics :: [String] -> Symbolic [SBV RoundingMode] Source #

literal :: RoundingMode -> SBV RoundingMode Source #

unliteral :: SBV RoundingMode -> Maybe RoundingMode Source #

fromCW :: CW -> RoundingMode Source #

isConcrete :: SBV RoundingMode -> Bool Source #

isSymbolic :: SBV RoundingMode -> Bool Source #

isConcretely :: SBV RoundingMode -> (RoundingMode -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV RoundingMode) Source #

SymWord State Source # |

Instance details

Defined in Documentation.SBV.Examples.Lists.BoundedMutex

Methods

forall :: String -> Symbolic (SBV State) Source #

forall_ :: Symbolic (SBV State) Source #

mkForallVars :: Int -> Symbolic [SBV State] Source #

exists :: String -> Symbolic (SBV State) Source #

exists_ :: Symbolic (SBV State) Source #

mkExistVars :: Int -> Symbolic [SBV State] Source #

free :: String -> Symbolic (SBV State) Source #

free_ :: Symbolic (SBV State) Source #

mkFreeVars :: Int -> Symbolic [SBV State] Source #

symbolic :: String -> Symbolic (SBV State) Source #

symbolics :: [String] -> Symbolic [SBV State] Source #

literal :: State -> SBV State Source #

unliteral :: SBV State -> Maybe State Source #

fromCW :: CW -> State Source #

isConcrete :: SBV State -> Bool Source #

isSymbolic :: SBV State -> Bool Source #

isConcretely :: SBV State -> (State -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV State) Source #

SymWord E Source # |

Instance details

Defined in Documentation.SBV.Examples.Misc.Enumerate

Methods

forall :: String -> Symbolic (SBV E) Source #

forall_ :: Symbolic (SBV E) Source #

mkForallVars :: Int -> Symbolic [SBV E] Source #

exists :: String -> Symbolic (SBV E) Source #

exists_ :: Symbolic (SBV E) Source #

mkExistVars :: Int -> Symbolic [SBV E] Source #

free :: String -> Symbolic (SBV E) Source #

free_ :: Symbolic (SBV E) Source #

mkFreeVars :: Int -> Symbolic [SBV E] Source #

symbolic :: String -> Symbolic (SBV E) Source #

symbolics :: [String] -> Symbolic [SBV E] Source #

literal :: E -> SBV E Source #

unliteral :: SBV E -> Maybe E Source #

fromCW :: CW -> E Source #

isConcrete :: SBV E -> Bool Source #

isSymbolic :: SBV E -> Bool Source #

isConcretely :: SBV E -> (E -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV E) Source #

SymWord Word4 Source # | SymWord instance, allowing this type to be used in proofs/sat etc.

Instance details

Defined in Documentation.SBV.Examples.Misc.Word4

Methods

forall :: String -> Symbolic (SBV Word4) Source #

forall_ :: Symbolic (SBV Word4) Source #

mkForallVars :: Int -> Symbolic [SBV Word4] Source #

exists :: String -> Symbolic (SBV Word4) Source #

exists_ :: Symbolic (SBV Word4) Source #

mkExistVars :: Int -> Symbolic [SBV Word4] Source #

free :: String -> Symbolic (SBV Word4) Source #

free_ :: Symbolic (SBV Word4) Source #

mkFreeVars :: Int -> Symbolic [SBV Word4] Source #

symbolic :: String -> Symbolic (SBV Word4) Source #

symbolics :: [String] -> Symbolic [SBV Word4] Source #

literal :: Word4 -> SBV Word4 Source #

unliteral :: SBV Word4 -> Maybe Word4 Source #

fromCW :: CW -> Word4 Source #

isConcrete :: SBV Word4 -> Bool Source #

isSymbolic :: SBV Word4 -> Bool Source #

isConcretely :: SBV Word4 -> (Word4 -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Word4) Source #

SymWord Color Source # |

Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

Methods

forall :: String -> Symbolic (SBV Color) Source #

forall_ :: Symbolic (SBV Color) Source #

mkForallVars :: Int -> Symbolic [SBV Color] Source #

exists :: String -> Symbolic (SBV Color) Source #

exists_ :: Symbolic (SBV Color) Source #

mkExistVars :: Int -> Symbolic [SBV Color] Source #

free :: String -> Symbolic (SBV Color) Source #

free_ :: Symbolic (SBV Color) Source #

mkFreeVars :: Int -> Symbolic [SBV Color] Source #

symbolic :: String -> Symbolic (SBV Color) Source #

symbolics :: [String] -> Symbolic [SBV Color] Source #

literal :: Color -> SBV Color Source #

unliteral :: SBV Color -> Maybe Color Source #

fromCW :: CW -> Color Source #

isConcrete :: SBV Color -> Bool Source #

isSymbolic :: SBV Color -> Bool Source #

isConcretely :: SBV Color -> (Color -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Color) Source #

SymWord Nationality Source # |

Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

Methods

forall :: String -> Symbolic (SBV Nationality) Source #

forall_ :: Symbolic (SBV Nationality) Source #

mkForallVars :: Int -> Symbolic [SBV Nationality] Source #

exists :: String -> Symbolic (SBV Nationality) Source #

exists_ :: Symbolic (SBV Nationality) Source #

mkExistVars :: Int -> Symbolic [SBV Nationality] Source #

free :: String -> Symbolic (SBV Nationality) Source #

free_ :: Symbolic (SBV Nationality) Source #

mkFreeVars :: Int -> Symbolic [SBV Nationality] Source #

symbolic :: String -> Symbolic (SBV Nationality) Source #

symbolics :: [String] -> Symbolic [SBV Nationality] Source #

literal :: Nationality -> SBV Nationality Source #

unliteral :: SBV Nationality -> Maybe Nationality Source #

fromCW :: CW -> Nationality Source #

isConcrete :: SBV Nationality -> Bool Source #

isSymbolic :: SBV Nationality -> Bool Source #

isConcretely :: SBV Nationality -> (Nationality -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Nationality) Source #

SymWord Beverage Source # |

Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

Methods

forall :: String -> Symbolic (SBV Beverage) Source #

forall_ :: Symbolic (SBV Beverage) Source #

mkForallVars :: Int -> Symbolic [SBV Beverage] Source #

exists :: String -> Symbolic (SBV Beverage) Source #

exists_ :: Symbolic (SBV Beverage) Source #

mkExistVars :: Int -> Symbolic [SBV Beverage] Source #

free :: String -> Symbolic (SBV Beverage) Source #

free_ :: Symbolic (SBV Beverage) Source #

mkFreeVars :: Int -> Symbolic [SBV Beverage] Source #

symbolic :: String -> Symbolic (SBV Beverage) Source #

symbolics :: [String] -> Symbolic [SBV Beverage] Source #

literal :: Beverage -> SBV Beverage Source #

unliteral :: SBV Beverage -> Maybe Beverage Source #

fromCW :: CW -> Beverage Source #

isConcrete :: SBV Beverage -> Bool Source #

isSymbolic :: SBV Beverage -> Bool Source #

isConcretely :: SBV Beverage -> (Beverage -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Beverage) Source #

SymWord Pet Source # |

Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

Methods

forall :: String -> Symbolic (SBV Pet) Source #

forall_ :: Symbolic (SBV Pet) Source #

mkForallVars :: Int -> Symbolic [SBV Pet] Source #

exists :: String -> Symbolic (SBV Pet) Source #

exists_ :: Symbolic (SBV Pet) Source #

mkExistVars :: Int -> Symbolic [SBV Pet] Source #

free :: String -> Symbolic (SBV Pet) Source #

free_ :: Symbolic (SBV Pet) Source #

mkFreeVars :: Int -> Symbolic [SBV Pet] Source #

symbolic :: String -> Symbolic (SBV Pet) Source #

symbolics :: [String] -> Symbolic [SBV Pet] Source #

literal :: Pet -> SBV Pet Source #

unliteral :: SBV Pet -> Maybe Pet Source #

fromCW :: CW -> Pet Source #

isConcrete :: SBV Pet -> Bool Source #

isSymbolic :: SBV Pet -> Bool Source #

isConcretely :: SBV Pet -> (Pet -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Pet) Source #

SymWord Sport Source # |

Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

Methods

forall :: String -> Symbolic (SBV Sport) Source #

forall_ :: Symbolic (SBV Sport) Source #

mkForallVars :: Int -> Symbolic [SBV Sport] Source #

exists :: String -> Symbolic (SBV Sport) Source #

exists_ :: Symbolic (SBV Sport) Source #

mkExistVars :: Int -> Symbolic [SBV Sport] Source #

free :: String -> Symbolic (SBV Sport) Source #

free_ :: Symbolic (SBV Sport) Source #

mkFreeVars :: Int -> Symbolic [SBV Sport] Source #

symbolic :: String -> Symbolic (SBV Sport) Source #

symbolics :: [String] -> Symbolic [SBV Sport] Source #

literal :: Sport -> SBV Sport Source #

unliteral :: SBV Sport -> Maybe Sport Source #

fromCW :: CW -> Sport Source #

isConcrete :: SBV Sport -> Bool Source #

isSymbolic :: SBV Sport -> Bool Source #

isConcretely :: SBV Sport -> (Sport -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Sport) Source #

SymWord Color Source # |

Instance details

Defined in Documentation.SBV.Examples.Puzzles.Garden

Methods

forall :: String -> Symbolic (SBV Color) Source #

forall_ :: Symbolic (SBV Color) Source #

mkForallVars :: Int -> Symbolic [SBV Color] Source #

exists :: String -> Symbolic (SBV Color) Source #

exists_ :: Symbolic (SBV Color) Source #

mkExistVars :: Int -> Symbolic [SBV Color] Source #

free :: String -> Symbolic (SBV Color) Source #

free_ :: Symbolic (SBV Color) Source #

mkFreeVars :: Int -> Symbolic [SBV Color] Source #

symbolic :: String -> Symbolic (SBV Color) Source #

symbolics :: [String] -> Symbolic [SBV Color] Source #

literal :: Color -> SBV Color Source #

unliteral :: SBV Color -> Maybe Color Source #

fromCW :: CW -> Color Source #

isConcrete :: SBV Color -> Bool Source #

isSymbolic :: SBV Color -> Bool Source #

isConcretely :: SBV Color -> (Color -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Color) Source #

SymWord Color Source # |

Instance details

Defined in Documentation.SBV.Examples.Puzzles.HexPuzzle

Methods

forall :: String -> Symbolic (SBV Color) Source #

forall_ :: Symbolic (SBV Color) Source #

mkForallVars :: Int -> Symbolic [SBV Color] Source #

exists :: String -> Symbolic (SBV Color) Source #

exists_ :: Symbolic (SBV Color) Source #

mkExistVars :: Int -> Symbolic [SBV Color] Source #

free :: String -> Symbolic (SBV Color) Source #

free_ :: Symbolic (SBV Color) Source #

mkFreeVars :: Int -> Symbolic [SBV Color] Source #

symbolic :: String -> Symbolic (SBV Color) Source #

symbolics :: [String] -> Symbolic [SBV Color] Source #

literal :: Color -> SBV Color Source #

unliteral :: SBV Color -> Maybe Color Source #

fromCW :: CW -> Color Source #

isConcrete :: SBV Color -> Bool Source #

isSymbolic :: SBV Color -> Bool Source #

isConcretely :: SBV Color -> (Color -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Color) Source #

SymWord U2Member Source # |

Instance details

Defined in Documentation.SBV.Examples.Puzzles.U2Bridge

Methods

forall :: String -> Symbolic (SBV U2Member) Source #

forall_ :: Symbolic (SBV U2Member) Source #

mkForallVars :: Int -> Symbolic [SBV U2Member] Source #

exists :: String -> Symbolic (SBV U2Member) Source #

exists_ :: Symbolic (SBV U2Member) Source #

mkExistVars :: Int -> Symbolic [SBV U2Member] Source #

free :: String -> Symbolic (SBV U2Member) Source #

free_ :: Symbolic (SBV U2Member) Source #

mkFreeVars :: Int -> Symbolic [SBV U2Member] Source #

symbolic :: String -> Symbolic (SBV U2Member) Source #

symbolics :: [String] -> Symbolic [SBV U2Member] Source #

literal :: U2Member -> SBV U2Member Source #

unliteral :: SBV U2Member -> Maybe U2Member Source #

fromCW :: CW -> U2Member Source #

isConcrete :: SBV U2Member -> Bool Source #

isSymbolic :: SBV U2Member -> Bool Source #

isConcretely :: SBV U2Member -> (U2Member -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV U2Member) Source #

SymWord Location Source # |

Instance details

Defined in Documentation.SBV.Examples.Puzzles.U2Bridge

Methods

forall :: String -> Symbolic (SBV Location) Source #

forall_ :: Symbolic (SBV Location) Source #

mkForallVars :: Int -> Symbolic [SBV Location] Source #

exists :: String -> Symbolic (SBV Location) Source #

exists_ :: Symbolic (SBV Location) Source #

mkExistVars :: Int -> Symbolic [SBV Location] Source #

free :: String -> Symbolic (SBV Location) Source #

free_ :: Symbolic (SBV Location) Source #

mkFreeVars :: Int -> Symbolic [SBV Location] Source #

symbolic :: String -> Symbolic (SBV Location) Source #

symbolics :: [String] -> Symbolic [SBV Location] Source #

literal :: Location -> SBV Location Source #

unliteral :: SBV Location -> Maybe Location Source #

fromCW :: CW -> Location Source #

isConcrete :: SBV Location -> Bool Source #

isSymbolic :: SBV Location -> Bool Source #

isConcretely :: SBV Location -> (Location -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Location) Source #

SymWord Day Source # |

Instance details

Defined in Documentation.SBV.Examples.Queries.Enums

Methods

forall :: String -> Symbolic (SBV Day) Source #

forall_ :: Symbolic (SBV Day) Source #

mkForallVars :: Int -> Symbolic [SBV Day] Source #

exists :: String -> Symbolic (SBV Day) Source #

exists_ :: Symbolic (SBV Day) Source #

mkExistVars :: Int -> Symbolic [SBV Day] Source #

free :: String -> Symbolic (SBV Day) Source #

free_ :: Symbolic (SBV Day) Source #

mkFreeVars :: Int -> Symbolic [SBV Day] Source #

symbolic :: String -> Symbolic (SBV Day) Source #

symbolics :: [String] -> Symbolic [SBV Day] Source #

literal :: Day -> SBV Day Source #

unliteral :: SBV Day -> Maybe Day Source #

fromCW :: CW -> Day Source #

isConcrete :: SBV Day -> Bool Source #

isSymbolic :: SBV Day -> Bool Source #

isConcretely :: SBV Day -> (Day -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Day) Source #

SymWord BinOp Source # |

Instance details

Defined in Documentation.SBV.Examples.Queries.FourFours

Methods

forall :: String -> Symbolic (SBV BinOp) Source #

forall_ :: Symbolic (SBV BinOp) Source #

mkForallVars :: Int -> Symbolic [SBV BinOp] Source #

exists :: String -> Symbolic (SBV BinOp) Source #

exists_ :: Symbolic (SBV BinOp) Source #

mkExistVars :: Int -> Symbolic [SBV BinOp] Source #

free :: String -> Symbolic (SBV BinOp) Source #

free_ :: Symbolic (SBV BinOp) Source #

mkFreeVars :: Int -> Symbolic [SBV BinOp] Source #

symbolic :: String -> Symbolic (SBV BinOp) Source #

symbolics :: [String] -> Symbolic [SBV BinOp] Source #

literal :: BinOp -> SBV BinOp Source #

unliteral :: SBV BinOp -> Maybe BinOp Source #

fromCW :: CW -> BinOp Source #

isConcrete :: SBV BinOp -> Bool Source #

isSymbolic :: SBV BinOp -> Bool Source #

isConcretely :: SBV BinOp -> (BinOp -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV BinOp) Source #

SymWord UnOp Source # |

Instance details

Defined in Documentation.SBV.Examples.Queries.FourFours

Methods

forall :: String -> Symbolic (SBV UnOp) Source #

forall_ :: Symbolic (SBV UnOp) Source #

mkForallVars :: Int -> Symbolic [SBV UnOp] Source #

exists :: String -> Symbolic (SBV UnOp) Source #

exists_ :: Symbolic (SBV UnOp) Source #

mkExistVars :: Int -> Symbolic [SBV UnOp] Source #

free :: String -> Symbolic (SBV UnOp) Source #

free_ :: Symbolic (SBV UnOp) Source #

mkFreeVars :: Int -> Symbolic [SBV UnOp] Source #

symbolic :: String -> Symbolic (SBV UnOp) Source #

symbolics :: [String] -> Symbolic [SBV UnOp] Source #

literal :: UnOp -> SBV UnOp Source #

unliteral :: SBV UnOp -> Maybe UnOp Source #

fromCW :: CW -> UnOp Source #

isConcrete :: SBV UnOp -> Bool Source #

isSymbolic :: SBV UnOp -> Bool Source #

isConcretely :: SBV UnOp -> (UnOp -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV UnOp) Source #

SymWord B Source # |

Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.Deduce

Methods

forall :: String -> Symbolic (SBV B) Source #

forall_ :: Symbolic (SBV B) Source #

mkForallVars :: Int -> Symbolic [SBV B] Source #

exists :: String -> Symbolic (SBV B) Source #

exists_ :: Symbolic (SBV B) Source #

mkExistVars :: Int -> Symbolic [SBV B] Source #

free :: String -> Symbolic (SBV B) Source #

free_ :: Symbolic (SBV B) Source #

mkFreeVars :: Int -> Symbolic [SBV B] Source #

symbolic :: String -> Symbolic (SBV B) Source #

symbolics :: [String] -> Symbolic [SBV B] Source #

literal :: B -> SBV B Source #

unliteral :: SBV B -> Maybe B Source #

fromCW :: CW -> B Source #

isConcrete :: SBV B -> Bool Source #

isSymbolic :: SBV B -> Bool Source #

isConcretely :: SBV B -> (B -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV B) Source #

SymWord Q Source # |

Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.Sort

Methods

forall :: String -> Symbolic (SBV Q) Source #

forall_ :: Symbolic (SBV Q) Source #

mkForallVars :: Int -> Symbolic [SBV Q] Source #

exists :: String -> Symbolic (SBV Q) Source #

exists_ :: Symbolic (SBV Q) Source #

mkExistVars :: Int -> Symbolic [SBV Q] Source #

free :: String -> Symbolic (SBV Q) Source #

free_ :: Symbolic (SBV Q) Source #

mkFreeVars :: Int -> Symbolic [SBV Q] Source #

symbolic :: String -> Symbolic (SBV Q) Source #

symbolics :: [String] -> Symbolic [SBV Q] Source #

literal :: Q -> SBV Q Source #

unliteral :: SBV Q -> Maybe Q Source #

fromCW :: CW -> Q Source #

isConcrete :: SBV Q -> Bool Source #

isSymbolic :: SBV Q -> Bool Source #

isConcretely :: SBV Q -> (Q -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Q) Source #

SymWord L Source # | Declare instances to make `L` a usable uninterpreted sort. First we need the `SymWord` instance, with the default definition sufficing.

Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.UISortAllSat

Methods

forall :: String -> Symbolic (SBV L) Source #

forall_ :: Symbolic (SBV L) Source #

mkForallVars :: Int -> Symbolic [SBV L] Source #

exists :: String -> Symbolic (SBV L) Source #

exists_ :: Symbolic (SBV L) Source #

mkExistVars :: Int -> Symbolic [SBV L] Source #

free :: String -> Symbolic (SBV L) Source #

free_ :: Symbolic (SBV L) Source #

mkFreeVars :: Int -> Symbolic [SBV L] Source #

symbolic :: String -> Symbolic (SBV L) Source #

symbolics :: [String] -> Symbolic [SBV L] Source #

literal :: L -> SBV L Source #

unliteral :: SBV L -> Maybe L Source #

fromCW :: CW -> L Source #

isConcrete :: SBV L -> Bool Source #

isSymbolic :: SBV L -> Bool Source #

isConcretely :: SBV L -> (L -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV L) Source #

SymWord a => SymWord [a] Source # |

Instance details

Defined in Data.SBV.Core.Model

Methods

forall :: String -> Symbolic (SBV [a]) Source #

forall_ :: Symbolic (SBV [a]) Source #

mkForallVars :: Int -> Symbolic [SBV [a]] Source #

exists :: String -> Symbolic (SBV [a]) Source #

exists_ :: Symbolic (SBV [a]) Source #

mkExistVars :: Int -> Symbolic [SBV [a]] Source #

free :: String -> Symbolic (SBV [a]) Source #

free_ :: Symbolic (SBV [a]) Source #

mkFreeVars :: Int -> Symbolic [SBV [a]] Source #

symbolic :: String -> Symbolic (SBV [a]) Source #

symbolics :: [String] -> Symbolic [SBV [a]] Source #

literal :: [a] -> SBV [a] Source #

unliteral :: SBV [a] -> Maybe [a] Source #

fromCW :: CW -> [a] Source #

isConcrete :: SBV [a] -> Bool Source #

isSymbolic :: SBV [a] -> Bool Source #

isConcretely :: SBV [a] -> ([a] -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV [a]) Source #

data Symbolic a Source #

A Symbolic computation. Represented by a reader monad carrying the state of the computation, layered on top of IO for creating unique references to hold onto intermediate results.

Instances

Monad Symbolic Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods (>>=) :: Symbolic a -> (a -> Symbolic b) -> Symbolic b Source # (>>) :: Symbolic a -> Symbolic b -> Symbolic b Source # return :: a -> Symbolic a Source # fail :: String -> Symbolic a Source #
Functor Symbolic Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods fmap :: (a -> b) -> Symbolic a -> Symbolic b Source # (<$) :: a -> Symbolic b -> Symbolic a Source #
MonadFail Symbolic Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods fail :: String -> Symbolic a Source #
Applicative Symbolic Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods pure :: a -> Symbolic a Source # (<*>) :: Symbolic (a -> b) -> Symbolic a -> Symbolic b Source # liftA2 :: (a -> b -> c) -> Symbolic a -> Symbolic b -> Symbolic c Source # (*>) :: Symbolic a -> Symbolic b -> Symbolic b Source # (<*) :: Symbolic a -> Symbolic b -> Symbolic a Source #
MonadIO Symbolic Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods liftIO :: IO a -> Symbolic a Source #
SolverContext Symbolic Source # | Symbolic computations provide a context for writing symbolic programs.

Instance details

Defined in Data.SBV.Core.Model

Methods

constrain :: SBool -> Symbolic () Source #

softConstrain :: SBool -> Symbolic () Source #

namedConstraint :: String -> SBool -> Symbolic () Source #

constrainWithAttribute :: [(String, String)] -> SBool -> Symbolic () Source #

setInfo :: String -> [String] -> Symbolic () Source #

setOption :: SMTOption -> Symbolic () Source #

setLogic :: Logic -> Symbolic () Source #

setTimeOut :: Integer -> Symbolic () Source #

Provable Goal Source # |

Instance details

Defined in Data.SBV

Methods

forAll_ :: Goal -> Predicate Source #

forAll :: [String] -> Goal -> Predicate Source #

forSome_ :: Goal -> Predicate Source #

forSome :: [String] -> Goal -> Predicate Source #

prove :: Goal -> IO ThmResult Source #

proveWith :: SMTConfig -> Goal -> IO ThmResult Source #

sat :: Goal -> IO SatResult Source #

satWith :: SMTConfig -> Goal -> IO SatResult Source #

allSat :: Goal -> IO AllSatResult Source #

allSatWith :: SMTConfig -> Goal -> IO AllSatResult Source #

optimize :: OptimizeStyle -> Goal -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> Goal -> IO OptimizeResult Source #

isVacuous :: Goal -> IO Bool Source #

isVacuousWith :: SMTConfig -> Goal -> IO Bool Source #

isTheorem :: Goal -> IO Bool Source #

isTheoremWith :: SMTConfig -> Goal -> IO Bool Source #

isSatisfiable :: Goal -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> Goal -> IO Bool Source #

proveWithAll :: [SMTConfig] -> Goal -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> Goal -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> Goal -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> Goal -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> Goal -> IO String Source #

Provable Predicate Source # |

Instance details

Defined in Data.SBV.Provers.Prover

Methods

forAll_ :: Predicate -> Predicate Source #

forAll :: [String] -> Predicate -> Predicate Source #

forSome_ :: Predicate -> Predicate Source #

forSome :: [String] -> Predicate -> Predicate Source #

prove :: Predicate -> IO ThmResult Source #

proveWith :: SMTConfig -> Predicate -> IO ThmResult Source #

sat :: Predicate -> IO SatResult Source #

satWith :: SMTConfig -> Predicate -> IO SatResult Source #

allSat :: Predicate -> IO AllSatResult Source #

allSatWith :: SMTConfig -> Predicate -> IO AllSatResult Source #

optimize :: OptimizeStyle -> Predicate -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> Predicate -> IO OptimizeResult Source #

isVacuous :: Predicate -> IO Bool Source #

isVacuousWith :: SMTConfig -> Predicate -> IO Bool Source #

isTheorem :: Predicate -> IO Bool Source #

isTheoremWith :: SMTConfig -> Predicate -> IO Bool Source #

isSatisfiable :: Predicate -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> Predicate -> IO Bool Source #

proveWithAll :: [SMTConfig] -> Predicate -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> Predicate -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> Predicate -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> Predicate -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> Predicate -> IO String Source #

MonadReader State Symbolic Source # |
Instance details Defined in Data.SBV.Core.Symbolic Methods ask :: Symbolic State Source # local :: (State -> State) -> Symbolic a -> Symbolic a Source # reader :: (State -> a) -> Symbolic a Source #
Testable (Symbolic SVal) Source # |
Instance details Defined in Data.SBV.Core.Model Methods property :: Symbolic SVal -> Property Source #
Testable (Symbolic SBool) Source # |
Instance details Defined in Data.SBV.Core.Model Methods property :: Symbolic SBool -> Property Source #
NFData a => SExecutable (Symbolic a) Source # |
Instance details Defined in Data.SBV.Provers.Prover Methods sName_ :: Symbolic a -> Symbolic () Source # sName :: [String] -> Symbolic a -> Symbolic () Source # safe :: Symbolic a -> IO [SafeResult] Source # safeWith :: SMTConfig -> Symbolic a -> IO [SafeResult] Source #

label :: SymWord a => String -> SBV a -> SBV a Source #

label: Label the result of an expression. This is essentially a no-op, but useful as it generates a comment in the generated C/SMT-Lib code. Note that if the argument is a constant, then the label is dropped completely, per the usual constant folding strategy. Compare this to `observe` which is good for printing counter-examples.

output :: Outputtable a => a -> Symbolic a Source #

Mark an interim result as an output. Useful when constructing Symbolic programs that return multiple values, or when the result is programmatically computed.

runSMT :: Symbolic a -> IO a Source #

Run an arbitrary symbolic computation, equivalent to ``runSMTWith` `defaultSMTCfg``

runSMTWith :: SMTConfig -> Symbolic a -> IO a Source #

Runs an arbitrary symbolic computation, exposed to the user in SAT mode

# Module exports

The SBV library exports the following modules wholesale, as user programs will have to import these modules to make any sensible use of the SBV functionality.

module Data.Bits

module Data.Word

module Data.Int

module Data.Ratio

# Orphan instances

Provable Goal Source # |

Instance details

Methods

forAll_ :: Goal -> Predicate Source #

forAll :: [String] -> Goal -> Predicate Source #

forSome_ :: Goal -> Predicate Source #

forSome :: [String] -> Goal -> Predicate Source #

prove :: Goal -> IO ThmResult Source #

proveWith :: SMTConfig -> Goal -> IO ThmResult Source #

sat :: Goal -> IO SatResult Source #

satWith :: SMTConfig -> Goal -> IO SatResult Source #

allSat :: Goal -> IO AllSatResult Source #

allSatWith :: SMTConfig -> Goal -> IO AllSatResult Source #

optimize :: OptimizeStyle -> Goal -> IO OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> Goal -> IO OptimizeResult Source #

isVacuous :: Goal -> IO Bool Source #

isVacuousWith :: SMTConfig -> Goal -> IO Bool Source #

isTheorem :: Goal -> IO Bool Source #

isTheoremWith :: SMTConfig -> Goal -> IO Bool Source #

isSatisfiable :: Goal -> IO Bool Source #

isSatisfiableWith :: SMTConfig -> Goal -> IO Bool Source #

proveWithAll :: [SMTConfig] -> Goal -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

proveWithAny :: [SMTConfig] -> Goal -> IO (Solver, NominalDiffTime, ThmResult) Source #

satWithAll :: [SMTConfig] -> Goal -> IO [(Solver, NominalDiffTime, SatResult)] Source #

satWithAny :: [SMTConfig] -> Goal -> IO (Solver, NominalDiffTime, SatResult) Source #

generateSMTBenchmark :: Bool -> Goal -> IO String Source #