Last active
August 29, 2015 14:24
-
-
Save LeventErkok/e65095f98a38de579016 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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