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

Safe HaskellNone
LanguageHaskell98

Language.SMTLib2.Internals.Type

Synopsis

Documentation

data Type Source

Describes the kind of all SMT types. It is only used in promoted form, for a concrete representation see Repr.

Constructors

BoolType 
IntType 
RealType 
BitVecType Nat 
ArrayType [Type] Type 
forall a . DataType a 

Instances

GCompare Type NumRepr Source 
GCompare Type Repr Source 
GCompare Type ConcreteValue Source 
GCompare Type NoVar 
GEq Type NumRepr Source 
GEq Type Repr Source 
GEq Type ConcreteValue Source 
GEq Type NoVar 
GShow Type NumRepr Source 
GShow Type Repr Source 
GShow Type ConcreteValue Source 
GShow Type NoVar 
GCompare ((,) [Type] *) con => GCompare Type (Value con) Source 
Ord v => GCompare Type (UntypedVar v) 
GEq ((,) [Type] *) con => GEq Type (Value con) Source 
Eq v => GEq Type (UntypedVar v) 
GShow ((,) [Type] *) con => GShow Type (Value con) Source 
Show v => GShow Type (UntypedVar v) 
(GCompare Type v, GCompare Type e) => GCompare Type (LetBinding v e) 
(GEq Type v, GEq Type e) => GEq Type (LetBinding v e) 
(GCompare Type v, GCompare Type qv, GCompare ((,) [Type] Type) fun, GCompare ((,) [Type] *) con, GCompare ((,) * Type) field, GCompare Type fv, GCompare Type lv, GCompare Type e) => GCompare Type (Expression v qv fun con field fv lv e) 
(GEq Type v, GEq Type qv, GEq ((,) [Type] Type) fun, GEq ((,) [Type] *) con, GEq ((,) * Type) field, GEq Type fv, GEq Type lv, GEq Type e) => GEq Type (Expression v qv fun con field fv lv e) 
(GShow Type v, GShow Type qv, GShow ((,) [Type] Type) fun, GShow ((,) [Type] *) con, GShow ((,) * Type) field, GShow Type fv, GShow Type lv, GShow Type e) => GShow Type (Expression v qv fun con field fv lv e) 
HasMonad (m (List Type e tp)) Source 
GCompare ((,) [Type] *) NoCon 
GCompare ((,) [Type] Type) FunRepr Source 
GCompare ((,) [Type] Type) NoFun 
GCompare ((,) * Type) NoField 
GEq ((,) [Type] *) NoCon 
GEq ((,) [Type] Type) FunRepr Source 
GEq ((,) [Type] Type) NoFun 
GEq ((,) * Type) NoField 
GShow ((,) [[Type]] *) Datatype Source 
GShow ((,) [Type] *) NoCon 
GShow ((,) [Type] Type) NoFun 
GShow ((,) * Type) NoField 
Ord v => GCompare ((,) [Type] *) (UntypedCon v) 
Ord v => GCompare ((,) [Type] Type) (UntypedFun v) 
Ord v => GCompare ((,) * Type) (UntypedField v) 
Eq v => GEq ((,) [Type] *) (UntypedCon v) 
Eq v => GEq ((,) [Type] Type) (UntypedFun v) 
Eq v => GEq ((,) * Type) (UntypedField v) 
Show v => GShow ((,) [Type] *) (UntypedCon v) 
Show v => GShow ((,) [Type] Type) (UntypedFun v) 
Show v => GShow ((,) * Type) (UntypedField v) 
(GCompare ((,) [Type] Type) fun, GCompare ((,) [Type] *) con, GCompare ((,) * Type) field) => GCompare ((,) [Type] Type) (Function fun con field) 
(GEq ((,) [Type] Type) fun, GEq ((,) [Type] *) con, GEq ((,) * Type) field) => GEq ((,) [Type] Type) (Function fun con field) 
(GShow ((,) [Type] Type) fun, GShow ((,) [Type] *) con, GShow ((,) * Type) field) => GShow ((,) [Type] Type) (Function fun con field) 
HasMonad (List Type e tp) Source 
(Same ((:) Type tp tps), (~) Type tp (SameType ((:) Type tp tps))) => Same ((:) Type tp ((:) Type tp tps)) Source 
Same ((:) Type tp ([] Type)) Source 
Unlift ((:) Type t2 ts) idx => Unlift ((:) Type t1 ((:) Type t2 ts)) idx Source 
Unlift ((:) Type tp ([] Type)) idx Source 
type MonadResult (m (List Type e tp)) = List Type e tp Source 
type MatchMonad (m (List Type e tp)) m' = (~) (* -> *) m m' Source 
type MonadResult (List Type e tp) = List Type e tp Source 
type MatchMonad (List Type e tp) m = () Source 

type family Lifted tps idx :: [Type] Source

Equations

Lifted `[]` idx = `[]` 
Lifted (tp : tps) idx = ArrayType idx tp : Lifted tps idx 

class Unlift tps idx where Source

Methods

unliftType :: List Repr (Lifted tps idx) -> (List Repr tps, List Repr idx) Source

unliftTypeWith :: List Repr (Lifted tps idx) -> List Repr tps -> List Repr idx Source

Instances

Unlift ((:) Type t2 ts) idx => Unlift ((:) Type t1 ((:) Type t2 ts)) idx Source 
Unlift ((:) Type tp ([] Type)) idx Source 

type family Fst a :: p Source

Equations

Fst `(x, y)` = x 

type family Snd a :: q Source

Equations

Snd `(x, y)` = y 

class (Typeable t, Typeable (DatatypeSig t), Show t, Ord t) => IsDatatype t where Source

Associated Types

type DatatypeSig t :: [[Type]] Source

type TypeCollectionSig t :: [([[Type]], *)] Source

Methods

getDatatype :: e t -> Datatype `(DatatypeSig t, t)` Source

getTypeCollection :: e t -> TypeCollection (TypeCollectionSig t) Source

getConstructor :: t -> Constrs con (DatatypeSig t) t -> (forall arg. con `(arg, t)` -> List ConcreteValue arg -> a) -> a Source

data Datatype sig Source

Constructors

Datatype 

Fields

datatypeName :: String
 
constructors :: Constrs Constr (Fst sig) (Snd sig)
 

Instances

data Constr sig Source

Constructors

Constr 

Fields

conName :: String
 
conFields :: List (Field (Snd sig)) (Fst sig)
 
construct :: List ConcreteValue (Fst sig) -> Snd sig
 
conTest :: Snd sig -> Bool
 

data Field a t Source

Constructors

Field 

Fields

fieldName :: String
 
fieldType :: Repr t
 
fieldGet :: a -> ConcreteValue t
 

data Value con a where Source

Constructors

BoolValue :: Bool -> Value con BoolType 
IntValue :: Integer -> Value con IntType 
RealValue :: Rational -> Value con RealType 
BitVecValue :: Integer -> Natural n -> Value con (BitVecType n) 
ConstrValue :: (Typeable con, IsDatatype t) => con `(arg, t)` -> List (Value con) arg -> Value con (DataType t) 

Instances

GCompare ((,) [Type] *) con => GCompare Type (Value con) Source 
GEq ((,) [Type] *) con => GEq Type (Value con) Source 
GShow ((,) [Type] *) con => GShow Type (Value con) Source 
GetType (Value con) Source 
GEq ((,) [Type] *) con => Eq (Value con t) Source 
GShow ((,) [Type] *) con => Show (Value con tp) Source 

data AnyValue con Source

Constructors

forall t . AnyValue (Value con t) 

data Repr t where Source

A concrete representation of an SMT type. For aesthetic reasons, it's recommended to use the functions bool, int, real, bitvec or array.

Constructors

BoolRepr :: Repr BoolType 
IntRepr :: Repr IntType 
RealRepr :: Repr RealType 
BitVecRepr :: Natural n -> Repr (BitVecType n) 
ArrayRepr :: List Repr idx -> Repr val -> Repr (ArrayType idx val) 
DataRepr :: IsDatatype dt => Datatype `(DatatypeSig dt, dt)` -> Repr (DataType dt) 

data Constrs con a t where Source

Constructors

NoCon :: Constrs con `[]` t 
ConsCon :: con `(arg, dt)` -> Constrs con args dt -> Constrs con (arg : args) dt 

data Datatypes dts sigs where Source

Constructors

NoDts :: Datatypes dts `[]` 
ConsDts :: IsDatatype dt => dts `(DatatypeSig dt, dt)` -> Datatypes dts sigs -> Datatypes dts (`(DatatypeSig dt, dt)` : sigs) 

data FunRepr sig where Source

Constructors

FunRepr :: List Repr arg -> Repr tp -> FunRepr `(arg, tp)` 

class GetType v where Source

Methods

getType :: v tp -> Repr tp Source

Instances

GetType Repr Source 
GetType ConcreteValue Source 
GetType NoVar Source 
GetType (Value con) Source 
GetType (UntypedVar v) Source 
(GetType var, GetType qvar, GetFunType fun, GetConType con, GetFieldType field, GetType farg, GetType lvar) => GetType (SMTExpr var qvar fun con field farg lvar) Source 
(GetType v, GetType qv, GetFunType fun, GetConType con, GetFieldType field, GetType fv, GetType lv, GetType e) => GetType (Expression v qv fun con field fv lv e) Source 

class GetFunType fun where Source

Methods

getFunType :: fun `(arg, res)` -> (List Repr arg, Repr res) Source

class GetConType con where Source

Methods

getConType :: IsDatatype dt => con `(arg, dt)` -> (List Repr arg, Datatype `(DatatypeSig dt, dt)`) Source

class GetFieldType field where Source

Methods

getFieldType :: IsDatatype dt => field `(dt, tp)` -> (Datatype `(DatatypeSig dt, dt)`, Repr tp) Source

bool :: Repr BoolType Source

A representation of the SMT Bool type. Holds the values true or false.

array :: List Repr idx -> Repr el -> Repr (ArrayType idx el) Source

reifyType :: Type -> (forall tp. Repr tp -> a) -> a Source

Get a concrete representation for a type.

mapValue :: (Monad m, Typeable con2) => (forall arg dt. con1 `(arg, dt)` -> m (con2 `(arg, dt)`)) -> Value con1 a -> m (Value con2 a) Source

findConstrByName :: String -> Datatype `(cons, dt)` -> (forall arg. Constr `(arg, dt)` -> a) -> a Source

valueToConcrete :: Monad m => (forall arg tp. IsDatatype tp => con `(arg, tp)` -> List ConcreteValue arg -> m tp) -> Value con t -> m (ConcreteValue t) Source

valueFromConcrete :: (Monad m, Typeable con) => (forall tp a. IsDatatype tp => tp -> (forall arg. con `(arg, tp)` -> List ConcreteValue arg -> m a) -> m a) -> ConcreteValue t -> m (Value con t) Source

valueType :: Value con tp -> Repr tp Source

liftType :: List Repr tps -> List Repr idx -> List Repr (Lifted tps idx) Source

getTypes :: GetType e => List e tps -> List Repr tps Source