Copyright | (c) Sirui Lu 2021-2023 |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | siruilu@cs.washington.edu |
Stability | Experimental |
Portability | GHC only |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Symbolic equality
Symbolic equality. Note that we can't use Haskell's Eq
class since
symbolic comparison won't necessarily return a concrete Bool
value.
>>>
let a = 1 :: SymInteger
>>>
let b = 2 :: SymInteger
>>>
a ==~ b
false>>>
a /=~ b
true
>>>
let a = "a" :: SymInteger
>>>
let b = "b" :: SymInteger
>>>
a /=~ b
(! (= a b))>>>
a /=~ b
(! (= a b))
Note: This type class can be derived for algebraic data types.
You may need the DerivingVia
and DerivingStrategies
extensions.
data X = ... deriving Generic deriving SEq via (Default X)
Instances
Auxiliary class for SEq
instance derivation
Symbolic Boolean operations
class LogicalOp b where Source #
Symbolic logical operators for symbolic booleans.
>>>
let t = con True :: SymBool
>>>
let f = con False :: SymBool
>>>
let a = "a" :: SymBool
>>>
let b = "b" :: SymBool
>>>
t ||~ f
true>>>
a ||~ t
true>>>
a ||~ f
a>>>
a ||~ b
(|| a b)>>>
t &&~ f
false>>>
a &&~ t
a>>>
a &&~ f
false>>>
a &&~ b
(&& a b)>>>
nots t
false>>>
nots f
true>>>
nots a
(! a)>>>
t `xors` f
true>>>
t `xors` t
false>>>
a `xors` t
(! a)>>>
a `xors` f
a>>>
a `xors` b
(|| (&& (! a) b) (&& a (! b)))
(||~) :: b -> b -> b infixr 2 Source #
Symbolic disjunction
(&&~) :: b -> b -> b infixr 3 Source #
Symbolic conjunction
Symbolic negation
Symbolic exclusive disjunction
implies :: b -> b -> b Source #
Symbolic implication
class (SimpleMergeable b, SEq b, Eq b, LogicalOp b, Solvable Bool b, ITEOp b) => SymBoolOp b Source #
Aggregation for the operations on symbolic boolean types
ITE operator for solvable (see Grisette.Core)s, including symbolic boolean, integer, etc.
>>>
let a = "a" :: SymBool
>>>
let b = "b" :: SymBool
>>>
let c = "c" :: SymBool
>>>
ites a b c
(ite a b c)
Instances
ITEOp SomeSymIntN Source # | |
Defined in Grisette.Core.Data.Class.Bool ites :: SymBool -> SomeSymIntN -> SomeSymIntN -> SomeSymIntN Source # | |
ITEOp SomeSymWordN Source # | |
Defined in Grisette.Core.Data.Class.Bool ites :: SymBool -> SomeSymWordN -> SomeSymWordN -> SomeSymWordN Source # | |
ITEOp SymBool Source # | |
ITEOp SymInteger Source # | |
Defined in Grisette.Core.Data.Class.Bool ites :: SymBool -> SymInteger -> SymInteger -> SymInteger Source # | |
(ITEOp a, Mergeable a) => ITEOp (UnionM a) Source # | |
(KnownNat n, 1 <= n) => ITEOp (SymIntN n) Source # | |
(KnownNat n, 1 <= n) => ITEOp (SymWordN n) Source # | |
(SupportedPrim ca, SupportedPrim cb, LinkedRep ca sa, LinkedRep cb sb) => ITEOp (sa -~> sb) Source # | |
(SupportedPrim ca, SupportedPrim cb, LinkedRep ca sa, LinkedRep cb sb) => ITEOp (sa =~> sb) Source # | |