Safe Haskell | None |
---|---|
Language | Haskell98 |
Example usage: This program tries to find two numbers greater than zero which sum up to 5.
import Language.SMTLib2 import Language.SMTLib2.Pipe program :: Backend b => SMT b (Integer,Integer) program = do x <- declareVar int y <- declareVar int assert $ x .+. y .==. cint 5 assert $ x .>. cint 0 assert $ y .>. cint 0 checkSat IntValue vx <- getValue x IntValue vy <- getValue y return (vx,vy) main = withBackend (createPipe "z3" ["-smt2","-in"]) program >>= print
- data SMT b a
- class (Applicative m, GCompare (EmVar m e), GCompare (EmQVar m e), GCompare (EmFun m e), GCompare (EmFunArg m e), GCompare (EmLVar m e)) => Embed m e
- class (Typeable b, Functor (SMTMonad b), Monad (SMTMonad b), GetType (Expr b), GetType (Var b), GetType (QVar b), GetFunType (Fun b), GetType (FunArg b), GetType (LVar b), Typeable (Expr b), Typeable (Var b), Typeable (QVar b), Typeable (Fun b), Typeable (FunArg b), Typeable (LVar b), Typeable (ClauseId b), GCompare (Expr b), GShow (Expr b), GCompare (Var b), GShow (Var b), GCompare (QVar b), GShow (QVar b), GCompare (Fun b), GShow (Fun b), GCompare (FunArg b), GShow (FunArg b), GCompare (LVar b), GShow (LVar b), Ord (ClauseId b), Show (ClauseId b), Ord (Proof b), Show (Proof b), Show (Model b)) => Backend b where
- withBackend :: Backend b => SMTMonad b b -> SMT b a -> SMTMonad b a
- withBackendExitCleanly :: (Backend b, SMTMonad b ~ IO) => IO b -> SMT b a -> IO a
- setOption :: Backend b => SMTOption -> SMT b ()
- data SMTOption
- getInfo :: Backend b => SMTInfo i -> SMT b i
- data SMTInfo i where
- declareVar :: Backend b => Repr t -> SMT b (Expr b t)
- declareVarNamed :: Backend b => Repr t -> String -> SMT b (Expr b t)
- defineVar :: (Backend b, HasMonad expr, MatchMonad expr (SMT b), MonadResult expr ~ Expr b t) => expr -> SMT b (Expr b t)
- defineVarNamed :: (Backend b, HasMonad expr, MatchMonad expr (SMT b), MonadResult expr ~ Expr b t) => String -> expr -> SMT b (Expr b t)
- declareFun :: Backend b => List Repr args -> Repr res -> SMT b (Fun b '(args, res))
- declareFunNamed :: Backend b => List Repr args -> Repr res -> String -> SMT b (Fun b '(args, res))
- defineFun :: (Backend b, HasMonad def, MatchMonad def (SMT b), MonadResult def ~ Expr b res) => List Repr args -> (List (Expr b) args -> def) -> SMT b (Fun b '(args, res))
- defineFunNamed :: (Backend b, HasMonad def, MatchMonad def (SMT b), MonadResult def ~ Expr b res) => String -> List Repr args -> (List (Expr b) args -> def) -> SMT b (Fun b '(args, res))
- constant :: Embed m e => Value tp -> m (e tp)
- data Value a where
- pattern ConstBool :: forall rtp v qv fun fv lv e. () => (~) Type rtp BoolType => Bool -> Expression v qv fun fv lv e rtp
- cbool :: Embed m e => Bool -> m (e BoolType)
- true :: Embed m e => m (e BoolType)
- false :: Embed m e => m (e BoolType)
- pattern ConstInt :: forall rtp v qv fun fv lv e. () => (~) Type rtp IntType => Integer -> Expression v qv fun fv lv e rtp
- cint :: Embed m e => Integer -> m (e IntType)
- pattern ConstReal :: forall rtp v qv fun fv lv e. () => (~) Type rtp RealType => Rational -> Expression v qv fun fv lv e rtp
- creal :: Embed m e => Rational -> m (e RealType)
- data BitWidth bw
- bw :: KnownNat bw => Proxy bw -> BitWidth bw
- pattern ConstBV :: forall rtp v qv fun fv lv e. () => forall bw. (~) Type rtp (BitVecType bw) => Integer -> BitWidth bw -> Expression v qv fun fv lv e rtp
- cbv :: Embed m e => Integer -> BitWidth bw -> m (e (BitVecType bw))
- cbvUntyped :: (Embed m e, Monad m) => Integer -> Integer -> (forall bw. e (BitVecType bw) -> m b) -> m b
- cdt :: (Embed m e, IsDatatype t, Length par ~ Parameters t) => t par Value -> m (e (DataType t par))
- exists :: (Embed m e, Monad m) => List Repr tps -> (forall m e. (Embed m e, Monad m) => List e tps -> m (e BoolType)) -> m (e BoolType)
- forall :: (Embed m e, Monad m) => List Repr tps -> (forall m e. (Embed m e, Monad m) => List e tps -> m (e BoolType)) -> m (e BoolType)
- pattern Fun :: forall t t1 t2 t3 t4 t5 t6. () => forall arg arg1 res. (~#) ([Type], Type) ([Type], Type) ((,) [Type] Type arg t) ((,) [Type] Type arg1 res) => t5 ((,) [Type] Type arg1 res) -> List Type t6 arg -> Expression t4 t3 t5 t2 t1 t6 t
- app :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ List e args) => Function (EmFun m e) '(args, res) -> a -> m (e res)
- fun :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ List e args) => EmFun m e '(args, res) -> a -> m (e res)
- pattern EqLst :: forall e rtp v qv fun fv lv. GetType e => forall tp. (~) Type rtp BoolType => [e tp] -> Expression v qv fun fv lv e rtp
- pattern Eq :: forall e rtp v qv fun fv lv. GetType e => forall tps. ((~) Type rtp BoolType, Same tps) => List Type e tps -> Expression v qv fun fv lv e rtp
- pattern (:==:) :: forall e rtp v qv fun fv lv. GetType e => forall tp. (~) Type rtp BoolType => e tp -> e tp -> Expression v qv fun fv lv e rtp
- eq :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e tp) => [a] -> m (e BoolType)
- (.==.) :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp) => a -> b -> m (e BoolType)
- pattern DistinctLst :: forall e rtp v qv fun fv lv. GetType e => forall tp. (~) Type rtp BoolType => [e tp] -> Expression v qv fun fv lv e rtp
- pattern Distinct :: forall e rtp v qv fun fv lv. GetType e => forall tps. ((~) Type rtp BoolType, Same tps) => List Type e tps -> Expression v qv fun fv lv e rtp
- pattern (:/=:) :: forall e rtp v qv fun fv lv. GetType e => forall tp. (~) Type rtp BoolType => e tp -> e tp -> Expression v qv fun fv lv e rtp
- distinct :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e tp) => [a] -> m (e BoolType)
- (./=.) :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp) => a -> b -> m (e BoolType)
- map' :: (Embed m e, HasMonad arg, MatchMonad arg m, MonadResult arg ~ List e (Lifted tps idx), Unlift tps idx, GetType e, GetFunType (EmFun m e)) => Function (EmFun m e) '(tps, res) -> arg -> m (e (ArrayType idx res))
- pattern Ord :: forall rtp e v qv fun fv lv. () => forall tp. ((~) Type rtp BoolType, IsSMTNumber tp) => OrdOp -> e tp -> e tp -> Expression v qv fun fv lv e rtp
- pattern (:>=:) :: forall rtp e v qv fun fv lv. () => forall tp. ((~) Type rtp BoolType, IsSMTNumber tp) => e tp -> e tp -> Expression v qv fun fv lv e rtp
- pattern (:>:) :: forall rtp e v qv fun fv lv. () => forall tp. ((~) Type rtp BoolType, IsSMTNumber tp) => e tp -> e tp -> Expression v qv fun fv lv e rtp
- pattern (:<=:) :: forall rtp e v qv fun fv lv. () => forall tp. ((~) Type rtp BoolType, IsSMTNumber tp) => e tp -> e tp -> Expression v qv fun fv lv e rtp
- pattern (:<:) :: forall rtp e v qv fun fv lv. () => forall tp. ((~) Type rtp BoolType, IsSMTNumber tp) => e tp -> e tp -> Expression v qv fun fv lv e rtp
- ord :: (Embed m e, IsSMTNumber tp, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp) => OrdOp -> a -> b -> m (e BoolType)
- (.>=.) :: (Embed m e, IsSMTNumber tp, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp) => a -> b -> m (e BoolType)
- (.>.) :: (Embed m e, IsSMTNumber tp, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp) => a -> b -> m (e BoolType)
- (.<=.) :: (Embed m e, IsSMTNumber tp, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp) => a -> b -> m (e BoolType)
- (.<.) :: (Embed m e, IsSMTNumber tp, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp) => a -> b -> m (e BoolType)
- pattern ArithLst :: forall tp e v qv fun fv lv. () => IsSMTNumber tp => ArithOp -> [e tp] -> Expression v qv fun fv lv e tp
- pattern Arith :: forall tp e v qv fun fv lv. () => forall tps. (IsSMTNumber tp, Same tps, (~) Type tp (SameType tps)) => ArithOp -> List Type e tps -> Expression v qv fun fv lv e tp
- arith :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e tp, IsSMTNumber tp) => ArithOp -> [a] -> m (e tp)
- pattern PlusLst :: forall lv fv fun qv v tp e. () => IsSMTNumber tp => [e tp] -> Expression v qv fun fv lv e tp
- pattern Plus :: forall tp lv fv fun qv v e. () => forall tps. (IsSMTNumber tp, Same tps, (~) Type tp (SameType tps)) => List Type e tps -> Expression v qv fun fv lv e tp
- pattern (:+:) :: forall tp lv fv fun qv v e. () => forall tps x xs x1 xs1. (IsSMTNumber tp, Same tps, (~) Type tp (SameType tps), (~#) [Type] [Type] tps ((:) Type x xs), (~#) [Type] [Type] xs ((:) Type x1 xs1), (~#) [Type] [Type] xs1 ([] Type)) => e x -> e x1 -> Expression v qv fun fv lv e tp
- plus :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e tp, IsSMTNumber tp) => [a] -> m (e tp)
- (.+.) :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp, IsSMTNumber tp) => a -> b -> m (e tp)
- pattern MultLst :: forall lv fv fun qv v tp e. () => IsSMTNumber tp => [e tp] -> Expression v qv fun fv lv e tp
- pattern Mult :: forall tp lv fv fun qv v e. () => forall tps. (IsSMTNumber tp, Same tps, (~) Type tp (SameType tps)) => List Type e tps -> Expression v qv fun fv lv e tp
- pattern (:*:) :: forall tp lv fv fun qv v e. () => forall tps x xs x1 xs1. (IsSMTNumber tp, Same tps, (~) Type tp (SameType tps), (~#) [Type] [Type] tps ((:) Type x xs), (~#) [Type] [Type] xs ((:) Type x1 xs1), (~#) [Type] [Type] xs1 ([] Type)) => e x -> e x1 -> Expression v qv fun fv lv e tp
- mult :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e tp, IsSMTNumber tp) => [a] -> m (e tp)
- (.*.) :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp, IsSMTNumber tp) => a -> b -> m (e tp)
- pattern MinusLst :: forall lv fv fun qv v tp e. () => IsSMTNumber tp => [e tp] -> Expression v qv fun fv lv e tp
- pattern Minus :: forall tp lv fv fun qv v e. () => forall tps. (IsSMTNumber tp, Same tps, (~) Type tp (SameType tps)) => List Type e tps -> Expression v qv fun fv lv e tp
- pattern (:-:) :: forall tp lv fv fun qv v e. () => forall tps x xs x1 xs1. (IsSMTNumber tp, Same tps, (~) Type tp (SameType tps), (~#) [Type] [Type] tps ((:) Type x xs), (~#) [Type] [Type] xs ((:) Type x1 xs1), (~#) [Type] [Type] xs1 ([] Type)) => e x -> e x1 -> Expression v qv fun fv lv e tp
- pattern Neg :: forall tp lv fv fun qv v e. () => forall tps x xs. (IsSMTNumber tp, Same tps, (~) Type tp (SameType tps), (~#) [Type] [Type] tps ((:) Type x xs), (~#) [Type] [Type] xs ([] Type)) => e x -> Expression v qv fun fv lv e tp
- minus :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e tp, IsSMTNumber tp) => [a] -> m (e tp)
- (.-.) :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp, IsSMTNumber tp) => a -> b -> m (e tp)
- neg :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e tp, IsSMTNumber tp) => a -> m (e tp)
- pattern Div :: forall t t1 t2 t3 t4 t5 t6. () => forall arg x xs x1 xs1. ((~#) ([Type], Type) ([Type], Type) ((,) [Type] Type arg t) ((,) [Type] Type ((:) Type IntType ((:) Type IntType ([] Type))) IntType), (~#) [Type] [Type] arg ((:) Type x xs), (~#) [Type] [Type] xs ((:) Type x1 xs1), (~#) [Type] [Type] xs1 ([] Type)) => t6 x -> t6 x1 -> Expression t5 t4 t3 t2 t1 t6 t
- pattern Mod :: forall t t1 t2 t3 t4 t5 t6. () => forall arg x xs x1 xs1. ((~#) ([Type], Type) ([Type], Type) ((,) [Type] Type arg t) ((,) [Type] Type ((:) Type IntType ((:) Type IntType ([] Type))) IntType), (~#) [Type] [Type] arg ((:) Type x xs), (~#) [Type] [Type] xs ((:) Type x1 xs1), (~#) [Type] [Type] xs1 ([] Type)) => t6 x -> t6 x1 -> Expression t5 t4 t3 t2 t1 t6 t
- pattern Rem :: forall t t1 t2 t3 t4 t5 t6. () => forall arg x xs x1 xs1. ((~#) ([Type], Type) ([Type], Type) ((,) [Type] Type arg t) ((,) [Type] Type ((:) Type IntType ((:) Type IntType ([] Type))) IntType), (~#) [Type] [Type] arg ((:) Type x xs), (~#) [Type] [Type] xs ((:) Type x1 xs1), (~#) [Type] [Type] xs1 ([] Type)) => t6 x -> t6 x1 -> Expression t5 t4 t3 t2 t1 t6 t
- div' :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e IntType, MonadResult b ~ e IntType) => a -> b -> m (e IntType)
- mod' :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e IntType, MonadResult b ~ e IntType) => a -> b -> m (e IntType)
- rem' :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e IntType, MonadResult b ~ e IntType) => a -> b -> m (e IntType)
- pattern (:/:) :: forall t t1 t2 t3 t4 t5 t6. () => forall arg x xs x1 xs1. ((~#) ([Type], Type) ([Type], Type) ((,) [Type] Type arg t) ((,) [Type] Type ((:) Type RealType ((:) Type RealType ([] Type))) RealType), (~#) [Type] [Type] arg ((:) Type x xs), (~#) [Type] [Type] xs ((:) Type x1 xs1), (~#) [Type] [Type] xs1 ([] Type)) => t6 x -> t6 x1 -> Expression t5 t4 t3 t2 t1 t6 t
- (./.) :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e RealType, MonadResult b ~ e RealType) => a -> b -> m (e RealType)
- pattern Abs :: forall tp e v qv fun fv lv. () => IsSMTNumber tp => e tp -> Expression v qv fun fv lv e tp
- abs' :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e tp, IsSMTNumber tp) => a -> m (e tp)
- pattern Not :: forall t t1 t2 t3 t4 t5 t6. () => forall arg x xs. ((~#) ([Type], Type) ([Type], Type) ((,) [Type] Type arg t) ((,) [Type] Type ((:) Type BoolType ([] Type)) BoolType), (~#) [Type] [Type] arg ((:) Type x xs), (~#) [Type] [Type] xs ([] Type)) => t6 x -> Expression t5 t4 t3 t2 t1 t6 t
- not' :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e BoolType) => a -> m (e BoolType)
- pattern LogicLst :: forall rtp e v qv fun fv lv. () => (~) Type rtp BoolType => LogicOp -> [e BoolType] -> Expression v qv fun fv lv e rtp
- pattern Logic :: forall rtp e v qv fun fv lv. () => forall tps. ((~) Type rtp BoolType, Same tps, (~) Type (SameType tps) BoolType) => LogicOp -> List Type e tps -> Expression v qv fun fv lv e rtp
- logic :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e BoolType) => LogicOp -> [a] -> m (e BoolType)
- pattern AndLst :: forall rtp lv fv fun qv v e. () => (~) Type rtp BoolType => [e BoolType] -> Expression v qv fun fv lv e rtp
- pattern And :: forall rtp lv fv fun qv v e. () => forall tps. ((~) Type rtp BoolType, Same tps, (~) Type (SameType tps) BoolType) => List Type e tps -> Expression v qv fun fv lv e rtp
- pattern (:&:) :: forall rtp e v qv fun fv lv. () => (~) Type rtp BoolType => e BoolType -> e BoolType -> Expression v qv fun fv lv e rtp
- and' :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e BoolType) => [a] -> m (e BoolType)
- (.&.) :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e BoolType, MonadResult b ~ e BoolType) => a -> b -> m (e BoolType)
- pattern OrLst :: forall rtp lv fv fun qv v e. () => (~) Type rtp BoolType => [e BoolType] -> Expression v qv fun fv lv e rtp
- pattern Or :: forall rtp lv fv fun qv v e. () => forall tps. ((~) Type rtp BoolType, Same tps, (~) Type (SameType tps) BoolType) => List Type e tps -> Expression v qv fun fv lv e rtp
- pattern (:|:) :: forall rtp e v qv fun fv lv. () => (~) Type rtp BoolType => e BoolType -> e BoolType -> Expression v qv fun fv lv e rtp
- or' :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e BoolType) => [a] -> m (e BoolType)
- (.|.) :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e BoolType, MonadResult b ~ e BoolType) => a -> b -> m (e BoolType)
- pattern XOrLst :: forall rtp lv fv fun qv v e. () => (~) Type rtp BoolType => [e BoolType] -> Expression v qv fun fv lv e rtp
- pattern XOr :: forall rtp lv fv fun qv v e. () => forall tps. ((~) Type rtp BoolType, Same tps, (~) Type (SameType tps) BoolType) => List Type e tps -> Expression v qv fun fv lv e rtp
- xor' :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e BoolType) => [a] -> m (e BoolType)
- pattern ImpliesLst :: forall rtp lv fv fun qv v e. () => (~) Type rtp BoolType => [e BoolType] -> Expression v qv fun fv lv e rtp
- pattern Implies :: forall rtp lv fv fun qv v e. () => forall tps. ((~) Type rtp BoolType, Same tps, (~) Type (SameType tps) BoolType) => List Type e tps -> Expression v qv fun fv lv e rtp
- pattern (:=>:) :: forall rtp e v qv fun fv lv. () => (~) Type rtp BoolType => e BoolType -> e BoolType -> Expression v qv fun fv lv e rtp
- implies :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e BoolType) => [a] -> m (e BoolType)
- (.=>.) :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e BoolType, MonadResult b ~ e BoolType) => a -> b -> m (e BoolType)
- pattern ToReal :: forall t t1 t2 t3 t4 t5 t6. () => forall arg x xs. ((~#) ([Type], Type) ([Type], Type) ((,) [Type] Type arg t) ((,) [Type] Type ((:) Type IntType ([] Type)) RealType), (~#) [Type] [Type] arg ((:) Type x xs), (~#) [Type] [Type] xs ([] Type)) => t6 x -> Expression t5 t4 t3 t2 t1 t6 t
- pattern ToInt :: forall t t1 t2 t3 t4 t5 t6. () => forall arg x xs. ((~#) ([Type], Type) ([Type], Type) ((,) [Type] Type arg t) ((,) [Type] Type ((:) Type RealType ([] Type)) IntType), (~#) [Type] [Type] arg ((:) Type x xs), (~#) [Type] [Type] xs ([] Type)) => t6 x -> Expression t5 t4 t3 t2 t1 t6 t
- toReal :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e IntType) => a -> m (e RealType)
- toInt :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e RealType) => a -> m (e IntType)
- pattern ITE :: forall e tp v qv fun fv lv. GetType e => e BoolType -> e tp -> e tp -> Expression v qv fun fv lv e tp
- ite :: (Embed m e, HasMonad a, HasMonad b, HasMonad c, MatchMonad a m, MatchMonad b m, MatchMonad c m, MonadResult a ~ e BoolType, MonadResult b ~ e tp, MonadResult c ~ e tp) => a -> b -> c -> m (e tp)
- pattern BVComp :: forall e rtp v qv fun fv lv. GetType e => forall bw. (~) Type rtp BoolType => BVCompOp -> e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVULE :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp BoolType => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVULT :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp BoolType => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVUGE :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp BoolType => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVUGT :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp BoolType => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVSLE :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp BoolType => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVSLT :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp BoolType => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVSGE :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp BoolType => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVSGT :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp BoolType => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- bvcomp :: forall m e a b bw. (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => BVCompOp -> a -> b -> m (e BoolType)
- bvule :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e BoolType)
- bvult :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e BoolType)
- bvuge :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e BoolType)
- bvugt :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e BoolType)
- bvsle :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e BoolType)
- bvslt :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e BoolType)
- bvsge :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e BoolType)
- bvsgt :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e BoolType)
- pattern BVBin :: forall e rtp v qv fun fv lv. GetType e => forall bw. (~) Type rtp (BitVecType bw) => BVBinOp -> e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVAdd :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVSub :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVMul :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVURem :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVSRem :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVUDiv :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVSDiv :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVSHL :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVLSHR :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVASHR :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVXor :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVAnd :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVOr :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- bvbin :: forall m e a b bw. (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => BVBinOp -> a -> b -> m (e (BitVecType bw))
- bvadd :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw))
- bvsub :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw))
- bvmul :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw))
- bvurem :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw))
- bvsrem :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw))
- bvudiv :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw))
- bvsdiv :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw))
- bvshl :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw))
- bvlshr :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw))
- bvashr :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw))
- bvxor :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw))
- bvand :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw))
- bvor :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw))
- pattern BVUn :: forall e rtp v qv fun fv lv. GetType e => forall bw. (~) Type rtp (BitVecType bw) => BVUnOp -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVNot :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- pattern BVNeg :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- bvun :: forall m e a bw. (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e (BitVecType bw)) => BVUnOp -> a -> m (e (BitVecType bw))
- bvnot :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e (BitVecType bw)) => a -> m (e (BitVecType bw))
- bvneg :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e (BitVecType bw)) => a -> m (e (BitVecType bw))
- pattern Concat :: forall e rtp v qv fun fv lv. GetType e => forall n1 n2. (~) Type rtp (BitVecType ((+) n1 n2)) => e (BitVecType n1) -> e (BitVecType n2) -> Expression v qv fun fv lv e rtp
- pattern Extract :: forall e rtp v qv fun fv lv. GetType e => forall len start bw. (~) Type rtp (BitVecType len) => BitWidth start -> BitWidth len -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp
- concat' :: forall m e a b n1 n2. (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType n1), MonadResult b ~ e (BitVecType n2)) => a -> b -> m (e (BitVecType (n1 + n2)))
- extract' :: forall m e a bw start len. (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e (BitVecType bw), (start + len) <= bw) => BitWidth start -> BitWidth len -> a -> m (e (BitVecType len))
- extractChecked :: forall m e a bw start len. (Embed m e, HasMonad a, MatchMonad a m, KnownNat start, KnownNat len, MonadResult a ~ e (BitVecType bw)) => BitWidth start -> BitWidth len -> a -> m (e (BitVecType len))
- extractUntypedStart :: forall m e a bw len. (Embed m e, HasMonad a, MatchMonad a m, KnownNat len, MonadResult a ~ e (BitVecType bw)) => Integer -> BitWidth len -> a -> m (e (BitVecType len))
- extractUntyped :: forall m e a bw b. (Embed m e, Monad m, HasMonad a, MatchMonad a m, MonadResult a ~ e (BitVecType bw)) => Integer -> Integer -> a -> (forall len. e (BitVecType len) -> m b) -> m b
- pattern Select :: forall e rtp v qv fun fv lv. GetType e => forall val idx. (~) Type rtp val => e (ArrayType idx val) -> List Type e idx -> Expression v qv fun fv lv e rtp
- pattern Store :: forall e rtp v qv fun fv lv. GetType e => forall idx val. (~) Type rtp (ArrayType idx val) => e (ArrayType idx val) -> List Type e idx -> e val -> Expression v qv fun fv lv e rtp
- pattern ConstArray :: forall e rtp v qv fun fv lv. GetType e => forall idx val. (~) Type rtp (ArrayType idx val) => List Type Repr idx -> e val -> Expression v qv fun fv lv e rtp
- select :: (Embed m e, HasMonad arr, MatchMonad arr m, MonadResult arr ~ e (ArrayType idx el), HasMonad i, MatchMonad i m, MonadResult i ~ List e idx) => arr -> i -> m (e el)
- select1 :: (Embed m e, HasMonad arr, HasMonad idx, MatchMonad arr m, MatchMonad idx m, MonadResult arr ~ e (ArrayType '[idx'] el), MonadResult idx ~ e idx') => arr -> idx -> m (e el)
- store :: (Embed m e, HasMonad arr, MatchMonad arr m, MonadResult arr ~ e (ArrayType idx el), HasMonad i, MatchMonad i m, MonadResult i ~ List e idx, HasMonad nel, MatchMonad nel m, MonadResult nel ~ e el) => arr -> i -> nel -> m (e (ArrayType idx el))
- store1 :: (Embed m e, HasMonad arr, HasMonad idx, HasMonad el, MatchMonad arr m, MatchMonad idx m, MatchMonad el m, MonadResult arr ~ e (ArrayType '[idx'] el'), MonadResult idx ~ e idx', MonadResult el ~ e el') => arr -> idx -> el -> m (e (ArrayType '[idx'] el'))
- constArray :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e tp) => List Repr idx -> a -> m (e (ArrayType idx tp))
- pattern Mk :: forall t t1 t2 t3 t4 t5 t6. () => forall arg dt par sig. ((~#) ([Type], Type) ([Type], Type) ((,) [Type] Type arg t) ((,) [Type] Type (Instantiated sig par) (DataType ([Type] -> (Type -> *) -> *) dt par)), IsDatatype dt, (~) Nat (Length Type par) (Parameters dt)) => Datatype dt -> List Type Repr par -> Constr dt sig -> List Type t6 arg -> Expression t5 t4 t3 t2 t1 t6 t
- mk :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ List e (Instantiated sig par), IsDatatype dt, Length par ~ Parameters dt) => Datatype dt -> List Repr par -> Constr dt sig -> a -> m (e (DataType dt par))
- pattern Is :: forall e rtp v qv fun fv lv. GetType e => forall dt sig par. (~) Type rtp BoolType => Constr dt sig -> e (DataType ([Type] -> (Type -> *) -> *) dt par) -> Expression v qv fun fv lv e rtp
- is :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e (DataType dt par), IsDatatype dt) => a -> Constr dt sig -> m (e BoolType)
- (.#.) :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e (DataType dt par), IsDatatype dt) => a -> Field dt tp -> m (e (CType tp par))
- pattern Divisible :: forall rtp e v qv fun fv lv. () => (~) Type rtp BoolType => Integer -> e IntType -> Expression v qv fun fv lv e rtp
- divisible :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e IntType) => Integer -> a -> m (e BoolType)
- getExpr :: Backend b => Expr b tp -> SMT b (Expression (Var b) (QVar b) (Fun b) (FunArg b) (LVar b) (Expr b) tp)
- assert :: (Backend b, HasMonad expr, MatchMonad expr (SMT b), MonadResult expr ~ Expr b BoolType) => expr -> SMT b ()
- checkSat :: Backend b => SMT b CheckSatResult
- checkSatWith :: Backend b => Maybe Tactic -> CheckSatLimits -> SMT b CheckSatResult
- data CheckSatResult
- data CheckSatLimits = CheckSatLimits {}
- noLimits :: CheckSatLimits
- assertId :: (Backend b, HasMonad expr, MatchMonad expr (SMT b), MonadResult expr ~ Expr b BoolType) => expr -> SMT b (ClauseId b)
- getUnsatCore :: Backend b => SMT b [ClauseId b]
- assertPartition :: (Backend b, HasMonad expr, MatchMonad expr (SMT b), MonadResult expr ~ Expr b BoolType) => expr -> Partition -> SMT b ()
- data Partition
- getInterpolant :: Backend b => SMT b (Expr b BoolType)
- getProof :: Backend b => SMT b (Proof b)
- analyzeProof :: Backend b => Proof b -> SMT b (Proof String (Expr b) (Proof b))
- push :: Backend b => SMT b ()
- pop :: Backend b => SMT b ()
- stack :: Backend b => SMT b a -> SMT b a
- getValue :: (Backend b, HasMonad expr, MatchMonad expr (SMT b), MonadResult expr ~ Expr b t) => expr -> SMT b (Value t)
- getModel :: Backend b => SMT b (Model b)
- modelEvaluate :: (Backend b, HasMonad expr, MatchMonad expr (SMT b), MonadResult expr ~ Expr b t) => Model b -> expr -> SMT b (Value t)
- registerDatatype :: (Backend b, IsDatatype dt) => Datatype dt -> SMT b ()
- data Type
- data Repr t where
- BoolRepr :: Repr BoolType
- IntRepr :: Repr IntType
- RealRepr :: Repr RealType
- BitVecRepr :: BitWidth bw -> Repr (BitVecType bw)
- ArrayRepr :: List Repr idx -> Repr val -> Repr (ArrayType idx val)
- DataRepr :: (IsDatatype dt, Length par ~ Parameters dt) => Datatype dt -> List Repr par -> Repr (DataType dt par)
- ParameterRepr :: Natural p -> Repr (ParameterType p)
- class GetType v where
- bool :: Repr BoolType
- int :: Repr IntType
- real :: Repr RealType
- bitvec :: BitWidth bw -> Repr (BitVecType bw)
- array :: List Repr idx -> Repr el -> Repr (ArrayType idx el)
- dt :: (IsDatatype dt, Parameters dt ~ Z) => Datatype dt -> Repr (DataType dt '[])
- dt' :: (IsDatatype dt, Length par ~ Parameters dt) => Datatype dt -> List Repr par -> Repr (DataType dt par)
- data Nat
- data Natural n where
- nat :: (Num a, Ord a) => a -> ExpQ
- natT :: (Num a, Ord a) => a -> TypeQ
- reifyNat :: Nat -> (forall n. Natural n -> r) -> r
- data List e tp where
- reifyList :: (forall r'. a -> (forall tp. e tp -> r') -> r') -> [a] -> (forall tp. List e tp -> r) -> r
- (.:.) :: (HasMonad a, MonadResult a ~ e tp, MatchMonad a m, Applicative m) => a -> m (List e tps) -> m (List e (tp ': tps))
- nil :: Applicative m => m (List e '[])
- comment :: Backend b => String -> SMT b ()
- simplify :: Backend b => Expr b tp -> SMT b (Expr b tp)
SMT Monad
The SMT monad is used to perform communication with the SMT solver. The type of solver is given by the b parameter.
Backend b => Monad (SMT b) Source # | |
Backend b => Functor (SMT b) Source # | |
Backend b => Applicative (SMT b) Source # | |
(Backend b, MonadIO (SMTMonad b)) => MonadIO (SMT b) Source # | |
Backend b => MonadState (SMTState b) (SMT b) Source # | |
Backend b => Embed (SMT b) (Expr b) Source # | |
type EmVar (SMT b) (Expr b) Source # | |
type EmQVar (SMT b) (Expr b) Source # | |
type EmFun (SMT b) (Expr b) Source # | |
type EmFunArg (SMT b) (Expr b) Source # | |
type EmLVar (SMT b) (Expr b) Source # | |
class (Applicative m, GCompare (EmVar m e), GCompare (EmQVar m e), GCompare (EmFun m e), GCompare (EmFunArg m e), GCompare (EmLVar m e)) => Embed m e Source #
A class of Monad
s that can be used to form SMTLib expressions.
The default instance of this class is the SMT
monad, together with its
associated Expr
type. An interesting instance is the Identity
monad
with the Value
type, which allows evaluation of SMTLib expressions.
Embed Identity Repr Source # | |
Embed Identity Value Source # | |
Embed Identity (ValueExt Identity) Source # | |
(GCompare Type var, GetType var, GCompare Type qvar, GetType qvar, GCompare ([Type], Type) fun, GetFunType fun, GCompare Type farg, GetType farg, GCompare Type lvar, GetType lvar) => Embed Identity (SMTExpr var qvar fun farg lvar) Source # | |
Backend b => Embed (SMT b) (Expr b) Source # | |
(Embed m e, Monad m) => Embed (ExceptT err m) e Source # | |
class (Typeable b, Functor (SMTMonad b), Monad (SMTMonad b), GetType (Expr b), GetType (Var b), GetType (QVar b), GetFunType (Fun b), GetType (FunArg b), GetType (LVar b), Typeable (Expr b), Typeable (Var b), Typeable (QVar b), Typeable (Fun b), Typeable (FunArg b), Typeable (LVar b), Typeable (ClauseId b), GCompare (Expr b), GShow (Expr b), GCompare (Var b), GShow (Var b), GCompare (QVar b), GShow (QVar b), GCompare (Fun b), GShow (Fun b), GCompare (FunArg b), GShow (FunArg b), GCompare (LVar b), GShow (LVar b), Ord (ClauseId b), Show (ClauseId b), Ord (Proof b), Show (Proof b), Show (Model b)) => Backend b Source #
A backend represents a specific type of SMT solver.
:: Backend b | |
=> SMTMonad b b | An action that creates a fresh backend. |
-> SMT b a | The SMT action to perform. |
-> SMTMonad b a |
Execute an SMT action on a given backend.
withBackendExitCleanly :: (Backend b, SMTMonad b ~ IO) => IO b -> SMT b a -> IO a Source #
Like withBackend
but specialized to the IO
monad so exeptions can be
handled by gracefully exiting the solver.
Setting options
setOption :: Backend b => SMTOption -> SMT b () Source #
Set an option controlling the behaviour of the SMT solver. Many solvers require you to specify what kind of queries you'll ask them after the model is specified.
For example, when using interpolation, it is often required to do the following:
do setOption (ProduceInterpolants True) -- Declare model interp <- getInterpolant -- Use interpolant
Options controling the behaviour of the SMT solver
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 |
SMTLogic String |
Getting informations about the solver
getInfo :: Backend b => SMTInfo i -> SMT b i Source #
Query the solver for information about itself.
Example:
isZ3Solver :: Backend b => SMT b Bool isZ3Solver = do name <- getInfo SMTSolverName return $ name=="Z3"
Solver information query type. Used with getInfo
.
Expressions
Declaring variables
Create a fresh variable of a given type.
Example:
do -- Declare a single integer variable v <- declareVar int -- Use variable v
Create a fresh variable (like declareVar
), but also give it a name.
Note that the name is a hint to the SMT solver that it may ignore.
Example:
do -- Declare a single boolean variable called "x" x <- declareVarNamed bool "x" -- Use variable x
Defining variables
:: (Backend b, HasMonad expr, MatchMonad expr (SMT b), MonadResult expr ~ Expr b t) | |
=> expr | The definition expression |
-> SMT b (Expr b t) |
Create a new variable that is defined by a given expression.
Example:
do -- x is an integer x <- declareVar int -- y is defined to be x+5 y <- defineVar $ x .+. cint 5 -- Use x and y
:: (Backend b, HasMonad expr, MatchMonad expr (SMT b), MonadResult expr ~ Expr b t) | |
=> String | Name of the resulting variable |
-> expr | Definition of the variable |
-> SMT b (Expr b t) |
Create a new named variable that is defined by a given expression (like
defineVar
).
Declaring functions
:: Backend b | |
=> List Repr args | Function argument types |
-> Repr res | Function result type |
-> SMT b (Fun b '(args, res)) |
Create a new uninterpreted function by specifying its signature.
Example:
do -- Create a function from (int,bool) to int f <- declareFun (int ::: bool ::: Nil) int -- Use f
:: Backend b | |
=> List Repr args | Function argument types |
-> Repr res | Function result type |
-> String | Function name |
-> SMT b (Fun b '(args, res)) |
Create a new uninterpreted function by specifying its signature (like
declareFun
), but also give it a name.
Defining functions
:: (Backend b, HasMonad def, MatchMonad def (SMT b), MonadResult def ~ Expr b res) | |
=> List Repr args | Function argument types |
-> (List (Expr b) args -> def) | Function definition |
-> SMT b (Fun b '(args, res)) |
Create a new interpreted function with a definition. Given a signature and a (haskell) function from the arguments to the resulting expression.
Example:
do -- Create a function from (int,int) to int that calculates the maximum max <- defineFun (int ::: int ::: Nil) $ (x ::: y ::: Nil) -> ite (x .>. y) x y -- Use max function
defineFunNamed :: (Backend b, HasMonad def, MatchMonad def (SMT b), MonadResult def ~ Expr b res) => String -> List Repr args -> (List (Expr b) args -> def) -> SMT b (Fun b '(args, res)) Source #
Create a new interpreted function with a definition (like defineFun
) but
also give it a name.
Constants
constant :: Embed m e => Value tp -> m (e tp) Source #
Create a constant, for example an integer:
Example:
do x <- declareVar int -- x is greater than 5 assert $ x .>. constant (IntValue 5)
Values that can be used as constants in expressions.
BoolValue :: Bool -> Value BoolType | |
IntValue :: Integer -> Value IntType | |
RealValue :: Rational -> Value RealType | |
BitVecValue :: Integer -> BitWidth bw -> Value (BitVecType bw) | |
DataValue :: (IsDatatype dt, Length par ~ Parameters dt) => dt par Value -> Value (DataType dt par) |
Boolean constants
pattern ConstBool :: forall rtp v qv fun fv lv e. () => (~) Type rtp BoolType => Bool -> Expression v qv fun fv lv e rtp Source #
Integer constants
pattern ConstInt :: forall rtp v qv fun fv lv e. () => (~) Type rtp IntType => Integer -> Expression v qv fun fv lv e rtp Source #
Real constants
pattern ConstReal :: forall rtp v qv fun fv lv e. () => (~) Type rtp RealType => Rational -> Expression v qv fun fv lv e rtp Source #
creal :: Embed m e => Rational -> m (e RealType) Source #
Create a real constant expression.
Example:
import Data.Ratio x = creal (5 % 4)
Bitvector constants
pattern ConstBV :: forall rtp v qv fun fv lv e. () => forall bw. (~) Type rtp (BitVecType bw) => Integer -> BitWidth bw -> Expression v qv fun fv lv e rtp Source #
:: Embed m e | |
=> Integer | The value (negative values will be stored in two's-complement). |
-> BitWidth bw | The bitwidth of the bitvector value. |
-> m (e (BitVecType bw)) |
Create a constant bitvector expression.
:: (Embed m e, Monad m) | |
=> Integer | The value (negative values will be stored in two's-complement). |
-> Integer | The bitwidth (must be >= 0). |
-> (forall bw. e (BitVecType bw) -> m b) | |
-> m b |
Create an untyped constant bitvector expression.
Datatype constants
cdt :: (Embed m e, IsDatatype t, Length par ~ Parameters t) => t par Value -> m (e (DataType t par)) Source #
Quantification
exists :: (Embed m e, Monad m) => List Repr tps -> (forall m e. (Embed m e, Monad m) => List e tps -> m (e BoolType)) -> m (e BoolType) Source #
forall :: (Embed m e, Monad m) => List Repr tps -> (forall m e. (Embed m e, Monad m) => List e tps -> m (e BoolType)) -> m (e BoolType) Source #
Functions
pattern Fun :: forall t t1 t2 t3 t4 t5 t6. () => forall arg arg1 res. (~#) ([Type], Type) ([Type], Type) ((,) [Type] Type arg t) ((,) [Type] Type arg1 res) => t5 ((,) [Type] Type arg1 res) -> List Type t6 arg -> Expression t4 t3 t5 t2 t1 t6 t Source #
app :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ List e args) => Function (EmFun m e) '(args, res) -> a -> m (e res) Source #
Create an expression by applying a function to a list of arguments.
fun :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ List e args) => EmFun m e '(args, res) -> a -> m (e res) Source #
Equality
pattern EqLst :: forall e rtp v qv fun fv lv. GetType e => forall tp. (~) Type rtp BoolType => [e tp] -> Expression v qv fun fv lv e rtp Source #
pattern Eq :: forall e rtp v qv fun fv lv. GetType e => forall tps. ((~) Type rtp BoolType, Same tps) => List Type e tps -> Expression v qv fun fv lv e rtp Source #
pattern (:==:) :: forall e rtp v qv fun fv lv. GetType e => forall tp. (~) Type rtp BoolType => e tp -> e tp -> Expression v qv fun fv lv e rtp Source #
eq :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e tp) => [a] -> m (e BoolType) Source #
(.==.) :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp) => a -> b -> m (e BoolType) infix 4 Source #
pattern DistinctLst :: forall e rtp v qv fun fv lv. GetType e => forall tp. (~) Type rtp BoolType => [e tp] -> Expression v qv fun fv lv e rtp Source #
pattern Distinct :: forall e rtp v qv fun fv lv. GetType e => forall tps. ((~) Type rtp BoolType, Same tps) => List Type e tps -> Expression v qv fun fv lv e rtp Source #
pattern (:/=:) :: forall e rtp v qv fun fv lv. GetType e => forall tp. (~) Type rtp BoolType => e tp -> e tp -> Expression v qv fun fv lv e rtp Source #
distinct :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e tp) => [a] -> m (e BoolType) Source #
(./=.) :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp) => a -> b -> m (e BoolType) infix 4 Source #
Map
map' :: (Embed m e, HasMonad arg, MatchMonad arg m, MonadResult arg ~ List e (Lifted tps idx), Unlift tps idx, GetType e, GetFunType (EmFun m e)) => Function (EmFun m e) '(tps, res) -> arg -> m (e (ArrayType idx res)) Source #
Comparison
pattern Ord :: forall rtp e v qv fun fv lv. () => forall tp. ((~) Type rtp BoolType, IsSMTNumber tp) => OrdOp -> e tp -> e tp -> Expression v qv fun fv lv e rtp Source #
pattern (:>=:) :: forall rtp e v qv fun fv lv. () => forall tp. ((~) Type rtp BoolType, IsSMTNumber tp) => e tp -> e tp -> Expression v qv fun fv lv e rtp Source #
pattern (:>:) :: forall rtp e v qv fun fv lv. () => forall tp. ((~) Type rtp BoolType, IsSMTNumber tp) => e tp -> e tp -> Expression v qv fun fv lv e rtp Source #
pattern (:<=:) :: forall rtp e v qv fun fv lv. () => forall tp. ((~) Type rtp BoolType, IsSMTNumber tp) => e tp -> e tp -> Expression v qv fun fv lv e rtp Source #
pattern (:<:) :: forall rtp e v qv fun fv lv. () => forall tp. ((~) Type rtp BoolType, IsSMTNumber tp) => e tp -> e tp -> Expression v qv fun fv lv e rtp Source #
ord :: (Embed m e, IsSMTNumber tp, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp) => OrdOp -> a -> b -> m (e BoolType) Source #
(.>=.) :: (Embed m e, IsSMTNumber tp, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp) => a -> b -> m (e BoolType) infix 4 Source #
(.>.) :: (Embed m e, IsSMTNumber tp, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp) => a -> b -> m (e BoolType) infix 4 Source #
(.<=.) :: (Embed m e, IsSMTNumber tp, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp) => a -> b -> m (e BoolType) infix 4 Source #
(.<.) :: (Embed m e, IsSMTNumber tp, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp) => a -> b -> m (e BoolType) infix 4 Source #
Arithmetic
pattern ArithLst :: forall tp e v qv fun fv lv. () => IsSMTNumber tp => ArithOp -> [e tp] -> Expression v qv fun fv lv e tp Source #
pattern Arith :: forall tp e v qv fun fv lv. () => forall tps. (IsSMTNumber tp, Same tps, (~) Type tp (SameType tps)) => ArithOp -> List Type e tps -> Expression v qv fun fv lv e tp Source #
arith :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e tp, IsSMTNumber tp) => ArithOp -> [a] -> m (e tp) Source #
pattern PlusLst :: forall lv fv fun qv v tp e. () => IsSMTNumber tp => [e tp] -> Expression v qv fun fv lv e tp Source #
pattern Plus :: forall tp lv fv fun qv v e. () => forall tps. (IsSMTNumber tp, Same tps, (~) Type tp (SameType tps)) => List Type e tps -> Expression v qv fun fv lv e tp Source #
pattern (:+:) :: forall tp lv fv fun qv v e. () => forall tps x xs x1 xs1. (IsSMTNumber tp, Same tps, (~) Type tp (SameType tps), (~#) [Type] [Type] tps ((:) Type x xs), (~#) [Type] [Type] xs ((:) Type x1 xs1), (~#) [Type] [Type] xs1 ([] Type)) => e x -> e x1 -> Expression v qv fun fv lv e tp Source #
plus :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e tp, IsSMTNumber tp) => [a] -> m (e tp) Source #
(.+.) :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp, IsSMTNumber tp) => a -> b -> m (e tp) infixl 6 Source #
pattern MultLst :: forall lv fv fun qv v tp e. () => IsSMTNumber tp => [e tp] -> Expression v qv fun fv lv e tp Source #
pattern Mult :: forall tp lv fv fun qv v e. () => forall tps. (IsSMTNumber tp, Same tps, (~) Type tp (SameType tps)) => List Type e tps -> Expression v qv fun fv lv e tp Source #
pattern (:*:) :: forall tp lv fv fun qv v e. () => forall tps x xs x1 xs1. (IsSMTNumber tp, Same tps, (~) Type tp (SameType tps), (~#) [Type] [Type] tps ((:) Type x xs), (~#) [Type] [Type] xs ((:) Type x1 xs1), (~#) [Type] [Type] xs1 ([] Type)) => e x -> e x1 -> Expression v qv fun fv lv e tp Source #
mult :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e tp, IsSMTNumber tp) => [a] -> m (e tp) Source #
(.*.) :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp, IsSMTNumber tp) => a -> b -> m (e tp) infixl 7 Source #
pattern MinusLst :: forall lv fv fun qv v tp e. () => IsSMTNumber tp => [e tp] -> Expression v qv fun fv lv e tp Source #
pattern Minus :: forall tp lv fv fun qv v e. () => forall tps. (IsSMTNumber tp, Same tps, (~) Type tp (SameType tps)) => List Type e tps -> Expression v qv fun fv lv e tp Source #
pattern (:-:) :: forall tp lv fv fun qv v e. () => forall tps x xs x1 xs1. (IsSMTNumber tp, Same tps, (~) Type tp (SameType tps), (~#) [Type] [Type] tps ((:) Type x xs), (~#) [Type] [Type] xs ((:) Type x1 xs1), (~#) [Type] [Type] xs1 ([] Type)) => e x -> e x1 -> Expression v qv fun fv lv e tp Source #
pattern Neg :: forall tp lv fv fun qv v e. () => forall tps x xs. (IsSMTNumber tp, Same tps, (~) Type tp (SameType tps), (~#) [Type] [Type] tps ((:) Type x xs), (~#) [Type] [Type] xs ([] Type)) => e x -> Expression v qv fun fv lv e tp Source #
minus :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e tp, IsSMTNumber tp) => [a] -> m (e tp) Source #
(.-.) :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e tp, MonadResult b ~ e tp, IsSMTNumber tp) => a -> b -> m (e tp) infixl 6 Source #
neg :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e tp, IsSMTNumber tp) => a -> m (e tp) Source #
pattern Div :: forall t t1 t2 t3 t4 t5 t6. () => forall arg x xs x1 xs1. ((~#) ([Type], Type) ([Type], Type) ((,) [Type] Type arg t) ((,) [Type] Type ((:) Type IntType ((:) Type IntType ([] Type))) IntType), (~#) [Type] [Type] arg ((:) Type x xs), (~#) [Type] [Type] xs ((:) Type x1 xs1), (~#) [Type] [Type] xs1 ([] Type)) => t6 x -> t6 x1 -> Expression t5 t4 t3 t2 t1 t6 t Source #
pattern Mod :: forall t t1 t2 t3 t4 t5 t6. () => forall arg x xs x1 xs1. ((~#) ([Type], Type) ([Type], Type) ((,) [Type] Type arg t) ((,) [Type] Type ((:) Type IntType ((:) Type IntType ([] Type))) IntType), (~#) [Type] [Type] arg ((:) Type x xs), (~#) [Type] [Type] xs ((:) Type x1 xs1), (~#) [Type] [Type] xs1 ([] Type)) => t6 x -> t6 x1 -> Expression t5 t4 t3 t2 t1 t6 t Source #
pattern Rem :: forall t t1 t2 t3 t4 t5 t6. () => forall arg x xs x1 xs1. ((~#) ([Type], Type) ([Type], Type) ((,) [Type] Type arg t) ((,) [Type] Type ((:) Type IntType ((:) Type IntType ([] Type))) IntType), (~#) [Type] [Type] arg ((:) Type x xs), (~#) [Type] [Type] xs ((:) Type x1 xs1), (~#) [Type] [Type] xs1 ([] Type)) => t6 x -> t6 x1 -> Expression t5 t4 t3 t2 t1 t6 t Source #
div' :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e IntType, MonadResult b ~ e IntType) => a -> b -> m (e IntType) infixl 7 Source #
mod' :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e IntType, MonadResult b ~ e IntType) => a -> b -> m (e IntType) infixl 7 Source #
rem' :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e IntType, MonadResult b ~ e IntType) => a -> b -> m (e IntType) infixl 7 Source #
pattern (:/:) :: forall t t1 t2 t3 t4 t5 t6. () => forall arg x xs x1 xs1. ((~#) ([Type], Type) ([Type], Type) ((,) [Type] Type arg t) ((,) [Type] Type ((:) Type RealType ((:) Type RealType ([] Type))) RealType), (~#) [Type] [Type] arg ((:) Type x xs), (~#) [Type] [Type] xs ((:) Type x1 xs1), (~#) [Type] [Type] xs1 ([] Type)) => t6 x -> t6 x1 -> Expression t5 t4 t3 t2 t1 t6 t Source #
(./.) :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e RealType, MonadResult b ~ e RealType) => a -> b -> m (e RealType) infixl 7 Source #
pattern Abs :: forall tp e v qv fun fv lv. () => IsSMTNumber tp => e tp -> Expression v qv fun fv lv e tp Source #
abs' :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e tp, IsSMTNumber tp) => a -> m (e tp) Source #
Logic
pattern Not :: forall t t1 t2 t3 t4 t5 t6. () => forall arg x xs. ((~#) ([Type], Type) ([Type], Type) ((,) [Type] Type arg t) ((,) [Type] Type ((:) Type BoolType ([] Type)) BoolType), (~#) [Type] [Type] arg ((:) Type x xs), (~#) [Type] [Type] xs ([] Type)) => t6 x -> Expression t5 t4 t3 t2 t1 t6 t Source #
not' :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e BoolType) => a -> m (e BoolType) Source #
pattern LogicLst :: forall rtp e v qv fun fv lv. () => (~) Type rtp BoolType => LogicOp -> [e BoolType] -> Expression v qv fun fv lv e rtp Source #
pattern Logic :: forall rtp e v qv fun fv lv. () => forall tps. ((~) Type rtp BoolType, Same tps, (~) Type (SameType tps) BoolType) => LogicOp -> List Type e tps -> Expression v qv fun fv lv e rtp Source #
logic :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e BoolType) => LogicOp -> [a] -> m (e BoolType) Source #
pattern AndLst :: forall rtp lv fv fun qv v e. () => (~) Type rtp BoolType => [e BoolType] -> Expression v qv fun fv lv e rtp Source #
pattern And :: forall rtp lv fv fun qv v e. () => forall tps. ((~) Type rtp BoolType, Same tps, (~) Type (SameType tps) BoolType) => List Type e tps -> Expression v qv fun fv lv e rtp Source #
pattern (:&:) :: forall rtp e v qv fun fv lv. () => (~) Type rtp BoolType => e BoolType -> e BoolType -> Expression v qv fun fv lv e rtp Source #
and' :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e BoolType) => [a] -> m (e BoolType) Source #
(.&.) :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e BoolType, MonadResult b ~ e BoolType) => a -> b -> m (e BoolType) infixr 3 Source #
pattern OrLst :: forall rtp lv fv fun qv v e. () => (~) Type rtp BoolType => [e BoolType] -> Expression v qv fun fv lv e rtp Source #
pattern Or :: forall rtp lv fv fun qv v e. () => forall tps. ((~) Type rtp BoolType, Same tps, (~) Type (SameType tps) BoolType) => List Type e tps -> Expression v qv fun fv lv e rtp Source #
pattern (:|:) :: forall rtp e v qv fun fv lv. () => (~) Type rtp BoolType => e BoolType -> e BoolType -> Expression v qv fun fv lv e rtp Source #
or' :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e BoolType) => [a] -> m (e BoolType) Source #
(.|.) :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e BoolType, MonadResult b ~ e BoolType) => a -> b -> m (e BoolType) infixr 2 Source #
pattern XOrLst :: forall rtp lv fv fun qv v e. () => (~) Type rtp BoolType => [e BoolType] -> Expression v qv fun fv lv e rtp Source #
pattern XOr :: forall rtp lv fv fun qv v e. () => forall tps. ((~) Type rtp BoolType, Same tps, (~) Type (SameType tps) BoolType) => List Type e tps -> Expression v qv fun fv lv e rtp Source #
xor' :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e BoolType) => [a] -> m (e BoolType) Source #
pattern ImpliesLst :: forall rtp lv fv fun qv v e. () => (~) Type rtp BoolType => [e BoolType] -> Expression v qv fun fv lv e rtp Source #
pattern Implies :: forall rtp lv fv fun qv v e. () => forall tps. ((~) Type rtp BoolType, Same tps, (~) Type (SameType tps) BoolType) => List Type e tps -> Expression v qv fun fv lv e rtp Source #
pattern (:=>:) :: forall rtp e v qv fun fv lv. () => (~) Type rtp BoolType => e BoolType -> e BoolType -> Expression v qv fun fv lv e rtp Source #
implies :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e BoolType) => [a] -> m (e BoolType) Source #
(.=>.) :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e BoolType, MonadResult b ~ e BoolType) => a -> b -> m (e BoolType) infixr 2 Source #
Conversion
pattern ToReal :: forall t t1 t2 t3 t4 t5 t6. () => forall arg x xs. ((~#) ([Type], Type) ([Type], Type) ((,) [Type] Type arg t) ((,) [Type] Type ((:) Type IntType ([] Type)) RealType), (~#) [Type] [Type] arg ((:) Type x xs), (~#) [Type] [Type] xs ([] Type)) => t6 x -> Expression t5 t4 t3 t2 t1 t6 t Source #
pattern ToInt :: forall t t1 t2 t3 t4 t5 t6. () => forall arg x xs. ((~#) ([Type], Type) ([Type], Type) ((,) [Type] Type arg t) ((,) [Type] Type ((:) Type RealType ([] Type)) IntType), (~#) [Type] [Type] arg ((:) Type x xs), (~#) [Type] [Type] xs ([] Type)) => t6 x -> Expression t5 t4 t3 t2 t1 t6 t Source #
toReal :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e IntType) => a -> m (e RealType) Source #
toInt :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e RealType) => a -> m (e IntType) Source #
If-then-else
pattern ITE :: forall e tp v qv fun fv lv. GetType e => e BoolType -> e tp -> e tp -> Expression v qv fun fv lv e tp Source #
ite :: (Embed m e, HasMonad a, HasMonad b, HasMonad c, MatchMonad a m, MatchMonad b m, MatchMonad c m, MonadResult a ~ e BoolType, MonadResult b ~ e tp, MonadResult c ~ e tp) => a -> b -> c -> m (e tp) Source #
Bitvectors
pattern BVComp :: forall e rtp v qv fun fv lv. GetType e => forall bw. (~) Type rtp BoolType => BVCompOp -> e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVULE :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp BoolType => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVULT :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp BoolType => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVUGE :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp BoolType => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVUGT :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp BoolType => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVSLE :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp BoolType => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVSLT :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp BoolType => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVSGE :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp BoolType => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVSGT :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp BoolType => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
bvcomp :: forall m e a b bw. (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => BVCompOp -> a -> b -> m (e BoolType) Source #
bvule :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e BoolType) Source #
bvult :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e BoolType) Source #
bvuge :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e BoolType) Source #
bvugt :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e BoolType) Source #
bvsle :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e BoolType) Source #
bvslt :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e BoolType) Source #
bvsge :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e BoolType) Source #
bvsgt :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e BoolType) Source #
pattern BVBin :: forall e rtp v qv fun fv lv. GetType e => forall bw. (~) Type rtp (BitVecType bw) => BVBinOp -> e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVAdd :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVSub :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVMul :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVURem :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVSRem :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVUDiv :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVSDiv :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVSHL :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVLSHR :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVASHR :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVXor :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVAnd :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVOr :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
bvbin :: forall m e a b bw. (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => BVBinOp -> a -> b -> m (e (BitVecType bw)) Source #
bvadd :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw)) Source #
bvsub :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw)) Source #
bvmul :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw)) Source #
bvurem :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw)) Source #
bvsrem :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw)) Source #
bvudiv :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw)) Source #
bvsdiv :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw)) Source #
bvshl :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw)) Source #
bvlshr :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw)) Source #
bvashr :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw)) Source #
bvxor :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw)) Source #
bvand :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw)) Source #
bvor :: (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType bw), MonadResult b ~ e (BitVecType bw)) => a -> b -> m (e (BitVecType bw)) Source #
pattern BVUn :: forall e rtp v qv fun fv lv. GetType e => forall bw. (~) Type rtp (BitVecType bw) => BVUnOp -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVNot :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
pattern BVNeg :: forall rtp lv fv fun qv v e. GetType e => forall bw. (~) Type rtp (BitVecType bw) => e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
bvun :: forall m e a bw. (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e (BitVecType bw)) => BVUnOp -> a -> m (e (BitVecType bw)) Source #
bvnot :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e (BitVecType bw)) => a -> m (e (BitVecType bw)) Source #
bvneg :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e (BitVecType bw)) => a -> m (e (BitVecType bw)) Source #
pattern Concat :: forall e rtp v qv fun fv lv. GetType e => forall n1 n2. (~) Type rtp (BitVecType ((+) n1 n2)) => e (BitVecType n1) -> e (BitVecType n2) -> Expression v qv fun fv lv e rtp Source #
pattern Extract :: forall e rtp v qv fun fv lv. GetType e => forall len start bw. (~) Type rtp (BitVecType len) => BitWidth start -> BitWidth len -> e (BitVecType bw) -> Expression v qv fun fv lv e rtp Source #
concat' :: forall m e a b n1 n2. (Embed m e, HasMonad a, HasMonad b, MatchMonad a m, MatchMonad b m, MonadResult a ~ e (BitVecType n1), MonadResult b ~ e (BitVecType n2)) => a -> b -> m (e (BitVecType (n1 + n2))) Source #
extract' :: forall m e a bw start len. (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e (BitVecType bw), (start + len) <= bw) => BitWidth start -> BitWidth len -> a -> m (e (BitVecType len)) Source #
extractChecked :: forall m e a bw start len. (Embed m e, HasMonad a, MatchMonad a m, KnownNat start, KnownNat len, MonadResult a ~ e (BitVecType bw)) => BitWidth start -> BitWidth len -> a -> m (e (BitVecType len)) Source #
extractUntypedStart :: forall m e a bw len. (Embed m e, HasMonad a, MatchMonad a m, KnownNat len, MonadResult a ~ e (BitVecType bw)) => Integer -> BitWidth len -> a -> m (e (BitVecType len)) Source #
extractUntyped :: forall m e a bw b. (Embed m e, Monad m, HasMonad a, MatchMonad a m, MonadResult a ~ e (BitVecType bw)) => Integer -> Integer -> a -> (forall len. e (BitVecType len) -> m b) -> m b Source #
Arrays
pattern Select :: forall e rtp v qv fun fv lv. GetType e => forall val idx. (~) Type rtp val => e (ArrayType idx val) -> List Type e idx -> Expression v qv fun fv lv e rtp Source #
pattern Store :: forall e rtp v qv fun fv lv. GetType e => forall idx val. (~) Type rtp (ArrayType idx val) => e (ArrayType idx val) -> List Type e idx -> e val -> Expression v qv fun fv lv e rtp Source #
pattern ConstArray :: forall e rtp v qv fun fv lv. GetType e => forall idx val. (~) Type rtp (ArrayType idx val) => List Type Repr idx -> e val -> Expression v qv fun fv lv e rtp Source #
select :: (Embed m e, HasMonad arr, MatchMonad arr m, MonadResult arr ~ e (ArrayType idx el), HasMonad i, MatchMonad i m, MonadResult i ~ List e idx) => arr -> i -> m (e el) Source #
Access an array element. The following law holds:
select (store arr i e) i .==. e
select1 :: (Embed m e, HasMonad arr, HasMonad idx, MatchMonad arr m, MatchMonad idx m, MonadResult arr ~ e (ArrayType '[idx'] el), MonadResult idx ~ e idx') => arr -> idx -> m (e el) Source #
A specialized version of select
when the index is just a single element.
store :: (Embed m e, HasMonad arr, MatchMonad arr m, MonadResult arr ~ e (ArrayType idx el), HasMonad i, MatchMonad i m, MonadResult i ~ List e idx, HasMonad nel, MatchMonad nel m, MonadResult nel ~ e el) => arr -> i -> nel -> m (e (ArrayType idx el)) Source #
Write an element into an array and return the resulting array. The following laws hold (forall i/=j):
select (store arr i e) i .==. e select (store arr i e) j .==. select arr j
store1 :: (Embed m e, HasMonad arr, HasMonad idx, HasMonad el, MatchMonad arr m, MatchMonad idx m, MatchMonad el m, MonadResult arr ~ e (ArrayType '[idx'] el'), MonadResult idx ~ e idx', MonadResult el ~ e el') => arr -> idx -> el -> m (e (ArrayType '[idx'] el')) Source #
A specialized version of store
when the index is just a single element.
constArray :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e tp) => List Repr idx -> a -> m (e (ArrayType idx tp)) Source #
Create an array where every element is the same. The following holds:
select (constArray tp e) i .==. e
Datatypes
pattern Mk :: forall t t1 t2 t3 t4 t5 t6. () => forall arg dt par sig. ((~#) ([Type], Type) ([Type], Type) ((,) [Type] Type arg t) ((,) [Type] Type (Instantiated sig par) (DataType ([Type] -> (Type -> *) -> *) dt par)), IsDatatype dt, (~) Nat (Length Type par) (Parameters dt)) => Datatype dt -> List Type Repr par -> Constr dt sig -> List Type t6 arg -> Expression t5 t4 t3 t2 t1 t6 t Source #
mk :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ List e (Instantiated sig par), IsDatatype dt, Length par ~ Parameters dt) => Datatype dt -> List Repr par -> Constr dt sig -> a -> m (e (DataType dt par)) Source #
pattern Is :: forall e rtp v qv fun fv lv. GetType e => forall dt sig par. (~) Type rtp BoolType => Constr dt sig -> e (DataType ([Type] -> (Type -> *) -> *) dt par) -> Expression v qv fun fv lv e rtp Source #
is :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e (DataType dt par), IsDatatype dt) => a -> Constr dt sig -> m (e BoolType) Source #
(.#.) :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e (DataType dt par), IsDatatype dt) => a -> Field dt tp -> m (e (CType tp par)) Source #
Misc
pattern Divisible :: forall rtp e v qv fun fv lv. () => (~) Type rtp BoolType => Integer -> e IntType -> Expression v qv fun fv lv e rtp Source #
divisible :: (Embed m e, HasMonad a, MatchMonad a m, MonadResult a ~ e IntType) => Integer -> a -> m (e BoolType) Source #
Analyzation
getExpr :: Backend b => Expr b tp -> SMT b (Expression (Var b) (QVar b) (Fun b) (FunArg b) (LVar b) (Expr b) tp) Source #
Convert an expression in the SMT solver-specific format into a more general, pattern-matchable format.
Example:
isGE :: Backend b => Expr b tp -> SMT b Bool isGE e = do e' <- getExpr e case e' of _ :>=: _ -> return True _ -> return False
Satisfiability
assert :: (Backend b, HasMonad expr, MatchMonad expr (SMT b), MonadResult expr ~ Expr b BoolType) => expr -> SMT b () Source #
Asserts a boolean expression to be true.
A successive successful checkSat
calls mean that the generated model is consistent with the assertion.
checkSat :: Backend b => SMT b CheckSatResult Source #
Checks if the set of asserted expressions is satisfiable.
checkSatWith :: Backend b => Maybe Tactic -> CheckSatLimits -> SMT b CheckSatResult Source #
data CheckSatResult Source #
The result of a check-sat query
data CheckSatLimits Source #
Describe limits on the ressources that an SMT-solver can use
Unsatisfiable core
assertId :: (Backend b, HasMonad expr, MatchMonad expr (SMT b), MonadResult expr ~ Expr b BoolType) => expr -> SMT b (ClauseId b) Source #
Works like assert
, but additionally allows the user to find the
unsatisfiable core of a set of assignments using getUnsatCore
.
getUnsatCore :: Backend b => SMT b [ClauseId b] Source #
After a checkSat
query that returned Unsat
, we can ask the SMT solver
for a subset of the assertions that are enough to make the specified
problem unsatisfiable. These assertions have to be created using
assertId
.
Example:
do setOption (ProduceUnsatCores True) x <- declareVar int y <- declareVar int cl1 <- assertId $ x .>. y cl2 <- assertId $ x .>. cint 5 cl3 <- assertId $ y .>. x checkSat core <- getUnsatCore -- core will contain cl1 and cl3
Interpolation
assertPartition :: (Backend b, HasMonad expr, MatchMonad expr (SMT b), MonadResult expr ~ Expr b BoolType) => expr -> Partition -> SMT b () Source #
When using interpolation, use this function to specify if an assertion is part of the A-partition or the B-partition of the original formula.
The interpolation partition
getInterpolant :: Backend b => SMT b (Expr b BoolType) Source #
After a checkSat
query that returned Unsat
, we can ask the SMT solver
for a formula C such that A (the A-partition) and (not C) is
unsatisfiable while B (the B-partition) and C is unsatisfiable.
Furthermore, C will only mention variables that occur in both A and
B.
Example:
do setOption (ProduceInterpolants True) p <- declareVar bool q <- declareVar bool r <- declareVar bool t <- declareVar bool assertPartition ((not' (p .&. q)) .=>. ((not' r) .&. q)) PartitionA assertPartition t PartitionB assertPartition r PartitionB assertPartition (not' p) PartitionB checkSat getInterpolant
Proofs
getProof :: Backend b => SMT b (Proof b) Source #
After a checkSat
query that returned Unsat
, we can ask the solver for
a proof that the given instance is indeed unsatisfiable.
analyzeProof :: Backend b => Proof b -> SMT b (Proof String (Expr b) (Proof b)) Source #
Convert the solver-specific proof encoding into a more general, pattern-matchable format.
Stack
push :: Backend b => SMT b () Source #
Push a fresh frame on the solver stack.
All variable definitions and assertions made in a frame are forgotten when
it is pop
'ed.
stack :: Backend b => SMT b a -> SMT b a Source #
Perform an SMT action by executing it in a fresh stack frame. The frame is
pop
'ed once the action has been performed.
Models
getValue :: (Backend b, HasMonad expr, MatchMonad expr (SMT b), MonadResult expr ~ Expr b t) => expr -> SMT b (Value t) Source #
After a successful checkSat
query, query the concrete value for a given
expression that the SMT solver assigned to it.
getModel :: Backend b => SMT b (Model b) Source #
After a successful checkSat
query, return a satisfying assignment that makes all asserted formula true.
modelEvaluate :: (Backend b, HasMonad expr, MatchMonad expr (SMT b), MonadResult expr ~ Expr b t) => Model b -> expr -> SMT b (Value t) Source #
Evaluate an expression in a model, yielding a concrete value.
Types
registerDatatype :: (Backend b, IsDatatype dt) => Datatype dt -> SMT b () Source #
Describes the kind of all SMT types.
It is only used in promoted form, for a concrete representation see Repr
.
A concrete representation of an SMT type.
For aesthetic reasons, it's recommended to use the functions bool
, int
, real
, bitvec
or array
.
BoolRepr :: Repr BoolType | |
IntRepr :: Repr IntType | |
RealRepr :: Repr RealType | |
BitVecRepr :: BitWidth bw -> Repr (BitVecType bw) | |
ArrayRepr :: List Repr idx -> Repr val -> Repr (ArrayType idx val) | |
DataRepr :: (IsDatatype dt, Length par ~ Parameters dt) => Datatype dt -> List Repr par -> Repr (DataType dt par) | |
ParameterRepr :: Natural p -> Repr (ParameterType p) |
GetType Repr Source # | |
GCompare Type Repr Source # | |
GEq Type Repr Source # | |
GShow Type Repr Source # | |
Embed Identity Repr Source # | |
Eq (Repr tp) Source # | |
Ord (Repr tp) Source # | |
Show (Repr t) Source # | |
type EmVar Identity Repr Source # | |
type EmQVar Identity Repr Source # | |
type EmFun Identity Repr Source # | |
type EmFunArg Identity Repr Source # | |
type EmLVar Identity Repr Source # | |
class GetType v where Source #
GetType NumRepr Source # | |
GetType Repr Source # | |
GetType Value Source # | |
GetType NoVar Source # | |
GetFunType fun => GetType (EvalResult fun) Source # | |
GetType (UntypedVar v) Source # | |
GetType (ValueExt m) Source # | |
(GetType var, GetType qvar, GetFunType fun, GetType farg, GetType lvar) => GetType (SMTExpr var qvar fun farg lvar) Source # | |
(GetType v, GetType qv, GetFunType fun, GetType fv, GetType lv, GetType e) => GetType (Expression v qv fun fv lv e) Source # | |
A representation of the SMT Int type.
Holds the unbounded positive and negative integers.
Constants can be created using cint
.
real :: Repr RealType Source #
A representation of the SMT Real type.
Holds positive and negative reals x/y where x and y are integers.
Constants can be created using creal
.
:: BitWidth bw | The width of the bitvector |
-> Repr (BitVecType bw) |
A typed representation of the SMT BitVec type.
Holds bitvectors (a vector of booleans) of a certain bitwidth.
Constants can be created using cbv
.
array :: List Repr idx -> Repr el -> Repr (ArrayType idx el) Source #
A representation of the SMT Array type.
Has a list of index types and an element type.
Stores one value of the element type for each combination of the index types.
Constants can be created using constArray
.
dt :: (IsDatatype dt, Parameters dt ~ Z) => Datatype dt -> Repr (DataType dt '[]) Source #
A representation of a user-defined datatype without parameters.
dt' :: (IsDatatype dt, Length par ~ Parameters dt) => Datatype dt -> List Repr par -> Repr (DataType dt par) Source #
A representation of a user-defined datatype with parameters.
Numbers
Natural numbers on the type-level.
A concrete representation of the Nat
type.
natT :: (Num a, Ord a) => a -> TypeQ Source #
A template haskell function to create nicer looking number types.
Example:
>>>
$(nat 5) :: Natural $(natT 5)
5
reifyNat :: Nat -> (forall n. Natural n -> r) -> r Source #
Get a static representation for a dynamically created natural number.
Example:
>>>
reifyNat (S (S Z)) show
"2"
Lists
Strongly typed heterogenous lists.
A List e '[tp1,tp2,tp3] contains 3 elements of types e tp1, e tp2 and e tp3 respectively.
As an example, the following list contains two types:
>>>
int ::: bool ::: Nil :: List Repr '[IntType,BoolType]
[IntRepr,BoolRepr]
HasMonad (m (List Type e tp)) Source # | |
GCompare a e => GCompare [a] (List a e) Source # | |
GEq a e => GEq [a] (List a e) Source # | |
GShow a e => GShow [a] (List a e) Source # | |
GEq a e => Eq (List a e lst) Source # | |
GCompare a e => Ord (List a e lst) Source # | |
GShow a e => Show (List a e lst) Source # | |
HasMonad (List Type e tp) Source # | |
type MonadResult (m (List Type e tp)) Source # | |
type MatchMonad (m (List Type e tp)) m' Source # | |
type MonadResult (List Type e tp) Source # | |
type MatchMonad (List Type e tp) m Source # | |
reifyList :: (forall r'. a -> (forall tp. e tp -> r') -> r') -> [a] -> (forall tp. List e tp -> r) -> r Source #
Get a static representation of a dynamic list.
For example, to convert a list of strings into a list of types:
>>>
reifyList (\name f -> case name of { "int" -> f int ; "bool" -> f bool }) ["bool","int"] show
"[BoolRepr,IntRepr]"
(.:.) :: (HasMonad a, MonadResult a ~ e tp, MatchMonad a m, Applicative m) => a -> m (List e tps) -> m (List e (tp ': tps)) infixr 5 Source #
Create a typed list by appending an element to the front of another list.
nil :: Applicative m => m (List e '[]) Source #
Create an empty list.