Created
May 28, 2017 17:15
-
-
Save LeventErkok/1b5962193d16273c320f61da442e7406 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 | |
p :: Goal | |
p = do a <- sInteger "a" | |
b <- sInteger "b" | |
ab <- sInteger "ab" | |
constrain $ a*a - b*b .== 21 | |
constrain $ a*a + b*b .== 29 | |
constrain $ ab .== a*b | |
{- | |
*Main> main | |
Solution #1: | |
a = -5 :: Integer | |
b = 2 :: Integer | |
ab = -10 :: Integer | |
Solution #2: | |
a = 5 :: Integer | |
b = 2 :: Integer | |
ab = 10 :: Integer | |
Solution #3: | |
a = -5 :: Integer | |
b = -2 :: Integer | |
ab = 10 :: Integer | |
Solution #4: | |
a = 5 :: Integer | |
b = -2 :: Integer | |
ab = -10 :: Integer | |
Found 4 different solutions. | |
-} | |
main :: IO () | |
main = print =<< allSat p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment