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 |
Grisette.Internal.Core.Data.Class.Solvable
Contents
Description
Solvable type interface
class IsString t => Solvable c t | t -> c where Source #
The class defines the creation and pattern matching of solvable type values.
Methods
Wrap a concrete value in a symbolic value.
>>>
con True :: SymBool
true
conView :: t -> Maybe c Source #
Extract the concrete value from a symbolic value.
>>>
conView (con True :: SymBool)
Just True
>>>
conView (ssym "a" :: SymBool)
Nothing
Generate symbolic constants.
Two symbolic constants with the same symbol are the same symbolic constant, and will always be assigned with the same value by the solver.
>>>
sym "a" :: SymBool
a>>>
(sym "a" :: SymBool) == sym "a"
True>>>
(sym "a" :: SymBool) == sym "b"
False>>>
(sym "a" :: SymBool) .&& sym "a"
a>>>
(sym "a" :: SymBool) == isym "a" 1
False
ssym :: Identifier -> t Source #
Generate simply-named symbolic constants.
Two symbolic constants with the same identifier are the same symbolic constant, and will always be assigned with the same value by the solver.
>>>
ssym "a" :: SymBool
a>>>
(ssym "a" :: SymBool) == ssym "a"
True>>>
(ssym "a" :: SymBool) == ssym "b"
False>>>
(ssym "a" :: SymBool) .&& ssym "a"
a
isym :: Identifier -> Int -> t Source #
Generate indexed symbolic constants.
Two symbolic constants with the same identifier but different indices are not the same symbolic constants.
>>>
isym "a" 1 :: SymBool
a@1
Instances
pattern Con :: Solvable c t => c -> t Source #
Extract the concrete value from a solvable value with conView
.
>>>
case con True :: SymBool of Con v -> v
True
slocsym :: Solvable c s => Text -> SpliceQ s Source #
Generate simply-named symbolic variables. The file location will be attached to the identifier.
>>>
$$(slocsym "a") :: SymBool
a:[grisette-file-location <interactive>...]
Calling slocsym
with the same name at different location will always
generate different symbolic constants. Calling slocsym
at the same
location for multiple times will generate the same symbolic constants.
>>>
($$(slocsym "a") :: SymBool) == $$(slocsym "a")
False>>>
let f _ = $$(slocsym "a") :: SymBool
>>>
f () == f ()
True
ilocsym :: Solvable c s => Text -> Int -> SpliceQ s Source #
Generate indexed symbolic variables. The file location will be attached to the identifier.
>>>
$$(ilocsym "a" 1) :: SymBool
a:[grisette-file-location <interactive>...]@1
Calling ilocsym
with the same name and index at different location will
always generate different symbolic constants. Calling slocsym
at the same
location for multiple times will generate the same symbolic constants.