| Copyright | (c) Levent Erkok |
|---|---|
| License | BSD3 |
| Maintainer | erkokl@gmail.com |
| Stability | experimental |
| Safe Haskell | None |
| Language | Haskell2010 |
Documentation.SBV.Examples.Misc.Enumerate
Description
Demonstrates how enumerations can be translated to their SMT-Lib counterparts, without losing any information content. Also see Documentation.SBV.Examples.Puzzles.U2Bridge for a more detailed example involving enumerations.
Synopsis
- data E
- cv2E :: String -> [CV] -> E
- _undefiner_E :: a
- type SE = SBV E
- sA :: SBV E
- sB :: SBV E
- sC :: SBV E
- isA :: SBV E -> SBool
- isB :: SBV E -> SBool
- isC :: SBV E -> SBool
- sCaseE :: Mergeable result => SBV E -> result -> result -> result -> result
- elts :: IO AllSatResult
- four :: IO SatResult
- maxE :: IO SatResult
- minE :: IO SatResult
Documentation
A simple enumerated type, that we'd like to translate to SMT-Lib intact; i.e., this type will not be uninterpreted but rather preserved and will be just like any other symbolic type SBV provides.
Instances
_undefiner_E :: a Source #
Autogenerated definition to avoid unused-variable warnings from GHC.
sCaseE :: Mergeable result => SBV E -> result -> result -> result -> result Source #
Case analyzer for the type E.
elts :: IO AllSatResult Source #
Have the SMT solver enumerate the elements of the domain. We have:
>>>eltsSolution #1: s0 = C :: E Solution #2: s0 = A :: E Solution #3: s0 = B :: E Found 3 different solutions.
Shows that if we require 4 distinct elements of the type E, we shall fail; as
the domain only has three elements. We have:
>>>fourUnsatisfiable
Enumerations are automatically ordered, so we can ask for the maximum element. Note the use of quantification. We have:
>>>maxESatisfiable. Model: maxE = C :: E