Closed LeventErkok closed 1 year ago
Current implementation:
import Data.SBV
foo :: IO AllSatResult
foo = allSatWith z3{allSatMaxModelCount = Just 12} $ do
x <- sInteger "x"
y <- sInteger "y"
partition "p1" $ x .> 0
partition "p2" $ y .> 0
This prints:
*Main> foo
Solution #1:
x = 0 :: Integer
y = 1 :: Integer
p1 = False :: Bool
p2 = True :: Bool
Solution #2:
x = 1 :: Integer
y = 1 :: Integer
p1 = True :: Bool
p2 = True :: Bool
Solution #3:
x = 1 :: Integer
y = 0 :: Integer
p1 = True :: Bool
p2 = False :: Bool
Solution #4:
x = 0 :: Integer
y = 0 :: Integer
p1 = False :: Bool
p2 = False :: Bool
Found 4 different solutions.
If you don't give the partitioning, then you'll get 12 outputs.
Need documentation and an example program, then we can close.
It's useful to be able to partition the all-sat results according to arbitrary user given equivalences. We can already express this in SBV, like this:
This allows for all-sat to consider equivalence classes amongst all the satisfying states.
Alas, this doesn't print the values of
x
andy
, since we have to make them non-model-vars. We can resolve this in one of two ways:showTheseVars
or similar, so they can be shown again.isPartitionVar
parameter, which acts just likeisNonModelVar
, but otherwise doesn't change printing behaviorI'm inclined towards the second, but perhaps the first one is easier to implement. Need to figure out the most useful form.