smtlib2-0.3: A type-safe interface to communicate with an SMT solver.

Safe HaskellNone
LanguageHaskell98

Language.SMTLib2.Internals

Synopsis

Documentation

data CheckSatLimits Source

Describe limits on the ressources that an SMT-solver can use

Constructors

CheckSatLimits 

Fields

limitTime :: Maybe Integer

A limit on the amount of time the solver can spend on the problem (in milliseconds)

limitMemory :: Maybe Integer

A limit on the amount of memory the solver can use (in megabytes)

data CheckSatResult Source

The result of a check-sat query

Constructors

Sat

The formula is satisfiable

Unsat

The formula is unsatisfiable

Unknown

The solver cannot determine the satisfiability of a formula

class Monad m => SMTBackend a m where Source

Methods

smtHandle :: Typeable response => a -> SMTRequest response -> m (response, a) Source

smtGetNames :: a -> m (Integer -> String) Source

smtNextName :: a -> m (Maybe String -> String) Source

class (Ord t, Typeable t, Ord (SMTAnnotation t), Typeable (SMTAnnotation t), Show (SMTAnnotation t)) => SMTType t where Source

Haskell types which can be represented in SMT

Minimal complete definition

getSort, asValueType, annotationFromSort, defaultExpr

Associated Types

type SMTAnnotation t Source

data Unmangling a Source

Constructors

PrimitiveUnmangling (Value -> SMTAnnotation a -> Maybe a) 
ComplexUnmangling (forall m s. Monad m => (forall b. SMTValue b => s -> SMTExpr b -> SMTAnnotation b -> m (b, s)) -> s -> SMTExpr a -> SMTAnnotation a -> m (Maybe a, s)) 

class (SMTType t, Show t) => SMTValue t where Source

Haskell values which can be represented as SMT constants

class (SMTValue t, Num t, SMTAnnotation t ~ ()) => SMTArith t Source

A type class for all types which support arithmetic operations in SMT

class SMTType t => SMTOrd t where Source

Lifts the Ord class into SMT

Methods

(.<.) :: SMTExpr t -> SMTExpr t -> SMTExpr Bool infix 4 Source

(.>=.) :: SMTExpr t -> SMTExpr t -> SMTExpr Bool infix 4 Source

(.>.) :: SMTExpr t -> SMTExpr t -> SMTExpr Bool infix 4 Source

(.<=.) :: SMTExpr t -> SMTExpr t -> SMTExpr Bool infix 4 Source

data SMTArray i v Source

An array which maps indices of type i to elements of type v.

Constructors

SMTArray 

Instances

data FunInfo Source

Constructors

forall arg r . (Args arg, SMTType r) => FunInfo 

data AnyBackend m Source

Constructors

forall b . SMTBackend b m => AnyBackend b 

Instances

data SMT' m a Source

The SMT monad used for communating with the SMT solver

Constructors

SMT 

Fields

runSMT :: forall b. SMTBackend b m => b -> m (a, b)
 

type SMT = SMT' IO Source

smtBackend :: Monad m => (forall b. SMTBackend b m => b -> m (res, b)) -> SMT' m res Source

data Untyped Source

Constructors

forall t . SMTType t => Untyped t 

data SMTExpr t where Source

An abstract SMT expression

Constructors

Var :: SMTType t => Integer -> SMTAnnotation t -> SMTExpr t 
QVar :: SMTType t => Integer -> Integer -> SMTAnnotation t -> SMTExpr t 
FunArg :: SMTType t => Integer -> SMTAnnotation t -> SMTExpr t 
Const :: SMTValue t => t -> SMTAnnotation t -> SMTExpr t 
AsArray :: (Args arg, SMTType res) => SMTFunction arg res -> ArgAnnotation arg -> SMTExpr (SMTArray arg res) 
Forall :: Integer -> [ProxyArg] -> SMTExpr Bool -> SMTExpr Bool 
Exists :: Integer -> [ProxyArg] -> SMTExpr Bool -> SMTExpr Bool 
Let :: Integer -> [SMTExpr Untyped] -> SMTExpr b -> SMTExpr b 
App :: (Args arg, SMTType res) => SMTFunction arg res -> arg -> SMTExpr res 
Named :: SMTExpr a -> Integer -> SMTExpr a 
InternalObj :: (SMTType t, Typeable a, Ord a, Show a) => a -> SMTAnnotation t -> SMTExpr t 
UntypedExpr :: SMTType t => SMTExpr t -> SMTExpr Untyped 
UntypedExprValue :: SMTValue t => SMTExpr t -> SMTExpr UntypedValue 

Instances

data SMTFunction arg res where Source

Constructors

SMTEq :: SMTType a => SMTFunction [SMTExpr a] Bool 
SMTMap :: (Liftable arg, SMTType res, Args i) => SMTFunction arg res -> SMTFunction (Lifted arg i) (SMTArray i res) 
SMTFun :: (Args arg, SMTType res) => Integer -> SMTAnnotation res -> SMTFunction arg res 
SMTBuiltIn :: (Liftable arg, SMTType res) => String -> SMTAnnotation res -> SMTFunction arg res 
SMTOrd :: SMTArith a => SMTOrdOp -> SMTFunction (SMTExpr a, SMTExpr a) Bool 
SMTArith :: SMTArith a => SMTArithOp -> SMTFunction [SMTExpr a] a 
SMTMinus :: SMTArith a => SMTFunction (SMTExpr a, SMTExpr a) a 
SMTIntArith :: SMTIntArithOp -> SMTFunction (SMTExpr Integer, SMTExpr Integer) Integer 
SMTDivide :: SMTFunction (SMTExpr Rational, SMTExpr Rational) Rational 
SMTNeg :: (SMTType a, Num a) => SMTFunction (SMTExpr a) a 
SMTAbs :: (SMTType a, Num a) => SMTFunction (SMTExpr a) a 
SMTNot :: SMTFunction (SMTExpr Bool) Bool 
SMTLogic :: SMTLogicOp -> SMTFunction [SMTExpr Bool] Bool 
SMTDistinct :: SMTType a => SMTFunction [SMTExpr a] Bool 
SMTToReal :: SMTFunction (SMTExpr Integer) Rational 
SMTToInt :: SMTFunction (SMTExpr Rational) Integer 
SMTITE :: SMTType a => SMTFunction (SMTExpr Bool, SMTExpr a, SMTExpr a) a 
SMTBVComp :: IsBitVector a => SMTBVCompOp -> SMTFunction (SMTExpr (BitVector a), SMTExpr (BitVector a)) Bool 
SMTBVBin :: IsBitVector a => SMTBVBinOp -> SMTFunction (SMTExpr (BitVector a), SMTExpr (BitVector a)) (BitVector a) 
SMTBVUn :: IsBitVector a => SMTBVUnOp -> SMTFunction (SMTExpr (BitVector a)) (BitVector a) 
SMTSelect :: (Liftable i, SMTType v) => SMTFunction (SMTExpr (SMTArray i v), i) v 
SMTStore :: (Liftable i, SMTType v) => SMTFunction (SMTExpr (SMTArray i v), i, SMTExpr v) (SMTArray i v) 
SMTConstArray :: (Args i, SMTType v) => ArgAnnotation i -> SMTFunction (SMTExpr v) (SMTArray i v) 
SMTConcat :: Concatable a b => SMTFunction (SMTExpr (BitVector a), SMTExpr (BitVector b)) (BitVector (ConcatResult a b)) 
SMTExtract :: (TypeableNat start, TypeableNat len, Extractable from len') => Proxy start -> Proxy len -> SMTFunction (SMTExpr (BitVector from)) (BitVector len') 
SMTConstructor :: (Args arg, SMTType dt) => Constructor arg dt -> SMTFunction arg dt 
SMTConTest :: (Args arg, SMTType dt) => Constructor arg dt -> SMTFunction (SMTExpr dt) Bool 
SMTFieldSel :: (SMTType a, SMTType f) => Field a f -> SMTFunction (SMTExpr a) f 
SMTDivisible :: Integer -> SMTFunction (SMTExpr Integer) Bool 

Instances

Show (SMTFunction arg res) Source 

data Constructor arg res Source

Represents a constructor of a datatype a Can be obtained by using the template haskell extension module

Instances

Show (Constructor arg res) Source 

data Field a f Source

Represents a field of the datatype a of the type f

Instances

Show (Field a f) Source 

newtype ClauseId Source

Identifies a clause in an unsatisfiable core

Constructors

ClauseId Integer 

data SMTOption Source

Options controling the behaviour of the SMT solver

Constructors

PrintSuccess Bool

Whether or not to print "success" after each operation

ProduceModels Bool

Produce a satisfying assignment after each successful checkSat

ProduceProofs Bool

Produce a proof of unsatisfiability after each failed checkSat

ProduceUnsatCores Bool

Enable the querying of unsatisfiable cores after a failed checkSat

ProduceInterpolants Bool

Enable the generation of craig interpolants

class (Ord a, Typeable a, Show a, Ord (ArgAnnotation a), Typeable (ArgAnnotation a), Show (ArgAnnotation a)) => Args a where Source

Instances of this class may be used as arguments for constructed functions and quantifiers.

Associated Types

type ArgAnnotation a Source

Methods

foldExprs :: Monad m => (forall t. SMTType t => s -> SMTExpr t -> SMTAnnotation t -> m (s, SMTExpr t)) -> s -> a -> ArgAnnotation a -> m (s, a) Source

foldsExprs :: Monad m => (forall t. SMTType t => s -> [(SMTExpr t, b)] -> SMTAnnotation t -> m (s, [SMTExpr t], SMTExpr t)) -> s -> [(a, b)] -> ArgAnnotation a -> m (s, [a], a) Source

extractArgAnnotation :: a -> ArgAnnotation a Source

toArgs :: ArgAnnotation a -> [SMTExpr Untyped] -> Maybe (a, [SMTExpr Untyped]) Source

fromArgs :: a -> [SMTExpr Untyped] Source

getTypes :: a -> ArgAnnotation a -> [ProxyArg] Source

getArgAnnotation :: a -> [Sort] -> (ArgAnnotation a, [Sort]) Source

Instances

getSorts :: Args a => a -> ArgAnnotation a -> [Sort] Source

foldExprsId :: Args a => (forall t. SMTType t => s -> SMTExpr t -> SMTAnnotation t -> (s, SMTExpr t)) -> s -> a -> ArgAnnotation a -> (s, a) Source

foldsExprsId :: Args a => (forall t. SMTType t => s -> [(SMTExpr t, b)] -> SMTAnnotation t -> (s, [SMTExpr t], SMTExpr t)) -> s -> [(a, b)] -> ArgAnnotation a -> (s, [a], a) Source

class Args a => Liftable a where Source

Associated Types

type Lifted a i Source

argSorts :: Args a => a -> ArgAnnotation a -> [Sort] Source

unpackArgs :: Args a => (forall t. SMTType t => SMTExpr t -> SMTAnnotation t -> s -> (c, s)) -> a -> ArgAnnotation a -> s -> ([c], s) Source

class Args a => LiftArgs a where Source

An extension of the Args class: Instances of this class can be represented as native haskell data types.

Associated Types

type Unpacked a Source

Methods

liftArgs :: Unpacked a -> ArgAnnotation a -> a Source

Converts a haskell value into its SMT representation.

unliftArgs :: Monad m => a -> (forall t. SMTValue t => SMTExpr t -> m t) -> m (Unpacked a) Source

Converts a SMT representation back into a haskell value.

getFunUndef :: SMTFunction arg res -> (arg, res) Source

getArrayUndef :: Args i => SMTExpr (SMTArray i v) -> (i, Unpacked i, v) Source

withSMTBackend :: SMTBackend a m => a -> SMT' m b -> m b Source

withSMTBackend' :: SMTBackend a m => a -> Bool -> SMT' m b -> m b Source

declareType :: (Monad m, SMTType t) => t -> SMTAnnotation t -> SMT' m () Source

data ProxyArg Source

Constructors

forall t . SMTType t => ProxyArg t (SMTAnnotation t) 

withProxyArg :: ProxyArg -> (forall t. SMTType t => t -> SMTAnnotation t -> a) -> a Source

withProxyArgValue :: ProxyArgValue -> (forall t. SMTValue t => t -> SMTAnnotation t -> a) -> a Source

data AnyValue Source

Constructors

forall t . SMTType t => AnyValue [ProxyArg] t (SMTAnnotation t) 

withAnyValue :: AnyValue -> (forall t. SMTType t => [ProxyArg] -> t -> SMTAnnotation t -> a) -> a Source

data DataType Source

Constructors

DataType 

Fields

dataTypeName :: String
 
dataTypeConstructors :: [Constr]
 
dataTypeGetUndefined :: forall r. [ProxyArg] -> (forall t. SMTType t => t -> SMTAnnotation t -> r) -> r
 

data Constr Source

Constructors

Constr 

Fields

conName :: String
 
conFields :: [DataField]
 
construct :: forall r. [Maybe ProxyArg] -> [AnyValue] -> (forall t. SMTType t => [ProxyArg] -> t -> SMTAnnotation t -> r) -> r
 
conUndefinedArgs :: forall r. [ProxyArg] -> (forall arg. Args arg => arg -> ArgAnnotation arg -> r) -> r
 
conTest :: forall t. SMTType t => [ProxyArg] -> t -> Bool
 

data DataField Source

Constructors

DataField 

Fields

fieldName :: String
 
fieldSort :: ArgumentSort
 
fieldGet :: forall r t. SMTType t => [ProxyArg] -> t -> (forall f. SMTType f => f -> SMTAnnotation f -> r) -> r
 

getNewTypeCollections :: SMTType t => Proxy t -> SMTAnnotation t -> DataTypeInfo -> ([TypeCollection], DataTypeInfo) Source

Get all the type collections which are not yet declared from a type.

data Z Source

Constructors

Z 

Instances

TypeableNat Z Source 
type Add Z n = n Source 

data S a Source

Constructors

S 

Instances

TypeableNat n => TypeableNat (S n) Source 
type Add (S n1) n2 = S (Add n1 n2) Source 

type family Add n1 n2 Source

Instances

type Add Z n = n Source 
type Add (S n1) n2 = S (Add n1 n2) Source 

reifyNat :: (Num a, Ord a) => a -> (forall n. TypeableNat n => Proxy n -> r) -> r Source

reifySum :: (Num a, Ord a) => a -> a -> (forall n1 n2. (TypeableNat n1, TypeableNat n2, TypeableNat (Add n1 n2)) => Proxy n1 -> Proxy n2 -> Proxy (Add n1 n2) -> r) -> r Source

reifyExtract :: (Num a, Ord a) => a -> a -> a -> (forall n1 n2 n3 n4. (TypeableNat n1, TypeableNat n2, TypeableNat n3, TypeableNat n4, Add n4 n2 ~ S n3) => Proxy n1 -> Proxy n2 -> Proxy n3 -> Proxy n4 -> r) -> r Source

type N0 = Z Source

type N1 = S N0 Source

type N2 = S N1 Source

type N3 = S N2 Source

type N4 = S N3 Source

type N5 = S N4 Source

type N6 = S N5 Source

type N7 = S N6 Source

type N8 = S N7 Source

type N9 = S N8 Source

type N10 = S N9 Source

type N11 = S N10 Source

type N12 = S N11 Source

type N13 = S N12 Source

type N14 = S N13 Source

type N15 = S N14 Source

type N16 = S N15 Source

type N17 = S N16 Source

type N18 = S N17 Source

type N19 = S N18 Source

type N20 = S N19 Source

type N21 = S N20 Source

type N22 = S N21 Source

type N23 = S N22 Source

type N24 = S N23 Source

type N25 = S N24 Source

type N26 = S N25 Source

type N27 = S N26 Source

type N28 = S N27 Source

type N29 = S N28 Source

type N30 = S N29 Source

type N31 = S N30 Source

type N32 = S N31 Source

type N33 = S N32 Source

type N34 = S N33 Source

type N35 = S N34 Source

type N36 = S N35 Source

type N37 = S N36 Source

type N38 = S N37 Source

type N39 = S N38 Source

type N40 = S N39 Source

type N41 = S N40 Source

type N42 = S N41 Source

type N43 = S N42 Source

type N44 = S N43 Source

type N45 = S N44 Source

type N46 = S N45 Source

type N47 = S N46 Source

type N48 = S N47 Source

type N49 = S N48 Source

type N50 = S N49 Source

type N51 = S N50 Source

type N52 = S N51 Source

type N53 = S N52 Source

type N54 = S N53 Source

type N55 = S N54 Source

type N56 = S N55 Source

type N57 = S N56 Source

type N58 = S N57 Source

type N59 = S N58 Source

type N60 = S N59 Source

type N61 = S N60 Source

type N62 = S N61 Source

type N63 = S N62 Source

type N64 = S N63 Source

newtype Bound Source

Constructors

Bound Integer