Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data SMTSort
- newtype SMTVar (t :: SMTSort) = SMTVar {}
- varId :: forall t t. Iso (SMTVar t) (SMTVar t) Int Int
- type family HaskellType (t :: SMTSort) = (r :: Type) | r -> t where ...
- data Value (t :: SMTSort) where
- IntValue :: HaskellType IntSort -> Value IntSort
- RealValue :: HaskellType RealSort -> Value RealSort
- BoolValue :: HaskellType BoolSort -> Value BoolSort
- BvValue :: HaskellType (BvSort n) -> Value (BvSort n)
- ArrayValue :: (KnownSMTSort k, KnownSMTSort v, Ord (HaskellType k)) => HaskellType (ArraySort k v) -> Value (ArraySort k v)
- unwrapValue :: Value t -> HaskellType t
- wrapValue :: forall t. KnownSMTSort t => HaskellType t -> Value t
- data SSMTSort (t :: SMTSort) where
- class KnownSMTSort (t :: SMTSort) where
- sortSing' :: forall prxy t. KnownSMTSort t => prxy t -> SSMTSort t
- data SomeSMTSort cs f where
- SomeSMTSort :: forall cs f (t :: SMTSort). AllC cs t => f t -> SomeSMTSort cs f
- type SomeKnownSMTSort f = SomeSMTSort '[KnownSMTSort] f
- type family AllC cs k :: Constraint where ...
- data Expr (t :: SMTSort)
- equal :: (Eq (HaskellType t), KnownSMTSort t, Foldable f) => f (Expr t) -> Expr BoolSort
- distinct :: (Eq (HaskellType t), KnownSMTSort t, Foldable f) => f (Expr t) -> Expr BoolSort
- bvShL :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n) -> Expr (BvSort n)
- bvLShR :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n) -> Expr (BvSort n)
- bvConcat :: (KnownNat n, KnownNat m) => Expr (BvSort n) -> Expr (BvSort m) -> Expr (BvSort (n + m))
- bvRotL :: (KnownNat n, KnownNat i, KnownNat (Mod i n)) => Proxy i -> Expr (BvSort n) -> Expr (BvSort n)
- bvRotR :: (KnownNat n, KnownNat i, KnownNat (Mod i n)) => Proxy i -> Expr (BvSort n) -> Expr (BvSort n)
- for_all :: forall t. KnownSMTSort t => (Expr t -> Expr BoolSort) -> Expr BoolSort
- exists :: forall t. KnownSMTSort t => (Expr t -> Expr BoolSort) -> Expr BoolSort
- select :: (KnownSMTSort k, KnownSMTSort v, Ord (HaskellType k)) => Expr (ArraySort k v) -> Expr k -> Expr v
- store :: (KnownSMTSort k, KnownSMTSort v, Ord (HaskellType k)) => Expr (ArraySort k v) -> Expr k -> Expr v -> Expr (ArraySort k v)
Documentation
Sorts in SMTLib2 - used as promoted type (data-kind).
BoolSort | Sort of Bool |
IntSort | Sort of Int |
RealSort | Sort of Real |
BvSort Nat | Sort of BitVec with length n |
ArraySort SMTSort SMTSort | Sort of Array with indices k and values v |
Instances
newtype SMTVar (t :: SMTSort) Source #
An internal SMT variable with a phantom-type which holds an Int
as it's identifier.
type family HaskellType (t :: SMTSort) = (r :: Type) | r -> t where ... Source #
HaskellType IntSort = Integer | |
HaskellType RealSort = Double | |
HaskellType BoolSort = Bool | |
HaskellType (BvSort n) = Bitvec n | |
HaskellType (ArraySort k v) = ConstArray (HaskellType k) (HaskellType v) |
data Value (t :: SMTSort) where Source #
A wrapper for values of SMTSort
s.
IntValue :: HaskellType IntSort -> Value IntSort | |
RealValue :: HaskellType RealSort -> Value RealSort | |
BoolValue :: HaskellType BoolSort -> Value BoolSort | |
BvValue :: HaskellType (BvSort n) -> Value (BvSort n) | |
ArrayValue :: (KnownSMTSort k, KnownSMTSort v, Ord (HaskellType k)) => HaskellType (ArraySort k v) -> Value (ArraySort k v) |
unwrapValue :: Value t -> HaskellType t Source #
Unwrap a value from Value
.
wrapValue :: forall t. KnownSMTSort t => HaskellType t -> Value t Source #
Wrap a value into Value
.
data SSMTSort (t :: SMTSort) where Source #
Singleton for SMTSort
.
SIntSort :: SSMTSort IntSort | |
SRealSort :: SSMTSort RealSort | |
SBoolSort :: SSMTSort BoolSort | |
SBvSort :: KnownNat n => Proxy n -> SSMTSort (BvSort n) | |
SArraySort :: (KnownSMTSort k, KnownSMTSort v, Ord (HaskellType k)) => Proxy k -> Proxy v -> SSMTSort (ArraySort k v) |
Instances
GCompare SSMTSort Source # | |
GEq SSMTSort Source # | |
Show (SSMTSort t) Source # | |
Eq (SSMTSort t) Source # | |
Ord (SSMTSort t) Source # | |
Defined in Language.Hasmtlib.Internal.Expr | |
Render (SSMTSort t) Source # | |
class KnownSMTSort (t :: SMTSort) where Source #
Instances
KnownSMTSort 'BoolSort Source # | |
KnownSMTSort 'IntSort Source # | |
KnownSMTSort 'RealSort Source # | |
KnownNat n => KnownSMTSort ('BvSort n) Source # | |
(KnownSMTSort k, KnownSMTSort v, Ord (HaskellType k)) => KnownSMTSort ('ArraySort k v) Source # | |
sortSing' :: forall prxy t. KnownSMTSort t => prxy t -> SSMTSort t Source #
data SomeSMTSort cs f where Source #
An existential wrapper that hides some SMTSort
and a list of Constraint
s holding for it.
SomeSMTSort :: forall cs f (t :: SMTSort). AllC cs t => f t -> SomeSMTSort cs f |
type SomeKnownSMTSort f = SomeSMTSort '[KnownSMTSort] f Source #
An existential wrapper that hides some known SMTSort
.
type family AllC cs k :: Constraint where ... Source #
AllC ensures that a list of constraints is applied to a poly-kinded Type
k
AllC '[] k = () AllC (c ': cs) k = (c k, AllC cs k)
data Expr (t :: SMTSort) Source #
A SMT expression. For internal use only. For building expressions use the corresponding instances (Num, Boolean, ...).
Instances
equal :: (Eq (HaskellType t), KnownSMTSort t, Foldable f) => f (Expr t) -> Expr BoolSort Source #
Test multiple expressions on equality within in the SMT
-Problem.
distinct :: (Eq (HaskellType t), KnownSMTSort t, Foldable f) => f (Expr t) -> Expr BoolSort Source #
Test multiple expressions on distinctness within in the SMT
-Problem.
bvShL :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n) -> Expr (BvSort n) Source #
Bitvector shift left
bvLShR :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n) -> Expr (BvSort n) Source #
Bitvector logical shift right
bvConcat :: (KnownNat n, KnownNat m) => Expr (BvSort n) -> Expr (BvSort m) -> Expr (BvSort (n + m)) Source #
Concat two bitvectors
bvRotL :: (KnownNat n, KnownNat i, KnownNat (Mod i n)) => Proxy i -> Expr (BvSort n) -> Expr (BvSort n) Source #
Rotate bitvector left
bvRotR :: (KnownNat n, KnownNat i, KnownNat (Mod i n)) => Proxy i -> Expr (BvSort n) -> Expr (BvSort n) Source #
Rotate bitvector right
for_all :: forall t. KnownSMTSort t => (Expr t -> Expr BoolSort) -> Expr BoolSort Source #
A universal quantification for any specific SMTSort
.
If the type cannot be inferred, apply a type-annotation.
Nested quantifiers are also supported.
Usage:
assert $ for_all @IntSort $ x -> x + 0 === x && 0 + x === x
The lambdas x
is all-quantified here.
It will only be scoped for the lambdas body.
exists :: forall t. KnownSMTSort t => (Expr t -> Expr BoolSort) -> Expr BoolSort Source #
An existential quantification for any specific SMTSort
If the type cannot be inferred, apply a type-annotation.
Nested quantifiers are also supported.
Usage:
assert $ for_all @(BvSort 8) $ x -> exists $ y -> x - y === 0
The lambdas y
is existentially quantified here.
It will only be scoped for the lambdas body.
select :: (KnownSMTSort k, KnownSMTSort v, Ord (HaskellType k)) => Expr (ArraySort k v) -> Expr k -> Expr v Source #
Select a value from an array.
store :: (KnownSMTSort k, KnownSMTSort v, Ord (HaskellType k)) => Expr (ArraySort k v) -> Expr k -> Expr v -> Expr (ArraySort k v) Source #
Store a value in an array.