Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import Data.SBV
choice = allSat $ do
[a, b, c, d, e, f] <- sBools ["a", "b", "c", "d", "e", "f"]
solve [ a .== bAnd [b, c, d, e] -- a. All of the below
, b .== bAnd (map bnot [c, d, e]) -- b. None of the below
, c .== bAnd [a, b] -- c. All of the above
, d .== ((1::SInteger) .== sum (map oneIf [a, b, c])) -- d. One of the above
, e .== bAnd (map bnot [a, b, c, d]) -- e. None of the above
, f .== bAnd (map bnot [a, b, c, d, e]) -- f. None of the above
]
{-
*Main> choice
Solution #1:
a = False
b = False
c = False
d = False
e = True
f = False
This is the only solution.
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.