sbv-10.2: SMT Based Verification: Symbolic Haskell theorem prover using SMT solving.
Copyright(c) Levent Erkok
LicenseBSD3
Maintainererkokl@gmail.com
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.SBV

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

And similarly, sat finds a satisfying instance. The types involved are:

    prove :: Provable a => a -> IO ThmResult
    sat   :: Satisfiable a => a -> IO SatResult

The classes Provable and Satisfiable come 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).
  • SWord n: Generalized symbolic words of arbitrary bit-size.
  • SInt n: Generalized symbolic ints of arbitrary bit-size.
  • SInteger: Unbounded signed integers.
  • SReal: Algebraic-real numbers.
  • SFloat: IEEE-754 single-precision floating point values.
  • SDouble: IEEE-754 double-precision floating point values.
  • SRational: Rationals. (Ratio of two symbolic integers.)
  • SFloatingPoint: Generalized IEEE-754 floating point values, with user specified exponent and mantissa widths.
  • SChar, SString, RegExp: Characters, strings and regular expressions.
  • SList: Symbolic lists (which can be nested)
  • STuple, STuple2, STuple3, .., STuple8 : Symbolic tuples (upto 8-tuples, can be nested)
  • SEither: Symbolic sums
  • SMaybe: Symbolic optional values.
  • SSet: Symbolic sets.
  • SArray: 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.
  • Ability to define SMTLib functions, generated directly from Haskell versions, including support for recursive and mutually recursive functions.
  • Express quantified formulas (both universals and existentials, including alternating quantifiers), covering first-order logic.
  • Model validation: SBV can validate models returned by solvers, which allows for protection against bugs in SMT solvers and SBV itself. (See the validateModel parameter.)

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:

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

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 Bools. 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

Boolean values and functions

sTrue :: SBool Source #

Symbolic True

sNot :: SBool -> SBool Source #

Symbolic boolean negation

(.&&) :: SBool -> SBool -> SBool infixr 3 Source #

Symbolic conjunction

(.||) :: SBool -> SBool -> SBool infixr 2 Source #

Symbolic disjunction

(.<+>) :: SBool -> SBool -> SBool infixl 6 Source #

Symbolic logical xor

(.~&) :: SBool -> SBool -> SBool infixr 3 Source #

Symbolic nand

(.~|) :: SBool -> SBool -> SBool infixr 2 Source #

Symbolic nor

(.=>) :: SBool -> SBool -> SBool infixr 1 Source #

Symbolic implication

(.<=>) :: SBool -> SBool -> SBool infixr 1 Source #

Symbolic boolean equivalence

fromBool :: Bool -> SBool Source #

Conversion from Bool to SBool

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

Returns 1 if the boolean is sTrue, otherwise 0.

Logical aggregations

sAnd :: [SBool] -> SBool Source #

Generalization of and

sOr :: [SBool] -> SBool Source #

Generalization of or

sAny :: (a -> SBool) -> [a] -> SBool Source #

Generalization of any

sAll :: (a -> SBool) -> [a] -> SBool 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

type SWord (n :: Nat) = SBV (WordN n) Source #

A symbolic unsigned bit-vector carrying its size info

data WordN (n :: Nat) Source #

An unsigned bit-vector carrying its size info

Instances

Instances details
KnownNat n => Arbitrary (WordN n) Source #

Quickcheck instance for WordN

Instance details

Defined in Data.SBV.Core.Sized

Methods

arbitrary :: Gen (WordN n) #

shrink :: WordN n -> [WordN n] #

(KnownNat n, BVIsNonZero n) => Bits (WordN n) Source # 
Instance details

Defined in Data.SBV.Core.Sized

Methods

(.&.) :: WordN n -> WordN n -> WordN n #

(.|.) :: WordN n -> WordN n -> WordN n #

xor :: WordN n -> WordN n -> WordN n #

complement :: WordN n -> WordN n #

shift :: WordN n -> Int -> WordN n #

rotate :: WordN n -> Int -> WordN n #

zeroBits :: WordN n #

bit :: Int -> WordN n #

setBit :: WordN n -> Int -> WordN n #

clearBit :: WordN n -> Int -> WordN n #

complementBit :: WordN n -> Int -> WordN n #

testBit :: WordN n -> Int -> Bool #

bitSizeMaybe :: WordN n -> Maybe Int #

bitSize :: WordN n -> Int #

isSigned :: WordN n -> Bool #

shiftL :: WordN n -> Int -> WordN n #

unsafeShiftL :: WordN n -> Int -> WordN n #

shiftR :: WordN n -> Int -> WordN n #

unsafeShiftR :: WordN n -> Int -> WordN n #

rotateL :: WordN n -> Int -> WordN n #

rotateR :: WordN n -> Int -> WordN n #

popCount :: WordN n -> Int #

(KnownNat n, BVIsNonZero n) => Bounded (WordN n) Source #

Bounded instance for WordN

Instance details

Defined in Data.SBV.Core.Sized

Methods

minBound :: WordN n #

maxBound :: WordN n #

(KnownNat n, BVIsNonZero n) => Enum (WordN n) Source #

Enum instance for WordN

Instance details

Defined in Data.SBV.Core.Sized

Methods

succ :: WordN n -> WordN n #

pred :: WordN n -> WordN n #

toEnum :: Int -> WordN n #

fromEnum :: WordN n -> Int #

enumFrom :: WordN n -> [WordN n] #

enumFromThen :: WordN n -> WordN n -> [WordN n] #

enumFromTo :: WordN n -> WordN n -> [WordN n] #

enumFromThenTo :: WordN n -> WordN n -> WordN n -> [WordN n] #

(KnownNat n, BVIsNonZero n) => Num (WordN n) Source #

Num instance for WordN

Instance details

Defined in Data.SBV.Core.Sized

Methods

(+) :: WordN n -> WordN n -> WordN n #

(-) :: WordN n -> WordN n -> WordN n #

(*) :: WordN n -> WordN n -> WordN n #

negate :: WordN n -> WordN n #

abs :: WordN n -> WordN n #

signum :: WordN n -> WordN n #

fromInteger :: Integer -> WordN n #

(KnownNat n, BVIsNonZero n) => Integral (WordN n) Source #

Integral instance for WordN

Instance details

Defined in Data.SBV.Core.Sized

Methods

quot :: WordN n -> WordN n -> WordN n #

rem :: WordN n -> WordN n -> WordN n #

div :: WordN n -> WordN n -> WordN n #

mod :: WordN n -> WordN n -> WordN n #

quotRem :: WordN n -> WordN n -> (WordN n, WordN n) #

divMod :: WordN n -> WordN n -> (WordN n, WordN n) #

toInteger :: WordN n -> Integer #

(KnownNat n, BVIsNonZero n) => Real (WordN n) Source #

Real instance for WordN

Instance details

Defined in Data.SBV.Core.Sized

Methods

toRational :: WordN n -> Rational #

Show (WordN n) Source #

Show instance for WordN

Instance details

Defined in Data.SBV.Core.Sized

Methods

showsPrec :: Int -> WordN n -> ShowS #

show :: WordN n -> String #

showList :: [WordN n] -> ShowS #

Eq (WordN n) Source # 
Instance details

Defined in Data.SBV.Core.Sized

Methods

(==) :: WordN n -> WordN n -> Bool #

(/=) :: WordN n -> WordN n -> Bool #

Ord (WordN n) Source # 
Instance details

Defined in Data.SBV.Core.Sized

Methods

compare :: WordN n -> WordN n -> Ordering #

(<) :: WordN n -> WordN n -> Bool #

(<=) :: WordN n -> WordN n -> Bool #

(>) :: WordN n -> WordN n -> Bool #

(>=) :: WordN n -> WordN n -> Bool #

max :: WordN n -> WordN n -> WordN n #

min :: WordN n -> WordN n -> WordN n #

ByteConverter (SWord 8) Source #

SWord 8 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 8 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 8 Source #

ByteConverter (SWord 16) Source #

SWord 16 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 16 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 16 Source #

ByteConverter (SWord 32) Source #

SWord 32 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 32 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 32 Source #

ByteConverter (SWord 64) Source #

SWord 64 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 64 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 64 Source #

ByteConverter (SWord 128) Source #

SWord 128 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 128 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 128 Source #

ByteConverter (SWord 256) Source #

SWord 256 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 256 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 256 Source #

ByteConverter (SWord 512) Source #

SWord 512 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 512 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 512 Source #

ByteConverter (SWord 1024) Source #

SWord 1024 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 1024 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 1024 Source #

(KnownNat n, BVIsNonZero n) => SymVal (WordN n) Source #

SymVal instance for WordN

Instance details

Defined in Data.SBV.Core.Sized

(KnownNat n, BVIsNonZero n) => HasKind (WordN n) Source #

WordN has a kind

Instance details

Defined in Data.SBV.Core.Sized

(KnownNat n, BVIsNonZero n) => Metric (WordN n) Source #

Optimizing WordN

Instance details

Defined in Data.SBV.Core.Sized

Associated Types

type MetricSpace (WordN n) Source #

(KnownNat n, BVIsNonZero n) => SDivisible (SWord n) Source #

SDivisible instance for SWord

Instance details

Defined in Data.SBV.Core.Sized

Methods

sQuotRem :: SWord n -> SWord n -> (SWord n, SWord n) Source #

sDivMod :: SWord n -> SWord n -> (SWord n, SWord n) Source #

sQuot :: SWord n -> SWord n -> SWord n Source #

sRem :: SWord n -> SWord n -> SWord n Source #

sDiv :: SWord n -> SWord n -> SWord n Source #

sMod :: SWord n -> SWord n -> SWord n Source #

(KnownNat n, BVIsNonZero n) => SDivisible (WordN n) Source #

SDivisible instance for WordN

Instance details

Defined in Data.SBV.Core.Sized

Methods

sQuotRem :: WordN n -> WordN n -> (WordN n, WordN n) Source #

sDivMod :: WordN n -> WordN n -> (WordN n, WordN n) Source #

sQuot :: WordN n -> WordN n -> WordN n Source #

sRem :: WordN n -> WordN n -> WordN n Source #

sDiv :: WordN n -> WordN n -> WordN n Source #

sMod :: WordN n -> WordN n -> WordN n Source #

(KnownNat n, BVIsNonZero n) => SFiniteBits (WordN n) Source #

SFiniteBits instance for WordN

Instance details

Defined in Data.SBV.Core.Sized

(KnownNat n, BVIsNonZero n) => SIntegral (WordN n) Source #

SIntegral instance for WordN

Instance details

Defined in Data.SBV.Core.Sized

(KnownNat n, BVIsNonZero n) => SatModel (WordN n) Source #

Constructing models for WordN

Instance details

Defined in Data.SBV.Core.Sized

Methods

parseCVs :: [CV] -> Maybe (WordN n, [CV]) Source #

cvtModel :: (WordN n -> Maybe b) -> Maybe (WordN n, [CV]) -> Maybe (b, [CV]) Source #

(KnownNat n, BVIsNonZero n) => ArithOverflow (SWord n) Source # 
Instance details

Defined in Data.SBV.Tools.Overflow

Methods

bvAddO :: SWord n -> SWord n -> (SBool, SBool) Source #

bvSubO :: SWord n -> SWord n -> (SBool, SBool) Source #

bvMulO :: SWord n -> SWord n -> (SBool, SBool) Source #

bvMulOFast :: SWord n -> SWord n -> (SBool, SBool) Source #

bvDivO :: SWord n -> SWord n -> (SBool, SBool) Source #

bvNegO :: SWord n -> (SBool, SBool) Source #

(KnownNat n, BVIsNonZero n) => CheckedArithmetic (WordN n) Source # 
Instance details

Defined in Data.SBV.Tools.Overflow

Methods

(+!) :: SBV (WordN n) -> SBV (WordN n) -> SBV (WordN n) Source #

(-!) :: SBV (WordN n) -> SBV (WordN n) -> SBV (WordN n) Source #

(*!) :: SBV (WordN n) -> SBV (WordN n) -> SBV (WordN n) Source #

(/!) :: SBV (WordN n) -> SBV (WordN n) -> SBV (WordN n) Source #

negateChecked :: SBV (WordN n) -> SBV (WordN n) Source #

(KnownNat n, BVIsNonZero n) => Polynomial (SWord n) Source # 
Instance details

Defined in Data.SBV.Tools.Polynomial

Methods

polynomial :: [Int] -> SWord n Source #

pAdd :: SWord n -> SWord n -> SWord n Source #

pMult :: (SWord n, SWord n, [Int]) -> SWord n Source #

pDiv :: SWord n -> SWord n -> SWord n Source #

pMod :: SWord n -> SWord n -> SWord n Source #

pDivMod :: SWord n -> SWord n -> (SWord n, SWord n) Source #

showPoly :: SWord n -> String Source #

showPolynomial :: Bool -> SWord n -> String Source #

type MetricSpace (WordN n) Source # 
Instance details

Defined in Data.SBV.Core.Sized

type MetricSpace (WordN n) = WordN n

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

type SInt (n :: Nat) = SBV (IntN n) Source #

A symbolic signed bit-vector carrying its size info

data IntN (n :: Nat) Source #

A signed bit-vector carrying its size info

Instances

Instances details
KnownNat n => Arbitrary (IntN n) Source #

Quickcheck instance for IntN

Instance details

Defined in Data.SBV.Core.Sized

Methods

arbitrary :: Gen (IntN n) #

shrink :: IntN n -> [IntN n] #

(KnownNat n, BVIsNonZero n) => Bits (IntN n) Source # 
Instance details

Defined in Data.SBV.Core.Sized

Methods

(.&.) :: IntN n -> IntN n -> IntN n #

(.|.) :: IntN n -> IntN n -> IntN n #

xor :: IntN n -> IntN n -> IntN n #

complement :: IntN n -> IntN n #

shift :: IntN n -> Int -> IntN n #

rotate :: IntN n -> Int -> IntN n #

zeroBits :: IntN n #

bit :: Int -> IntN n #

setBit :: IntN n -> Int -> IntN n #

clearBit :: IntN n -> Int -> IntN n #

complementBit :: IntN n -> Int -> IntN n #

testBit :: IntN n -> Int -> Bool #

bitSizeMaybe :: IntN n -> Maybe Int #

bitSize :: IntN n -> Int #

isSigned :: IntN n -> Bool #

shiftL :: IntN n -> Int -> IntN n #

unsafeShiftL :: IntN n -> Int -> IntN n #

shiftR :: IntN n -> Int -> IntN n #

unsafeShiftR :: IntN n -> Int -> IntN n #

rotateL :: IntN n -> Int -> IntN n #

rotateR :: IntN n -> Int -> IntN n #

popCount :: IntN n -> Int #

(KnownNat n, BVIsNonZero n) => Bounded (IntN n) Source #

Bounded instance for IntN

Instance details

Defined in Data.SBV.Core.Sized

Methods

minBound :: IntN n #

maxBound :: IntN n #

(KnownNat n, BVIsNonZero n) => Enum (IntN n) Source #

Enum instance for IntN

Instance details

Defined in Data.SBV.Core.Sized

Methods

succ :: IntN n -> IntN n #

pred :: IntN n -> IntN n #

toEnum :: Int -> IntN n #

fromEnum :: IntN n -> Int #

enumFrom :: IntN n -> [IntN n] #

enumFromThen :: IntN n -> IntN n -> [IntN n] #

enumFromTo :: IntN n -> IntN n -> [IntN n] #

enumFromThenTo :: IntN n -> IntN n -> IntN n -> [IntN n] #

(KnownNat n, BVIsNonZero n) => Num (IntN n) Source #

Num instance for IntN

Instance details

Defined in Data.SBV.Core.Sized

Methods

(+) :: IntN n -> IntN n -> IntN n #

(-) :: IntN n -> IntN n -> IntN n #

(*) :: IntN n -> IntN n -> IntN n #

negate :: IntN n -> IntN n #

abs :: IntN n -> IntN n #

signum :: IntN n -> IntN n #

fromInteger :: Integer -> IntN n #

(KnownNat n, BVIsNonZero n) => Integral (IntN n) Source #

Integral instance for IntN

Instance details

Defined in Data.SBV.Core.Sized

Methods

quot :: IntN n -> IntN n -> IntN n #

rem :: IntN n -> IntN n -> IntN n #

div :: IntN n -> IntN n -> IntN n #

mod :: IntN n -> IntN n -> IntN n #

quotRem :: IntN n -> IntN n -> (IntN n, IntN n) #

divMod :: IntN n -> IntN n -> (IntN n, IntN n) #

toInteger :: IntN n -> Integer #

(KnownNat n, BVIsNonZero n) => Real (IntN n) Source #

Real instance for IntN

Instance details

Defined in Data.SBV.Core.Sized

Methods

toRational :: IntN n -> Rational #

Show (IntN n) Source #

Show instance for IntN

Instance details

Defined in Data.SBV.Core.Sized

Methods

showsPrec :: Int -> IntN n -> ShowS #

show :: IntN n -> String #

showList :: [IntN n] -> ShowS #

Eq (IntN n) Source # 
Instance details

Defined in Data.SBV.Core.Sized

Methods

(==) :: IntN n -> IntN n -> Bool #

(/=) :: IntN n -> IntN n -> Bool #

Ord (IntN n) Source # 
Instance details

Defined in Data.SBV.Core.Sized

Methods

compare :: IntN n -> IntN n -> Ordering #

(<) :: IntN n -> IntN n -> Bool #

(<=) :: IntN n -> IntN n -> Bool #

(>) :: IntN n -> IntN n -> Bool #

(>=) :: IntN n -> IntN n -> Bool #

max :: IntN n -> IntN n -> IntN n #

min :: IntN n -> IntN n -> IntN n #

(KnownNat n, BVIsNonZero n) => SymVal (IntN n) Source #

SymVal instance for IntN

Instance details

Defined in Data.SBV.Core.Sized

(KnownNat n, BVIsNonZero n) => HasKind (IntN n) Source #

IntN has a kind

Instance details

Defined in Data.SBV.Core.Sized

(KnownNat n, BVIsNonZero n) => Metric (IntN n) Source #

Optimizing IntN

Instance details

Defined in Data.SBV.Core.Sized

Associated Types

type MetricSpace (IntN n) Source #

(KnownNat n, BVIsNonZero n) => SDivisible (IntN n) Source #

SDivisible instance for IntN

Instance details

Defined in Data.SBV.Core.Sized

Methods

sQuotRem :: IntN n -> IntN n -> (IntN n, IntN n) Source #

sDivMod :: IntN n -> IntN n -> (IntN n, IntN n) Source #

sQuot :: IntN n -> IntN n -> IntN n Source #

sRem :: IntN n -> IntN n -> IntN n Source #

sDiv :: IntN n -> IntN n -> IntN n Source #

sMod :: IntN n -> IntN n -> IntN n Source #

(KnownNat n, BVIsNonZero n) => SDivisible (SInt n) Source #

SDivisible instance for SInt

Instance details

Defined in Data.SBV.Core.Sized

Methods

sQuotRem :: SInt n -> SInt n -> (SInt n, SInt n) Source #

sDivMod :: SInt n -> SInt n -> (SInt n, SInt n) Source #

sQuot :: SInt n -> SInt n -> SInt n Source #

sRem :: SInt n -> SInt n -> SInt n Source #

sDiv :: SInt n -> SInt n -> SInt n Source #

sMod :: SInt n -> SInt n -> SInt n Source #

(KnownNat n, BVIsNonZero n) => SFiniteBits (IntN n) Source #

SFiniteBits instance for IntN

Instance details

Defined in Data.SBV.Core.Sized

(KnownNat n, BVIsNonZero n) => SIntegral (IntN n) Source #

SIntegral instance for IntN

Instance details

Defined in Data.SBV.Core.Sized

(KnownNat n, BVIsNonZero n) => SatModel (IntN n) Source #

Constructing models for IntN

Instance details

Defined in Data.SBV.Core.Sized

Methods

parseCVs :: [CV] -> Maybe (IntN n, [CV]) Source #

cvtModel :: (IntN n -> Maybe b) -> Maybe (IntN n, [CV]) -> Maybe (b, [CV]) Source #

(KnownNat n, BVIsNonZero n) => ArithOverflow (SInt n) Source # 
Instance details

Defined in Data.SBV.Tools.Overflow

Methods

bvAddO :: SInt n -> SInt n -> (SBool, SBool) Source #

bvSubO :: SInt n -> SInt n -> (SBool, SBool) Source #

bvMulO :: SInt n -> SInt n -> (SBool, SBool) Source #

bvMulOFast :: SInt n -> SInt n -> (SBool, SBool) Source #

bvDivO :: SInt n -> SInt n -> (SBool, SBool) Source #

bvNegO :: SInt n -> (SBool, SBool) Source #

(KnownNat n, BVIsNonZero n) => CheckedArithmetic (IntN n) Source # 
Instance details

Defined in Data.SBV.Tools.Overflow

Methods

(+!) :: SBV (IntN n) -> SBV (IntN n) -> SBV (IntN n) Source #

(-!) :: SBV (IntN n) -> SBV (IntN n) -> SBV (IntN n) Source #

(*!) :: SBV (IntN n) -> SBV (IntN n) -> SBV (IntN n) Source #

(/!) :: SBV (IntN n) -> SBV (IntN n) -> SBV (IntN n) Source #

negateChecked :: SBV (IntN n) -> SBV (IntN n) Source #

type MetricSpace (IntN n) Source # 
Instance details

Defined in Data.SBV.Core.Sized

type MetricSpace (IntN n) = WordN n

Converting between fixed-size and arbitrary bitvectors

type family BVIsNonZero (arg :: Nat) :: Constraint where ... Source #

Type family to create the appropriate non-zero constraint

Equations

BVIsNonZero 0 = TypeError BVZeroWidth 
BVIsNonZero _ = () 

type family FromSized (t :: Type) :: Type where ... Source #

Capture the correspondence between sized and fixed-sized BVs

type family ToSized (t :: Type) :: Type where ... Source #

Capture the correspondence between fixed-sized and sized BVs

fromSized :: FromSizedBV a => a -> FromSized a Source #

Convert a sized bit-vector to the corresponding fixed-sized bit-vector, for instance 'SWord 16' to SWord16. See also toSized.

toSized :: ToSizedBV a => a -> ToSized a Source #

Convert a fixed-sized bit-vector to the corresponding sized bit-vector, for instance SWord16 to 'SWord 16'. See also fromSized.

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:

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 family ValidFloat (eb :: Nat) (sb :: Nat) :: Constraint where ... Source #

A valid float has restrictions on eb/sb values. NB. In the below encoding, I found that CPP is very finicky about substitution of the machine-dependent macros. If you try to put the conditionals in the same line, it fails to substitute for some reason. Hence the awkward spacing. Filed this as a bug report for CPPHS at https://github.com/malcolmwallace/cpphs/issues/25.

Equations

ValidFloat (eb :: Nat) (sb :: Nat) = (KnownNat eb, KnownNat sb, If ((((eb `CmpNat` 2) == 'EQ) || ((eb `CmpNat` 2) == 'GT)) && ((((eb `CmpNat` 61) == 'EQ) || ((eb `CmpNat` 61) == 'LT)) && ((((sb `CmpNat` 2) == 'EQ) || ((sb `CmpNat` 2) == 'GT)) && (((sb `CmpNat` 4611686018427387902) == 'EQ) || ((sb `CmpNat` 4611686018427387902) == 'LT))))) (() :: Constraint) (TypeError (InvalidFloat eb sb))) 

type SFloat = SBV Float Source #

IEEE-754 single-precision floating point numbers

type SDouble = SBV Double Source #

IEEE-754 double-precision floating point numbers

type SFloatingPoint (eb :: Nat) (sb :: Nat) = SBV (FloatingPoint eb sb) Source #

A symbolic arbitrary precision floating point value

data FloatingPoint (eb :: Nat) (sb :: Nat) Source #

A floating point value, indexed by its exponent and significand sizes.

An IEEE SP is FloatingPoint 8 24 DP is FloatingPoint 11 53 etc.

Instances

Instances details
ValidFloat eb sb => Floating (SFloatingPoint eb sb) Source #

We give a specific instance for SFloatingPoint, because the underlying floating-point type doesn't support fromRational directly. The overlap with the above instance is unfortunate.

Instance details

Defined in Data.SBV.Core.Model

ValidFloat eb sb => Floating (FloatingPoint eb sb) Source # 
Instance details

Defined in Data.SBV.Core.SizedFloats

Methods

pi :: FloatingPoint eb sb #

exp :: FloatingPoint eb sb -> FloatingPoint eb sb #

log :: FloatingPoint eb sb -> FloatingPoint eb sb #

sqrt :: FloatingPoint eb sb -> FloatingPoint eb sb #

(**) :: FloatingPoint eb sb -> FloatingPoint eb sb -> FloatingPoint eb sb #

logBase :: FloatingPoint eb sb -> FloatingPoint eb sb -> FloatingPoint eb sb #

sin :: FloatingPoint eb sb -> FloatingPoint eb sb #

cos :: FloatingPoint eb sb -> FloatingPoint eb sb #

tan :: FloatingPoint eb sb -> FloatingPoint eb sb #

asin :: FloatingPoint eb sb -> FloatingPoint eb sb #

acos :: FloatingPoint eb sb -> FloatingPoint eb sb #

atan :: FloatingPoint eb sb -> FloatingPoint eb sb #

sinh :: FloatingPoint eb sb -> FloatingPoint eb sb #

cosh :: FloatingPoint eb sb -> FloatingPoint eb sb #

tanh :: FloatingPoint eb sb -> FloatingPoint eb sb #

asinh :: FloatingPoint eb sb -> FloatingPoint eb sb #

acosh :: FloatingPoint eb sb -> FloatingPoint eb sb #

atanh :: FloatingPoint eb sb -> FloatingPoint eb sb #

log1p :: FloatingPoint eb sb -> FloatingPoint eb sb #

expm1 :: FloatingPoint eb sb -> FloatingPoint eb sb #

log1pexp :: FloatingPoint eb sb -> FloatingPoint eb sb #

log1mexp :: FloatingPoint eb sb -> FloatingPoint eb sb #

ValidFloat eb sb => RealFloat (FloatingPoint eb sb) Source #

RealFloat instance for FloatingPoint. NB. The methods haven't been subjected to much testing, so beware of any floating-point snafus here.

Instance details

Defined in Data.SBV.Core.Floating

ValidFloat eb sb => Num (FloatingPoint eb sb) Source #

Num instance for FloatingPoint

Instance details

Defined in Data.SBV.Core.SizedFloats

Methods

(+) :: FloatingPoint eb sb -> FloatingPoint eb sb -> FloatingPoint eb sb #

(-) :: FloatingPoint eb sb -> FloatingPoint eb sb -> FloatingPoint eb sb #

(*) :: FloatingPoint eb sb -> FloatingPoint eb sb -> FloatingPoint eb sb #

negate :: FloatingPoint eb sb -> FloatingPoint eb sb #

abs :: FloatingPoint eb sb -> FloatingPoint eb sb #

signum :: FloatingPoint eb sb -> FloatingPoint eb sb #

fromInteger :: Integer -> FloatingPoint eb sb #

ValidFloat eb sb => Fractional (FloatingPoint eb sb) Source # 
Instance details

Defined in Data.SBV.Core.SizedFloats

Methods

(/) :: FloatingPoint eb sb -> FloatingPoint eb sb -> FloatingPoint eb sb #

recip :: FloatingPoint eb sb -> FloatingPoint eb sb #

fromRational :: Rational -> FloatingPoint eb sb #

ValidFloat eb sb => Real (FloatingPoint eb sb) Source #

Real instance for FloatingPoint. NB. The methods haven't been subjected to much testing, so beware of any floating-point snafus here.

Instance details

Defined in Data.SBV.Core.Floating

Methods

toRational :: FloatingPoint eb sb -> Rational #

ValidFloat eb sb => RealFrac (FloatingPoint eb sb) Source #

RealFrac instance for FloatingPoint. NB. The methods haven't been subjected to much testing, so beware of any floating-point snafus here.

Instance details

Defined in Data.SBV.Core.Floating

Methods

properFraction :: Integral b => FloatingPoint eb sb -> (b, FloatingPoint eb sb) #

truncate :: Integral b => FloatingPoint eb sb -> b #

round :: Integral b => FloatingPoint eb sb -> b #

ceiling :: Integral b => FloatingPoint eb sb -> b #

floor :: Integral b => FloatingPoint eb sb -> b #

Show (FloatingPoint eb sb) Source #

Show instance for Floats. By default we print in base 10, with standard scientific notation.

Instance details

Defined in Data.SBV.Core.SizedFloats

Methods

showsPrec :: Int -> FloatingPoint eb sb -> ShowS #

show :: FloatingPoint eb sb -> String #

showList :: [FloatingPoint eb sb] -> ShowS #

Eq (FloatingPoint eb sb) Source # 
Instance details

Defined in Data.SBV.Core.SizedFloats

Methods

(==) :: FloatingPoint eb sb -> FloatingPoint eb sb -> Bool #

(/=) :: FloatingPoint eb sb -> FloatingPoint eb sb -> Bool #

Ord (FloatingPoint eb sb) Source # 
Instance details

Defined in Data.SBV.Core.SizedFloats

Methods

compare :: FloatingPoint eb sb -> FloatingPoint eb sb -> Ordering #

(<) :: FloatingPoint eb sb -> FloatingPoint eb sb -> Bool #

(<=) :: FloatingPoint eb sb -> FloatingPoint eb sb -> Bool #

(>) :: FloatingPoint eb sb -> FloatingPoint eb sb -> Bool #

(>=) :: FloatingPoint eb sb -> FloatingPoint eb sb -> Bool #

max :: FloatingPoint eb sb -> FloatingPoint eb sb -> FloatingPoint eb sb #

min :: FloatingPoint eb sb -> FloatingPoint eb sb -> FloatingPoint eb sb #

ValidFloat eb sb => SymVal (FloatingPoint eb sb) Source # 
Instance details

Defined in Data.SBV.Core.Model

ValidFloat eb sb => IEEEFloatConvertible (FloatingPoint eb sb) Source # 
Instance details

Defined in Data.SBV.Core.Floating

ValidFloat eb sb => IEEEFloating (FloatingPoint eb sb) Source # 
Instance details

Defined in Data.SBV.Core.Floating

Methods

fpAbs :: SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpNeg :: SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpAdd :: SRoundingMode -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpSub :: SRoundingMode -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpMul :: SRoundingMode -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpDiv :: SRoundingMode -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpFMA :: SRoundingMode -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpSqrt :: SRoundingMode -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpRem :: SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpRoundToIntegral :: SRoundingMode -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpMin :: SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpMax :: SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpIsEqualObject :: SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBool Source #

fpIsNormal :: SBV (FloatingPoint eb sb) -> SBool Source #

fpIsSubnormal :: SBV (FloatingPoint eb sb) -> SBool Source #

fpIsZero :: SBV (FloatingPoint eb sb) -> SBool Source #

fpIsInfinite :: SBV (FloatingPoint eb sb) -> SBool Source #

fpIsNaN :: SBV (FloatingPoint eb sb) -> SBool Source #

fpIsNegative :: SBV (FloatingPoint eb sb) -> SBool Source #

fpIsPositive :: SBV (FloatingPoint eb sb) -> SBool Source #

fpIsNegativeZero :: SBV (FloatingPoint eb sb) -> SBool Source #

fpIsPositiveZero :: SBV (FloatingPoint eb sb) -> SBool Source #

fpIsPoint :: SBV (FloatingPoint eb sb) -> SBool Source #

ValidFloat eb sb => HasKind (FloatingPoint eb sb) Source # 
Instance details

Defined in Data.SBV.Core.Model

(BVIsNonZero (eb + sb), KnownNat (eb + sb), ValidFloat eb sb) => Metric (FloatingPoint eb sb) Source # 
Instance details

Defined in Data.SBV.Core.Floating

Associated Types

type MetricSpace (FloatingPoint eb sb) Source #

(KnownNat eb, KnownNat sb) => SatModel (FloatingPoint eb sb) Source #

A general floating-point extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (FloatingPoint eb sb, [CV]) Source #

cvtModel :: (FloatingPoint eb sb -> Maybe b) -> Maybe (FloatingPoint eb sb, [CV]) -> Maybe (b, [CV]) Source #

type MetricSpace (FloatingPoint eb sb) Source # 
Instance details

Defined in Data.SBV.Core.Floating

type MetricSpace (FloatingPoint eb sb) = WordN (eb + sb)

type SFPHalf = SBV FPHalf Source #

A symbolic half-precision float

type FPHalf = FloatingPoint 5 11 Source #

Abbreviation for IEEE half precision float, bit width 16 = 5 + 11.

type SFPBFloat = SBV FPBFloat Source #

A symbolic brain-float precision float

type FPBFloat = FloatingPoint 8 8 Source #

Abbreviation for brain-float precision float, bit width 16 = 8 + 8.

type SFPSingle = SBV FPSingle Source #

A symbolic single-precision float

type FPSingle = FloatingPoint 8 24 Source #

Abbreviation for IEEE single precision float, bit width 32 = 8 + 24.

type SFPDouble = SBV FPDouble Source #

A symbolic double-precision float

type FPDouble = FloatingPoint 11 53 Source #

Abbreviation for IEEE double precision float, bit width 64 = 11 + 53.

type SFPQuad = SBV FPQuad Source #

A symbolic quad-precision float

type FPQuad = FloatingPoint 15 113 Source #

Abbreviation for IEEE quadruble precision float, bit width 128 = 15 + 113.

Rationals

type SRational = SBV Rational Source #

A symbolic rational value.

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

Constructors

AlgRational Bool Rational

bool says it's exact (i.e., SMT-solver did not return it with ? at the end.)

AlgPolyRoot (Integer, AlgRealPoly) (Maybe String)

which root of this polynomial and an approximate decimal representation with given precision, if available

AlgInterval (RealPoint Rational) (RealPoint Rational)

interval, with low and high bounds

Instances

Instances details
Arbitrary AlgReal Source # 
Instance details

Defined in Data.SBV.Core.AlgReals

Floating SReal Source #

SReal Floating instance, used in conjunction with the dReal solver for delta-satisfiability. Note that we do not constant fold these values (except for pi), as Haskell doesn't really have any means of computing them for arbitrary rationals.

Instance details

Defined in Data.SBV.Core.Model

Num AlgReal Source # 
Instance details

Defined in Data.SBV.Core.AlgReals

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

Real AlgReal Source # 
Instance details

Defined in Data.SBV.Core.AlgReals

Show AlgReal Source # 
Instance details

Defined in Data.SBV.Core.AlgReals

Eq AlgReal Source # 
Instance details

Defined in Data.SBV.Core.AlgReals

Methods

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

(/=) :: AlgReal -> AlgReal -> Bool #

Ord AlgReal Source # 
Instance details

Defined in Data.SBV.Core.AlgReals

Random AlgReal Source # 
Instance details

Defined in Data.SBV.Core.AlgReals

Methods

randomR :: RandomGen g => (AlgReal, AlgReal) -> g -> (AlgReal, g) #

random :: RandomGen g => g -> (AlgReal, g) #

randomRs :: RandomGen g => (AlgReal, AlgReal) -> g -> [AlgReal] #

randoms :: RandomGen g => g -> [AlgReal] #

SymVal AlgReal Source # 
Instance details

Defined in Data.SBV.Core.Model

IEEEFloatConvertible AlgReal Source # 
Instance details

Defined in Data.SBV.Core.Floating

HasKind AlgReal Source # 
Instance details

Defined in Data.SBV.Core.Kind

Metric AlgReal Source # 
Instance details

Defined in Data.SBV.Core.Model

Associated Types

type MetricSpace AlgReal Source #

SatModel AlgReal Source #

AlgReal as extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (AlgReal, [CV]) Source #

cvtModel :: (AlgReal -> Maybe b) -> Maybe (AlgReal, [CV]) -> Maybe (b, [CV]) Source #

type MetricSpace AlgReal Source # 
Instance details

Defined in Data.SBV.Core.Model

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.

algRealToRational :: AlgReal -> RationalCV Source #

Convert an AlgReal to a Rational. If the AlgReal is exact, then you get a Left value. Otherwise, you get a Right value which is simply an approximation.

data RealPoint a Source #

Is the endpoint included in the interval?

Constructors

OpenPoint a

open: i.e., doesn't include the point

ClosedPoint a

closed: i.e., includes the point

Instances

Instances details
Show a => Show (RealPoint a) Source # 
Instance details

Defined in Data.SBV.Core.AlgReals

Eq a => Eq (RealPoint a) Source # 
Instance details

Defined in Data.SBV.Core.AlgReals

Methods

(==) :: RealPoint a -> RealPoint a -> Bool #

(/=) :: RealPoint a -> RealPoint a -> Bool #

Ord a => Ord (RealPoint a) Source # 
Instance details

Defined in Data.SBV.Core.AlgReals

realPoint :: RealPoint a -> a Source #

Extract the point associated with the open-closed point

data RationalCV Source #

Conversion from internal rationals to Haskell values

Constructors

RatIrreducible AlgReal

Root of a polynomial, cannot be reduced

RatExact Rational

An exact rational

RatApprox Rational

An approximated value

RatInterval (RealPoint Rational) (RealPoint Rational)

Interval. Can be open/closed on both ends.

Instances

Instances details
Show RationalCV Source # 
Instance details

Defined in Data.SBV.Core.AlgReals

Characters, Strings and Regular Expressions

Support for characters, strings, and regular expressions (initial version contributed by Joel Burget) adds support for QF_S logic, described here: http://smtlib.cs.uiowa.edu/theories-UnicodeStrings.shtml

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

type SChar = SBV Char Source #

A symbolic character. Note that this is the full unicode character set. see: http://smtlib.cs.uiowa.edu/theories-UnicodeStrings.shtml for details.

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 (initial version contributed by Joel Burget) adds support for sequence support.

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.

Tuples

Tuples can be used as symbolic values. This is useful in combination with lists, for example SBV [(Integer, String)] is a valid type. These types can be arbitrarily nested, eg SBV [(Integer, [(Char, (Integer, String))])]. Instances of upto 8-tuples are provided.

class SymTuple a Source #

Identify tuple like things. Note that there are no methods, just instances to control type inference

Instances

Instances details
SymTuple () Source # 
Instance details

Defined in Data.SBV.Core.Model

SymTuple (a, b) Source # 
Instance details

Defined in Data.SBV.Core.Model

SymTuple (a, b, c) Source # 
Instance details

Defined in Data.SBV.Core.Model

SymTuple (a, b, c, d) Source # 
Instance details

Defined in Data.SBV.Core.Model

SymTuple (a, b, c, d, e) Source # 
Instance details

Defined in Data.SBV.Core.Model

SymTuple (a, b, c, d, e, f) Source # 
Instance details

Defined in Data.SBV.Core.Model

SymTuple (a, b, c, d, e, f, g) Source # 
Instance details

Defined in Data.SBV.Core.Model

SymTuple (a, b, c, d, e, f, g, h) Source # 
Instance details

Defined in Data.SBV.Core.Model

type STuple a b = SBV (a, b) Source #

Symbolic 2-tuple. NB. STuple and STuple2 are equivalent.

type STuple2 a b = SBV (a, b) Source #

Symbolic 2-tuple. NB. STuple and STuple2 are equivalent.

type STuple3 a b c = SBV (a, b, c) Source #

Symbolic 3-tuple.

type STuple4 a b c d = SBV (a, b, c, d) Source #

Symbolic 4-tuple.

type STuple5 a b c d e = SBV (a, b, c, d, e) Source #

Symbolic 5-tuple.

type STuple6 a b c d e f = SBV (a, b, c, d, e, f) Source #

Symbolic 6-tuple.

type STuple7 a b c d e f g = SBV (a, b, c, d, e, f, g) Source #

Symbolic 7-tuple.

type STuple8 a b c d e f g h = SBV (a, b, c, d, e, f, g, h) Source #

Symbolic 8-tuple.

Sum types

type SMaybe a = SBV (Maybe a) Source #

Symbolic Maybe

type SEither a b = SBV (Either a b) Source #

Symbolic Either

Sets

data RCSet a Source #

A RCSet is either a regular set or a set given by its complement from the corresponding universal set.

Constructors

RegularSet (Set a) 
ComplementSet (Set a) 

Instances

Instances details
Show a => Show (RCSet a) Source #

Show instance. Regular sets are shown as usual. Complements are shown "U -" notation.

Instance details

Defined in Data.SBV.Core.Concrete

Methods

showsPrec :: Int -> RCSet a -> ShowS #

show :: RCSet a -> String #

showList :: [RCSet a] -> ShowS #

(Ord a, SymVal a) => SymVal (RCSet a) Source # 
Instance details

Defined in Data.SBV.Core.Model

HasKind a => HasKind (RCSet a) Source # 
Instance details

Defined in Data.SBV.Core.Concrete

type SSet a = SBV (RCSet a) Source #

Symbolic Set. Note that we use RCSet, which supports both regular sets and complements, i.e., those obtained from the universal set (of the right type) by removing elements.

Arrays of symbolic values

class SymArray array where Source #

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.

The reason for this class is rather historic. In the past, SBV provided two different kinds of arrays: an SArray abstraction that mapped directly to SMTLib arrays (which is still available today), and a functional notion of arrays that used internal caching, called SFunArray. The latter has been removed as the code turned out to be rather tricky and hard to maintain; so we only have one instance of this class. But end users can add their own instances, if needed.

NB. sListArray insists on a concrete initializer, because not having one would break referential transparency. See https://github.com/LeventErkok/sbv/issues/553 for details.

Methods

sListArray :: (HasKind a, SymVal b) => b -> [(SBV a, SBV b)] -> array a b Source #

Create a literal array

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

Read the array element at a

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

Update the element at a to be b

mergeArrays :: SymVal b => SBV Bool -> array a b -> array a b -> array a b Source #

Merge two given arrays on the symbolic condition Intuitively: mergeArrays cond a b = if cond then a else b. Merging pushes the if-then-else choice down on to elements

Instances

Instances details
SymArray SArray Source # 
Instance details

Defined in Data.SBV.Core.Data

Methods

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

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

sListArray :: (HasKind a, SymVal b) => b -> [(SBV a, SBV b)] -> SArray a b Source #

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

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

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

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

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

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

NB. For a version which generalizes over the underlying monad, see newArray_

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

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

NB. For a version which generalizes over the underlying monad, see newArray

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 uninitialized 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

Instances

Instances details
SymArray SArray Source # 
Instance details

Defined in Data.SBV.Core.Data

Methods

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

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

sListArray :: (HasKind a, SymVal b) => b -> [(SBV a, SBV b)] -> SArray a b Source #

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

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

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

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

(HasKind a, HasKind b, ProvableM m p) => ProvableM m (SArray a b -> p) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

proofArgReduce :: (SArray a b -> p) -> SymbolicT m SBool Source #

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

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

dprove :: (SArray a b -> p) -> m ThmResult Source #

dproveWith :: SMTConfig -> (SArray a b -> p) -> m ThmResult Source #

isVacuousProof :: (SArray a b -> p) -> m Bool Source #

isVacuousProofWith :: SMTConfig -> (SArray a b -> p) -> m Bool Source #

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

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

(HasKind a, HasKind b, SatisfiableM m p) => SatisfiableM m (SArray a b -> p) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

satArgReduce :: (SArray a b -> p) -> SymbolicT m SBool Source #

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

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

dsat :: (SArray a b -> p) -> m SatResult Source #

dsatWith :: SMTConfig -> (SArray a b -> p) -> m SatResult Source #

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

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

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

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

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

optimizeWith :: SMTConfig -> OptimizeStyle -> (SArray a b -> p) -> m OptimizeResult 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 #

show :: SArray a b -> String #

showList :: [SArray a b] -> ShowS #

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 #

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

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

distinct :: [SArray a b] -> SBool Source #

distinctExcept :: [SArray a b] -> [SArray a b] -> SBool Source #

allEqual :: [SArray a b] -> SBool Source #

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

sNotElem :: SArray a b -> [SArray a b] -> SBool Source #

SymVal 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 :: (Ord b0, SymVal b0, Num b0) => [SArray a b] -> SArray a b -> SBV b0 -> SArray a b Source #

lambdaAsArray :: forall a b. (SymVal a, HasKind b) => (SBV a -> SBV b) -> SArray a b Source #

Using a lambda as an array

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. We provide both the named and anonymous versions, latter with the underscore suffix.

sBool :: String -> Symbolic SBool Source #

Declare a named SBool

NB. For a version which generalizes over the underlying monad, see sBool

sBool_ :: Symbolic SBool Source #

Declare an unnamed SBool

NB. For a version which generalizes over the underlying monad, see sBool_

sWord8 :: String -> Symbolic SWord8 Source #

Declare a named SWord8

NB. For a version which generalizes over the underlying monad, see sWord8

sWord8_ :: Symbolic SWord8 Source #

Declare an unnamed SWord8

NB. For a version which generalizes over the underlying monad, see sWord8_

sWord16 :: String -> Symbolic SWord16 Source #

Declare a named SWord16

NB. For a version which generalizes over the underlying monad, see sWord16

sWord16_ :: Symbolic SWord16 Source #

Declare an unnamed SWord16

NB. For a version which generalizes over the underlying monad, see sWord16_

sWord32 :: String -> Symbolic SWord32 Source #

Declare a named SWord32

NB. For a version which generalizes over the underlying monad, see sWord32

sWord32_ :: Symbolic SWord32 Source #

Declare an unnamed SWord32

NB. For a version which generalizes over the underlying monad, see sWord32_

sWord64 :: String -> Symbolic SWord64 Source #

Declare a named SWord64

NB. For a version which generalizes over the underlying monad, see sWord64

sWord64_ :: Symbolic SWord64 Source #

Declare an unnamed SWord64

NB. For a version which generalizes over the underlying monad, see sWord64_

sWord :: (KnownNat n, BVIsNonZero n) => String -> Symbolic (SWord n) Source #

Declare a named SWord

NB. For a version which generalizes over the underlying monad, see sWord

sWord_ :: (KnownNat n, BVIsNonZero n) => Symbolic (SWord n) Source #

Declare an unnamed SWord

NB. For a version which generalizes over the underlying monad, see sWord_

sInt8 :: String -> Symbolic SInt8 Source #

Declare a named SInt8

NB. For a version which generalizes over the underlying monad, see sInt8

sInt8_ :: Symbolic SInt8 Source #

Declare an unnamed SInt8

NB. For a version which generalizes over the underlying monad, see sInt8_

sInt16 :: String -> Symbolic SInt16 Source #

Declare a named SInt16

NB. For a version which generalizes over the underlying monad, see sInt16

sInt16_ :: Symbolic SInt16 Source #

Declare an unnamed SInt16

NB. For a version which generalizes over the underlying monad, see sInt16_

sInt32 :: String -> Symbolic SInt32 Source #

Declare a named SInt32

NB. For a version which generalizes over the underlying monad, see sInt32

sInt32_ :: Symbolic SInt32 Source #

Declare an unnamed SInt32

NB. For a version which generalizes over the underlying monad, see sInt32_

sInt64 :: String -> Symbolic SInt64 Source #

Declare a named SInt64

NB. For a version which generalizes over the underlying monad, see sInt64

sInt64_ :: Symbolic SInt64 Source #

Declare an unnamed SInt64

NB. For a version which generalizes over the underlying monad, see sInt64_

sInt :: (KnownNat n, BVIsNonZero n) => String -> Symbolic (SInt n) Source #

Declare a named SInt

NB. For a version which generalizes over the underlying monad, see sInt

sInt_ :: (KnownNat n, BVIsNonZero n) => Symbolic (SInt n) Source #

Declare an unnamed SInt

NB. For a version which generalizes over the underlying monad, see sInt_

sInteger :: String -> Symbolic SInteger Source #

Declare a named SInteger

NB. For a version which generalizes over the underlying monad, see sInteger

sInteger_ :: Symbolic SInteger Source #

Declare an unnamed SInteger

NB. For a version which generalizes over the underlying monad, see sInteger_

sReal :: String -> Symbolic SReal Source #

Declare a named SReal

NB. For a version which generalizes over the underlying monad, see sReal

sReal_ :: Symbolic SReal Source #

Declare an unnamed SReal

NB. For a version which generalizes over the underlying monad, see sReal_

sRational :: String -> Symbolic SRational Source #

Declare a named SRational.

NB. For a version which generalizes over the underlying monad, see sRational

sRational_ :: Symbolic SRational Source #

Declare an unnamed SRational.

NB. For a version which generalizes over the underlying monad, see sRational_

sFloat :: String -> Symbolic SFloat Source #

Declare a named SFloat

NB. For a version which generalizes over the underlying monad, see sFloat

sFloat_ :: Symbolic SFloat Source #

Declare an unnamed SFloat

NB. For a version which generalizes over the underlying monad, see sFloat_

sDouble :: String -> Symbolic SDouble Source #

Declare a named SDouble

NB. For a version which generalizes over the underlying monad, see sDouble

sDouble_ :: Symbolic SDouble Source #

Declare an unnamed SDouble

NB. For a version which generalizes over the underlying monad, see sDouble_

sFloatingPoint :: ValidFloat eb sb => String -> Symbolic (SFloatingPoint eb sb) Source #

Declare a named 'SFloatingPoint eb sb'

NB. For a version which generalizes over the underlying monad, see sFloatingPoint

sFloatingPoint_ :: ValidFloat eb sb => Symbolic (SFloatingPoint eb sb) Source #

Declare an unnamed SFloatingPoint eb sb

NB. For a version which generalizes over the underlying monad, see sFloatingPoint_

sFPHalf :: String -> Symbolic SFPHalf Source #

Declare a named SFPHalf

NB. For a version which generalizes over the underlying monad, see sFPHalf

sFPHalf_ :: Symbolic SFPHalf Source #

Declare an unnamed SFPHalf

NB. For a version which generalizes over the underlying monad, see sFPHalf_

sFPBFloat :: String -> Symbolic SFPBFloat Source #

Declare a named SFPBFloat

NB. For a version which generalizes over the underlying monad, see SFPBFloat

sFPBFloat_ :: Symbolic SFPBFloat Source #

Declare an unnamed SFPBFloat

NB. For a version which generalizes over the underlying monad, see SFPBFloat

sFPSingle :: String -> Symbolic SFPSingle Source #

Declare a named SFPSingle

NB. For a version which generalizes over the underlying monad, see sFPSingle

sFPSingle_ :: Symbolic SFPSingle Source #

Declare an unnamed SFPSingle

NB. For a version which generalizes over the underlying monad, see sFPSingle_

sFPDouble :: String -> Symbolic SFPDouble Source #

Declare a named SFPDouble

NB. For a version which generalizes over the underlying monad, see sFPDouble

sFPDouble_ :: Symbolic SFPDouble Source #

Declare an unnamed SFPDouble

NB. For a version which generalizes over the underlying monad, see sFPDouble_

sFPQuad :: String -> Symbolic SFPQuad Source #

Declare a named SFPQuad

NB. For a version which generalizes over the underlying monad, see sFPQuad

sFPQuad_ :: Symbolic SFPQuad Source #

Declare an unnamed SFPQuad

NB. For a version which generalizes over the underlying monad, see sFPQuad_

sChar :: String -> Symbolic SChar Source #

Declare a named SChar

NB. For a version which generalizes over the underlying monad, see sChar

sChar_ :: Symbolic SChar Source #

Declare an unnamed SChar

NB. For a version which generalizes over the underlying monad, see sChar_

sString :: String -> Symbolic SString Source #

Declare a named SString

NB. For a version which generalizes over the underlying monad, see sString

sString_ :: Symbolic SString Source #

Declare an unnamed SString

NB. For a version which generalizes over the underlying monad, see sString_

sList :: SymVal a => String -> Symbolic (SList a) Source #

Declare a named SList

NB. For a version which generalizes over the underlying monad, see sList

sList_ :: SymVal a => Symbolic (SList a) Source #

Declare an unnamed SList

NB. For a version which generalizes over the underlying monad, see sList_

sTuple :: (SymTuple tup, SymVal tup) => String -> Symbolic (SBV tup) Source #

Declare a named tuple.

NB. For a version which generalizes over the underlying monad, see sTuple

sTuple_ :: (SymTuple tup, SymVal tup) => Symbolic (SBV tup) Source #

Declare an unnamed tuple.

NB. For a version which generalizes over the underlying monad, see sTuple_

sEither :: (SymVal a, SymVal b) => String -> Symbolic (SEither a b) Source #

Declare a named SEither.

NB. For a version which generalizes over the underlying monad, see sEither

sEither_ :: (SymVal a, SymVal b) => Symbolic (SEither a b) Source #

Declare an unnamed SEither.

NB. For a version which generalizes over the underlying monad, see sEither_

sMaybe :: SymVal a => String -> Symbolic (SMaybe a) Source #

Declare a named SMaybe.

NB. For a version which generalizes over the underlying monad, see sMaybe

sMaybe_ :: SymVal a => Symbolic (SMaybe a) Source #

Declare an unnamed SMaybe.

NB. For a version which generalizes over the underlying monad, see sMaybe_

sSet :: (Ord a, SymVal a) => String -> Symbolic (SSet a) Source #

Declare a named SSet.

NB. For a version which generalizes over the underlying monad, see sSet

sSet_ :: (Ord a, SymVal a) => Symbolic (SSet a) Source #

Declare an unnamed SSet.

NB. For a version which generalizes over the underlying monad, see sSet_

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 SBools

NB. For a version which generalizes over the underlying monad, see sBools

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

Declare a list of SWord8s

NB. For a version which generalizes over the underlying monad, see sWord8s

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

Declare a list of SWord16s

NB. For a version which generalizes over the underlying monad, see sWord16s

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

Declare a list of SWord32s

NB. For a version which generalizes over the underlying monad, see sWord32s

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

Declare a list of SWord64s

NB. For a version which generalizes over the underlying monad, see sWord64s

sWords :: (KnownNat n, BVIsNonZero n) => [String] -> Symbolic [SWord n] Source #

Declare a list of SWord8s

NB. For a version which generalizes over the underlying monad, see sWords

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

Declare a list of SInt8s

NB. For a version which generalizes over the underlying monad, see sInt8s

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

Declare a list of SInt16s

NB. For a version which generalizes over the underlying monad, see sInt16s

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

Declare a list of SInt32s

NB. For a version which generalizes over the underlying monad, see sInt32s

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

Declare a list of SInt64s

NB. For a version which generalizes over the underlying monad, see sInt64s

sInts :: (KnownNat n, BVIsNonZero n) => [String] -> Symbolic [SInt n] Source #

Declare a list of SInts

NB. For a version which generalizes over the underlying monad, see sInts

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

Declare a list of SIntegers

NB. For a version which generalizes over the underlying monad, see sIntegers

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

Declare a list of SReals

NB. For a version which generalizes over the underlying monad, see sReals

sRationals :: [String] -> Symbolic [SRational] Source #

Declare a list of SRational values.

NB. For a version which generalizes over the underlying monad, see sRationals

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

Declare a list of SFloats

NB. For a version which generalizes over the underlying monad, see sFloats

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

Declare a list of SDoubles

NB. For a version which generalizes over the underlying monad, see sDoubles

sFloatingPoints :: ValidFloat eb sb => [String] -> Symbolic [SFloatingPoint eb sb] Source #

Declare a list of SFloatingPoint eb sb's

NB. For a version which generalizes over the underlying monad, see sFloatingPoints

sFPHalfs :: [String] -> Symbolic [SFPHalf] Source #

Declare a list of SFPHalfs

NB. For a version which generalizes over the underlying monad, see sFPHalfs

sFPBFloats :: [String] -> Symbolic [SFPBFloat] Source #

Declare a list of SFPQuads

NB. For a version which generalizes over the underlying monad, see sFPBFloats

sFPSingles :: [String] -> Symbolic [SFPSingle] Source #

Declare a list of SFPSingles

NB. For a version which generalizes over the underlying monad, see sFPSingles

sFPDoubles :: [String] -> Symbolic [SFPDouble] Source #

Declare a list of SFPDoubles

NB. For a version which generalizes over the underlying monad, see sFPDoubles

sFPQuads :: [String] -> Symbolic [SFPQuad] Source #

Declare a list of SFPQuads

NB. For a version which generalizes over the underlying monad, see sFPQuads

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

Declare a list of SChars

NB. For a version which generalizes over the underlying monad, see sChars

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

Declare a list of SStrings

NB. For a version which generalizes over the underlying monad, see sStrings

sLists :: SymVal a => [String] -> Symbolic [SList a] Source #

Declare a list of SLists

NB. For a version which generalizes over the underlying monad, see sLists

sTuples :: (SymTuple tup, SymVal tup) => [String] -> Symbolic [SBV tup] Source #

Declare a list of tuples.

NB. For a version which generalizes over the underlying monad, see sTuples

sEithers :: (SymVal a, SymVal b) => [String] -> Symbolic [SEither a b] Source #

Declare a list of SEither values.

NB. For a version which generalizes over the underlying monad, see sEithers

sMaybes :: SymVal a => [String] -> Symbolic [SMaybe a] Source #

Declare a list of SMaybe values.

NB. For a version which generalizes over the underlying monad, see sMaybes

sSets :: (Ord a, SymVal a) => [String] -> Symbolic [SSet a] Source #

Declare a list of SSet values.

NB. For a version which generalizes over the underlying monad, see sSets

Symbolic Equality and Comparisons

Symbolic equality provides the notion of what it means to be equal, similar to Haskell's Eq class, except allowing comparison of symbolic values. The methods are .== and ./=, returning SBool results. We also provide a notion of strong equality (.=== and ./==), which is useful for floating-point value comparisons as it deals more uniformly with NaN and positive/negative zeros. Additionally, we provide distinct that can be used to assert all elements of a list are different from each other, and distinctExcept which is similar to distinct but allows for certain values to be considered different. These latter two functions are useful in modeling a variety of puzzles and cardinality constraints:

>>> prove $ \a -> distinctExcept [a, a] [0::SInteger] .<=> a .== 0
Q.E.D.
>>> prove $ \a b -> distinctExcept [a, b] [0::SWord8] .<=> (a .== b .=> a .== 0)
Q.E.D.
>>> prove $ \a b c d -> distinctExcept [a, b, c, d] [] .== distinct [a, b, c, (d::SInteger)]
Q.E.D.

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: None, if the type is instance of Generic. Otherwise (.==).

Minimal complete definition

Nothing

Methods

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

Symbolic equality.

default (.==) :: (Generic a, GEqSymbolic (Rep a)) => a -> a -> SBool Source #

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

Symbolic inequality.

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

Strong equality. On floats (SFloat/SDouble), strong equality is object equality; that is NaN == NaN holds, but +0 == -0 doesn't. On other types, (.===) is simply (.==). Note that (.==) is the right notion of equality for floats per IEEE754 specs, since by definition +0 == -0 and NaN equals no other value including itself. But occasionally we want to be stronger and state NaN equals NaN and +0 and -0 are different from each other. In a context where your type is concrete, simply use fpIsEqualObject. But in a polymorphic context, use the strong equality instead.

NB. If you do not care about or work with floats, simply use (.==) and (./=).

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

Negation of strong equality. Equaivalent to negation of (.===) on all types.

distinct :: [a] -> SBool Source #

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

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

Returns (symbolic) sTrue if all the elements of the given list are different. The second list contains exceptions, i.e., if an element belongs to that set, it will be considered distinct regardless of repetition.

allEqual :: [a] -> SBool Source #

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

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

Symbolic membership test.

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

Symbolic negated membership test.

Instances

Instances details
EqSymbolic RegExp Source #

Regular expressions can be compared for equality. Note that we diverge here from the equality in the concrete sense; i.e., the Eq instance does not match the symbolic case. This is a bit unfortunate, but unavoidable with the current design of how we "distinguish" operators. Hopefully shouldn't be a big deal, though one should be careful.

Instance details

Defined in Data.SBV.Core.Model

EqSymbolic Bool Source # 
Instance details

Defined in Data.SBV.Core.Model

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 #

(.===) :: SBV a -> SBV a -> SBool Source #

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

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

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

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

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

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

EqSymbolic a => EqSymbolic (S a) Source #

Symbolic equality for S.

Instance details

Defined in Documentation.SBV.Examples.ProofTools.BMC

Methods

(.==) :: S a -> S a -> SBool Source #

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

(.===) :: S a -> S a -> SBool Source #

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

distinct :: [S a] -> SBool Source #

distinctExcept :: [S a] -> [S a] -> SBool Source #

allEqual :: [S a] -> SBool Source #

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

sNotElem :: S a -> [S 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 #

(.===) :: Maybe a -> Maybe a -> SBool Source #

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

distinct :: [Maybe a] -> SBool Source #

distinctExcept :: [Maybe a] -> [Maybe a] -> SBool Source #

allEqual :: [Maybe a] -> SBool Source #

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

sNotElem :: Maybe a -> [Maybe a] -> SBool Source #

EqSymbolic a => EqSymbolic [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 #

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

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

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

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

sNotElem :: [a] -> [[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 #

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

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

distinct :: [Either a b] -> SBool Source #

distinctExcept :: [Either a b] -> [Either a b] -> SBool Source #

allEqual :: [Either a b] -> SBool Source #

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

sNotElem :: Either a b -> [Either 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 #

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

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

distinct :: [SArray a b] -> SBool Source #

distinctExcept :: [SArray a b] -> [SArray a b] -> SBool Source #

allEqual :: [SArray a b] -> SBool Source #

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

sNotElem :: SArray a b -> [SArray 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 #

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

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

distinct :: [(a, b)] -> SBool Source #

distinctExcept :: [(a, b)] -> [(a, b)] -> SBool Source #

allEqual :: [(a, b)] -> SBool Source #

sElem :: (a, b) -> [(a, b)] -> SBool Source #

sNotElem :: (a, b) -> [(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 #

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

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

distinct :: [(a, b, c)] -> SBool Source #

distinctExcept :: [(a, b, c)] -> [(a, b, c)] -> SBool Source #

allEqual :: [(a, b, c)] -> SBool Source #

sElem :: (a, b, c) -> [(a, b, c)] -> SBool Source #

sNotElem :: (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 #

(.===) :: (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 #

distinctExcept :: [(a, b, c, d)] -> [(a, b, c, d)] -> SBool Source #

allEqual :: [(a, b, c, d)] -> SBool Source #

sElem :: (a, b, c, d) -> [(a, b, c, d)] -> SBool Source #

sNotElem :: (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 #

(.===) :: (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 #

distinctExcept :: [(a, b, c, d, e)] -> [(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 #

sNotElem :: (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 #

(.===) :: (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 #

distinctExcept :: [(a, b, c, d, e, f)] -> [(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 #

sNotElem :: (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 #

(.===) :: (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 #

distinctExcept :: [(a, b, c, d, e, f, g)] -> [(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 #

sNotElem :: (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 within the allowed inclusive range?

Instances

Instances details
(Ord a, SymVal a) => OrdSymbolic (SBV a) Source #

If comparison is over something SMTLib can handle, just translate it. Otherwise desugar.

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 (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 #

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 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

Instances details
(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SymVal f, SymVal 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.Core.Model

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 #

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SymVal f, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> SBV f -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

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 #

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

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 #

(SymVal a, SymVal b, SymVal c, SymVal d, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> SBV d -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

(===) :: (SBV a -> SBV b -> SBV c -> SBV d -> z) -> (SBV a -> SBV b -> SBV c -> SBV d -> z) -> IO ThmResult Source #

(SymVal a, SymVal b, SymVal c, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

(===) :: (SBV a -> SBV b -> SBV c -> z) -> (SBV a -> SBV b -> SBV c -> z) -> IO ThmResult Source #

(SymVal a, SymVal b, EqSymbolic z) => Equality (SBV a -> SBV b -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

(===) :: (SBV a -> SBV b -> z) -> (SBV a -> SBV b -> z) -> IO ThmResult Source #

(SymVal a, EqSymbolic z) => Equality (SBV a -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

(===) :: (SBV a -> z) -> (SBV a -> z) -> IO ThmResult Source #

(SymVal a, SymVal b, EqSymbolic z) => Equality ((SBV a, SBV b) -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

(===) :: ((SBV a, SBV b) -> z) -> ((SBV a, SBV b) -> z) -> IO ThmResult Source #

(SymVal a, SymVal b, SymVal c, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c) -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

(===) :: ((SBV a, SBV b, SBV c) -> z) -> ((SBV a, SBV b, SBV c) -> z) -> IO ThmResult Source #

(SymVal a, SymVal b, SymVal c, SymVal d, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c, SBV d) -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

(===) :: ((SBV a, SBV b, SBV c, SBV d) -> z) -> ((SBV a, SBV b, SBV c, SBV d) -> z) -> IO ThmResult Source #

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c, SBV d, SBV e) -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

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 #

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SymVal f, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

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 #

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SymVal f, SymVal 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.Core.Model

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 #

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.

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

select :: (Ord b, SymVal 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.

Instances

Instances details
Mergeable Int16 Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

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

select :: (Ord b, SymVal b, Num b) => [Int16] -> Int16 -> SBV b -> Int16 Source #

Mergeable Int32 Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

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

select :: (Ord b, SymVal b, Num b) => [Int32] -> Int32 -> SBV b -> Int32 Source #

Mergeable Int64 Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

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

select :: (Ord b, SymVal b, Num b) => [Int64] -> Int64 -> SBV b -> Int64 Source #

Mergeable Int8 Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

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

select :: (Ord b, SymVal b, Num b) => [Int8] -> Int8 -> SBV b -> Int8 Source #

Mergeable Word16 Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

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

select :: (Ord b, SymVal b, Num b) => [Word16] -> Word16 -> SBV b -> Word16 Source #

Mergeable Word32 Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

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

select :: (Ord b, SymVal b, Num b) => [Word32] -> Word32 -> SBV b -> Word32 Source #

Mergeable Word64 Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

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

select :: (Ord b, SymVal b, Num b) => [Word64] -> Word64 -> SBV b -> Word64 Source #

Mergeable Word8 Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

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

select :: (Ord b, SymVal b, Num b) => [Word8] -> Word8 -> SBV b -> Word8 Source #

Mergeable Mostek Source # 
Instance details

Defined in Documentation.SBV.Examples.BitPrecise.Legato

Methods

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

select :: (Ord b, SymVal b, Num b) => [Mostek] -> Mostek -> SBV b -> Mostek Source #

Mergeable Jug Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Jugs

Methods

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

select :: (Ord b, SymVal b, Num b) => [Jug] -> Jug -> SBV b -> Jug Source #

Mergeable Assignment Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Orangutans

Mergeable Status Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.U2Bridge

Methods

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

select :: (Ord b, SymVal b, Num b) => [Status] -> Status -> SBV b -> Status Source #

Mergeable Integer Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

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

select :: (Ord b, SymVal b, Num b) => [Integer] -> Integer -> SBV b -> Integer Source #

Mergeable () Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

symbolicMerge :: Bool -> SBool -> () -> () -> () Source #

select :: (Ord b, SymVal b, Num b) => [()] -> () -> SBV b -> () Source #

Mergeable Bool Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

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

select :: (Ord b, SymVal b, Num b) => [Bool] -> Bool -> SBV b -> Bool Source #

Mergeable Char Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

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

select :: (Ord b, SymVal b, Num b) => [Char] -> Char -> SBV b -> Char Source #

Mergeable Double Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

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

select :: (Ord b, SymVal b, Num b) => [Double] -> Double -> SBV b -> Double Source #

Mergeable Float Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

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

select :: (Ord b, SymVal b, Num b) => [Float] -> Float -> SBV b -> Float 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 :: (Ord b, SymVal b, Num b) => [ZipList a] -> ZipList a -> SBV b -> ZipList a Source #

SymVal 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 :: (Ord b, SymVal b, Num b) => [SBV a] -> SBV a -> SBV b -> SBV a Source #

Mergeable a => Mergeable (S a) Source # 
Instance details

Defined in Documentation.SBV.Examples.ProofTools.Fibonacci

Methods

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

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

Mergeable a => Mergeable (S a) Source # 
Instance details

Defined in Documentation.SBV.Examples.ProofTools.Sum

Methods

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

select :: (Ord b, SymVal b, Num b) => [S a] -> S a -> SBV b -> S 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 :: (Ord b, SymVal b, Num b) => [Move a] -> Move a -> SBV b -> Move a Source #

SymVal a => Mergeable (AppS a) Source # 
Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.Append

Methods

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

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

Mergeable a => Mergeable (IncS a) Source # 
Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.Basics

Methods

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

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

Mergeable a => Mergeable (FibS a) Source # 
Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.Fib

Methods

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

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

Mergeable a => Mergeable (GCDS a) Source # 
Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.GCD

Methods

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

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

Mergeable a => Mergeable (DivS a) Source # 
Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.IntDiv

Methods

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

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

Mergeable a => Mergeable (SqrtS a) Source # 
Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.IntSqrt

Methods

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

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

SymVal a => Mergeable (LenS a) Source # 
Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.Length

Methods

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

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

Mergeable a => Mergeable (SumS a) Source # 
Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.Sum

Methods

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

select :: (Ord b, SymVal b, Num b) => [SumS a] -> SumS a -> SBV b -> SumS 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 :: (Ord b, SymVal b, Num b) => [Maybe a] -> Maybe a -> SBV b -> Maybe a Source #

Mergeable a => Mergeable [a] Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

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

select :: (Ord b, SymVal b, Num b) => [[a]] -> [a] -> SBV b -> [a] 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 :: (Ord b0, SymVal b0, Num b0) => [Either a b] -> Either a b -> SBV b0 -> Either 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 :: (Ord b0, SymVal b0, Num b0) => [Array a b] -> Array a b -> SBV b0 -> Array a b Source #

SymVal 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 :: (Ord b0, SymVal b0, Num b0) => [SArray a b] -> SArray a b -> SBV b0 -> SArray a b Source #

SymVal 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 :: (Ord b, SymVal b, Num b) => [STree i e] -> STree i e -> SBV b -> STree i e 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 :: (Ord b0, SymVal b0, Num b0) => [(a, b)] -> (a, b) -> SBV b0 -> (a, b) 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 :: (Ord b0, SymVal b0, Num b0) => [a -> b] -> (a -> b) -> SBV b0 -> a -> b 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 :: (Ord b0, SymVal 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 :: (Ord b0, SymVal 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 :: (Ord b0, SymVal 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 :: (Ord b0, SymVal 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 :: (Ord b0, SymVal 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 (SymVal 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

Instances details
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 Int8 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 Word8 Source # 
Instance details

Defined in Data.SBV.Core.Model

SIntegral Integer Source # 
Instance details

Defined in Data.SBV.Core.Model

(KnownNat n, BVIsNonZero n) => SIntegral (IntN n) Source #

SIntegral instance for IntN

Instance details

Defined in Data.SBV.Core.Sized

(KnownNat n, BVIsNonZero n) => SIntegral (WordN n) Source #

SIntegral instance for WordN

Instance details

Defined in Data.SBV.Core.Sized

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.

C code generation of division operations

In the case of division or modulo of a minimal signed value (e.g. -128 for SInt8) by -1, SMTLIB and Haskell agree on what the result should be. Unfortunately the result in C code depends on CPU architecture and compiler settings, as this is undefined behaviour in C. **SBV does not guarantee** what will happen in generated C code in this corner case.

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

Instances details
SDivisible Int16 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible Int32 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible Int64 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible Int8 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible Word16 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible Word32 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible Word64 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible Word8 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible CV Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

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

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

sQuot :: CV -> CV -> CV Source #

sRem :: CV -> CV -> CV Source #

sDiv :: CV -> CV -> CV Source #

sMod :: CV -> CV -> CV Source #

SDivisible SInt16 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible SInt32 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible SInt64 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible SInt8 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible SInteger Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible SWord16 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible SWord32 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible SWord64 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible SWord8 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible Integer Source # 
Instance details

Defined in Data.SBV.Core.Model

(KnownNat n, BVIsNonZero n) => SDivisible (IntN n) Source #

SDivisible instance for IntN

Instance details

Defined in Data.SBV.Core.Sized

Methods

sQuotRem :: IntN n -> IntN n -> (IntN n, IntN n) Source #

sDivMod :: IntN n -> IntN n -> (IntN n, IntN n) Source #

sQuot :: IntN n -> IntN n -> IntN n Source #

sRem :: IntN n -> IntN n -> IntN n Source #

sDiv :: IntN n -> IntN n -> IntN n Source #

sMod :: IntN n -> IntN n -> IntN n Source #

(KnownNat n, BVIsNonZero n) => SDivisible (SInt n) Source #

SDivisible instance for SInt

Instance details

Defined in Data.SBV.Core.Sized

Methods

sQuotRem :: SInt n -> SInt n -> (SInt n, SInt n) Source #

sDivMod :: SInt n -> SInt n -> (SInt n, SInt n) Source #

sQuot :: SInt n -> SInt n -> SInt n Source #

sRem :: SInt n -> SInt n -> SInt n Source #

sDiv :: SInt n -> SInt n -> SInt n Source #

sMod :: SInt n -> SInt n -> SInt n Source #

(KnownNat n, BVIsNonZero n) => SDivisible (SWord n) Source #

SDivisible instance for SWord

Instance details

Defined in Data.SBV.Core.Sized

Methods

sQuotRem :: SWord n -> SWord n -> (SWord n, SWord n) Source #

sDivMod :: SWord n -> SWord n -> (SWord n, SWord n) Source #

sQuot :: SWord n -> SWord n -> SWord n Source #

sRem :: SWord n -> SWord n -> SWord n Source #

sDiv :: SWord n -> SWord n -> SWord n Source #

sMod :: SWord n -> SWord n -> SWord n Source #

(KnownNat n, BVIsNonZero n) => SDivisible (WordN n) Source #

SDivisible instance for WordN

Instance details

Defined in Data.SBV.Core.Sized

Methods

sQuotRem :: WordN n -> WordN n -> (WordN n, WordN n) Source #

sDivMod :: WordN n -> WordN n -> (WordN n, WordN n) Source #

sQuot :: WordN n -> WordN n -> WordN n Source #

sRem :: WordN n -> WordN n -> WordN n Source #

sDiv :: WordN n -> WordN n -> WordN n Source #

sMod :: WordN n -> WordN n -> WordN n Source #

Euclidian division and modulus

Euclidian division and modulus for integers differ from regular division modulus when the divisor is negative. It satisfies the following desirable property: For any m, n, we have:

  Given m, n, s.t., n /= 0
  Let (q, r) = m sEDivMod n
  Then: m = n * q + r
   and 0 <= r <= |n| - 1

That is, the modulus is always positive. There's no standard Haskell function that performs this operation. The main reason to prefer this function is that SMT solvers can deal with them better. Compare:

>>> sDivMod @SInteger 3 (-2)
(-2 :: SInteger,-1 :: SInteger)
>>> sEDivMod 3 (-2)
(-1 :: SInteger,1 :: SInteger)
>>> prove $ \x y -> y .> 0 .=> x `sDivMod` y .== x `sEDivMod` y
Q.E.D.

sEDivMod :: SInteger -> SInteger -> (SInteger, SInteger) Source #

Euclidian division and modulus.

sEDiv :: SInteger -> SInteger -> SInteger Source #

Euclidian division.

sEMod :: SInteger -> SInteger -> SInteger Source #

Euclidian modulus.

Bit-vector operations

Conversions

sFromIntegral :: forall a b. (Integral a, HasKind a, Num a, SymVal a, HasKind b, Num b, SymVal 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) => 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.

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

An implementation of rotate-left, using a barrel shifter like design. Only works when both arguments are finite bitvectors, and furthermore when the second argument is unsigned. The first condition is enforced by the type, but the second is dynamically checked. We provide this implementation as an alternative to sRotateLeft since SMTLib logic does not support variable argument rotates (as opposed to shifts), and thus this implementation can produce better code for verification compared to sRotateLeft.

>>> prove $ \x y -> (x `sBarrelRotateLeft`  y) `sBarrelRotateRight` (y :: SWord32) .== (x :: SWord64)
Q.E.D.

sRotateRight :: (SIntegral a, SIntegral 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.

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

An implementation of rotate-right, using a barrel shifter like design. See comments for sBarrelRotateLeft for details.

>>> prove $ \x y -> (x `sBarrelRotateRight` y) `sBarrelRotateLeft`  (y :: SWord32) .== (x :: SWord64)
Q.E.D.

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 (Ord a, SymVal 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 multiplier, 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

Instances details
SFiniteBits Int16 Source # 
Instance details

Defined in Data.SBV.Core.Model

SFiniteBits Int32 Source # 
Instance details

Defined in Data.SBV.Core.Model

SFiniteBits Int64 Source # 
Instance details

Defined in Data.SBV.Core.Model

SFiniteBits Int8 Source # 
Instance details

Defined in Data.SBV.Core.Model

SFiniteBits Word16 Source # 
Instance details

Defined in Data.SBV.Core.Model

SFiniteBits Word32 Source # 
Instance details

Defined in Data.SBV.Core.Model

SFiniteBits Word64 Source # 
Instance details

Defined in Data.SBV.Core.Model

SFiniteBits Word8 Source # 
Instance details

Defined in Data.SBV.Core.Model

(KnownNat n, BVIsNonZero n) => SFiniteBits (IntN n) Source #

SFiniteBits instance for IntN

Instance details

Defined in Data.SBV.Core.Sized

(KnownNat n, BVIsNonZero n) => SFiniteBits (WordN n) Source #

SFiniteBits instance for WordN

Instance details

Defined in Data.SBV.Core.Sized

Splitting, joining, and extending bit-vectors

bvExtract Source #

Arguments

:: forall i j n bv proxy. (KnownNat n, BVIsNonZero n, SymVal (bv n), KnownNat i, KnownNat j, (i + 1) <= n, j <= i, BVIsNonZero ((i - j) + 1)) 
=> proxy i

i: Start position, numbered from n-1 to 0

-> proxy j

j: End position, numbered from n-1 to 0, j <= i must hold

-> SBV (bv n)

Input bit vector of size n

-> SBV (bv ((i - j) + 1))

Output is of size i - j + 1

Extract a portion of bits to form a smaller bit-vector.

>>> prove $ \x -> bvExtract (Proxy @7) (Proxy @3) (x :: SWord 12) .== bvDrop (Proxy @4) (bvTake (Proxy @9) x)
Q.E.D.

(#) infixr 5 Source #

Arguments

:: (KnownNat n, BVIsNonZero n, SymVal (bv n), KnownNat m, BVIsNonZero m, SymVal (bv m)) 
=> SBV (bv n)

First input, of size n, becomes the left side

-> SBV (bv m)

Second input, of size m, becomes the right side

-> SBV (bv (n + m))

Concatenation, of size n+m

Join two bitvectors.

>>> prove $ \x y -> x .== bvExtract (Proxy @79) (Proxy @71) ((x :: SWord 9) # (y :: SWord 71))
Q.E.D.

zeroExtend Source #

Arguments

:: forall n m bv. (KnownNat n, BVIsNonZero n, SymVal (bv n), KnownNat m, BVIsNonZero m, SymVal (bv m), (n + 1) <= m, SIntegral (bv (m - n)), BVIsNonZero (m - n)) 
=> SBV (bv n)

Input, of size n

-> SBV (bv m)

Output, of size m. n < m must hold

Zero extend a bit-vector.

>>> prove $ \x -> bvExtract (Proxy @20) (Proxy @12) (zeroExtend (x :: SInt 12) :: SInt 21) .== 0
Q.E.D.

signExtend Source #

Arguments

:: forall n m bv. (KnownNat n, BVIsNonZero n, SymVal (bv n), KnownNat m, BVIsNonZero m, SymVal (bv m), (n + 1) <= m, SFiniteBits (bv n), SIntegral (bv (m - n)), BVIsNonZero (m - n)) 
=> SBV (bv n)

Input, of size n

-> SBV (bv m)

Output, of size m. n < m must hold

Sign extend a bit-vector.

>>> prove $ \x -> sNot (msb x) .=> bvExtract (Proxy @20) (Proxy @12) (signExtend (x :: SInt 12) :: SInt 21) .== 0
Q.E.D.
>>> prove $ \x ->       msb x  .=> bvExtract (Proxy @20) (Proxy @12) (signExtend (x :: SInt 12) :: SInt 21) .== complement 0
Q.E.D.

bvDrop Source #

Arguments

:: forall i n m bv proxy. (KnownNat n, BVIsNonZero n, KnownNat i, (i + 1) <= n, ((i + m) - n) <= 0, BVIsNonZero (n - i)) 
=> proxy i

i: Number of bits to drop. i < n must hold.

-> SBV (bv n)

Input, of size n

-> SBV (bv m)

Output, of size m. m = n - i holds.

Drop bits from the top of a bit-vector.

>>> prove $ \x -> bvDrop (Proxy @0) (x :: SWord 43) .== x
Q.E.D.
>>> prove $ \x -> bvDrop (Proxy @20) (x :: SWord 21) .== ite (lsb x) 1 (0 :: SWord 1)
Q.E.D.

bvTake Source #

Arguments

:: forall i n bv proxy. (KnownNat n, BVIsNonZero n, KnownNat i, BVIsNonZero i, i <= n) 
=> proxy i

i: Number of bits to take. 0 < i <= n must hold.

-> SBV (bv n)

Input, of size n

-> SBV (bv i)

Output, of size i

Take bits from the top of a bit-vector.

>>> prove $ \x -> bvTake (Proxy @13) (x :: SWord 13) .== x
Q.E.D.
>>> prove $ \x -> bvTake (Proxy @1) (x :: SWord 13) .== ite (msb x) 1 0
Q.E.D.
>>> prove $ \x -> bvTake (Proxy @4) x # bvDrop (Proxy @4) x .== (x :: SWord 23)
Q.E.D.

class ByteConverter a where Source #

A helper class to convert sized bit-vectors to/from bytes.

Methods

toBytes :: a -> [SWord 8] Source #

Convert to a sequence of bytes

>>> prove $ \a b c d -> toBytes ((fromBytes [a, b, c, d]) :: SWord 32) .== [a, b, c, d]
Q.E.D.

fromBytes :: [SWord 8] -> a Source #

Convert from a sequence of bytes

>>> prove $ \r -> fromBytes (toBytes r) .== (r :: SWord 64)
Q.E.D.

Instances

Instances details
ByteConverter (SWord 8) Source #

SWord 8 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 8 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 8 Source #

ByteConverter (SWord 16) Source #

SWord 16 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 16 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 16 Source #

ByteConverter (SWord 32) Source #

SWord 32 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 32 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 32 Source #

ByteConverter (SWord 64) Source #

SWord 64 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 64 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 64 Source #

ByteConverter (SWord 128) Source #

SWord 128 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 128 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 128 Source #

ByteConverter (SWord 256) Source #

SWord 256 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 256 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 256 Source #

ByteConverter (SWord 512) Source #

SWord 512 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 512 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 512 Source #

ByteConverter (SWord 1024) Source #

SWord 1024 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 1024 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 1024 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 (SymVal 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

Instances details
IEEEFloating Double Source #

SDouble instance

Instance details

Defined in Data.SBV.Core.Floating

IEEEFloating Float Source #

SFloat instance

Instance details

Defined in Data.SBV.Core.Floating

ValidFloat eb sb => IEEEFloating (FloatingPoint eb sb) Source # 
Instance details

Defined in Data.SBV.Core.Floating

Methods

fpAbs :: SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpNeg :: SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpAdd :: SRoundingMode -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpSub :: SRoundingMode -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpMul :: SRoundingMode -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpDiv :: SRoundingMode -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpFMA :: SRoundingMode -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpSqrt :: SRoundingMode -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpRem :: SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpRoundToIntegral :: SRoundingMode -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpMin :: SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpMax :: SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) Source #

fpIsEqualObject :: SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb) -> SBool Source #

fpIsNormal :: SBV (FloatingPoint eb sb) -> SBool Source #

fpIsSubnormal :: SBV (FloatingPoint eb sb) -> SBool Source #

fpIsZero :: SBV (FloatingPoint eb sb) -> SBool Source #

fpIsInfinite :: SBV (FloatingPoint eb sb) -> SBool Source #

fpIsNaN :: SBV (FloatingPoint eb sb) -> SBool Source #

fpIsNegative :: SBV (FloatingPoint eb sb) -> SBool Source #

fpIsPositive :: SBV (FloatingPoint eb sb) -> SBool Source #

fpIsNegativeZero :: SBV (FloatingPoint eb sb) -> SBool Source #

fpIsPositiveZero :: SBV (FloatingPoint eb sb) -> SBool Source #

fpIsPoint :: SBV (FloatingPoint eb sb) -> 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

Instances details
Data RoundingMode Source # 
Instance details

Defined in Data.SBV.Core.Kind

Methods

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

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

toConstr :: RoundingMode -> Constr #

dataTypeOf :: RoundingMode -> DataType #

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

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

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

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

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

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

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

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

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

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

Bounded RoundingMode Source # 
Instance details

Defined in Data.SBV.Core.Kind

Enum RoundingMode Source # 
Instance details

Defined in Data.SBV.Core.Kind

Read RoundingMode Source # 
Instance details

Defined in Data.SBV.Core.Kind

Show RoundingMode Source # 
Instance details

Defined in Data.SBV.Core.Kind

Eq RoundingMode Source # 
Instance details

Defined in Data.SBV.Core.Kind

Ord RoundingMode Source # 
Instance details

Defined in Data.SBV.Core.Kind

SymVal RoundingMode Source #

RoundingMode can be used symbolically

Instance details

Defined in Data.SBV.Core.Data

HasKind RoundingMode Source #

RoundingMode kind

Instance details

Defined in Data.SBV.Core.Kind

SatModel RoundingMode Source #

A rounding mode, extracted from a model. (Default definition suffices)

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (RoundingMode, [CV]) Source #

cvtModel :: (RoundingMode -> Maybe b) -> Maybe (RoundingMode, [CV]) -> Maybe (b, [CV]) 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, SymVal a) => SBV a Source #

Symbolic variant of Not-A-Number. This value will inhabit SFloat, SDouble and SFloatingPoint. types.

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

Symbolic variant of infinity. This value will inhabit both SFloat, SDouble and SFloatingPoint. types.

Rounding modes

Conversion to/from floats

Capture convertability from/to FloatingPoint representations.

Conversions to float: toSFloat and toSDouble simply return the nearest representable float from the given type based on the rounding mode provided. Similarly, toSFloatingPoint converts to a generalized floating-point number with specified exponent and significand bith widths.

Conversions from float: fromSFloat, fromSDouble, fromSFloatingPoint functions do the reverse conversion. However some care is needed when given values that are not representable in the integral target domain. For instance, converting an SFloat to an SInt8 is problematic. The rules are as follows:

If the input value is a finite point and when rounded in the given rounding mode to an integral value lies within the target bounds, then that result is returned. (This is the regular interpretation of rounding in IEEE754.)

Otherwise (i.e., if the integral value in the float or double domain) doesn't fit into the target type, then the result is unspecified. Note that if the input is +oo, -oo, or NaN, then the result is unspecified.

Due to the unspecified nature of conversions, SBV will never constant fold conversions from floats to integral values. That is, you will always get a symbolic value as output. (Conversions from floats to other floats will be constant folded. Conversions from integral values to floats will also be constant folded.)

Note that unspecified really means unspecified: In particular, SBV makes no guarantees about matching the behavior between what you might get in Haskell, via SMT-Lib, or the C-translation. If the input value is out-of-bounds as defined above, or is NaN or oo or -oo, then all bets are off. In particular C and SMTLib are decidedly undefine this case, though that doesn't mean they do the same thing! Same goes for Haskell, which seems to convert via Int64, but we do not model that behavior in SBV as it doesn't seem to be intentional nor well documented.

You can check for NaN, oo and -oo, using the predicates fpIsNaN, fpIsInfinite, and fpIsPositive, fpIsNegative predicates, respectively; and do the proper conversion based on your needs. (0 is a good choice, as are min/max bounds of the target type.)

Currently, SBV provides no predicates to check if a value would lie within range for a particular conversion task, as this depends on the rounding mode and the types involved and can be rather tricky to determine. (See http://github.com/LeventErkok/sbv/issues/456 for a discussion of the issues involved.) In a future release, we hope to be able to provide underflow and overflow predicates for these conversions as well.

Some examples to illustrate the behavior follows:

>>> :{
roundTrip :: forall a. (Eq a, IEEEFloatConvertible a) => SRoundingMode -> SBV a -> SBool
roundTrip m x = fromSFloat m (toSFloat m x) .== x
:}
>>> prove $ roundTrip @Int8
Q.E.D.
>>> prove $ roundTrip @Word8
Q.E.D.
>>> prove $ roundTrip @Int16
Q.E.D.
>>> prove $ roundTrip @Word16
Q.E.D.
>>> prove $ roundTrip @Int32
Falsifiable. Counter-example:
  s0 = RoundNearestTiesToAway :: RoundingMode
  s1 =             -740395022 :: Int32

Note how we get a failure on Int32. The counter-example value is not representable exactly as a single precision float:

>>> toRational (-740395022 :: Float)
(-740395008) % 1

Note how the numerator is different, it is off by 14. This is hardly surprising, since floats become sparser as the magnitude increases to be able to cover all the integer values representable.

>>> :{
roundTrip :: forall a. (Eq a, IEEEFloatConvertible a) => SRoundingMode -> SBV a -> SBool
roundTrip m x = fromSDouble m (toSDouble m x) .== x
:}
>>> prove $ roundTrip @Int8
Q.E.D.
>>> prove $ roundTrip @Word8
Q.E.D.
>>> prove $ roundTrip @Int16
Q.E.D.
>>> prove $ roundTrip @Word16
Q.E.D.
>>> prove $ roundTrip @Int32
Q.E.D.
>>> prove $ roundTrip @Word32
Q.E.D.
>>> prove $ roundTrip @Int64
Falsifiable. Counter-example:
  s0 = RoundTowardPositive :: RoundingMode
  s1 = 1152921504606846896 :: Int64

Just like in the SFloat case, once we reach 64-bits, we no longer can exactly represent the integer value for all possible values:

>>> toRational (fromIntegral (1152921504606846896 :: Int64) :: Double)
1152921504606846848 % 1

In this case the numerator is off by 48.

class SymVal a => IEEEFloatConvertible a where Source #

Conversion to and from floats

Minimal complete definition

Nothing

Methods

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

Convert from an IEEE74 single precision float.

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

Convert to an IEEE-754 Single-precision float.

default toSFloat :: Integral a => SRoundingMode -> SBV a -> SFloat Source #

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

Convert from an IEEE74 double precision float.

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

Convert to an IEEE-754 Double-precision float.

fromSFloatingPoint :: ValidFloat eb sb => SRoundingMode -> SFloatingPoint eb sb -> SBV a Source #

Convert from an arbitrary floating point.

toSFloatingPoint :: ValidFloat eb sb => SRoundingMode -> SBV a -> SFloatingPoint eb sb Source #

Convert to an arbitrary floating point.

Instances

Instances details
IEEEFloatConvertible Int16 Source # 
Instance details

Defined in Data.SBV.Core.Floating

IEEEFloatConvertible Int32 Source # 
Instance details

Defined in Data.SBV.Core.Floating

IEEEFloatConvertible Int64 Source # 
Instance details

Defined in Data.SBV.Core.Floating

IEEEFloatConvertible Int8 Source # 
Instance details

Defined in Data.SBV.Core.Floating

IEEEFloatConvertible Word16 Source # 
Instance details

Defined in Data.SBV.Core.Floating

IEEEFloatConvertible Word32 Source # 
Instance details

Defined in Data.SBV.Core.Floating

IEEEFloatConvertible Word64 Source # 
Instance details

Defined in Data.SBV.Core.Floating

IEEEFloatConvertible Word8 Source # 
Instance details

Defined in Data.SBV.Core.Floating

IEEEFloatConvertible AlgReal Source # 
Instance details

Defined in Data.SBV.Core.Floating

IEEEFloatConvertible Integer Source # 
Instance details

Defined in Data.SBV.Core.Floating

IEEEFloatConvertible Double Source # 
Instance details

Defined in Data.SBV.Core.Floating

IEEEFloatConvertible Float Source # 
Instance details

Defined in Data.SBV.Core.Floating

ValidFloat eb sb => IEEEFloatConvertible (FloatingPoint eb sb) Source # 
Instance details

Defined in Data.SBV.Core.Floating

Bit-pattern conversions

sFloatAsSWord32 :: SFloat -> SWord32 Source #

Convert an SFloat to an SWord32, preserving the bit-correspondence. Note that since the representation for NaNs 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 NaNs 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

sFloatingPointAsSWord :: forall eb sb. (ValidFloat eb sb, KnownNat (eb + sb), BVIsNonZero (eb + sb)) => SFloatingPoint eb sb -> SWord (eb + sb) Source #

Convert a float to the word containing the corresponding bit pattern

sWordAsSFloatingPoint :: forall eb sb. (KnownNat (eb + sb), BVIsNonZero (eb + sb), ValidFloat eb sb) => SWord (eb + sb) -> SFloatingPoint eb sb Source #

Convert a word to an arbitrary float, by reinterpreting the bits of the word as the corresponding bits of the float.

Extracting bit patterns from floats

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.

blastSFloatingPoint :: forall eb sb. (ValidFloat eb sb, KnownNat (eb + sb), BVIsNonZero (eb + sb)) => SFloatingPoint eb sb -> (SBool, [SBool], [SBool]) Source #

Extract the sign/exponent/mantissa of an arbitrary precision float. The output will have eb bits in the second argument for exponent, and sb-1 bits in the third for mantissa.

Showing values in detail

crack :: SBV a -> String Source #

Show a value in detailed (cracked) form, if possible. This makes most sense with numbers, and especially floating-point types.

Enumerations

If the uninterpreted sort definition takes the form of an enumeration (i.e., a simple data type with all nullary constructors), then you can use the mkSymbolicEnumeration function to turn it into an enumeration in SMTLib. 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

The declaration will automatically introduce the type:

    type SX = SBV X

along with symbolic values of each of the enumerated values sA, sB, and sC. This way, you can refer to the symbolic version as SX, treating it 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 <=. For each enumerated value X, the symbolic versions sX is defined to be equal to literal X.

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.

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 an empty data-type in Haskell and registering it as such. The following example demonstrates:

    data B
    mkUninterpretedSort ''B
 

(Note that you'll also need to use pragmas TemplateHaskell, StandAloneDeriving, DeriveDataTypeable, and DeriveAnyClass for this to work, follow GHC's error messages!)

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 this will also introduce the type SB into your environment, which is a synonym for SBV B.

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

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

Make an uninterpred sort.

Stopping unrolling: Defined functions

class SMTDefinable a where Source #

SMT definable constants and functions, which can also be uninterpeted. This class captures functions that we can generate standalone-code for in the SMT solver. Note that we also allow uninterpreted constants and functions too. 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: sbvDefineValue. However, most instances in practice are already provided by SBV, so end-users should not need to define their own instances.

Minimal complete definition

sbvDefineValue

Methods

smtFunction :: Lambda Symbolic a => String -> a -> a Source #

Generate the code for this value as an SMTLib function, instead of the usual unrolling semantics. This is useful for generating sub-functions in generated SMTLib problem, or handling recursive (and mutually-recursive) definitions that wouldn't terminate in an unrolling symbolic simulation context.

IMPORTANT NOTE The string argument names this function. Note that SBV will identify this function with that name, i.e., if you use this function twice (or use it recursively), it will simply assume this name uniquely identifies the function being defined. Hence, the user has to assure that this string is unique amongst all the functions you use. Furthermore, if the call to smtFunction happens in the scope of a parameter, you must make sure the string is chosen to keep it unique per parameter value. For instance, if you have:

  bar :: SInteger -> SInteger -> SInteger
  bar k = smtFunction "bar" (x -> x+k)   -- Note the capture of k!

and you call bar 2 and bar 3, you *will* get the same SMTLib function. Obviously this is unsound. The reason is that the parameter value isn't captured by the name. In general, you should simply not do this, but if you must, have a concrete argument to make sure you can create a unique name. Something like:

  bar :: String -> SInteger -> SInteger -> SInteger
  bar tag k = smtFunction ("bar_" ++ tag) (x -> x+k)   -- Tag should make the name unique!

Then, make sure you use bar "two" 2 and bar "three" 3 etc. to preserve the invariant.

Note that this is a design choice, to keep function creation as easy to use as possible. SBV could've made smtFunction a monadic call and generated the name itself to avoid all these issues. But the ergonomics of that is worse, and doesn't fit with the general design philosophy. If you can think of a solution (perhaps using some nifty GHC tricks?) to avoid this issue without making smtFunction return a monadic result, please get in touch!

uninterpret :: String -> a Source #

Uninterpret a value, i.e., add this value as a completely undefined value/function that the solver is free to instantiate to satisfy other constraints.

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.

sbvDefineValue :: String -> UIKind a -> 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.

sym :: String -> a Source #

A synonym for uninterpret. Allows us to create variables without having to call free explicitly, i.e., without being in the symbolic monad.

Instances

Instances details
HasKind a => SMTDefinable (SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: String -> SBV a -> SBV a Source #

uninterpret :: String -> SBV a Source #

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

sbvDefineValue :: String -> UIKind (SBV a) -> SBV a Source #

sym :: String -> SBV a Source #

(SymVal b, HasKind a) => SMTDefinable (SBV b -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: String -> (SBV b -> SBV a) -> SBV b -> SBV a Source #

uninterpret :: String -> SBV b -> SBV a Source #

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

sbvDefineValue :: String -> UIKind (SBV b -> SBV a) -> SBV b -> SBV a Source #

sym :: String -> SBV b -> SBV a Source #

(SymVal c, SymVal b, HasKind a) => SMTDefinable (SBV c -> SBV b -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: String -> (SBV c -> SBV b -> SBV a) -> SBV c -> SBV b -> SBV a Source #

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 #

sbvDefineValue :: String -> UIKind (SBV c -> SBV b -> SBV a) -> SBV c -> SBV b -> SBV a Source #

sym :: String -> SBV c -> SBV b -> SBV a Source #

(SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable (SBV d -> SBV c -> SBV b -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: String -> (SBV d -> SBV c -> SBV b -> SBV a) -> SBV d -> SBV c -> SBV b -> SBV a Source #

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 #

sbvDefineValue :: String -> UIKind (SBV d -> SBV c -> SBV b -> SBV a) -> SBV d -> SBV c -> SBV b -> SBV a Source #

sym :: String -> SBV d -> SBV c -> SBV b -> SBV a Source #

(SymVal e, SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable (SBV e -> SBV d -> SBV c -> SBV b -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: String -> (SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

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 #

sbvDefineValue :: String -> UIKind (SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

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

(SymVal f, SymVal e, SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable (SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: 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 #

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 #

sbvDefineValue :: String -> UIKind (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 #

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

(SymVal g, SymVal f, SymVal e, SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable (SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: 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 #

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 #

sbvDefineValue :: String -> UIKind (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 #

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

(SymVal h, SymVal g, SymVal f, SymVal e, SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable (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

smtFunction :: 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 #

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 #

sbvDefineValue :: String -> UIKind (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 #

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

(SymVal c, SymVal b, HasKind a) => SMTDefinable ((SBV c, SBV b) -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: String -> ((SBV c, SBV b) -> SBV a) -> (SBV c, SBV b) -> SBV a Source #

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 #

sbvDefineValue :: String -> UIKind ((SBV c, SBV b) -> SBV a) -> (SBV c, SBV b) -> SBV a Source #

sym :: String -> (SBV c, SBV b) -> SBV a Source #

(SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable ((SBV d, SBV c, SBV b) -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: String -> ((SBV d, SBV c, SBV b) -> SBV a) -> (SBV d, SBV c, SBV b) -> SBV a Source #

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 #

sbvDefineValue :: String -> UIKind ((SBV d, SBV c, SBV b) -> SBV a) -> (SBV d, SBV c, SBV b) -> SBV a Source #

sym :: String -> (SBV d, SBV c, SBV b) -> SBV a Source #

(SymVal e, SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable ((SBV e, SBV d, SBV c, SBV b) -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

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

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 #

sbvDefineValue :: String -> UIKind ((SBV e, SBV d, SBV c, SBV b) -> SBV a) -> (SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

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

(SymVal f, SymVal e, SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable ((SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: 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 #

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 #

sbvDefineValue :: String -> UIKind ((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 #

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

(SymVal g, SymVal f, SymVal e, SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable ((SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: 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 #

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 #

sbvDefineValue :: String -> UIKind ((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 #

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

(SymVal h, SymVal g, SymVal f, SymVal e, SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable ((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

smtFunction :: 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 #

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 #

sbvDefineValue :: String -> UIKind ((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 #

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

Special relations

A special relation is a binary relation that has additional properties. SBV allows for the checking of various kinds of special relations respecting various axioms, and allows for creating transitive closures. See Documentation.SBV.Examples.Misc.FirstOrderLogic for several examples.

type Relation a = (SBV a, SBV a) -> SBool Source #

A type synonym for binary relations.

isPartialOrder :: SymVal a => String -> Relation a -> SBool Source #

Check if a relation is a partial order. The string argument must uniquely identify this order.

isLinearOrder :: SymVal a => String -> Relation a -> SBool Source #

Check if a relation is a linear order. The string argument must uniquely identify this order.

isTreeOrder :: SymVal a => String -> Relation a -> SBool Source #

Check if a relation is a tree order. The string argument must uniquely identify this order.

isPiecewiseLinearOrder :: SymVal a => String -> Relation a -> SBool Source #

Check if a relation is a piece-wise linear order. The string argument must uniquely identify this order.

mkTransitiveClosure :: forall a. SymVal a => String -> Relation a -> Relation a Source #

Create the transitive closure of a given relation. The string argument must uniquely identify the newly created relation.

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.

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 getAvailableSolvers 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 ConstraintSet = Symbolic () Source #

A constraint set is a symbolic program that returns no values. The idea is that the constraints/min-max goals will serve as the collection of constraints that will be used for sat/optimize calls.

type Provable = ProvableM IO Source #

Provable is specialization of ProvableM to the IO monad. Unless you are using transformers explicitly, this is the type you should prefer.

type Satisfiable = SatisfiableM IO Source #

Satisfiable is specialization of SatisfiableM to the IO monad. Unless you are using transformers explicitly, this is the type you should prefer.

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

Prove a predicate, using the default solver.

NB. For a version which generalizes over the underlying monad, see prove

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

Prove the predicate using the given SMT-solver.

NB. For a version which generalizes over the underlying monad, see proveWith

dprove :: Provable a => a -> IO ThmResult Source #

Prove a predicate with delta-satisfiability, using the default solver.

NB. For a version which generalizes over the underlying monad, see prove

dproveWith :: Provable a => SMTConfig -> a -> IO ThmResult Source #

Prove the predicate with delta-satisfiability using the given SMT-solver.

NB. For a version which generalizes over the underlying monad, see proveWith

sat :: Satisfiable a => a -> IO SatResult Source #

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

NB. For a version which generalizes over the underlying monad, see sat

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

Find a satisfying assignment using the given SMT-solver.

NB. For a version which generalizes over the underlying monad, see satWith

dsat :: Satisfiable a => a -> IO SatResult Source #

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

NB. For a version which generalizes over the underlying monad, see dsat

dsatWith :: Satisfiable a => SMTConfig -> a -> IO SatResult Source #

Find a satisfying assignment using the given SMT-solver.

NB. For a version which generalizes over the underlying monad, see satWith

allSat :: Satisfiable a => a -> IO AllSatResult Source #

Find all satisfying assignments, using the default solver. Equivalent to allSatWith defaultSMTCfg. See allSatWith for details.

NB. For a version which generalizes over the underlying monad, see allSat

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

Return all satisfying assignments for a predicate. 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

NB. For a version which generalizes over the underlying monad, see allSatWith

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

Optimize a given collection of Objectives.

NB. For a version which generalizes over the underlying monad, see optimize

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

Optimizes the objectives using the given SMT-solver.

NB. For a version which generalizes over the underlying monad, see optimizeWith

isVacuousProof :: Provable a => a -> IO Bool Source #

Check if the constraints given are consistent in a prove call using the default solver.

NB. For a version which generalizes over the underlying monad, see isVacuousProof

isVacuousProofWith :: Provable a => SMTConfig -> a -> IO Bool Source #

Determine if the constraints are vacuous in a SAT call using the given SMT-solver.

NB. For a version which generalizes over the underlying monad, see isVacuousProofWith

isTheorem :: Provable a => a -> IO Bool Source #

Checks theoremhood using the default solver.

NB. For a version which generalizes over the underlying monad, see isTheorem

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

Check whether a given property is a theorem.

NB. For a version which generalizes over the underlying monad, see isTheoremWith

isSatisfiable :: Satisfiable a => a -> IO Bool Source #

Checks satisfiability using the default solver.

NB. For a version which generalizes over the underlying monad, see isSatisfiable

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

Check whether a given property is satisfiable.

NB. For a version which generalizes over the underlying monad, see isSatisfiableWith

proveWithAny :: Provable a => [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 an exception 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.

proveWithAll :: Provable a => [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.

proveConcurrentWithAny :: Provable a => SMTConfig -> [Query b] -> a -> IO (Solver, NominalDiffTime, ThmResult) Source #

Prove a property by running many queries each isolated to their own thread concurrently and return the first that finishes, killing the others

proveConcurrentWithAll :: Provable a => SMTConfig -> [Query b] -> a -> IO [(Solver, NominalDiffTime, ThmResult)] Source #

Prove a property by running many queries each isolated to their own thread concurrently and wait for each to finish returning all results

satWithAny :: Satisfiable a => [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 an exception 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 :: Satisfiable a => [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.

satConcurrentWithAny :: Satisfiable a => SMTConfig -> [Query b] -> a -> IO (Solver, NominalDiffTime, SatResult) Source #

Find a satisfying assignment to a property using a single solver, but providing several query problems of interest, with each query running in a separate thread and return the first one that returns. This can be useful to use symbolic mode to drive to a location in the search space of the solver and then refine the problem in query mode. If the computation is very hard to solve for the solver than running in concurrent mode may provide a large performance benefit.

satConcurrentWithAll :: Satisfiable a => SMTConfig -> [Query b] -> a -> IO [(Solver, NominalDiffTime, SatResult)] Source #

Find a satisfying assignment to a property using a single solver, but run each query problem in a separate isolated thread and wait for each thread to finish. See satConcurrentWithAny for more details.

generateSMTBenchmarkSat :: SatisfiableM m a => a -> m String Source #

Create an SMT-Lib2 benchmark, for a SAT query.

generateSMTBenchmarkProof :: ProvableM m a => a -> m String Source #

Create an SMT-Lib2 benchmark, for a Proof query.

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]

NB. For a version which generalizes over the underlying monad, see solve

Constraints and Quantifiers

A constraint is a means for restricting the input domain of a formula. Here's a simple example:

   do x <- free "x"
      y <- free "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 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 <- free "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 isVacuousProof (and isVacuousProofWith) 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 sFalse.)

constrain :: (SolverContext m, QuantifiedBool a) => a -> m () Source #

Add a constraint, any satisfying instance must satisfy this condition.

softConstrain :: (SolverContext m, QuantifiedBool a) => a -> m () Source #

Add a soft constraint. The solver will try to satisfy this condition if possible, but won't if it cannot.

Quantified constraints, quantifier elimination, and skolemization

You can write quantified formulas, and reason with them as in first-order logic. Here is a simple example:

    constrain $ \(Forall x) (Exists y) -> y .> (x :: SInteger)

You can nest quantifiers as you wish, and the quantified parameters can be of arbitrary symbolic type. Additionally, you can convert such a quantified formula to a regular boolean, via a call to quantifiedBool function, essentially performing quantifier elimination:

    other_condition .&& quantifiedBool (\(Forall x) (Exists y) -> y .> (x :: SInteger))

Or you can prove/sat quantified formulas directly:

    prove $ \(Forall x) (Exists y) -> y .> (x :: SInteger)

This facility makes quantifiers part of the regular SBV language, allowing them to be mixed/matched with all your other symbolic computations. See the following files demonstrating reasoning with quantifiers:

SBV also supports the constructors ExistsUnique to create unique existentials, in addition to ForallN and ExistsN for creating multiple variables at the same time.

In general, SBV will not display the values of quantified variables for a satisfying instance. For a satisfiability problem, you can apply skolemization manually to have these values computed by the backend solver. Note that skolemization will produce functions for existentials under universals, and SBV generally cannot translate function values back to Haskell, except in certain simple cases. However, for prefix existentials, the manual transformation can pay off. As an example, compare:

>>> sat $ \(Exists x) (Forall y) -> x .<= (y :: SWord8)
Satisfiable

to:

>>> sat $ do { x <- free "x"; pure (quantifiedBool (\(Forall y) -> x .<= (y :: SWord8))) }
Satisfiable. Model:
  x = 0 :: Word8

where we have skolemized the top-level existential out, and received a witness value for it.

class QuantifiedBool a Source #

A value that can be used as a quantified boolean

Minimal complete definition

quantifiedBool

Instances

Instances details
QuantifiedBool SBool Source #

Base case of quantification, simple booleans

Instance details

Defined in Data.SBV.Core.Data

Constraint Symbolic a => QuantifiedBool a Source #

A constraint can be turned into a boolean

Instance details

Defined in Data.SBV.Lambda

Methods

quantifiedBool :: a -> SBool Source #

quantifiedBool :: QuantifiedBool a => a -> SBool Source #

Turn a quantified boolean into a regular boolean. That is, this function turns an exists/forall quantified formula to a simple boolean that can be used as a regular boolean value. An example is:

  quantifiedBool $ \(Forall x) (Exists y) -> y .> (x :: SInteger)

is equivalent to sTrue. You can think of this function as performing quantifier-elimination: It takes a quantified formula, and reduces it to a simple boolean that is equivalent to it, but has no quantifiers.

newtype Forall (nm :: Symbol) a Source #

A universal symbolic variable, used in building quantified constraints. The name attached via the symbol is used during skolemization. It names the corresponding argument to the skolem-functions within the scope of this quantifier.

Constructors

Forall (SBV a) 

Instances

Instances details
(SymVal a, Constraint m r) => Constraint m (Forall nm a -> r) Source #

Functions of a single universal

Instance details

Defined in Data.SBV.Core.Data

Methods

mkConstraint :: State -> (Forall nm a -> r) -> m () Source #

(ExtractIO m, SymVal a, Constraint Symbolic r, ProvableM m r) => ProvableM m (Forall nm a -> r) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

proofArgReduce :: (Forall nm a -> r) -> SymbolicT m SBool Source #

prove :: (Forall nm a -> r) -> m ThmResult Source #

proveWith :: SMTConfig -> (Forall nm a -> r) -> m ThmResult Source #

dprove :: (Forall nm a -> r) -> m ThmResult Source #

dproveWith :: SMTConfig -> (Forall nm a -> r) -> m ThmResult Source #

isVacuousProof :: (Forall nm a -> r) -> m Bool Source #

isVacuousProofWith :: SMTConfig -> (Forall nm a -> r) -> m Bool Source #

isTheorem :: (Forall nm a -> r) -> m Bool Source #

isTheoremWith :: SMTConfig -> (Forall nm a -> r) -> m Bool Source #

(ExtractIO m, SymVal a, Constraint Symbolic r, SatisfiableM m r) => SatisfiableM m (Forall nm a -> r) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

satArgReduce :: (Forall nm a -> r) -> SymbolicT m SBool Source #

sat :: (Forall nm a -> r) -> m SatResult Source #

satWith :: SMTConfig -> (Forall nm a -> r) -> m SatResult Source #

dsat :: (Forall nm a -> r) -> m SatResult Source #

dsatWith :: SMTConfig -> (Forall nm a -> r) -> m SatResult Source #

allSat :: (Forall nm a -> r) -> m AllSatResult Source #

allSatWith :: SMTConfig -> (Forall nm a -> r) -> m AllSatResult Source #

isSatisfiable :: (Forall nm a -> r) -> m Bool Source #

isSatisfiableWith :: SMTConfig -> (Forall nm a -> r) -> m Bool Source #

optimize :: OptimizeStyle -> (Forall nm a -> r) -> m OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> (Forall nm a -> r) -> m OptimizeResult Source #

QNot r => QNot (Forall nm a -> r) Source #

Negate over a universal quantifier. Switches to existential.

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type NegatesTo (Forall nm a -> r) Source #

Methods

qNot :: (Forall nm a -> r) -> NegatesTo (Forall nm a -> r) Source #

(KnownSymbol nm, Skolemize r) => Skolemize (Forall nm a -> r) Source #

Skolemize over a universal quantifier

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type SkolemsTo (Forall nm a -> r)

Methods

skolem :: String -> [(SVal, String)] -> (Forall nm a -> r) -> SkolemsTo (Forall nm a -> r)

skolemize :: (Forall nm a -> r) -> SkolemsTo (Forall nm a -> r) Source #

taggedSkolemize :: String -> (Forall nm a -> r) -> SkolemsTo (Forall nm a -> r) Source #

type NegatesTo (Forall nm a -> r) Source # 
Instance details

Defined in Data.SBV.Core.Data

type NegatesTo (Forall nm a -> r) = Exists nm a -> NegatesTo r

newtype Exists (nm :: Symbol) a Source #

An existential symbolic variable, used in building quantified constraints. The name attached via the symbol is used during skolemization to create a skolem-function name when this variable is eliminated.

Constructors

Exists (SBV a) 

Instances

Instances details
(SymVal a, Constraint m r) => Constraint m (Exists nm a -> r) Source #

Functions of a single existential

Instance details

Defined in Data.SBV.Core.Data

Methods

mkConstraint :: State -> (Exists nm a -> r) -> m () Source #

(ExtractIO m, SymVal a, Constraint Symbolic r, ProvableM m r) => ProvableM m (Exists nm a -> r) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

proofArgReduce :: (Exists nm a -> r) -> SymbolicT m SBool Source #

prove :: (Exists nm a -> r) -> m ThmResult Source #

proveWith :: SMTConfig -> (Exists nm a -> r) -> m ThmResult Source #

dprove :: (Exists nm a -> r) -> m ThmResult Source #

dproveWith :: SMTConfig -> (Exists nm a -> r) -> m ThmResult Source #

isVacuousProof :: (Exists nm a -> r) -> m Bool Source #

isVacuousProofWith :: SMTConfig -> (Exists nm a -> r) -> m Bool Source #

isTheorem :: (Exists nm a -> r) -> m Bool Source #

isTheoremWith :: SMTConfig -> (Exists nm a -> r) -> m Bool Source #

(ExtractIO m, SymVal a, Constraint Symbolic r, SatisfiableM m r) => SatisfiableM m (Exists nm a -> r) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

satArgReduce :: (Exists nm a -> r) -> SymbolicT m SBool Source #

sat :: (Exists nm a -> r) -> m SatResult Source #

satWith :: SMTConfig -> (Exists nm a -> r) -> m SatResult Source #

dsat :: (Exists nm a -> r) -> m SatResult Source #

dsatWith :: SMTConfig -> (Exists nm a -> r) -> m SatResult Source #

allSat :: (Exists nm a -> r) -> m AllSatResult Source #

allSatWith :: SMTConfig -> (Exists nm a -> r) -> m AllSatResult Source #

isSatisfiable :: (Exists nm a -> r) -> m Bool Source #

isSatisfiableWith :: SMTConfig -> (Exists nm a -> r) -> m Bool Source #

optimize :: OptimizeStyle -> (Exists nm a -> r) -> m OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> (Exists nm a -> r) -> m OptimizeResult Source #

QNot r => QNot (Exists nm a -> r) Source #

Negate over an existential quantifier. Switches to universal.

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type NegatesTo (Exists nm a -> r) Source #

Methods

qNot :: (Exists nm a -> r) -> NegatesTo (Exists nm a -> r) Source #

(HasKind a, KnownSymbol nm, Skolemize r) => Skolemize (Exists nm a -> r) Source #

Skolemize over an existential quantifier

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type SkolemsTo (Exists nm a -> r)

Methods

skolem :: String -> [(SVal, String)] -> (Exists nm a -> r) -> SkolemsTo (Exists nm a -> r)

skolemize :: (Exists nm a -> r) -> SkolemsTo (Exists nm a -> r) Source #

taggedSkolemize :: String -> (Exists nm a -> r) -> SkolemsTo (Exists nm a -> r) Source #

type NegatesTo (Exists nm a -> r) Source # 
Instance details

Defined in Data.SBV.Core.Data

type NegatesTo (Exists nm a -> r) = Forall nm a -> NegatesTo r

newtype ExistsUnique (nm :: Symbol) a Source #

An existential unique symbolic variable, used in building quantified constraints. The name attached via the symbol is used during skolemization. It's split into two extra names, suffixed _eu1 and _eu2, to name the universals in the equivalent formula: \(\exists! x\,P(x)\Leftrightarrow \exists x\,P(x) \land \forall x_{eu1} \forall x_{eu2} (P(x_{eu1}) \land P(x_{eu2}) \Rightarrow x_{eu1} = x_{eu2}) \)

Constructors

ExistsUnique (SBV a) 

Instances

Instances details
(SymVal a, Constraint m r, EqSymbolic (SBV a), QuantifiedBool r) => Constraint m (ExistsUnique nm a -> r) Source #

Functions of a unique single existential

Instance details

Defined in Data.SBV.Core.Data

Methods

mkConstraint :: State -> (ExistsUnique nm a -> r) -> m () Source #

(ExtractIO m, SymVal a, Constraint Symbolic r, ProvableM m r, EqSymbolic (SBV a)) => ProvableM m (ExistsUnique nm a -> r) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

(ExtractIO m, SymVal a, Constraint Symbolic r, SatisfiableM m r, EqSymbolic (SBV a)) => SatisfiableM m (ExistsUnique nm a -> r) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

(QNot r, QuantifiedBool r, EqSymbolic (SBV a)) => QNot (ExistsUnique nm a -> r) Source #

Negate over an unique existential quantifier

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type NegatesTo (ExistsUnique nm a -> r) Source #

Methods

qNot :: (ExistsUnique nm a -> r) -> NegatesTo (ExistsUnique nm a -> r) Source #

(HasKind a, EqSymbolic (SBV a), KnownSymbol nm, QuantifiedBool r, Skolemize (Forall (AppendSymbol nm "_eu1") a -> Forall (AppendSymbol nm "_eu2") a -> SBool)) => Skolemize (ExistsUnique nm a -> r) Source #

Skolemize over a unique existential quantifier

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type SkolemsTo (ExistsUnique nm a -> r)

Methods

skolem :: String -> [(SVal, String)] -> (ExistsUnique nm a -> r) -> SkolemsTo (ExistsUnique nm a -> r)

skolemize :: (ExistsUnique nm a -> r) -> SkolemsTo (ExistsUnique nm a -> r) Source #

taggedSkolemize :: String -> (ExistsUnique nm a -> r) -> SkolemsTo (ExistsUnique nm a -> r) Source #

type NegatesTo (ExistsUnique nm a -> r) Source # 
Instance details

Defined in Data.SBV.Core.Data

type NegatesTo (ExistsUnique nm a -> r) = Forall nm a -> Exists (AppendSymbol nm "_eu1") a -> Exists (AppendSymbol nm "_eu2") a -> SBool

newtype ForallN (n :: Nat) (nm :: Symbol) a Source #

Exactly n universal symbolic variables, used in in building quantified constraints. The name attached will be prefixed in front of _1, _2, ..., _n to form the names of the variables.

Constructors

ForallN [SBV a] 

Instances

Instances details
(KnownNat n, SymVal a, Constraint m r) => Constraint m (ForallN n nm a -> r) Source #

Functions of a number of universals

Instance details

Defined in Data.SBV.Core.Data

Methods

mkConstraint :: State -> (ForallN n nm a -> r) -> m () Source #

(KnownNat n, ExtractIO m, SymVal a, Constraint Symbolic r, ProvableM m r) => ProvableM m (ForallN n nm a -> r) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

proofArgReduce :: (ForallN n nm a -> r) -> SymbolicT m SBool Source #

prove :: (ForallN n nm a -> r) -> m ThmResult Source #

proveWith :: SMTConfig -> (ForallN n nm a -> r) -> m ThmResult Source #

dprove :: (ForallN n nm a -> r) -> m ThmResult Source #

dproveWith :: SMTConfig -> (ForallN n nm a -> r) -> m ThmResult Source #

isVacuousProof :: (ForallN n nm a -> r) -> m Bool Source #

isVacuousProofWith :: SMTConfig -> (ForallN n nm a -> r) -> m Bool Source #

isTheorem :: (ForallN n nm a -> r) -> m Bool Source #

isTheoremWith :: SMTConfig -> (ForallN n nm a -> r) -> m Bool Source #

(KnownNat n, ExtractIO m, SymVal a, Constraint Symbolic r, SatisfiableM m r) => SatisfiableM m (ForallN n nm a -> r) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

satArgReduce :: (ForallN n nm a -> r) -> SymbolicT m SBool Source #

sat :: (ForallN n nm a -> r) -> m SatResult Source #

satWith :: SMTConfig -> (ForallN n nm a -> r) -> m SatResult Source #

dsat :: (ForallN n nm a -> r) -> m SatResult Source #

dsatWith :: SMTConfig -> (ForallN n nm a -> r) -> m SatResult Source #

allSat :: (ForallN n nm a -> r) -> m AllSatResult Source #

allSatWith :: SMTConfig -> (ForallN n nm a -> r) -> m AllSatResult Source #

isSatisfiable :: (ForallN n nm a -> r) -> m Bool Source #

isSatisfiableWith :: SMTConfig -> (ForallN n nm a -> r) -> m Bool Source #

optimize :: OptimizeStyle -> (ForallN n nm a -> r) -> m OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> (ForallN n nm a -> r) -> m OptimizeResult Source #

QNot r => QNot (ForallN nm n a -> r) Source #

Negate over a number of universal quantifiers

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type NegatesTo (ForallN nm n a -> r) Source #

Methods

qNot :: (ForallN nm n a -> r) -> NegatesTo (ForallN nm n a -> r) Source #

(KnownSymbol nm, Skolemize r) => Skolemize (ForallN n nm a -> r) Source #

Skolemize over a number of universal quantifiers

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type SkolemsTo (ForallN n nm a -> r)

Methods

skolem :: String -> [(SVal, String)] -> (ForallN n nm a -> r) -> SkolemsTo (ForallN n nm a -> r)

skolemize :: (ForallN n nm a -> r) -> SkolemsTo (ForallN n nm a -> r) Source #

taggedSkolemize :: String -> (ForallN n nm a -> r) -> SkolemsTo (ForallN n nm a -> r) Source #

type NegatesTo (ForallN nm n a -> r) Source # 
Instance details

Defined in Data.SBV.Core.Data

type NegatesTo (ForallN nm n a -> r) = ExistsN nm n a -> NegatesTo r

newtype ExistsN (n :: Nat) (nm :: Symbol) a Source #

Exactly n existential symbolic variables, used in building quantified constraints. The name attached will be prefixed in front of _1, _2, ..., _n to form the names of the variables.

Constructors

ExistsN [SBV a] 

Instances

Instances details
(KnownNat n, SymVal a, Constraint m r) => Constraint m (ExistsN n nm a -> r) Source #

Functions of a number of existentials

Instance details

Defined in Data.SBV.Core.Data

Methods

mkConstraint :: State -> (ExistsN n nm a -> r) -> m () Source #

(KnownNat n, ExtractIO m, SymVal a, Constraint Symbolic r, ProvableM m r) => ProvableM m (ExistsN n nm a -> r) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

proofArgReduce :: (ExistsN n nm a -> r) -> SymbolicT m SBool Source #

prove :: (ExistsN n nm a -> r) -> m ThmResult Source #

proveWith :: SMTConfig -> (ExistsN n nm a -> r) -> m ThmResult Source #

dprove :: (ExistsN n nm a -> r) -> m ThmResult Source #

dproveWith :: SMTConfig -> (ExistsN n nm a -> r) -> m ThmResult Source #

isVacuousProof :: (ExistsN n nm a -> r) -> m Bool Source #

isVacuousProofWith :: SMTConfig -> (ExistsN n nm a -> r) -> m Bool Source #

isTheorem :: (ExistsN n nm a -> r) -> m Bool Source #

isTheoremWith :: SMTConfig -> (ExistsN n nm a -> r) -> m Bool Source #

(KnownNat n, ExtractIO m, SymVal a, Constraint Symbolic r, SatisfiableM m r) => SatisfiableM m (ExistsN n nm a -> r) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

satArgReduce :: (ExistsN n nm a -> r) -> SymbolicT m SBool Source #

sat :: (ExistsN n nm a -> r) -> m SatResult Source #

satWith :: SMTConfig -> (ExistsN n nm a -> r) -> m SatResult Source #

dsat :: (ExistsN n nm a -> r) -> m SatResult Source #

dsatWith :: SMTConfig -> (ExistsN n nm a -> r) -> m SatResult Source #

allSat :: (ExistsN n nm a -> r) -> m AllSatResult Source #

allSatWith :: SMTConfig -> (ExistsN n nm a -> r) -> m AllSatResult Source #

isSatisfiable :: (ExistsN n nm a -> r) -> m Bool Source #

isSatisfiableWith :: SMTConfig -> (ExistsN n nm a -> r) -> m Bool Source #

optimize :: OptimizeStyle -> (ExistsN n nm a -> r) -> m OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> (ExistsN n nm a -> r) -> m OptimizeResult Source #

QNot r => QNot (ExistsN nm n a -> r) Source #

Negate over a number of existential quantifiers

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type NegatesTo (ExistsN nm n a -> r) Source #

Methods

qNot :: (ExistsN nm n a -> r) -> NegatesTo (ExistsN nm n a -> r) Source #

(HasKind a, KnownNat n, KnownSymbol nm, Skolemize r) => Skolemize (ExistsN n nm a -> r) Source #

Skolemize over a number of existential quantifiers

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type SkolemsTo (ExistsN n nm a -> r)

Methods

skolem :: String -> [(SVal, String)] -> (ExistsN n nm a -> r) -> SkolemsTo (ExistsN n nm a -> r)

skolemize :: (ExistsN n nm a -> r) -> SkolemsTo (ExistsN n nm a -> r) Source #

taggedSkolemize :: String -> (ExistsN n nm a -> r) -> SkolemsTo (ExistsN n nm a -> r) Source #

type NegatesTo (ExistsN nm n a -> r) Source # 
Instance details

Defined in Data.SBV.Core.Data

type NegatesTo (ExistsN nm n a -> r) = ForallN nm n a -> NegatesTo r

class QNot a where Source #

Class of things that we can logically negate

Associated Types

type NegatesTo a :: Type Source #

Methods

qNot :: a -> NegatesTo a Source #

Negation of a quantified formula. This operation essentially lifts sNot to quantified formulae. Note that you can achieve the same using sNot . quantifiedBool, but that will hide the quantifiers, so prefer this version if you want to keep them around.

Instances

Instances details
QNot SBool Source #

Base case; pure symbolic boolean

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type NegatesTo SBool Source #

QNot r => QNot (Exists nm a -> r) Source #

Negate over an existential quantifier. Switches to universal.

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type NegatesTo (Exists nm a -> r) Source #

Methods

qNot :: (Exists nm a -> r) -> NegatesTo (Exists nm a -> r) Source #

QNot r => QNot (ExistsN nm n a -> r) Source #

Negate over a number of existential quantifiers

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type NegatesTo (ExistsN nm n a -> r) Source #

Methods

qNot :: (ExistsN nm n a -> r) -> NegatesTo (ExistsN nm n a -> r) Source #

(QNot r, QuantifiedBool r, EqSymbolic (SBV a)) => QNot (ExistsUnique nm a -> r) Source #

Negate over an unique existential quantifier

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type NegatesTo (ExistsUnique nm a -> r) Source #

Methods

qNot :: (ExistsUnique nm a -> r) -> NegatesTo (ExistsUnique nm a -> r) Source #

QNot r => QNot (Forall nm a -> r) Source #

Negate over a universal quantifier. Switches to existential.

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type NegatesTo (Forall nm a -> r) Source #

Methods

qNot :: (Forall nm a -> r) -> NegatesTo (Forall nm a -> r) Source #

QNot r => QNot (ForallN nm n a -> r) Source #

Negate over a number of universal quantifiers

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type NegatesTo (ForallN nm n a -> r) Source #

Methods

qNot :: (ForallN nm n a -> r) -> NegatesTo (ForallN nm n a -> r) Source #

class Skolemize a where Source #

A class of values that can be skolemized. Note that we don't export this class. Use the skolemize function instead.

Minimal complete definition

skolem

Methods

skolemize :: (Constraint Symbolic (SkolemsTo a), Skolemize a) => a -> SkolemsTo a Source #

Skolemization. For any formula, skolemization gives back an equisatisfiable formula that has no existential quantifiers in it. You have to provide enough names for all the existentials in the argument. (Extras OK, so you can pass an infinite list if you like.) The names should be distinct, and also different from any other uninterpreted name you might have elsewhere.

taggedSkolemize :: (Constraint Symbolic (SkolemsTo a), Skolemize a) => String -> a -> SkolemsTo a Source #

If you use the same names for skolemized arguments in different functions, they will collide; which is undesirable. Unfortunately there's no easy way for SBV to detect this. In such cases, use taggedSkolemize to add a scope to the skolem-function names generated.

Instances

Instances details
Skolemize (SBV a) Source #

Base case; pure symbolic values

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type SkolemsTo (SBV a)

Methods

skolem :: String -> [(SVal, String)] -> SBV a -> SkolemsTo (SBV a)

skolemize :: SBV a -> SkolemsTo (SBV a) Source #

taggedSkolemize :: String -> SBV a -> SkolemsTo (SBV a) Source #

(HasKind a, KnownSymbol nm, Skolemize r) => Skolemize (Exists nm a -> r) Source #

Skolemize over an existential quantifier

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type SkolemsTo (Exists nm a -> r)

Methods

skolem :: String -> [(SVal, String)] -> (Exists nm a -> r) -> SkolemsTo (Exists nm a -> r)

skolemize :: (Exists nm a -> r) -> SkolemsTo (Exists nm a -> r) Source #

taggedSkolemize :: String -> (Exists nm a -> r) -> SkolemsTo (Exists nm a -> r) Source #

(HasKind a, KnownNat n, KnownSymbol nm, Skolemize r) => Skolemize (ExistsN n nm a -> r) Source #

Skolemize over a number of existential quantifiers

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type SkolemsTo (ExistsN n nm a -> r)

Methods

skolem :: String -> [(SVal, String)] -> (ExistsN n nm a -> r) -> SkolemsTo (ExistsN n nm a -> r)

skolemize :: (ExistsN n nm a -> r) -> SkolemsTo (ExistsN n nm a -> r) Source #

taggedSkolemize :: String -> (ExistsN n nm a -> r) -> SkolemsTo (ExistsN n nm a -> r) Source #

(HasKind a, EqSymbolic (SBV a), KnownSymbol nm, QuantifiedBool r, Skolemize (Forall (AppendSymbol nm "_eu1") a -> Forall (AppendSymbol nm "_eu2") a -> SBool)) => Skolemize (ExistsUnique nm a -> r) Source #

Skolemize over a unique existential quantifier

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type SkolemsTo (ExistsUnique nm a -> r)

Methods

skolem :: String -> [(SVal, String)] -> (ExistsUnique nm a -> r) -> SkolemsTo (ExistsUnique nm a -> r)

skolemize :: (ExistsUnique nm a -> r) -> SkolemsTo (ExistsUnique nm a -> r) Source #

taggedSkolemize :: String -> (ExistsUnique nm a -> r) -> SkolemsTo (ExistsUnique nm a -> r) Source #

(KnownSymbol nm, Skolemize r) => Skolemize (Forall nm a -> r) Source #

Skolemize over a universal quantifier

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type SkolemsTo (Forall nm a -> r)

Methods

skolem :: String -> [(SVal, String)] -> (Forall nm a -> r) -> SkolemsTo (Forall nm a -> r)

skolemize :: (Forall nm a -> r) -> SkolemsTo (Forall nm a -> r) Source #

taggedSkolemize :: String -> (Forall nm a -> r) -> SkolemsTo (Forall nm a -> r) Source #

(KnownSymbol nm, Skolemize r) => Skolemize (ForallN n nm a -> r) Source #

Skolemize over a number of universal quantifiers

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type SkolemsTo (ForallN n nm a -> r)

Methods

skolem :: String -> [(SVal, String)] -> (ForallN n nm a -> r) -> SkolemsTo (ForallN n nm a -> r)

skolemize :: (ForallN n nm a -> r) -> SkolemsTo (ForallN n nm a -> r) Source #

taggedSkolemize :: String -> (ForallN n nm a -> r) -> SkolemsTo (ForallN n nm a -> r) Source #

Constraint Vacuity

When adding constraints, one has to be careful about making sure they are not inconsistent. The function isVacuousProof can be used 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 isVacuousProof to make sure to see that the pass was vacuous:

>>> isVacuousProof 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:

>>> isVacuousProof 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, QuantifiedBool a) => String -> a -> m () Source #

Add a named constraint. The name is used in unsat-core extraction.

constrainWithAttribute :: (SolverContext m, QuantifiedBool a) => [(String, String)] -> a -> m () Source #

Add a constraint, with arbitrary attributes.

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 sTrue. 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 #

sTrue if at most k of the input arguments are sTrue

pbAtLeast :: [SBool] -> Int -> SBool Source #

sTrue if at least k of the input arguments are sTrue

pbExactly :: [SBool] -> Int -> SBool Source #

sTrue if exactly k of the input arguments are sTrue

pbLe :: [(Int, SBool)] -> Int -> SBool Source #

sTrue if the sum of coefficients for sTrue elements is at most k. Generalizes pbAtMost.

pbGe :: [(Int, SBool)] -> Int -> SBool Source #

sTrue if the sum of coefficients for sTrue elements is at least k. Generalizes pbAtLeast.

pbEq :: [(Int, SBool)] -> Int -> SBool Source #

sTrue if the sum of coefficients for sTrue elements is exactly least k. Useful for coding exactly K-of-N constraints, and in particular mutex constraints.

pbMutexed :: [SBool] -> SBool Source #

sTrue if there is at most one set bit

pbStronglyMutexed :: [SBool] -> SBool Source #

sTrue 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 = 0 :: Int8
  s1 = 1 :: 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 :: HasKind a => Maybe CallStack -> String -> SBool -> SBV a -> SBV a Source #

Symbolic assert. Check that the given boolean condition is always sTrue 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 ExtractIO m => SExecutable m a Source #

Symbolically executable program fragments. This class is mainly used for safe calls, and is sufficiently 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

Instances

Instances details
ExtractIO m => SExecutable m () Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName :: () -> SymbolicT m () Source #

safe :: () -> m [SafeResult] Source #

safeWith :: SMTConfig -> () -> m [SafeResult] Source #

ExtractIO m => SExecutable m (SBV a) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName :: SBV a -> SymbolicT m () Source #

safe :: SBV a -> m [SafeResult] Source #

safeWith :: SMTConfig -> SBV a -> m [SafeResult] Source #

ExtractIO m => SExecutable m [SBV a] Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName :: [SBV a] -> SymbolicT m () Source #

safe :: [SBV a] -> m [SafeResult] Source #

safeWith :: SMTConfig -> [SBV a] -> m [SafeResult] Source #

(ExtractIO m, NFData a) => SExecutable m (SymbolicT m a) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

(ExtractIO m, NFData a, SymVal a, NFData b, SymVal b) => SExecutable m (SBV a, SBV b) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName :: (SBV a, SBV b) -> SymbolicT m () Source #

safe :: (SBV a, SBV b) -> m [SafeResult] Source #

safeWith :: SMTConfig -> (SBV a, SBV b) -> m [SafeResult] Source #

(SymVal a, SExecutable m p) => SExecutable m (SBV a -> p) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName :: (SBV a -> p) -> SymbolicT m () Source #

safe :: (SBV a -> p) -> m [SafeResult] Source #

safeWith :: SMTConfig -> (SBV a -> p) -> m [SafeResult] Source #

(SymVal a, SymVal b, SExecutable m p) => SExecutable m ((SBV a, SBV b) -> p) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName :: ((SBV a, SBV b) -> p) -> SymbolicT m () Source #

safe :: ((SBV a, SBV b) -> p) -> m [SafeResult] Source #

safeWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> m [SafeResult] Source #

(SymVal a, SymVal b, SymVal c, SExecutable m p) => SExecutable m ((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) -> SymbolicT m () Source #

safe :: ((SBV a, SBV b, SBV c) -> p) -> m [SafeResult] Source #

safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> m [SafeResult] Source #

(SymVal a, SymVal b, SymVal c, SymVal d, SExecutable m p) => SExecutable m ((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) -> SymbolicT m () Source #

safe :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> m [SafeResult] Source #

safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> m [SafeResult] Source #

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SExecutable m p) => SExecutable m ((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) -> SymbolicT m () Source #

safe :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> m [SafeResult] Source #

safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> m [SafeResult] Source #

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SymVal f, SExecutable m p) => SExecutable m ((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) -> SymbolicT m () Source #

safe :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> m [SafeResult] Source #

safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> m [SafeResult] Source #

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SymVal f, SymVal g, SExecutable m p) => SExecutable m ((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) -> SymbolicT m () Source #

safe :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> m [SafeResult] Source #

safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> m [SafeResult] Source #

(ExtractIO m, NFData a, SymVal a, NFData b, SymVal b, NFData c, SymVal c) => SExecutable m (SBV a, SBV b, SBV c) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName :: (SBV a, SBV b, SBV c) -> SymbolicT m () Source #

safe :: (SBV a, SBV b, SBV c) -> m [SafeResult] Source #

safeWith :: SMTConfig -> (SBV a, SBV b, SBV c) -> m [SafeResult] Source #

(ExtractIO m, NFData a, SymVal a, NFData b, SymVal b, NFData c, SymVal c, NFData d, SymVal d) => SExecutable m (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) -> SymbolicT m () Source #

safe :: (SBV a, SBV b, SBV c, SBV d) -> m [SafeResult] Source #

safeWith :: SMTConfig -> (SBV a, SBV b, SBV c, SBV d) -> m [SafeResult] Source #

(ExtractIO m, NFData a, SymVal a, NFData b, SymVal b, NFData c, SymVal c, NFData d, SymVal d, NFData e, SymVal e) => SExecutable m (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) -> SymbolicT m () Source #

safe :: (SBV a, SBV b, SBV c, SBV d, SBV e) -> m [SafeResult] Source #

safeWith :: SMTConfig -> (SBV a, SBV b, SBV c, SBV d, SBV e) -> m [SafeResult] Source #

(ExtractIO m, NFData a, SymVal a, NFData b, SymVal b, NFData c, SymVal c, NFData d, SymVal d, NFData e, SymVal e, NFData f, SymVal f) => SExecutable m (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) -> SymbolicT m () Source #

safe :: (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> m [SafeResult] Source #

safeWith :: SMTConfig -> (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> m [SafeResult] Source #

(ExtractIO m, NFData a, SymVal a, NFData b, SymVal b, NFData c, SymVal c, NFData d, SymVal d, NFData e, SymVal e, NFData f, SymVal f, NFData g, SymVal g) => SExecutable m (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) -> SymbolicT m () Source #

safe :: (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> m [SafeResult] Source #

safeWith :: SMTConfig -> (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> m [SafeResult] Source #

sName :: SExecutable IO a => a -> Symbolic () Source #

Create an argument for a name used in a safety-checking call.

NB. For a version which generalizes over the underlying monad, see sName_

safe :: SExecutable IO a => a -> IO [SafeResult] Source #

Check safety using the default solver.

NB. For a version which generalizes over the underlying monad, see safe

safeWith :: SExecutable IO a => SMTConfig -> a -> IO [SafeResult] Source #

Check if any of the sAssert calls can be violated.

NB. For a version which generalizes over the underlying monad, see safeWith

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 SReals. 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:

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

Instances details
Show OptimizeStyle Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

NFData OptimizeStyle Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Methods

rnf :: OptimizeStyle -> () #

Eq OptimizeStyle Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Objectives and Metrics

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

Instances details
Functor Objective Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Methods

fmap :: (a -> b) -> Objective a -> Objective b #

(<$) :: a -> Objective b -> Objective a #

Show a => Show (Objective a) Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

NFData a => NFData (Objective a) Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Methods

rnf :: Objective a -> () #

class Metric a where Source #

Class of metrics we can optimize for. Currently, booleans, bounded signed/unsigned bit-vectors, unbounded integers, algebraic reals and floats can be optimized. You can add your instances, but bewared that the MetricSpace should map your type to something the backend solver understands, which are limited to unsigned bit-vectors, reals, and unbounded integers for z3.

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.

Minimal completion: None. However, if MetricSpace is not identical to the type, you want to define toMetricSpace and possibly minimize/maximize to add extra constraints as necessary.

Minimal complete definition

Nothing

Associated Types

type MetricSpace a :: Type Source #

The metric space we optimize the goal over. Usually the same as the type itself, but not always! For instance, signed bit-vectors are optimized over their unsigned counterparts, floats are optimized over their Word32 comparable counterparts, etc.

type MetricSpace a = a

Methods

toMetricSpace :: SBV a -> SBV (MetricSpace a) Source #

Compute the metric value to optimize.

default toMetricSpace :: a ~ MetricSpace a => SBV a -> SBV (MetricSpace a) Source #

fromMetricSpace :: SBV (MetricSpace a) -> SBV a Source #

Compute the value itself from the metric corresponding to it.

default fromMetricSpace :: a ~ MetricSpace a => SBV (MetricSpace a) -> SBV a Source #

msMinimize :: (MonadSymbolic m, SolverContext m) => String -> SBV a -> m () Source #

Minimizing a metric space

msMaximize :: (MonadSymbolic m, SolverContext m) => String -> SBV a -> m () Source #

Maximizing a metric space

Instances

Instances details
Metric Int16 Source # 
Instance details

Defined in Data.SBV.Core.Model

Associated Types

type MetricSpace Int16 Source #

Metric Int32 Source # 
Instance details

Defined in Data.SBV.Core.Model

Associated Types

type MetricSpace Int32 Source #

Metric Int64 Source # 
Instance details

Defined in Data.SBV.Core.Model

Associated Types

type MetricSpace Int64 Source #

Metric Int8 Source # 
Instance details

Defined in Data.SBV.Core.Model

Associated Types

type MetricSpace Int8 Source #

Metric Word16 Source # 
Instance details

Defined in Data.SBV.Core.Model

Associated Types

type MetricSpace Word16 Source #

Metric Word32 Source # 
Instance details

Defined in Data.SBV.Core.Model

Associated Types

type MetricSpace Word32 Source #

Metric Word64 Source # 
Instance details

Defined in Data.SBV.Core.Model

Associated Types

type MetricSpace Word64 Source #

Metric Word8 Source # 
Instance details

Defined in Data.SBV.Core.Model

Associated Types

type MetricSpace Word8 Source #

Metric AlgReal Source # 
Instance details

Defined in Data.SBV.Core.Model

Associated Types

type MetricSpace AlgReal Source #

Metric Day Source #

Make day an optimizable value, by mapping it to Word8 in the most obvious way. We can map it to any value the underlying solver can optimize, but Word8 is the simplest and it'll fit the bill.

Instance details

Defined in Documentation.SBV.Examples.Optimization.Enumerate

Associated Types

type MetricSpace Day Source #

Metric Integer Source # 
Instance details

Defined in Data.SBV.Core.Model

Associated Types

type MetricSpace Integer Source #

Metric Bool Source # 
Instance details

Defined in Data.SBV.Core.Model

Associated Types

type MetricSpace Bool Source #

Metric Double Source #

Double instance for Metric goes through the lexicographic ordering on Word64. It implicitly makes sure that the value is not NaN.

Instance details

Defined in Data.SBV.Core.Floating

Associated Types

type MetricSpace Double Source #

Metric Float Source #

Float instance for Metric goes through the lexicographic ordering on Word32. It implicitly makes sure that the value is not NaN.

Instance details

Defined in Data.SBV.Core.Floating

Associated Types

type MetricSpace Float Source #

(KnownNat n, BVIsNonZero n) => Metric (IntN n) Source #

Optimizing IntN

Instance details

Defined in Data.SBV.Core.Sized

Associated Types

type MetricSpace (IntN n) Source #

(KnownNat n, BVIsNonZero n) => Metric (WordN n) Source #

Optimizing WordN

Instance details

Defined in Data.SBV.Core.Sized

Associated Types

type MetricSpace (WordN n) Source #

(BVIsNonZero (eb + sb), KnownNat (eb + sb), ValidFloat eb sb) => Metric (FloatingPoint eb sb) Source # 
Instance details

Defined in Data.SBV.Core.Floating

Associated Types

type MetricSpace (FloatingPoint eb sb) Source #

(SymVal a, Metric a, SymVal b, Metric b) => Metric (a, b) Source # 
Instance details

Defined in Data.SBV.Tuple

Associated Types

type MetricSpace (a, b) Source #

Methods

toMetricSpace :: SBV (a, b) -> SBV (MetricSpace (a, b)) Source #

fromMetricSpace :: SBV (MetricSpace (a, b)) -> SBV (a, b) Source #

msMinimize :: (MonadSymbolic m, SolverContext m) => String -> SBV (a, b) -> m () Source #

msMaximize :: (MonadSymbolic m, SolverContext m) => String -> SBV (a, b) -> m () Source #

(SymVal a, Metric a, SymVal b, Metric b, SymVal c, Metric c) => Metric (a, b, c) Source # 
Instance details

Defined in Data.SBV.Tuple

Associated Types

type MetricSpace (a, b, c) Source #

Methods

toMetricSpace :: SBV (a, b, c) -> SBV (MetricSpace (a, b, c)) Source #

fromMetricSpace :: SBV (MetricSpace (a, b, c)) -> SBV (a, b, c) Source #

msMinimize :: (MonadSymbolic m, SolverContext m) => String -> SBV (a, b, c) -> m () Source #

msMaximize :: (MonadSymbolic m, SolverContext m) => String -> SBV (a, b, c) -> m () Source #

(SymVal a, Metric a, SymVal b, Metric b, SymVal c, Metric c, SymVal d, Metric d) => Metric (a, b, c, d) Source # 
Instance details

Defined in Data.SBV.Tuple

Associated Types

type MetricSpace (a, b, c, d) Source #

Methods

toMetricSpace :: SBV (a, b, c, d) -> SBV (MetricSpace (a, b, c, d)) Source #

fromMetricSpace :: SBV (MetricSpace (a, b, c, d)) -> SBV (a, b, c, d) Source #

msMinimize :: (MonadSymbolic m, SolverContext m) => String -> SBV (a, b, c, d) -> m () Source #

msMaximize :: (MonadSymbolic m, SolverContext m) => String -> SBV (a, b, c, d) -> m () Source #

(SymVal a, Metric a, SymVal b, Metric b, SymVal c, Metric c, SymVal d, Metric d, SymVal e, Metric e) => Metric (a, b, c, d, e) Source # 
Instance details

Defined in Data.SBV.Tuple

Associated Types

type MetricSpace (a, b, c, d, e) Source #

Methods

toMetricSpace :: SBV (a, b, c, d, e) -> SBV (MetricSpace (a, b, c, d, e)) Source #

fromMetricSpace :: SBV (MetricSpace (a, b, c, d, e)) -> SBV (a, b, c, d, e) Source #

msMinimize :: (MonadSymbolic m, SolverContext m) => String -> SBV (a, b, c, d, e) -> m () Source #

msMaximize :: (MonadSymbolic m, SolverContext m) => String -> SBV (a, b, c, d, e) -> m () Source #

(SymVal a, Metric a, SymVal b, Metric b, SymVal c, Metric c, SymVal d, Metric d, SymVal e, Metric e, SymVal f, Metric f) => Metric (a, b, c, d, e, f) Source # 
Instance details

Defined in Data.SBV.Tuple

Associated Types

type MetricSpace (a, b, c, d, e, f) Source #

Methods

toMetricSpace :: SBV (a, b, c, d, e, f) -> SBV (MetricSpace (a, b, c, d, e, f)) Source #

fromMetricSpace :: SBV (MetricSpace (a, b, c, d, e, f)) -> SBV (a, b, c, d, e, f) Source #

msMinimize :: (MonadSymbolic m, SolverContext m) => String -> SBV (a, b, c, d, e, f) -> m () Source #

msMaximize :: (MonadSymbolic m, SolverContext m) => String -> SBV (a, b, c, d, e, f) -> m () Source #

(SymVal a, Metric a, SymVal b, Metric b, SymVal c, Metric c, SymVal d, Metric d, SymVal e, Metric e, SymVal f, Metric f, SymVal g, Metric g) => Metric (a, b, c, d, e, f, g) Source # 
Instance details

Defined in Data.SBV.Tuple

Associated Types

type MetricSpace (a, b, c, d, e, f, g) Source #

Methods

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

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

msMinimize :: (MonadSymbolic m, SolverContext m) => String -> SBV (a, b, c, d, e, f, g) -> m () Source #

msMaximize :: (MonadSymbolic m, SolverContext m) => String -> SBV (a, b, c, d, e, f, g) -> m () Source #

(SymVal a, Metric a, SymVal b, Metric b, SymVal c, Metric c, SymVal d, Metric d, SymVal e, Metric e, SymVal f, Metric f, SymVal g, Metric g, SymVal h, Metric h) => Metric (a, b, c, d, e, f, g, h) Source # 
Instance details

Defined in Data.SBV.Tuple

Associated Types

type MetricSpace (a, b, c, d, e, f, g, h) Source #

Methods

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

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

msMinimize :: (MonadSymbolic m, SolverContext m) => String -> SBV (a, b, c, d, e, f, g, h) -> m () Source #

msMaximize :: (MonadSymbolic m, SolverContext m) => String -> SBV (a, b, c, d, e, f, g, h) -> m () Source #

minimize :: Metric a => String -> SBV a -> Symbolic () Source #

Minimize a named metric

NB. For a version which generalizes over the underlying monad, see minimize

maximize :: Metric a => String -> SBV a -> Symbolic () Source #

Maximize a named metric

NB. For a version which generalizes over the underlying monad, see maximize

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

NB. For a version which generalizes over the underlying monad, see assertWithPenalty

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

Instances details
Show Penalty Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

NFData Penalty Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Methods

rnf :: Penalty -> () #

Field extensions

If an optimization results in an infinity/epsilon value, the returned CV value will be in the corresponding extension field.

data ExtCV Source #

A simple expression type over extended values, covering infinity, epsilon and intervals.

data GeneralizedCV Source #

A generalized CV allows for expressions involving infinite and epsilon values/intervals Used in optimization problems.

Constructors

ExtendedCV ExtCV 
RegularCV CV 

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.

data AllSatResult Source #

An allSat call results in a AllSatResult

Constructors

AllSatResult 

Fields

Instances

Instances details
Show AllSatResult Source # 
Instance details

Defined in Data.SBV.SMT.SMT

newtype SafeResult Source #

A safe call results in a SafeResult

Instances

Instances details
Show SafeResult Source # 
Instance details

Defined in Data.SBV.SMT.SMT

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.

Instances

Instances details
Show OptimizeResult Source # 
Instance details

Defined in Data.SBV.SMT.SMT

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

DeltaSat SMTConfig (Maybe String) SMTModel

Delta satisfiable with queried string if available and 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] (Maybe SMTResult)

Prover errored out, with possibly a bogus result

data SMTReasonUnknown Source #

Reason for reporting unknown.

Instances

Instances details
Show SMTReasonUnknown Source #

Show instance for unknown

Instance details

Defined in Data.SBV.Control.Types

NFData SMTReasonUnknown Source #

Trivial rnf instance

Instance details

Defined in Data.SBV.Control.Types

Methods

rnf :: SMTReasonUnknown -> () #

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 with the sObserve variant.. This is useful for, for instance, recording expected vs. 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:
  Expected = 34 :: Word8
  Result   =  1 :: Word8
  i1       = 12 :: Word8
  i2       = 22 :: Word8

The observeIf variant allows the user to specify a boolean condition when the value is interesting to observe. Useful when you have lots of "debugging" points, but not all are of interest. Use the sObserve variant when you are at the Symbolic monad, which also supports quick-check applications.

observe :: SymVal a => String -> SBV a -> SBV a Source #

Observe the value of an expression, unconditionally. See observeIf for a generalized version.

observeIf :: SymVal a => (a -> Bool) -> String -> SBV a -> SBV a Source #

Observe the value of an expression, if the given condition holds. 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.

sObserve :: SymVal a => String -> SBV a -> Symbolic () Source #

A variant of observe that you can use at the top-level. This is useful with quick-check, for instance.

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 CV's (constant values) 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: parseCVs

Minimal complete definition

Nothing

Methods

parseCVs :: [CV] -> Maybe (a, [CV]) 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

default parseCVs :: Read a => [CV] -> Maybe (a, [CV]) Source #

cvtModel :: (a -> Maybe b) -> Maybe (a, [CV]) -> Maybe (b, [CV]) 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.

Instances

Instances details
SatModel Int16 Source #

Int16 as extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (Int16, [CV]) Source #

cvtModel :: (Int16 -> Maybe b) -> Maybe (Int16, [CV]) -> Maybe (b, [CV]) Source #

SatModel Int32 Source #

Int32 as extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (Int32, [CV]) Source #

cvtModel :: (Int32 -> Maybe b) -> Maybe (Int32, [CV]) -> Maybe (b, [CV]) Source #

SatModel Int64 Source #

Int64 as extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (Int64, [CV]) Source #

cvtModel :: (Int64 -> Maybe b) -> Maybe (Int64, [CV]) -> Maybe (b, [CV]) Source #

SatModel Int8 Source #

Int8 as extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (Int8, [CV]) Source #

cvtModel :: (Int8 -> Maybe b) -> Maybe (Int8, [CV]) -> Maybe (b, [CV]) Source #

SatModel Word16 Source #

Word16 as extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (Word16, [CV]) Source #

cvtModel :: (Word16 -> Maybe b) -> Maybe (Word16, [CV]) -> Maybe (b, [CV]) Source #

SatModel Word32 Source #

Word32 as extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (Word32, [CV]) Source #

cvtModel :: (Word32 -> Maybe b) -> Maybe (Word32, [CV]) -> Maybe (b, [CV]) Source #

SatModel Word64 Source #

Word64 as extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (Word64, [CV]) Source #

cvtModel :: (Word64 -> Maybe b) -> Maybe (Word64, [CV]) -> Maybe (b, [CV]) Source #

SatModel Word8 Source #

Word8 as extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (Word8, [CV]) Source #

cvtModel :: (Word8 -> Maybe b) -> Maybe (Word8, [CV]) -> Maybe (b, [CV]) Source #

SatModel AlgReal Source #

AlgReal as extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (AlgReal, [CV]) Source #

cvtModel :: (AlgReal -> Maybe b) -> Maybe (AlgReal, [CV]) -> Maybe (b, [CV]) Source #

SatModel CV Source #

CV as extracted from a model; trivial definition

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (CV, [CV]) Source #

cvtModel :: (CV -> Maybe b) -> Maybe (CV, [CV]) -> Maybe (b, [CV]) Source #

SatModel RoundingMode Source #

A rounding mode, extracted from a model. (Default definition suffices)

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (RoundingMode, [CV]) Source #

cvtModel :: (RoundingMode -> Maybe b) -> Maybe (RoundingMode, [CV]) -> Maybe (b, [CV]) Source #

SatModel State Source # 
Instance details

Defined in Documentation.SBV.Examples.Lists.BoundedMutex

Methods

parseCVs :: [CV] -> Maybe (State, [CV]) Source #

cvtModel :: (State -> Maybe b) -> Maybe (State, [CV]) -> Maybe (b, [CV]) Source #

SatModel E Source # 
Instance details

Defined in Documentation.SBV.Examples.Misc.Enumerate

Methods

parseCVs :: [CV] -> Maybe (E, [CV]) Source #

cvtModel :: (E -> Maybe b) -> Maybe (E, [CV]) -> Maybe (b, [CV]) Source #

SatModel E Source # 
Instance details

Defined in Documentation.SBV.Examples.Misc.FirstOrderLogic

Methods

parseCVs :: [CV] -> Maybe (E, [CV]) Source #

cvtModel :: (E -> Maybe b) -> Maybe (E, [CV]) -> Maybe (b, [CV]) Source #

SatModel U Source # 
Instance details

Defined in Documentation.SBV.Examples.Misc.FirstOrderLogic

Methods

parseCVs :: [CV] -> Maybe (U, [CV]) Source #

cvtModel :: (U -> Maybe b) -> Maybe (U, [CV]) -> Maybe (b, [CV]) Source #

SatModel V Source # 
Instance details

Defined in Documentation.SBV.Examples.Misc.FirstOrderLogic

Methods

parseCVs :: [CV] -> Maybe (V, [CV]) Source #

cvtModel :: (V -> Maybe b) -> Maybe (V, [CV]) -> Maybe (b, [CV]) Source #

SatModel Day Source # 
Instance details

Defined in Documentation.SBV.Examples.Optimization.Enumerate

Methods

parseCVs :: [CV] -> Maybe (Day, [CV]) Source #

cvtModel :: (Day -> Maybe b) -> Maybe (Day, [CV]) -> Maybe (b, [CV]) Source #

SatModel Day Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Birthday

Methods

parseCVs :: [CV] -> Maybe (Day, [CV]) Source #

cvtModel :: (Day -> Maybe b) -> Maybe (Day, [CV]) -> Maybe (b, [CV]) Source #

SatModel Month Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Birthday

Methods

parseCVs :: [CV] -> Maybe (Month, [CV]) Source #

cvtModel :: (Month -> Maybe b) -> Maybe (Month, [CV]) -> Maybe (b, [CV]) Source #

SatModel P Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Drinker

Methods

parseCVs :: [CV] -> Maybe (P, [CV]) Source #

cvtModel :: (P -> Maybe b) -> Maybe (P, [CV]) -> Maybe (b, [CV]) Source #

SatModel Beverage Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

Methods

parseCVs :: [CV] -> Maybe (Beverage, [CV]) Source #

cvtModel :: (Beverage -> Maybe b) -> Maybe (Beverage, [CV]) -> Maybe (b, [CV]) Source #

SatModel Color Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

Methods

parseCVs :: [CV] -> Maybe (Color, [CV]) Source #

cvtModel :: (Color -> Maybe b) -> Maybe (Color, [CV]) -> Maybe (b, [CV]) Source #

SatModel Nationality Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

Methods

parseCVs :: [CV] -> Maybe (Nationality, [CV]) Source #

cvtModel :: (Nationality -> Maybe b) -> Maybe (Nationality, [CV]) -> Maybe (b, [CV]) Source #

SatModel Pet Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

Methods

parseCVs :: [CV] -> Maybe (Pet, [CV]) Source #

cvtModel :: (Pet -> Maybe b) -> Maybe (Pet, [CV]) -> Maybe (b, [CV]) Source #

SatModel Sport Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

Methods

parseCVs :: [CV] -> Maybe (Sport, [CV]) Source #

cvtModel :: (Sport -> Maybe b) -> Maybe (Sport, [CV]) -> Maybe (b, [CV]) Source #

SatModel Color Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Garden

Methods

parseCVs :: [CV] -> Maybe (Color, [CV]) Source #

cvtModel :: (Color -> Maybe b) -> Maybe (Color, [CV]) -> Maybe (b, [CV]) Source #

SatModel Color Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.HexPuzzle

Methods

parseCVs :: [CV] -> Maybe (Color, [CV]) Source #

cvtModel :: (Color -> Maybe b) -> Maybe (Color, [CV]) -> Maybe (b, [CV]) Source #

SatModel Identity Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.KnightsAndKnaves

Methods

parseCVs :: [CV] -> Maybe (Identity, [CV]) Source #

cvtModel :: (Identity -> Maybe b) -> Maybe (Identity, [CV]) -> Maybe (b, [CV]) Source #

SatModel Inhabitant Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.KnightsAndKnaves

Methods

parseCVs :: [CV] -> Maybe (Inhabitant, [CV]) Source #

cvtModel :: (Inhabitant -> Maybe b) -> Maybe (Inhabitant, [CV]) -> Maybe (b, [CV]) Source #

SatModel Statement Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.KnightsAndKnaves

Methods

parseCVs :: [CV] -> Maybe (Statement, [CV]) Source #

cvtModel :: (Statement -> Maybe b) -> Maybe (Statement, [CV]) -> Maybe (b, [CV]) Source #

SatModel Location Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

parseCVs :: [CV] -> Maybe (Location, [CV]) Source #

cvtModel :: (Location -> Maybe b) -> Maybe (Location, [CV]) -> Maybe (b, [CV]) Source #

SatModel Role Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

parseCVs :: [CV] -> Maybe (Role, [CV]) Source #

cvtModel :: (Role -> Maybe b) -> Maybe (Role, [CV]) -> Maybe (b, [CV]) Source #

SatModel Sex Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

parseCVs :: [CV] -> Maybe (Sex, [CV]) Source #

cvtModel :: (Sex -> Maybe b) -> Maybe (Sex, [CV]) -> Maybe (b, [CV]) Source #

SatModel Handler Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Orangutans

Methods

parseCVs :: [CV] -> Maybe (Handler, [CV]) Source #

cvtModel :: (Handler -> Maybe b) -> Maybe (Handler, [CV]) -> Maybe (b, [CV]) Source #

SatModel Location Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Orangutans

Methods

parseCVs :: [CV] -> Maybe (Location, [CV]) Source #

cvtModel :: (Location -> Maybe b) -> Maybe (Location, [CV]) -> Maybe (b, [CV]) Source #

SatModel Orangutan Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Orangutans

Methods

parseCVs :: [CV] -> Maybe (Orangutan, [CV]) Source #

cvtModel :: (Orangutan -> Maybe b) -> Maybe (Orangutan, [CV]) -> Maybe (b, [CV]) Source #

SatModel Rabbit Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Rabbits

Methods

parseCVs :: [CV] -> Maybe (Rabbit, [CV]) Source #

cvtModel :: (Rabbit -> Maybe b) -> Maybe (Rabbit, [CV]) -> Maybe (b, [CV]) Source #

SatModel Location Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.U2Bridge

Methods

parseCVs :: [CV] -> Maybe (Location, [CV]) Source #

cvtModel :: (Location -> Maybe b) -> Maybe (Location, [CV]) -> Maybe (b, [CV]) Source #

SatModel U2Member Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.U2Bridge

Methods

parseCVs :: [CV] -> Maybe (U2Member, [CV]) Source #

cvtModel :: (U2Member -> Maybe b) -> Maybe (U2Member, [CV]) -> Maybe (b, [CV]) Source #

SatModel Day Source # 
Instance details

Defined in Documentation.SBV.Examples.Queries.Enums

Methods

parseCVs :: [CV] -> Maybe (Day, [CV]) Source #

cvtModel :: (Day -> Maybe b) -> Maybe (Day, [CV]) -> Maybe (b, [CV]) Source #

SatModel BinOp Source # 
Instance details

Defined in Documentation.SBV.Examples.Queries.FourFours

Methods

parseCVs :: [CV] -> Maybe (BinOp, [CV]) Source #

cvtModel :: (BinOp -> Maybe b) -> Maybe (BinOp, [CV]) -> Maybe (b, [CV]) Source #

SatModel UnOp Source # 
Instance details

Defined in Documentation.SBV.Examples.Queries.FourFours

Methods

parseCVs :: [CV] -> Maybe (UnOp, [CV]) Source #

cvtModel :: (UnOp -> Maybe b) -> Maybe (UnOp, [CV]) -> Maybe (b, [CV]) Source #

SatModel B Source # 
Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.Deduce

Methods

parseCVs :: [CV] -> Maybe (B, [CV]) Source #

cvtModel :: (B -> Maybe b) -> Maybe (B, [CV]) -> Maybe (b, [CV]) Source #

SatModel Q Source # 
Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.Sort

Methods

parseCVs :: [CV] -> Maybe (Q, [CV]) Source #

cvtModel :: (Q -> Maybe b) -> Maybe (Q, [CV]) -> Maybe (b, [CV]) Source #

SatModel L Source # 
Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.UISortAllSat

Methods

parseCVs :: [CV] -> Maybe (L, [CV]) Source #

cvtModel :: (L -> Maybe b) -> Maybe (L, [CV]) -> Maybe (b, [CV]) Source #

SatModel Integer Source #

Integer as extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (Integer, [CV]) Source #

cvtModel :: (Integer -> Maybe b) -> Maybe (Integer, [CV]) -> Maybe (b, [CV]) 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

parseCVs :: [CV] -> Maybe ((), [CV]) Source #

cvtModel :: (() -> Maybe b) -> Maybe ((), [CV]) -> Maybe (b, [CV]) Source #

SatModel Bool Source #

Bool as extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (Bool, [CV]) Source #

cvtModel :: (Bool -> Maybe b) -> Maybe (Bool, [CV]) -> Maybe (b, [CV]) Source #

SatModel Char Source #

Char as extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (Char, [CV]) Source #

cvtModel :: (Char -> Maybe b) -> Maybe (Char, [CV]) -> Maybe (b, [CV]) Source #

SatModel Double Source #

Double as extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (Double, [CV]) Source #

cvtModel :: (Double -> Maybe b) -> Maybe (Double, [CV]) -> Maybe (b, [CV]) Source #

SatModel Float Source #

Float as extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (Float, [CV]) Source #

cvtModel :: (Float -> Maybe b) -> Maybe (Float, [CV]) -> Maybe (b, [CV]) Source #

(KnownNat n, BVIsNonZero n) => SatModel (IntN n) Source #

Constructing models for IntN

Instance details

Defined in Data.SBV.Core.Sized

Methods

parseCVs :: [CV] -> Maybe (IntN n, [CV]) Source #

cvtModel :: (IntN n -> Maybe b) -> Maybe (IntN n, [CV]) -> Maybe (b, [CV]) Source #

(KnownNat n, BVIsNonZero n) => SatModel (WordN n) Source #

Constructing models for WordN

Instance details

Defined in Data.SBV.Core.Sized

Methods

parseCVs :: [CV] -> Maybe (WordN n, [CV]) Source #

cvtModel :: (WordN n -> Maybe b) -> Maybe (WordN n, [CV]) -> Maybe (b, [CV]) Source #

SatModel [Char] Source #

String as extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe ([Char], [CV]) Source #

cvtModel :: ([Char] -> Maybe b) -> Maybe ([Char], [CV]) -> Maybe (b, [CV]) 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

parseCVs :: [CV] -> Maybe ([a], [CV]) Source #

cvtModel :: ([a] -> Maybe b) -> Maybe ([a], [CV]) -> Maybe (b, [CV]) Source #

(KnownNat eb, KnownNat sb) => SatModel (FloatingPoint eb sb) Source #

A general floating-point extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe (FloatingPoint eb sb, [CV]) Source #

cvtModel :: (FloatingPoint eb sb -> Maybe b) -> Maybe (FloatingPoint eb sb, [CV]) -> Maybe (b, [CV]) Source #

(SatModel a, SatModel b) => SatModel (a, b) Source #

Tuples extracted from a model

Instance details

Defined in Data.SBV.SMT.SMT

Methods

parseCVs :: [CV] -> Maybe ((a, b), [CV]) Source #

cvtModel :: ((a, b) -> Maybe b0) -> Maybe ((a, b), [CV]) -> Maybe (b0, [CV]) 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

parseCVs :: [CV] -> Maybe ((a, b, c), [CV]) Source #

cvtModel :: ((a, b, c) -> Maybe b0) -> Maybe ((a, b, c), [CV]) -> Maybe (b0, [CV]) 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

parseCVs :: [CV] -> Maybe ((a, b, c, d), [CV]) Source #

cvtModel :: ((a, b, c, d) -> Maybe b0) -> Maybe ((a, b, c, d), [CV]) -> Maybe (b0, [CV]) 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

parseCVs :: [CV] -> Maybe ((a, b, c, d, e), [CV]) Source #

cvtModel :: ((a, b, c, d, e) -> Maybe b0) -> Maybe ((a, b, c, d, e), [CV]) -> Maybe (b0, [CV]) 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

parseCVs :: [CV] -> Maybe ((a, b, c, d, e, f), [CV]) Source #

cvtModel :: ((a, b, c, d, e, f) -> Maybe b0) -> Maybe ((a, b, c, d, e, f), [CV]) -> Maybe (b0, [CV]) 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

parseCVs :: [CV] -> Maybe ((a, b, c, d, e, f, g), [CV]) Source #

cvtModel :: ((a, b, c, d, e, f, g) -> Maybe b0) -> Maybe ((a, b, c, d, e, f, g), [CV]) -> Maybe (b0, [CV]) Source #

class Modelable a where Source #

Various SMT results that we can extract models out of.

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 CV 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 :: SymVal 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 GeneralizedCV Source #

Extract model objective values, for all optimization goals.

getModelObjectiveValue :: String -> a -> Maybe GeneralizedCV Source #

Extract the value of an objective

getModelUIFuns :: a -> Map String (SBVType, Either String ([([CV], CV)], CV)) Source #

Extract model uninterpreted-functions

getModelUIFunValue :: String -> a -> Maybe (SBVType, Either String ([([CV], CV)], CV)) Source #

Extract the value of an uninterpreted-function as an association list

Instances

Instances details
Modelable SMTResult Source #

SMTResult as a generic model provider

Instance details

Defined in Data.SBV.SMT.SMT

Modelable SatResult Source #

SatResult as a generic model provider

Instance details

Defined in Data.SBV.SMT.SMT

Modelable ThmResult Source #

ThmResult as a generic model provider

Instance details

Defined in Data.SBV.SMT.SMT

displayModels :: SatModel a => ([(Bool, a)] -> [(Bool, 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, returning Unknown). The arrange argument can sort the results in any way you like, if necessary.

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 CV] Source #

Get dictionaries from an all-sat call. Similar to getModelDictionary.

getModelValues :: SymVal 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 end 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.

The crackNum field can be used to display numbers in detail, all its bits and how they are laid out in memory. Works with all bounded number types (i.e., SWord and SInt), but also with floats. It is particularly useful with floating-point numbers, as it shows you how they are laid out in memory following the IEEE754 rules.

Constructors

SMTConfig 

Fields

Instances

Instances details
Show SMTConfig Source #

We show the name of the solver for the config. Arguably this is misleading, but better than nothing.

Instance details

Defined in Data.SBV.Core.Symbolic

NFData SMTConfig Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Methods

rnf :: SMTConfig -> () #

data Timing Source #

Specify how to save timing information, if at all.

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 

data Solver Source #

Solvers that SBV is aware of

Instances

Instances details
Bounded Solver Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Enum Solver Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Show Solver Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

data SMTSolver Source #

An SMT solver

Constructors

SMTSolver 

Fields

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

bitwuzla :: SMTConfig Source #

Default configuration for the Bitwuzla SMT solver

cvc4 :: SMTConfig Source #

Default configuration for the CVC4 SMT Solver.

cvc5 :: SMTConfig Source #

Default configuration for the CVC5 SMT Solver.

yices :: SMTConfig Source #

Default configuration for the Yices SMT Solver.

dReal :: 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.

defaultDeltaSMTCfg :: SMTConfig Source #

The default solver used by SBV for delta-satisfiability problems. This is currently set to dReal, which is also the only solver that supports delta-satisfiability.

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.

getAvailableSolvers :: 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

Instances details
Show Logic Source # 
Instance details

Defined in Data.SBV.Control.Types

Methods

showsPrec :: Int -> Logic -> ShowS #

show :: Logic -> String #

showList :: [Logic] -> ShowS #

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.

Instances

Instances details
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

Show SBVException Source #

A fairly nice rendering of the exception, for display purposes.

Instance details

Defined in Data.SBV.SMT.Utils

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

Instances details
Testable SBool Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

property :: SBool -> Property #

propertyForAllShrinkShow :: Gen a -> (a -> [a]) -> (a -> [String]) -> (a -> SBool) -> Property #

IsString SString Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

fromString :: String -> SString #

Floating SReal Source #

SReal Floating instance, used in conjunction with the dReal solver for delta-satisfiability. Note that we do not constant fold these values (except for pi), as Haskell doesn't really have any means of computing them for arbitrary rationals.

Instance details

Defined in Data.SBV.Core.Model

QNot SBool Source #

Base case; pure symbolic boolean

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type NegatesTo SBool Source #

QuantifiedBool SBool Source #

Base case of quantification, simple booleans

Instance details

Defined in Data.SBV.Core.Data

SDivisible SInt16 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible SInt32 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible SInt64 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible SInt8 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible SInteger Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible SWord16 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible SWord32 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible SWord64 Source # 
Instance details

Defined in Data.SBV.Core.Model

SDivisible SWord8 Source # 
Instance details

Defined in Data.SBV.Core.Model

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 #

RegExpMatchable SString Source #

Matching symbolic strings.

Instance details

Defined in Data.SBV.RegExp

Methods

match :: SString -> RegExp -> SBool Source #

ArithOverflow SInt16 Source # 
Instance details

Defined in Data.SBV.Tools.Overflow

ArithOverflow SInt32 Source # 
Instance details

Defined in Data.SBV.Tools.Overflow

ArithOverflow SInt64 Source # 
Instance details

Defined in Data.SBV.Tools.Overflow

ArithOverflow SInt8 Source # 
Instance details

Defined in Data.SBV.Tools.Overflow

ArithOverflow SWord16 Source # 
Instance details

Defined in Data.SBV.Tools.Overflow

ArithOverflow SWord32 Source # 
Instance details

Defined in Data.SBV.Tools.Overflow

ArithOverflow SWord64 Source # 
Instance details

Defined in Data.SBV.Tools.Overflow

ArithOverflow SWord8 Source # 
Instance details

Defined in Data.SBV.Tools.Overflow

Polynomial SWord16 Source # 
Instance details

Defined in Data.SBV.Tools.Polynomial

Polynomial SWord32 Source # 
Instance details

Defined in Data.SBV.Tools.Polynomial

Polynomial SWord64 Source # 
Instance details

Defined in Data.SBV.Tools.Polynomial

Polynomial SWord8 Source # 
Instance details

Defined in Data.SBV.Tools.Polynomial

MonadSymbolic m => Constraint m SBool Source #

Base case: simple booleans

Instance details

Defined in Data.SBV.Core.Data

Methods

mkConstraint :: State -> SBool -> m () Source #

ExtractIO m => ProvableM m SBool Source # 
Instance details

Defined in Data.SBV.Provers.Prover

ExtractIO m => SatisfiableM m SBool Source # 
Instance details

Defined in Data.SBV.Provers.Prover

MonadSymbolic m => Lambda m (SBV a) Source #

Base case, simple values

Instance details

Defined in Data.SBV.Core.Data

Methods

mkLambda :: State -> SBV a -> m () Source #

Fresh IO (S SInteger) Source #

Fresh instance for our state

Instance details

Defined in Documentation.SBV.Examples.ProofTools.BMC

Fresh IO (S SInteger) Source #

Fresh instance for our state

Instance details

Defined in Documentation.SBV.Examples.ProofTools.Fibonacci

Fresh IO (S SInteger) Source #

Fresh instance for our state

Instance details

Defined in Documentation.SBV.Examples.ProofTools.Strengthen

Fresh IO (S SInteger) Source #

Fresh instance for our state

Instance details

Defined in Documentation.SBV.Examples.ProofTools.Sum

SymVal a => Fresh IO (IncS (SBV a)) Source #

Fresh instance for the program state

Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.Basics

Methods

fresh :: QueryT IO (IncS (SBV a)) Source #

SymVal a => Fresh IO (FibS (SBV a)) Source #

Fresh instance for the program state

Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.Fib

Methods

fresh :: QueryT IO (FibS (SBV a)) Source #

SymVal a => Fresh IO (GCDS (SBV a)) Source #

Fresh instance for the program state

Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.GCD

Methods

fresh :: QueryT IO (GCDS (SBV a)) Source #

SymVal a => Fresh IO (DivS (SBV a)) Source #

Fresh instance for the program state

Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.IntDiv

Methods

fresh :: QueryT IO (DivS (SBV a)) Source #

SymVal a => Fresh IO (SqrtS (SBV a)) Source #

Fresh instance for the program state

Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.IntSqrt

Methods

fresh :: QueryT IO (SqrtS (SBV a)) Source #

SymVal a => Fresh IO (SumS (SBV a)) Source #

Fresh instance for the program state

Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.Sum

Methods

fresh :: QueryT IO (SumS (SBV a)) Source #

(MonadIO m, SymVal a) => Queriable m (SBV a) Source #

Generic Queriable instance for SymVal values

Instance details

Defined in Data.SBV.Control.Utils

Associated Types

type QueryResult (SBV a) Source #

Methods

create :: QueryT m (SBV a) Source #

project :: SBV a -> QueryT m (QueryResult (SBV a)) Source #

embed :: QueryResult (SBV a) -> QueryT m (SBV a) Source #

(MonadIO m, SymVal a, Foldable t, Traversable t, Fresh m (t (SBV a))) => Queriable m (t (SBV a)) Source #

Generic Queriable instance for things that are Fresh and look like containers:

Instance details

Defined in Data.SBV.Control.Utils

Associated Types

type QueryResult (t (SBV a)) Source #

Methods

create :: QueryT m (t (SBV a)) Source #

project :: t (SBV a) -> QueryT m (QueryResult (t (SBV a))) Source #

embed :: QueryResult (t (SBV a)) -> QueryT m (t (SBV a)) Source #

ExtractIO m => SExecutable m (SBV a) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName :: SBV a -> SymbolicT m () Source #

safe :: SBV a -> m [SafeResult] Source #

safeWith :: SMTConfig -> SBV a -> m [SafeResult] Source #

ExtractIO m => SExecutable m [SBV a] Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName :: [SBV a] -> SymbolicT m () Source #

safe :: [SBV a] -> m [SafeResult] Source #

safeWith :: SMTConfig -> [SBV a] -> m [SafeResult] Source #

(SymVal a, Lambda m r) => Lambda m (SBV a -> r) Source #

Functions

Instance details

Defined in Data.SBV.Core.Data

Methods

mkLambda :: State -> (SBV a -> r) -> m () Source #

ExtractIO m => ProvableM m (SymbolicT m SBool) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

(SymVal a, ProvableM m p) => ProvableM m (SBV a -> p) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

proofArgReduce :: (SBV a -> p) -> SymbolicT m SBool Source #

prove :: (SBV a -> p) -> m ThmResult Source #

proveWith :: SMTConfig -> (SBV a -> p) -> m ThmResult Source #

dprove :: (SBV a -> p) -> m ThmResult Source #

dproveWith :: SMTConfig -> (SBV a -> p) -> m ThmResult Source #

isVacuousProof :: (SBV a -> p) -> m Bool Source #

isVacuousProofWith :: SMTConfig -> (SBV a -> p) -> m Bool Source #

isTheorem :: (SBV a -> p) -> m Bool Source #

isTheoremWith :: SMTConfig -> (SBV a -> p) -> m Bool Source #

(SymVal a, SymVal b, ProvableM m p) => ProvableM m ((SBV a, SBV b) -> p) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

proofArgReduce :: ((SBV a, SBV b) -> p) -> SymbolicT m SBool Source #

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

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

dprove :: ((SBV a, SBV b) -> p) -> m ThmResult Source #

dproveWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> m ThmResult Source #

isVacuousProof :: ((SBV a, SBV b) -> p) -> m Bool Source #

isVacuousProofWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> m Bool Source #

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

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

(SymVal a, SymVal b, SymVal c, ProvableM m p) => ProvableM m ((SBV a, SBV b, SBV c) -> p) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

proofArgReduce :: ((SBV a, SBV b, SBV c) -> p) -> SymbolicT m SBool Source #

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

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

dprove :: ((SBV a, SBV b, SBV c) -> p) -> m ThmResult Source #

dproveWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> m ThmResult Source #

isVacuousProof :: ((SBV a, SBV b, SBV c) -> p) -> m Bool Source #

isVacuousProofWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> m Bool Source #

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

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

(SymVal a, SymVal b, SymVal c, SymVal d, ProvableM m p) => ProvableM m ((SBV a, SBV b, SBV c, SBV d) -> p) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

proofArgReduce :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> SymbolicT m SBool Source #

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

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

dprove :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> m ThmResult Source #

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

isVacuousProof :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> m Bool Source #

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

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

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

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, ProvableM m p) => ProvableM m ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

proofArgReduce :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> SymbolicT m SBool Source #

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

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

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

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

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

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

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

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

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SymVal f, ProvableM m p) => ProvableM m ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

proofArgReduce :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> SymbolicT m SBool Source #

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

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

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

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

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

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

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

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

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SymVal f, SymVal g, ProvableM m p) => ProvableM m ((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

proofArgReduce :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> SymbolicT m SBool Source #

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

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

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

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

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

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

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

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

(ExtractIO m, NFData a, SymVal a, NFData b, SymVal b) => SExecutable m (SBV a, SBV b) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName :: (SBV a, SBV b) -> SymbolicT m () Source #

safe :: (SBV a, SBV b) -> m [SafeResult] Source #

safeWith :: SMTConfig -> (SBV a, SBV b) -> m [SafeResult] Source #

(SymVal a, SExecutable m p) => SExecutable m (SBV a -> p) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName :: (SBV a -> p) -> SymbolicT m () Source #

safe :: (SBV a -> p) -> m [SafeResult] Source #

safeWith :: SMTConfig -> (SBV a -> p) -> m [SafeResult] Source #

(SymVal a, SymVal b, SExecutable m p) => SExecutable m ((SBV a, SBV b) -> p) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName :: ((SBV a, SBV b) -> p) -> SymbolicT m () Source #

safe :: ((SBV a, SBV b) -> p) -> m [SafeResult] Source #

safeWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> m [SafeResult] Source #

(SymVal a, SymVal b, SymVal c, SExecutable m p) => SExecutable m ((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) -> SymbolicT m () Source #

safe :: ((SBV a, SBV b, SBV c) -> p) -> m [SafeResult] Source #

safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> m [SafeResult] Source #

(SymVal a, SymVal b, SymVal c, SymVal d, SExecutable m p) => SExecutable m ((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) -> SymbolicT m () Source #

safe :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> m [SafeResult] Source #

safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d) -> p) -> m [SafeResult] Source #

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SExecutable m p) => SExecutable m ((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) -> SymbolicT m () Source #

safe :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> m [SafeResult] Source #

safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> m [SafeResult] Source #

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SymVal f, SExecutable m p) => SExecutable m ((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) -> SymbolicT m () Source #

safe :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> m [SafeResult] Source #

safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> m [SafeResult] Source #

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SymVal f, SymVal g, SExecutable m p) => SExecutable m ((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) -> SymbolicT m () Source #

safe :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> m [SafeResult] Source #

safeWith :: SMTConfig -> ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> m [SafeResult] Source #

ExtractIO m => SatisfiableM m (SymbolicT m SBool) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

(SymVal a, SatisfiableM m p) => SatisfiableM m (SBV a -> p) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

satArgReduce :: (SBV a -> p) -> SymbolicT m SBool Source #

sat :: (SBV a -> p) -> m SatResult Source #

satWith :: SMTConfig -> (SBV a -> p) -> m SatResult Source #

dsat :: (SBV a -> p) -> m SatResult Source #

dsatWith :: SMTConfig -> (SBV a -> p) -> m SatResult Source #

allSat :: (SBV a -> p) -> m AllSatResult Source #

allSatWith :: SMTConfig -> (SBV a -> p) -> m AllSatResult Source #

isSatisfiable :: (SBV a -> p) -> m Bool Source #

isSatisfiableWith :: SMTConfig -> (SBV a -> p) -> m Bool Source #

optimize :: OptimizeStyle -> (SBV a -> p) -> m OptimizeResult Source #

optimizeWith :: SMTConfig -> OptimizeStyle -> (SBV a -> p) -> m OptimizeResult Source #

(SymVal a, SymVal b, SatisfiableM m p) => SatisfiableM m ((SBV a, SBV b) -> p) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

satArgReduce :: ((SBV a, SBV b) -> p) -> SymbolicT m SBool Source #

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

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

dsat :: ((SBV a, SBV b) -> p) -> m SatResult Source #

dsatWith :: SMTConfig -> ((SBV a, SBV b) -> p) -> m SatResult Source #

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

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

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

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

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

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

(SymVal a, SymVal b, SymVal c, SatisfiableM m p) => SatisfiableM m ((SBV a, SBV b, SBV c) -> p) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

satArgReduce :: ((SBV a, SBV b, SBV c) -> p) -> SymbolicT m SBool Source #

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

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

dsat :: ((SBV a, SBV b, SBV c) -> p) -> m SatResult Source #

dsatWith :: SMTConfig -> ((SBV a, SBV b, SBV c) -> p) -> m SatResult Source #

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

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

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

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

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

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

(SymVal a, SymVal b, SymVal c, SymVal d, SatisfiableM m p) => SatisfiableM m ((SBV a, SBV b, SBV c, SBV d) -> p) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

satArgReduce :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> SymbolicT m SBool Source #

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

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

dsat :: ((SBV a, SBV b, SBV c, SBV d) -> p) -> m SatResult Source #

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

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

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

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

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

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

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

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SatisfiableM m p) => SatisfiableM m ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

satArgReduce :: ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) -> SymbolicT m SBool Source #

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

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

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

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

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

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

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

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

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

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

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SymVal f, SatisfiableM m p) => SatisfiableM m ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

satArgReduce :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) -> SymbolicT m SBool Source #

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

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

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

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

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

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

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

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

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

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

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SymVal f, SymVal g, SatisfiableM m p) => SatisfiableM m ((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

satArgReduce :: ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) -> SymbolicT m SBool Source #

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

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

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

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

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

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

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

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

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

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

(ExtractIO m, NFData a, SymVal a, NFData b, SymVal b, NFData c, SymVal c) => SExecutable m (SBV a, SBV b, SBV c) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Methods

sName :: (SBV a, SBV b, SBV c) -> SymbolicT m () Source #

safe :: (SBV a, SBV b, SBV c) -> m [SafeResult] Source #

safeWith :: SMTConfig -> (SBV a, SBV b, SBV c) -> m [SafeResult] Source #

(ExtractIO m, NFData a, SymVal a, NFData b, SymVal b, NFData c, SymVal c, NFData d, SymVal d) => SExecutable m (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) -> SymbolicT m () Source #

safe :: (SBV a, SBV b, SBV c, SBV d) -> m [SafeResult] Source #

safeWith :: SMTConfig -> (SBV a, SBV b, SBV c, SBV d) -> m [SafeResult] Source #

(ExtractIO m, NFData a, SymVal a, NFData b, SymVal b, NFData c, SymVal c, NFData d, SymVal d, NFData e, SymVal e) => SExecutable m (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) -> SymbolicT m () Source #

safe :: (SBV a, SBV b, SBV c, SBV d, SBV e) -> m [SafeResult] Source #

safeWith :: SMTConfig -> (SBV a, SBV b, SBV c, SBV d, SBV e) -> m [SafeResult] Source #

(ExtractIO m, NFData a, SymVal a, NFData b, SymVal b, NFData c, SymVal c, NFData d, SymVal d, NFData e, SymVal e, NFData f, SymVal f) => SExecutable m (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) -> SymbolicT m () Source #

safe :: (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> m [SafeResult] Source #

safeWith :: SMTConfig -> (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> m [SafeResult] Source #

(ExtractIO m, NFData a, SymVal a, NFData b, SymVal b, NFData c, SymVal c, NFData d, SymVal d, NFData e, SymVal e, NFData f, SymVal f, NFData g, SymVal g) => SExecutable m (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) -> SymbolicT m () Source #

safe :: (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> m [SafeResult] Source #

safeWith :: SMTConfig -> (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> m [SafeResult] Source #

(SymVal a, Arbitrary a) => Arbitrary (SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

arbitrary :: Gen (SBV a) #

shrink :: SBV a -> [SBV a] #

Testable (Symbolic SBool) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

property :: Symbolic SBool -> Property #

propertyForAllShrinkShow :: Gen a -> (a -> [a]) -> (a -> [String]) -> (a -> Symbolic SBool) -> Property #

(Ord a, Num a, Bits a, SymVal 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 #

(.|.) :: SBV a -> SBV a -> SBV a #

xor :: SBV a -> SBV a -> SBV a #

complement :: SBV a -> SBV a #

shift :: SBV a -> Int -> SBV a #

rotate :: SBV a -> Int -> SBV a #

zeroBits :: SBV a #

bit :: Int -> SBV a #

setBit :: SBV a -> Int -> SBV a #

clearBit :: SBV a -> Int -> SBV a #

complementBit :: SBV a -> Int -> SBV a #

testBit :: SBV a -> Int -> Bool #

bitSizeMaybe :: SBV a -> Maybe Int #

bitSize :: SBV a -> Int #

isSigned :: SBV a -> Bool #

shiftL :: SBV a -> Int -> SBV a #

unsafeShiftL :: SBV a -> Int -> SBV a #

shiftR :: SBV a -> Int -> SBV a #

unsafeShiftR :: SBV a -> Int -> SBV a #

rotateL :: SBV a -> Int -> SBV a #

rotateR :: SBV a -> Int -> SBV a #

popCount :: SBV a -> Int #

(SymVal a, Bounded a) => Bounded (SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

minBound :: SBV a #

maxBound :: SBV a #

(Show a, Bounded a, Integral a, Num a, SymVal a) => Enum (SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

succ :: SBV a -> SBV a #

pred :: SBV a -> SBV a #

toEnum :: Int -> SBV a #

fromEnum :: SBV a -> Int #

enumFrom :: SBV a -> [SBV a] #

enumFromThen :: SBV a -> SBV a -> [SBV a] #

enumFromTo :: SBV a -> SBV a -> [SBV a] #

enumFromThenTo :: SBV a -> SBV a -> SBV a -> [SBV a] #

(Ord a, SymVal 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, SDouble, and SReal. (See the separate definition below for SFloatingPoint.) Note that unless you use delta-sat via dReal on SReal, most of the fields are "undefined" for symbolic values. We will add methods as they are supported by SMTLib. Currently, the only symbolically available function in this class is sqrt for SFloat, SDouble and SFloatingPoint.

Instance details

Defined in Data.SBV.Core.Model

Methods

pi :: SBV a #

exp :: SBV a -> SBV a #

log :: SBV a -> SBV a #

sqrt :: SBV a -> SBV a #

(**) :: SBV a -> SBV a -> SBV a #

logBase :: SBV a -> SBV a -> SBV a #

sin :: SBV a -> SBV a #

cos :: SBV a -> SBV a #

tan :: SBV a -> SBV a #

asin :: SBV a -> SBV a #

acos :: SBV a -> SBV a #

atan :: SBV a -> SBV a #

sinh :: SBV a -> SBV a #

cosh :: SBV a -> SBV a #

tanh :: SBV a -> SBV a #

asinh :: SBV a -> SBV a #

acosh :: SBV a -> SBV a #

atanh :: SBV a -> SBV a #

log1p :: SBV a -> SBV a #

expm1 :: SBV a -> SBV a #

log1pexp :: SBV a -> SBV a #

log1mexp :: SBV a -> SBV a #

Generic (SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Data

Associated Types

type Rep (SBV a) :: Type -> Type #

Methods

from :: SBV a -> Rep (SBV a) x #

to :: Rep (SBV a) x -> SBV a #

SymVal [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) #

Methods

fromList :: [Item (SList a)] -> SList a #

fromListN :: Int -> [Item (SList a)] -> SList a #

toList :: SList a -> [Item (SList a)] #

(Ord a, SymVal a, Num a) => Num (SBV (Maybe a)) Source #

Custom Num instance over SMaybe

Instance details

Defined in Data.SBV.Maybe

Methods

(+) :: SBV (Maybe a) -> SBV (Maybe a) -> SBV (Maybe a) #

(-) :: SBV (Maybe a) -> SBV (Maybe a) -> SBV (Maybe a) #

(*) :: SBV (Maybe a) -> SBV (Maybe a) -> SBV (Maybe a) #

negate :: SBV (Maybe a) -> SBV (Maybe a) #

abs :: SBV (Maybe a) -> SBV (Maybe a) #

signum :: SBV (Maybe a) -> SBV (Maybe a) #

fromInteger :: Integer -> SBV (Maybe a) #

(Ord a, Num a, SymVal a) => Num (SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

(+) :: SBV a -> SBV a -> SBV a #

(-) :: SBV a -> SBV a -> SBV a #

(*) :: SBV a -> SBV a -> SBV a #

negate :: SBV a -> SBV a #

abs :: SBV a -> SBV a #

signum :: SBV a -> SBV a #

fromInteger :: Integer -> SBV a #

(Ord a, SymVal a, Fractional a) => Fractional (SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

(/) :: SBV a -> SBV a -> SBV a #

recip :: SBV a -> SBV a #

fromRational :: Rational -> SBV a #

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 #

show :: SBV a -> String #

showList :: [SBV a] -> ShowS #

(SymVal a, Show a) => Show (IncS (SBV a)) Source #

Show instance for IncS. The above deriving clause would work just as well, but we want it to be a little prettier here, and hence the OVERLAPS directive.

Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.Basics

Methods

showsPrec :: Int -> IncS (SBV a) -> ShowS #

show :: IncS (SBV a) -> String #

showList :: [IncS (SBV a)] -> ShowS #

(SymVal a, Show a) => Show (FibS (SBV a)) Source #

Show instance for FibS. The above deriving clause would work just as well, but we want it to be a little prettier here, and hence the OVERLAPS directive.

Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.Fib

Methods

showsPrec :: Int -> FibS (SBV a) -> ShowS #

show :: FibS (SBV a) -> String #

showList :: [FibS (SBV a)] -> ShowS #

(SymVal a, Show a) => Show (GCDS (SBV a)) Source #

Show instance for GCDS. The above deriving clause would work just as well, but we want it to be a little prettier here, and hence the OVERLAPS directive.

Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.GCD

Methods

showsPrec :: Int -> GCDS (SBV a) -> ShowS #

show :: GCDS (SBV a) -> String #

showList :: [GCDS (SBV a)] -> ShowS #

(SymVal a, Show a) => Show (DivS (SBV a)) Source #

Show instance for DivS. The above deriving clause would work just as well, but we want it to be a little prettier here, and hence the OVERLAPS directive.

Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.IntDiv

Methods

showsPrec :: Int -> DivS (SBV a) -> ShowS #

show :: DivS (SBV a) -> String #

showList :: [DivS (SBV a)] -> ShowS #

(SymVal a, Show a) => Show (SqrtS (SBV a)) Source #

Show instance for SqrtS. The above deriving clause would work just as well, but we want it to be a little prettier here, and hence the OVERLAPS directive.

Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.IntSqrt

Methods

showsPrec :: Int -> SqrtS (SBV a) -> ShowS #

show :: SqrtS (SBV a) -> String #

showList :: [SqrtS (SBV a)] -> ShowS #

(SymVal a, Show a) => Show (SumS (SBV a)) Source #

Show instance for SumS. The above deriving clause would work just as well, but we want it to be a little prettier here, and hence the OVERLAPS directive.

Instance details

Defined in Documentation.SBV.Examples.WeakestPreconditions.Sum

Methods

showsPrec :: Int -> SumS (SBV a) -> ShowS #

show :: SumS (SBV a) -> String #

showList :: [SumS (SBV a)] -> ShowS #

NFData (SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Data

Methods

rnf :: SBV a -> () #

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 #

(/=) :: SBV a -> SBV a -> Bool #

(Random a, SymVal 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) #

random :: RandomGen g => g -> (SBV a, g) #

randomRs :: RandomGen g => (SBV a, SBV a) -> g -> [SBV a] #

randoms :: RandomGen g => g -> [SBV a] #

ByteConverter (SWord 8) Source #

SWord 8 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 8 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 8 Source #

ByteConverter (SWord 16) Source #

SWord 16 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 16 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 16 Source #

ByteConverter (SWord 32) Source #

SWord 32 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 32 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 32 Source #

ByteConverter (SWord 64) Source #

SWord 64 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 64 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 64 Source #

ByteConverter (SWord 128) Source #

SWord 128 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 128 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 128 Source #

ByteConverter (SWord 256) Source #

SWord 256 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 256 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 256 Source #

ByteConverter (SWord 512) Source #

SWord 512 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 512 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 512 Source #

ByteConverter (SWord 1024) Source #

SWord 1024 instance for ByteConverter

Instance details

Defined in Data.SBV

Methods

toBytes :: SWord 1024 -> [SWord 8] Source #

fromBytes :: [SWord 8] -> SWord 1024 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 #

(.===) :: SBV a -> SBV a -> SBool Source #

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

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

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

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

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

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

Outputtable (SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Data

Methods

output :: MonadSymbolic m => SBV a -> m (SBV a) Source #

Skolemize (SBV a) Source #

Base case; pure symbolic values

Instance details

Defined in Data.SBV.Core.Data

Associated Types

type SkolemsTo (SBV a)

Methods

skolem :: String -> [(SVal, String)] -> SBV a -> SkolemsTo (SBV a)

skolemize :: SBV a -> SkolemsTo (SBV a) Source #

taggedSkolemize :: String -> SBV a -> SkolemsTo (SBV a) Source #

HasKind a => HasKind (SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Data

SymVal 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 :: (Ord b, SymVal b, Num b) => [SBV a] -> SBV a -> SBV b -> SBV a Source #

(Ord a, SymVal a) => OrdSymbolic (SBV a) Source #

If comparison is over something SMTLib can handle, just translate it. Otherwise desugar.

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 #

(KnownNat n, BVIsNonZero n) => SDivisible (SInt n) Source #

SDivisible instance for SInt

Instance details

Defined in Data.SBV.Core.Sized

Methods

sQuotRem :: SInt n -> SInt n -> (SInt n, SInt n) Source #

sDivMod :: SInt n -> SInt n -> (SInt n, SInt n) Source #

sQuot :: SInt n -> SInt n -> SInt n Source #

sRem :: SInt n -> SInt n -> SInt n Source #

sDiv :: SInt n -> SInt n -> SInt n Source #

sMod :: SInt n -> SInt n -> SInt n Source #

(KnownNat n, BVIsNonZero n) => SDivisible (SWord n) Source #

SDivisible instance for SWord

Instance details

Defined in Data.SBV.Core.Sized

Methods

sQuotRem :: SWord n -> SWord n -> (SWord n, SWord n) Source #

sDivMod :: SWord n -> SWord n -> (SWord n, SWord n) Source #

sQuot :: SWord n -> SWord n -> SWord n Source #

sRem :: SWord n -> SWord n -> SWord n Source #

sDiv :: SWord n -> SWord n -> SWord n Source #

sMod :: SWord n -> SWord n -> SWord n Source #

HasKind a => SMTDefinable (SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: String -> SBV a -> SBV a Source #

uninterpret :: String -> SBV a Source #

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

sbvDefineValue :: String -> UIKind (SBV a) -> SBV a Source #

sym :: String -> SBV a Source #

(KnownNat n, BVIsNonZero n) => ArithOverflow (SInt n) Source # 
Instance details

Defined in Data.SBV.Tools.Overflow

Methods

bvAddO :: SInt n -> SInt n -> (SBool, SBool) Source #

bvSubO :: SInt n -> SInt n -> (SBool, SBool) Source #

bvMulO :: SInt n -> SInt n -> (SBool, SBool) Source #

bvMulOFast :: SInt n -> SInt n -> (SBool, SBool) Source #

bvDivO :: SInt n -> SInt n -> (SBool, SBool) Source #

bvNegO :: SInt n -> (SBool, SBool) Source #

(KnownNat n, BVIsNonZero n) => ArithOverflow (SWord n) Source # 
Instance details

Defined in Data.SBV.Tools.Overflow

Methods

bvAddO :: SWord n -> SWord n -> (SBool, SBool) Source #

bvSubO :: SWord n -> SWord n -> (SBool, SBool) Source #

bvMulO :: SWord n -> SWord n -> (SBool, SBool) Source #

bvMulOFast :: SWord n -> SWord n -> (SBool, SBool) Source #

bvDivO :: SWord n -> SWord n -> (SBool, SBool) Source #

bvNegO :: SWord n -> (SBool, SBool) Source #

(KnownNat n, BVIsNonZero n) => Polynomial (SWord n) Source # 
Instance details

Defined in Data.SBV.Tools.Polynomial

Methods

polynomial :: [Int] -> SWord n Source #

pAdd :: SWord n -> SWord n -> SWord n Source #

pMult :: (SWord n, SWord n, [Int]) -> SWord n Source #

pDiv :: SWord n -> SWord n -> SWord n Source #

pMod :: SWord n -> SWord n -> SWord n Source #

pDivMod :: SWord n -> SWord n -> (SWord n, SWord n) Source #

showPoly :: SWord n -> String Source #

showPolynomial :: Bool -> SWord n -> String Source #

(SymVal 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 #

hexP :: SBV a -> String Source #

binP :: SBV a -> String Source #

hex :: SBV a -> String Source #

bin :: SBV a -> String Source #

ValidFloat eb sb => Floating (SFloatingPoint eb sb) Source #

We give a specific instance for SFloatingPoint, because the underlying floating-point type doesn't support fromRational directly. The overlap with the above instance is unfortunate.

Instance details

Defined in Data.SBV.Core.Model

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SymVal f, SymVal 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.Core.Model

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 #

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SymVal f, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> SBV f -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

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 #

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

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 #

(SymVal a, SymVal b, SymVal c, SymVal d, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> SBV d -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

(===) :: (SBV a -> SBV b -> SBV c -> SBV d -> z) -> (SBV a -> SBV b -> SBV c -> SBV d -> z) -> IO ThmResult Source #

(SymVal a, SymVal b, SymVal c, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

(===) :: (SBV a -> SBV b -> SBV c -> z) -> (SBV a -> SBV b -> SBV c -> z) -> IO ThmResult Source #

(SymVal a, SymVal b, EqSymbolic z) => Equality (SBV a -> SBV b -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

(===) :: (SBV a -> SBV b -> z) -> (SBV a -> SBV b -> z) -> IO ThmResult Source #

(SymVal a, EqSymbolic z) => Equality (SBV a -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

(===) :: (SBV a -> z) -> (SBV a -> z) -> IO ThmResult Source #

(SymVal a, SymVal b, EqSymbolic z) => Equality ((SBV a, SBV b) -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

(===) :: ((SBV a, SBV b) -> z) -> ((SBV a, SBV b) -> z) -> IO ThmResult Source #

(SymVal a, SymVal b, SymVal c, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c) -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

(===) :: ((SBV a, SBV b, SBV c) -> z) -> ((SBV a, SBV b, SBV c) -> z) -> IO ThmResult Source #

(SymVal a, SymVal b, SymVal c, SymVal d, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c, SBV d) -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

(===) :: ((SBV a, SBV b, SBV c, SBV d) -> z) -> ((SBV a, SBV b, SBV c, SBV d) -> z) -> IO ThmResult Source #

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c, SBV d, SBV e) -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

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 #

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SymVal f, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> z) Source # 
Instance details

Defined in Data.SBV.Core.Model

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 #

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SymVal f, SymVal 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.Core.Model

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 #

SymVal 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 :: (Ord b, SymVal b, Num b) => [STree i e] -> STree i e -> SBV b -> STree i e Source #

(SymVal b, HasKind a) => SMTDefinable (SBV b -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: String -> (SBV b -> SBV a) -> SBV b -> SBV a Source #

uninterpret :: String -> SBV b -> SBV a Source #

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

sbvDefineValue :: String -> UIKind (SBV b -> SBV a) -> SBV b -> SBV a Source #

sym :: String -> SBV b -> SBV a Source #

(SymVal c, SymVal b, HasKind a) => SMTDefinable (SBV c -> SBV b -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: String -> (SBV c -> SBV b -> SBV a) -> SBV c -> SBV b -> SBV a Source #

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 #

sbvDefineValue :: String -> UIKind (SBV c -> SBV b -> SBV a) -> SBV c -> SBV b -> SBV a Source #

sym :: String -> SBV c -> SBV b -> SBV a Source #

(SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable (SBV d -> SBV c -> SBV b -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: String -> (SBV d -> SBV c -> SBV b -> SBV a) -> SBV d -> SBV c -> SBV b -> SBV a Source #

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 #

sbvDefineValue :: String -> UIKind (SBV d -> SBV c -> SBV b -> SBV a) -> SBV d -> SBV c -> SBV b -> SBV a Source #

sym :: String -> SBV d -> SBV c -> SBV b -> SBV a Source #

(SymVal e, SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable (SBV e -> SBV d -> SBV c -> SBV b -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: String -> (SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

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 #

sbvDefineValue :: String -> UIKind (SBV e -> SBV d -> SBV c -> SBV b -> SBV a) -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a Source #

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

(SymVal f, SymVal e, SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable (SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: 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 #

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 #

sbvDefineValue :: String -> UIKind (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 #

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

(SymVal g, SymVal f, SymVal e, SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable (SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: 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 #

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 #

sbvDefineValue :: String -> UIKind (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 #

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

(SymVal h, SymVal g, SymVal f, SymVal e, SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable (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

smtFunction :: 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 #

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 #

sbvDefineValue :: String -> UIKind (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 #

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

(SymVal c, SymVal b, HasKind a) => SMTDefinable ((SBV c, SBV b) -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: String -> ((SBV c, SBV b) -> SBV a) -> (SBV c, SBV b) -> SBV a Source #

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 #

sbvDefineValue :: String -> UIKind ((SBV c, SBV b) -> SBV a) -> (SBV c, SBV b) -> SBV a Source #

sym :: String -> (SBV c, SBV b) -> SBV a Source #

(SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable ((SBV d, SBV c, SBV b) -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: String -> ((SBV d, SBV c, SBV b) -> SBV a) -> (SBV d, SBV c, SBV b) -> SBV a Source #

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 #

sbvDefineValue :: String -> UIKind ((SBV d, SBV c, SBV b) -> SBV a) -> (SBV d, SBV c, SBV b) -> SBV a Source #

sym :: String -> (SBV d, SBV c, SBV b) -> SBV a Source #

(SymVal e, SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable ((SBV e, SBV d, SBV c, SBV b) -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

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

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 #

sbvDefineValue :: String -> UIKind ((SBV e, SBV d, SBV c, SBV b) -> SBV a) -> (SBV e, SBV d, SBV c, SBV b) -> SBV a Source #

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

(SymVal f, SymVal e, SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable ((SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: 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 #

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 #

sbvDefineValue :: String -> UIKind ((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 #

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

(SymVal g, SymVal f, SymVal e, SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable ((SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

smtFunction :: 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 #

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 #

sbvDefineValue :: String -> UIKind ((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 #

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

(SymVal h, SymVal g, SymVal f, SymVal e, SymVal d, SymVal c, SymVal b, HasKind a) => SMTDefinable ((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

smtFunction :: 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 #

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 #

sbvDefineValue :: String -> UIKind ((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 #

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

type NegatesTo SBool Source # 
Instance details

Defined in Data.SBV.Core.Data

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-10.2-inplace" '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
type QueryResult (SBV a) Source # 
Instance details

Defined in Data.SBV.Control.Utils

type QueryResult (SBV a) = a
type QueryResult (t (SBV a)) Source # 
Instance details

Defined in Data.SBV.Control.Utils

type QueryResult (t (SBV a)) = t 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

Instances

Instances details
HasKind Int16 Source # 
Instance details

Defined in Data.SBV.Core.Kind

HasKind Int32 Source # 
Instance details

Defined in Data.SBV.Core.Kind

HasKind Int64 Source # 
Instance details

Defined in Data.SBV.Core.Kind

HasKind Int8 Source # 
Instance details

Defined in Data.SBV.Core.Kind

HasKind Rational Source # 
Instance details

Defined in Data.SBV.Core.Kind

HasKind Word16 Source # 
Instance details

Defined in Data.SBV.Core.Kind

HasKind Word32 Source # 
Instance details

Defined in Data.SBV.Core.Kind

HasKind Word64 Source # 
Instance details

Defined in Data.SBV.Core.Kind

HasKind Word8 Source # 
Instance details

Defined in Data.SBV.Core.Kind

HasKind AlgReal Source # 
Instance details

Defined in Data.SBV.Core.Kind

HasKind CV Source #

Kind instance for CV

Instance details

Defined in Data.SBV.Core.Concrete

HasKind ExtCV Source #

Kind instance for Extended CV

Instance details

Defined in Data.SBV.Core.Concrete

HasKind GeneralizedCV Source #

Kind instance for generalized CV

Instance details

Defined in Data.SBV.Core.Concrete

HasKind Kind Source # 
Instance details

Defined in Data.SBV.Core.Kind

HasKind RoundingMode Source #

RoundingMode kind

Instance details

Defined in Data.SBV.Core.Kind

HasKind SV Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

HasKind SVal Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

HasKind State Source # 
Instance details

Defined in Documentation.SBV.Examples.Lists.BoundedMutex

HasKind E Source # 
Instance details

Defined in Documentation.SBV.Examples.Misc.Enumerate

HasKind E Source # 
Instance details

Defined in Documentation.SBV.Examples.Misc.FirstOrderLogic

HasKind U Source # 
Instance details

Defined in Documentation.SBV.Examples.Misc.FirstOrderLogic

HasKind V Source # 
Instance details

Defined in Documentation.SBV.Examples.Misc.FirstOrderLogic

HasKind HumanHeightInCm Source #

Symbolic instance simply follows the underlying type, just like Metres.

Instance details

Defined in Documentation.SBV.Examples.Misc.Newtypes

HasKind Metres Source #

To use Metres symbolically, we associate it with the underlying symbolic type's kind.

Instance details

Defined in Documentation.SBV.Examples.Misc.Newtypes

HasKind Day Source # 
Instance details

Defined in Documentation.SBV.Examples.Optimization.Enumerate

HasKind Day Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Birthday

HasKind Month Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Birthday

HasKind P Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Drinker

HasKind Beverage Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

HasKind Color Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

HasKind Nationality Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

HasKind Pet Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

HasKind Sport Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

HasKind Color Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Garden

HasKind Color Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.HexPuzzle

HasKind Identity Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.KnightsAndKnaves

HasKind Inhabitant Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.KnightsAndKnaves

HasKind Statement Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.KnightsAndKnaves

HasKind Location Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

HasKind Role Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

HasKind Sex Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

HasKind Handler Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Orangutans

HasKind Location Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Orangutans

HasKind Orangutan Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Orangutans

HasKind Rabbit Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Rabbits

HasKind Location Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.U2Bridge

HasKind U2Member Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.U2Bridge

HasKind Day Source # 
Instance details

Defined in Documentation.SBV.Examples.Queries.Enums

HasKind BinOp Source # 
Instance details

Defined in Documentation.SBV.Examples.Queries.FourFours

HasKind UnOp Source # 
Instance details

Defined in Documentation.SBV.Examples.Queries.FourFours

HasKind B Source # 
Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.Deduce

HasKind Q Source # 
Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.Sort

HasKind L Source # 
Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.UISortAllSat

HasKind Integer Source # 
Instance details

Defined in Data.SBV.Core.Kind

HasKind () Source # 
Instance details

Defined in Data.SBV.Core.Kind

HasKind Bool Source # 
Instance details

Defined in Data.SBV.Core.Kind

HasKind Char Source # 
Instance details

Defined in Data.SBV.Core.Kind

HasKind Double Source # 
Instance details

Defined in Data.SBV.Core.Kind

HasKind Float Source # 
Instance details

Defined in Data.SBV.Core.Kind

HasKind a => HasKind (RCSet a) Source # 
Instance details

Defined in Data.SBV.Core.Concrete

HasKind a => HasKind (SBV a) Source # 
Instance details

Defined in Data.SBV.Core.Data

(KnownNat n, BVIsNonZero n) => HasKind (IntN n) Source #

IntN has a kind

Instance details

Defined in Data.SBV.Core.Sized

(KnownNat n, BVIsNonZero n) => HasKind (WordN n) Source #

WordN has a kind

Instance details

Defined in Data.SBV.Core.Sized

HasKind a => HasKind (Maybe a) Source # 
Instance details

Defined in Data.SBV.Core.Kind

(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 #

isRational :: [a] -> Bool Source #

isFP :: [a] -> Bool Source #

isUnbounded :: [a] -> Bool Source #

isUserSort :: [a] -> Bool Source #

isChar :: [a] -> Bool Source #

isString :: [a] -> Bool Source #

isList :: [a] -> Bool Source #

isSet :: [a] -> Bool Source #

isTuple :: [a] -> Bool Source #

isMaybe :: [a] -> Bool Source #

isEither :: [a] -> Bool Source #

showType :: [a] -> String Source #

(HasKind a, HasKind b) => HasKind (Either a b) Source # 
Instance details

Defined in Data.SBV.Core.Kind

HasKind a => HasKind (Proxy a) Source #

This instance allows us to use the `kindOf (Proxy @a)` idiom instead of the `kindOf (undefined :: a)`, which is safer and looks more idiomatic.

Instance details

Defined in Data.SBV.Core.Kind

ValidFloat eb sb => HasKind (FloatingPoint eb sb) Source # 
Instance details

Defined in Data.SBV.Core.Model

(HasKind a, HasKind b) => HasKind (a, b) Source # 
Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: (a, b) -> Kind Source #

hasSign :: (a, b) -> Bool Source #

intSizeOf :: (a, b) -> Int Source #

isBoolean :: (a, b) -> Bool Source #

isBounded :: (a, b) -> Bool Source #

isReal :: (a, b) -> Bool Source #

isFloat :: (a, b) -> Bool Source #

isDouble :: (a, b) -> Bool Source #

isRational :: (a, b) -> Bool Source #

isFP :: (a, b) -> Bool Source #

isUnbounded :: (a, b) -> Bool Source #

isUserSort :: (a, b) -> Bool Source #

isChar :: (a, b) -> Bool Source #

isString :: (a, b) -> Bool Source #

isList :: (a, b) -> Bool Source #

isSet :: (a, b) -> Bool Source #

isTuple :: (a, b) -> Bool Source #

isMaybe :: (a, b) -> Bool Source #

isEither :: (a, b) -> Bool Source #

showType :: (a, b) -> String Source #

(HasKind a, HasKind b, HasKind c) => HasKind (a, b, c) Source # 
Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: (a, b, c) -> Kind Source #

hasSign :: (a, b, c) -> Bool Source #

intSizeOf :: (a, b, c) -> Int Source #

isBoolean :: (a, b, c) -> Bool Source #

isBounded :: (a, b, c) -> Bool Source #

isReal :: (a, b, c) -> Bool Source #

isFloat :: (a, b, c) -> Bool Source #

isDouble :: (a, b, c) -> Bool Source #

isRational :: (a, b, c) -> Bool Source #

isFP :: (a, b, c) -> Bool Source #

isUnbounded :: (a, b, c) -> Bool Source #

isUserSort :: (a, b, c) -> Bool Source #

isChar :: (a, b, c) -> Bool Source #

isString :: (a, b, c) -> Bool Source #

isList :: (a, b, c) -> Bool Source #

isSet :: (a, b, c) -> Bool Source #

isTuple :: (a, b, c) -> Bool Source #

isMaybe :: (a, b, c) -> Bool Source #

isEither :: (a, b, c) -> Bool Source #

showType :: (a, b, c) -> String Source #

(HasKind a, HasKind b, HasKind c, HasKind d) => HasKind (a, b, c, d) Source # 
Instance details

Defined in Data.SBV.Core.Kind

Methods

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(HasKind a, HasKind b, HasKind c, HasKind d, HasKind e) => HasKind (a, b, c, d, e) Source # 
Instance details

Defined in Data.SBV.Core.Kind

Methods

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(HasKind a, HasKind b, HasKind c, HasKind d, HasKind e, HasKind f) => HasKind (a, b, c, d, e, f) Source # 
Instance details

Defined in Data.SBV.Core.Kind

Methods

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(HasKind a, HasKind b, HasKind c, HasKind d, HasKind e, HasKind f, HasKind g) => HasKind (a, b, c, d, e, f, g) Source # 
Instance details

Defined in Data.SBV.Core.Kind

Methods

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(HasKind a, HasKind b, HasKind c, HasKind d, HasKind e, HasKind f, HasKind g, HasKind h) => HasKind (a, b, c, d, e, f, g, h) Source # 
Instance details

Defined in Data.SBV.Core.Kind

Methods

kindOf :: (a, b, c, d, e, f, g, h) -> Kind Source #

hasSign :: (a, b, c, d, e, f, g, h) -> Bool Source #

intSizeOf :: (a, b, c, d, e, f, g, h) -> Int Source #

isBoolean :: (a, b, c, d, e, f, g, h) -> Bool Source #

isBounded :: (a, b, c, d, e, f, g, h) -> Bool Source #

isReal :: (a, b, c, d, e, f, g, h) -> Bool Source #

isFloat :: (a, b, c, d, e, f, g, h) -> Bool Source #

isDouble :: (a, b, c, d, e, f, g, h) -> Bool Source #

isRational :: (a, b, c, d, e, f, g, h) -> Bool Source #

isFP :: (a, b, c, d, e, f, g, h) -> Bool Source #

isUnbounded :: (a, b, c, d, e, f, g, h) -> Bool Source #

isUserSort :: (a, b, c, d, e, f, g, h) -> Bool Source #

isChar :: (a, b, c, d, e, f, g, h) -> Bool Source #

isString :: (a, b, c, d, e, f, g, h) -> Bool Source #

isList :: (a, b, c, d, e, f, g, h) -> Bool Source #

isSet :: (a, b, c, d, e, f, g, h) -> Bool Source #

isTuple :: (a, b, c, d, e, f, g, h) -> Bool Source #

isMaybe :: (a, b, c, d, e, f, g, h) -> Bool Source #

isEither :: (a, b, c, d, e, f, g, h) -> Bool Source #

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

data Kind Source #

Kind of symbolic value

Instances

Instances details
Data Kind Source # 
Instance details

Defined in Data.SBV.Core.Kind

Methods

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

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

toConstr :: Kind -> Constr #

dataTypeOf :: Kind -> DataType #

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

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

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

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

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

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

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

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

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

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

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 #

show :: Kind -> String #

showList :: [Kind] -> ShowS #

NFData Kind Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Methods

rnf :: Kind -> () #

Eq Kind Source # 
Instance details

Defined in Data.SBV.Core.Kind

Methods

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

(/=) :: Kind -> Kind -> Bool #

Ord Kind Source # 
Instance details

Defined in Data.SBV.Core.Kind

Methods

compare :: Kind -> Kind -> Ordering #

(<) :: Kind -> Kind -> Bool #

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

(>) :: Kind -> Kind -> Bool #

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

max :: Kind -> Kind -> Kind #

min :: Kind -> Kind -> Kind #

HasKind Kind Source # 
Instance details

Defined in Data.SBV.Core.Kind

class (HasKind a, Typeable a) => SymVal a Source #

A SymVal is a potential symbolic value that can be created instances of to be fed to a symbolic program.

Instances

Instances details
SymVal Int16 Source # 
Instance details

Defined in Data.SBV.Core.Model

SymVal Int32 Source # 
Instance details

Defined in Data.SBV.Core.Model

SymVal Int64 Source # 
Instance details

Defined in Data.SBV.Core.Model

SymVal Int8 Source # 
Instance details

Defined in Data.SBV.Core.Model

SymVal Rational Source # 
Instance details

Defined in Data.SBV.Core.Model

SymVal Word16 Source # 
Instance details

Defined in Data.SBV.Core.Model

SymVal Word32 Source # 
Instance details

Defined in Data.SBV.Core.Model

SymVal Word64 Source # 
Instance details

Defined in Data.SBV.Core.Model

SymVal Word8 Source # 
Instance details

Defined in Data.SBV.Core.Model

SymVal AlgReal Source # 
Instance details

Defined in Data.SBV.Core.Model

SymVal RoundingMode Source #

RoundingMode can be used symbolically

Instance details

Defined in Data.SBV.Core.Data

SymVal State Source # 
Instance details

Defined in Documentation.SBV.Examples.Lists.BoundedMutex

SymVal E Source # 
Instance details

Defined in Documentation.SBV.Examples.Misc.Enumerate

SymVal E Source # 
Instance details

Defined in Documentation.SBV.Examples.Misc.FirstOrderLogic

SymVal U Source # 
Instance details

Defined in Documentation.SBV.Examples.Misc.FirstOrderLogic

SymVal V Source # 
Instance details

Defined in Documentation.SBV.Examples.Misc.FirstOrderLogic

SymVal HumanHeightInCm Source #

Similarly here, for the SymVal instance.

Instance details

Defined in Documentation.SBV.Examples.Misc.Newtypes

SymVal Metres Source #

The SymVal instance simply uses stock definitions. This is always possible for newtypes that simply wrap over an existing symbolic type.

Instance details

Defined in Documentation.SBV.Examples.Misc.Newtypes

SymVal Day Source # 
Instance details

Defined in Documentation.SBV.Examples.Optimization.Enumerate

SymVal Day Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Birthday

SymVal Month Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Birthday

SymVal P Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Drinker

SymVal Beverage Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

SymVal Color Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

SymVal Nationality Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

SymVal Pet Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

SymVal Sport Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Fish

SymVal Color Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Garden

SymVal Color Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.HexPuzzle

SymVal Identity Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.KnightsAndKnaves

SymVal Inhabitant Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.KnightsAndKnaves

SymVal Statement Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.KnightsAndKnaves

SymVal Location Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

SymVal Role Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

SymVal Sex Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

SymVal Handler Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Orangutans

SymVal Location Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Orangutans

SymVal Orangutan Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Orangutans

SymVal Rabbit Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Rabbits

SymVal Location Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.U2Bridge

SymVal U2Member Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.U2Bridge

SymVal Day Source # 
Instance details

Defined in Documentation.SBV.Examples.Queries.Enums

SymVal BinOp Source # 
Instance details

Defined in Documentation.SBV.Examples.Queries.FourFours

SymVal UnOp Source # 
Instance details

Defined in Documentation.SBV.Examples.Queries.FourFours

SymVal B Source # 
Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.Deduce

SymVal Q Source # 
Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.Sort

SymVal L Source # 
Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.UISortAllSat

SymVal Integer Source # 
Instance details

Defined in Data.SBV.Core.Model

SymVal () Source #

SymVal for 0-tuple (i.e., unit)

Instance details

Defined in Data.SBV.Core.Model

Methods

mkSymVal :: MonadSymbolic m => VarContext -> Maybe String -> m (SBV ()) Source #

literal :: () -> SBV () Source #

fromCV :: CV -> () Source #

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

free :: MonadSymbolic m => String -> m (SBV ()) Source #

free_ :: MonadSymbolic m => m (SBV ()) Source #

mkFreeVars :: MonadSymbolic m => Int -> m [SBV ()] Source #

symbolic :: MonadSymbolic m => String -> m (SBV ()) Source #

symbolics :: MonadSymbolic m => [String] -> m [SBV ()] Source #

unliteral :: SBV () -> Maybe () Source #

isConcrete :: SBV () -> Bool Source #

isSymbolic :: SBV () -> Bool Source #

SymVal Bool Source # 
Instance details

Defined in Data.SBV.Core.Model

SymVal Char Source # 
Instance details

Defined in Data.SBV.Core.Model

SymVal Double Source # 
Instance details

Defined in Data.SBV.Core.Model

SymVal Float Source # 
Instance details

Defined in Data.SBV.Core.Model

(Ord a, SymVal a) => SymVal (RCSet a) Source # 
Instance details

Defined in Data.SBV.Core.Model

(KnownNat n, BVIsNonZero n) => SymVal (IntN n) Source #

SymVal instance for IntN

Instance details

Defined in Data.SBV.Core.Sized

(KnownNat n, BVIsNonZero n) => SymVal (WordN n) Source #

SymVal instance for WordN

Instance details

Defined in Data.SBV.Core.Sized

SymVal a => SymVal (Maybe a) Source # 
Instance details

Defined in Data.SBV.Core.Model

SymVal a => SymVal [a] Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

mkSymVal :: MonadSymbolic m => VarContext -> Maybe String -> m (SBV [a]) Source #

literal :: [a] -> SBV [a] Source #

fromCV :: CV -> [a] Source #

isConcretely :: SBV [a] -> ([a] -> Bool) -> Bool Source #

free :: MonadSymbolic m => String -> m (SBV [a]) Source #

free_ :: MonadSymbolic m => m (SBV [a]) Source #

mkFreeVars :: MonadSymbolic m => Int -> m [SBV [a]] Source #

symbolic :: MonadSymbolic m => String -> m (SBV [a]) Source #

symbolics :: MonadSymbolic m => [String] -> m [SBV [a]] Source #

unliteral :: SBV [a] -> Maybe [a] Source #

isConcrete :: SBV [a] -> Bool Source #

isSymbolic :: SBV [a] -> Bool Source #

(SymVal a, SymVal b) => SymVal (Either a b) Source # 
Instance details

Defined in Data.SBV.Core.Model

ValidFloat eb sb => SymVal (FloatingPoint eb sb) Source # 
Instance details

Defined in Data.SBV.Core.Model

(SymVal a, SymVal b) => SymVal (a, b) Source #

SymVal for 2-tuples

Instance details

Defined in Data.SBV.Core.Model

Methods

mkSymVal :: MonadSymbolic m => VarContext -> Maybe String -> m (SBV (a, b)) Source #

literal :: (a, b) -> SBV (a, b) Source #

fromCV :: CV -> (a, b) Source #

isConcretely :: SBV (a, b) -> ((a, b) -> Bool) -> Bool Source #

free :: MonadSymbolic m => String -> m (SBV (a, b)) Source #

free_ :: MonadSymbolic m => m (SBV (a, b)) Source #

mkFreeVars :: MonadSymbolic m => Int -> m [SBV (a, b)] Source #

symbolic :: MonadSymbolic m => String -> m (SBV (a, b)) Source #

symbolics :: MonadSymbolic m => [String] -> m [SBV (a, b)] Source #

unliteral :: SBV (a, b) -> Maybe (a, b) Source #

isConcrete :: SBV (a, b) -> Bool Source #

isSymbolic :: SBV (a, b) -> Bool Source #

(SymVal a, SymVal b, SymVal c) => SymVal (a, b, c) Source #

SymVal for 3-tuples

Instance details

Defined in Data.SBV.Core.Model

Methods

mkSymVal :: MonadSymbolic m => VarContext -> Maybe String -> m (SBV (a, b, c)) Source #

literal :: (a, b, c) -> SBV (a, b, c) Source #

fromCV :: CV -> (a, b, c) Source #

isConcretely :: SBV (a, b, c) -> ((a, b, c) -> Bool) -> Bool Source #

free :: MonadSymbolic m => String -> m (SBV (a, b, c)) Source #

free_ :: MonadSymbolic m => m (SBV (a, b, c)) Source #

mkFreeVars :: MonadSymbolic m => Int -> m [SBV (a, b, c)] Source #

symbolic :: MonadSymbolic m => String -> m (SBV (a, b, c)) Source #

symbolics :: MonadSymbolic m => [String] -> m [SBV (a, b, c)] Source #

unliteral :: SBV (a, b, c) -> Maybe (a, b, c) Source #

isConcrete :: SBV (a, b, c) -> Bool Source #

isSymbolic :: SBV (a, b, c) -> Bool Source #

(SymVal a, SymVal b, SymVal c, SymVal d) => SymVal (a, b, c, d) Source #

SymVal for 4-tuples

Instance details

Defined in Data.SBV.Core.Model

Methods

mkSymVal :: MonadSymbolic m => VarContext -> Maybe String -> m (SBV (a, b, c, d)) Source #

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

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

isConcretely :: SBV (a, b, c, d) -> ((a, b, c, d) -> Bool) -> Bool Source #

free :: MonadSymbolic m => String -> m (SBV (a, b, c, d)) Source #

free_ :: MonadSymbolic m => m (SBV (a, b, c, d)) Source #

mkFreeVars :: MonadSymbolic m => Int -> m [SBV (a, b, c, d)] Source #

symbolic :: MonadSymbolic m => String -> m (SBV (a, b, c, d)) Source #

symbolics :: MonadSymbolic m => [String] -> m [SBV (a, b, c, d)] Source #

unliteral :: SBV (a, b, c, d) -> Maybe (a, b, c, d) Source #

isConcrete :: SBV (a, b, c, d) -> Bool Source #

isSymbolic :: SBV (a, b, c, d) -> Bool Source #

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

SymVal for 5-tuples

Instance details

Defined in Data.SBV.Core.Model

Methods

mkSymVal :: MonadSymbolic m => VarContext -> Maybe String -> m (SBV (a, b, c, d, e)) Source #

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

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

isConcretely :: SBV (a, b, c, d, e) -> ((a, b, c, d, e) -> Bool) -> Bool Source #

free :: MonadSymbolic m => String -> m (SBV (a, b, c, d, e)) Source #

free_ :: MonadSymbolic m => m (SBV (a, b, c, d, e)) Source #

mkFreeVars :: MonadSymbolic m => Int -> m [SBV (a, b, c, d, e)] Source #

symbolic :: MonadSymbolic m => String -> m (SBV (a, b, c, d, e)) Source #

symbolics :: MonadSymbolic m => [String] -> m [SBV (a, b, c, d, e)] Source #

unliteral :: SBV (a, b, c, d, e) -> Maybe (a, b, c, d, e) Source #

isConcrete :: SBV (a, b, c, d, e) -> Bool Source #

isSymbolic :: SBV (a, b, c, d, e) -> Bool Source #

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

SymVal for 6-tuples

Instance details

Defined in Data.SBV.Core.Model

Methods

mkSymVal :: MonadSymbolic m => VarContext -> Maybe String -> m (SBV (a, b, c, d, e, f)) Source #

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

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

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

free :: MonadSymbolic m => String -> m (SBV (a, b, c, d, e, f)) Source #

free_ :: MonadSymbolic m => m (SBV (a, b, c, d, e, f)) Source #

mkFreeVars :: MonadSymbolic m => Int -> m [SBV (a, b, c, d, e, f)] Source #

symbolic :: MonadSymbolic m => String -> m (SBV (a, b, c, d, e, f)) Source #

symbolics :: MonadSymbolic m => [String] -> m [SBV (a, b, c, d, e, f)] Source #

unliteral :: SBV (a, b, c, d, e, f) -> Maybe (a, b, c, d, e, f) Source #

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

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

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

SymVal for 7-tuples

Instance details

Defined in Data.SBV.Core.Model

Methods

mkSymVal :: MonadSymbolic m => VarContext -> Maybe String -> m (SBV (a, b, c, d, e, f, g)) Source #

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

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

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

free :: MonadSymbolic m => String -> m (SBV (a, b, c, d, e, f, g)) Source #

free_ :: MonadSymbolic m => m (SBV (a, b, c, d, e, f, g)) Source #

mkFreeVars :: MonadSymbolic m => Int -> m [SBV (a, b, c, d, e, f, g)] Source #

symbolic :: MonadSymbolic m => String -> m (SBV (a, b, c, d, e, f, g)) Source #

symbolics :: MonadSymbolic m => [String] -> m [SBV (a, b, c, d, e, f, g)] Source #

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

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

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

(SymVal a, SymVal b, SymVal c, SymVal d, SymVal e, SymVal f, SymVal g, SymVal h) => SymVal (a, b, c, d, e, f, g, h) Source #

SymVal for 8-tuples

Instance details

Defined in Data.SBV.Core.Model

Methods

mkSymVal :: MonadSymbolic m => VarContext -> Maybe String -> m (SBV (a, b, c, d, e, f, g, h)) Source #

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

fromCV :: CV -> (a, b, c, d, e, f, g, h) Source #

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

free :: MonadSymbolic m => String -> m (SBV (a, b, c, d, e, f, g, h)) Source #

free_ :: MonadSymbolic m => m (SBV (a, b, c, d, e, f, g, h)) Source #

mkFreeVars :: MonadSymbolic m => Int -> m [SBV (a, b, c, d, e, f, g, h)] Source #

symbolic :: MonadSymbolic m => String -> m (SBV (a, b, c, d, e, f, g, h)) Source #

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

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

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

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

free :: SymVal a => String -> Symbolic (SBV a) Source #

Create a free variable, universal in a proof, existential in sat

NB. For a version which generalizes over the underlying monad, see free

free_ :: SymVal a => Symbolic (SBV a) Source #

Create an unnamed free variable, universal in proof, existential in sat

NB. For a version which generalizes over the underlying monad, see free_

mkFreeVars :: SymVal a => Int -> Symbolic [SBV a] Source #

Create a bunch of free vars

NB. For a version which generalizes over the underlying monad, see mkFreeVars

symbolic :: SymVal a => String -> Symbolic (SBV a) Source #

Similar to free; Just a more convenient name

NB. For a version which generalizes over the underlying monad, see symbolic

symbolics :: SymVal a => [String] -> Symbolic [SBV a] Source #

Similar to mkFreeVars; but automatically gives names based on the strings

NB. For a version which generalizes over the underlying monad, see symbolics

literal :: SymVal a => a -> SBV a Source #

Turn a literal constant to symbolic

unliteral :: SymVal a => SBV a -> Maybe a Source #

Extract a literal, if the value is concrete

fromCV :: SymVal a => CV -> a Source #

Extract a literal, from a CV representation

isConcrete :: SymVal a => SBV a -> Bool Source #

Is the symbolic word concrete?

isSymbolic :: SymVal a => SBV a -> Bool Source #

Is the symbolic word really symbolic?

isConcretely :: SymVal a => SBV a -> (a -> Bool) -> Bool Source #

Does it concretely satisfy the given predicate?

mkSymVal :: SymVal a => VarContext -> Maybe String -> Symbolic (SBV a) Source #

One stop allocator

NB. For a version which generalizes over the underlying monad, see mkSymVal

class MonadIO m => MonadSymbolic m where 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.

Computations which support symbolic operations

Minimal complete definition

Nothing

Methods

symbolicEnv :: m State Source #

default symbolicEnv :: (MonadTrans t, MonadSymbolic m', m ~ t m') => m State Source #

Instances

Instances details
MonadSymbolic SBVCodeGen Source # 
Instance details

Defined in Data.SBV.Compilers.CodeGen

MonadSymbolic Query Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

MonadSymbolic Alloc Source # 
Instance details

Defined in Documentation.SBV.Examples.Transformers.SymbolicEval

MonadIO m => MonadSymbolic (SymbolicT m) Source #

MonadSymbolic instance for `SymbolicT m`

Instance details

Defined in Data.SBV.Core.Symbolic

MonadSymbolic m => MonadSymbolic (MaybeT m) Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

MonadSymbolic m => MonadSymbolic (ExceptT e m) Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

MonadSymbolic m => MonadSymbolic (ReaderT r m) Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

MonadSymbolic m => MonadSymbolic (StateT s m) Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

MonadSymbolic m => MonadSymbolic (StateT s m) Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

(MonadSymbolic m, Monoid w) => MonadSymbolic (WriterT w m) Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

(MonadSymbolic m, Monoid w) => MonadSymbolic (WriterT w m) Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

type Symbolic = SymbolicT IO Source #

Symbolic is specialization of SymbolicT to the IO monad. Unless you are using transformers explicitly, this is the type you should prefer.

data SymbolicT m a Source #

A generalization of Symbolic.

Instances

Instances details
MonadTrans SymbolicT Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Methods

lift :: Monad m => m a -> SymbolicT m a #

MonadError e m => MonadError e (SymbolicT m) Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Methods

throwError :: e -> SymbolicT m a #

catchError :: SymbolicT m a -> (e -> SymbolicT m a) -> SymbolicT m a #

MonadReader r m => MonadReader r (SymbolicT m) Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Methods

ask :: SymbolicT m r #

local :: (r -> r) -> SymbolicT m a -> SymbolicT m a #

reader :: (r -> a) -> SymbolicT m a #

MonadState s m => MonadState s (SymbolicT m) Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Methods

get :: SymbolicT m s #

put :: s -> SymbolicT m () #

state :: (s -> (a, s)) -> SymbolicT m a #

MonadWriter w m => MonadWriter w (SymbolicT m) Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Methods

writer :: (a, w) -> SymbolicT m a #

tell :: w -> SymbolicT m () #

listen :: SymbolicT m a -> SymbolicT m (a, w) #

pass :: SymbolicT m (a, w -> w) -> SymbolicT m a #

ExtractIO m => ProvableM m (SymbolicT m SBool) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

(ExtractIO m, NFData a) => SExecutable m (SymbolicT m a) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

ExtractIO m => SatisfiableM m (SymbolicT m SBool) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

ExtractIO m => SatisfiableM m (SymbolicT m ()) Source # 
Instance details

Defined in Data.SBV.Provers.Prover

Testable (Symbolic SBool) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

property :: Symbolic SBool -> Property #

propertyForAllShrinkShow :: Gen a -> (a -> [a]) -> (a -> [String]) -> (a -> Symbolic SBool) -> Property #

Testable (Symbolic SVal) Source # 
Instance details

Defined in Data.SBV.Core.Model

Methods

property :: Symbolic SVal -> Property #

propertyForAllShrinkShow :: Gen a -> (a -> [a]) -> (a -> [String]) -> (a -> Symbolic SVal) -> Property #

MonadFail m => MonadFail (SymbolicT m) Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Methods

fail :: String -> SymbolicT m a #

MonadIO m => MonadIO (SymbolicT m) Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Methods

liftIO :: IO a -> SymbolicT m a #

Applicative m => Applicative (SymbolicT m) Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Methods

pure :: a -> SymbolicT m a #

(<*>) :: SymbolicT m (a -> b) -> SymbolicT m a -> SymbolicT m b #

liftA2 :: (a -> b -> c) -> SymbolicT m a -> SymbolicT m b -> SymbolicT m c #

(*>) :: SymbolicT m a -> SymbolicT m b -> SymbolicT m b #

(<*) :: SymbolicT m a -> SymbolicT m b -> SymbolicT m a #

Functor m => Functor (SymbolicT m) Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Methods

fmap :: (a -> b) -> SymbolicT m a -> SymbolicT m b #

(<$) :: a -> SymbolicT m b -> SymbolicT m a #

Monad m => Monad (SymbolicT m) Source # 
Instance details

Defined in Data.SBV.Core.Symbolic

Methods

(>>=) :: SymbolicT m a -> (a -> SymbolicT m b) -> SymbolicT m b #

(>>) :: SymbolicT m a -> SymbolicT m b -> SymbolicT m b #

return :: a -> SymbolicT m a #

MonadIO m => SolverContext (SymbolicT m) Source #

Symbolic computations provide a context for writing symbolic programs.

Instance details

Defined in Data.SBV.Core.Model

MonadIO m => MonadSymbolic (SymbolicT m) Source #

MonadSymbolic instance for `SymbolicT m`

Instance details

Defined in Data.SBV.Core.Symbolic

label :: SymVal 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.

NB. For a version which generalizes over the underlying monad, see output

runSMT :: Symbolic a -> IO a Source #

Run an arbitrary symbolic computation, equivalent to runSMTWith defaultSMTCfg

NB. For a version which generalizes over the underlying monad, see runSMT

runSMTWith :: SMTConfig -> Symbolic a -> IO a Source #

Runs an arbitrary symbolic computation, exposed to the user in SAT mode

NB. For a version which generalizes over the underlying monad, see runSMTWith

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