Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Language.Hasmtlib.Type.Expr
Synopsis
- newtype SMTVar (t :: SMTSort) = SMTVar {}
- varId :: forall t t. Iso (SMTVar t) (SMTVar t) Int Int
- 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)
- StringValue :: HaskellType StringSort -> Value StringSort
- unwrapValue :: Value t -> HaskellType t
- wrapValue :: forall t. KnownSMTSort t => HaskellType t -> Value t
- data Expr (t :: SMTSort) where
- Var :: SMTVar t -> Expr t
- Constant :: Value t -> Expr t
- Plus :: Num (HaskellType t) => Expr t -> Expr t -> Expr t
- Neg :: Num (HaskellType t) => Expr t -> Expr t
- Mul :: Num (HaskellType t) => Expr t -> Expr t -> Expr t
- Abs :: Num (HaskellType t) => Expr t -> Expr t
- Mod :: Expr IntSort -> Expr IntSort -> Expr IntSort
- IDiv :: Expr IntSort -> Expr IntSort -> Expr IntSort
- Div :: Expr RealSort -> Expr RealSort -> Expr RealSort
- LTH :: (Ord (HaskellType t), KnownSMTSort t) => Expr t -> Expr t -> Expr BoolSort
- LTHE :: (Ord (HaskellType t), KnownSMTSort t) => Expr t -> Expr t -> Expr BoolSort
- EQU :: (Eq (HaskellType t), KnownSMTSort t, KnownNat n) => Vector (n + 2) (Expr t) -> Expr BoolSort
- Distinct :: (Eq (HaskellType t), KnownSMTSort t, KnownNat n) => Vector (n + 2) (Expr t) -> Expr BoolSort
- GTHE :: (Ord (HaskellType t), KnownSMTSort t) => Expr t -> Expr t -> Expr BoolSort
- GTH :: (Ord (HaskellType t), KnownSMTSort t) => Expr t -> Expr t -> Expr BoolSort
- Not :: Boolean (HaskellType t) => Expr t -> Expr t
- And :: Boolean (HaskellType t) => Expr t -> Expr t -> Expr t
- Or :: Boolean (HaskellType t) => Expr t -> Expr t -> Expr t
- Impl :: Boolean (HaskellType t) => Expr t -> Expr t -> Expr t
- Xor :: Boolean (HaskellType t) => Expr t -> Expr t -> Expr t
- Pi :: Expr RealSort
- Sqrt :: Expr RealSort -> Expr RealSort
- Exp :: Expr RealSort -> Expr RealSort
- Sin :: Expr RealSort -> Expr RealSort
- Cos :: Expr RealSort -> Expr RealSort
- Tan :: Expr RealSort -> Expr RealSort
- Asin :: Expr RealSort -> Expr RealSort
- Acos :: Expr RealSort -> Expr RealSort
- Atan :: Expr RealSort -> Expr RealSort
- ToReal :: Expr IntSort -> Expr RealSort
- ToInt :: Expr RealSort -> Expr IntSort
- IsInt :: Expr RealSort -> Expr BoolSort
- Ite :: Expr BoolSort -> Expr t -> Expr t -> Expr t
- BvNot :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n)
- BvAnd :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n) -> Expr (BvSort n)
- BvOr :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n) -> Expr (BvSort n)
- BvXor :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n) -> Expr (BvSort n)
- BvNand :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n) -> Expr (BvSort n)
- BvNor :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n) -> Expr (BvSort n)
- BvNeg :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n)
- BvAdd :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n) -> Expr (BvSort n)
- BvSub :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n) -> Expr (BvSort n)
- BvMul :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n) -> Expr (BvSort n)
- BvuDiv :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n) -> Expr (BvSort n)
- BvuRem :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n) -> Expr (BvSort n)
- 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)
- BvuLT :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n) -> Expr BoolSort
- BvuLTHE :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n) -> Expr BoolSort
- BvuGTHE :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n) -> Expr BoolSort
- BvuGT :: KnownNat n => Expr (BvSort n) -> Expr (BvSort n) -> Expr BoolSort
- ArrSelect :: (KnownSMTSort k, KnownSMTSort v, Ord (HaskellType k)) => Expr (ArraySort k v) -> Expr k -> Expr v
- ArrStore :: (KnownSMTSort k, KnownSMTSort v, Ord (HaskellType k)) => Expr (ArraySort k v) -> Expr k -> Expr v -> Expr (ArraySort k v)
- StrConcat :: Expr StringSort -> Expr StringSort -> Expr StringSort
- StrLength :: Expr StringSort -> Expr IntSort
- StrLT :: Expr StringSort -> Expr StringSort -> Expr BoolSort
- StrLTHE :: Expr StringSort -> Expr StringSort -> Expr BoolSort
- StrAt :: Expr StringSort -> Expr IntSort -> Expr StringSort
- StrSubstring :: Expr StringSort -> Expr IntSort -> Expr IntSort -> Expr StringSort
- StrPrefixOf :: Expr StringSort -> Expr StringSort -> Expr BoolSort
- StrSuffixOf :: Expr StringSort -> Expr StringSort -> Expr BoolSort
- StrContains :: Expr StringSort -> Expr StringSort -> Expr BoolSort
- StrIndexOf :: Expr StringSort -> Expr StringSort -> Expr IntSort -> Expr IntSort
- StrReplace :: Expr StringSort -> Expr StringSort -> Expr StringSort -> Expr StringSort
- StrReplaceAll :: Expr StringSort -> Expr StringSort -> Expr StringSort -> Expr StringSort
- ForAll :: KnownSMTSort t => Maybe (SMTVar t) -> (Expr t -> Expr BoolSort) -> Expr BoolSort
- Exists :: KnownSMTSort t => Maybe (SMTVar t) -> (Expr t -> Expr BoolSort) -> Expr BoolSort
- 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)
- toIntSort :: Expr RealSort -> Expr IntSort
- toRealSort :: Expr IntSort -> Expr RealSort
- isIntSort :: Expr RealSort -> Expr BoolSort
- 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)
- strLength :: Expr StringSort -> Expr IntSort
- strAt :: Expr StringSort -> Expr IntSort -> Expr StringSort
- strSubstring :: Expr StringSort -> Expr IntSort -> Expr IntSort -> Expr StringSort
- strPrefixOf :: Expr StringSort -> Expr StringSort -> Expr BoolSort
- strSuffixOf :: Expr StringSort -> Expr StringSort -> Expr BoolSort
- strContains :: Expr StringSort -> Expr StringSort -> Expr BoolSort
- strIndexOf :: Expr StringSort -> Expr StringSort -> Expr IntSort -> Expr IntSort
- strReplace :: Expr StringSort -> Expr StringSort -> Expr StringSort -> Expr StringSort
- strReplaceAll :: Expr StringSort -> Expr StringSort -> Expr StringSort -> Expr StringSort
Documentation
newtype SMTVar (t :: SMTSort) Source #
An internal SMT variable with a phantom-type which holds an Int
as it's identifier.
data Value (t :: SMTSort) where Source #
A wrapper for values of SMTSort
s.
Constructors
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) | |
StringValue :: HaskellType StringSort -> Value StringSort |
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 Expr (t :: SMTSort) where Source #
Am SMT expression. For internal use only. For building expressions use the corresponding instances (Num, Boolean, ...).
Constructors
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.
strAt :: Expr StringSort -> Expr IntSort -> Expr StringSort Source #
Singleton string containing a character at given position or empty string when position is out of range. The leftmost position is 0.
strSubstring :: Expr StringSort -> Expr IntSort -> Expr IntSort -> Expr StringSort Source #
(strSubstring s i n)
evaluates to the longest (unscattered) substring
of s
of length at most n
starting at position i
.
It evaluates to the empty string if n
is negative or i
is not in
the interval [0,l-1]
where l
is the length of s
.
strPrefixOf :: Expr StringSort -> Expr StringSort -> Expr BoolSort Source #
First string is a prefix of second one.
(str.prefixof s t)
is true
iff s
is a prefix of t
.
strSuffixOf :: Expr StringSort -> Expr StringSort -> Expr BoolSort Source #
First string is a suffix of second one.
(str.suffixof s t)
is true
iff s
is a suffix of t
.
strContains :: Expr StringSort -> Expr StringSort -> Expr BoolSort Source #
First string contains second one
(str.contains s t)
iff s
contains t
.
strIndexOf :: Expr StringSort -> Expr StringSort -> Expr IntSort -> Expr IntSort Source #
Index of first occurrence of second string in first one starting at the position specified by the third argument.
(str.indexof s t i)
, with 0 <= i <= |s|
is the position of the first
occurrence of t
in s
at or after position i
, if any.
Otherwise, it is -1
. Note that the result is i
whenever i
is within
the range [0, |s|]
and t
is empty.
strReplace :: Expr StringSort -> Expr StringSort -> Expr StringSort -> Expr StringSort Source #
(str.replace s t t')
is the string obtained by replacing the first
occurrence of t
in s
, if any, by t'
. Note that if t
is empty, the
result is to prepend t'
to s
; also, if t
does not occur in s
then
the result is s
.
strReplaceAll :: Expr StringSort -> Expr StringSort -> Expr StringSort -> Expr StringSort Source #
(str.replace_all s t t’)
is s
if t
is the empty string. Otherwise, it
is the string obtained from s
by replacing all occurrences of t
in s
by t’
, starting with the first occurrence and proceeding in left-to-right order.