{-# OPTIONS_GHC -Wall -Werror #-}
module Documentation.SBV.Examples.Puzzles.LadyAndTigers where
import Data.SBV
ladyAndTigers :: IO AllSatResult
ladyAndTigers :: IO AllSatResult
ladyAndTigers = forall a. Provable a => a -> IO AllSatResult
allSat forall a b. (a -> b) -> a -> b
$ do
[SBool
sign1, SBool
sign2, SBool
sign3] <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM String -> Symbolic SBool
sBool [String
"sign1", String
"sign2", String
"sign3"]
[SBool
tiger1, SBool
tiger2, SBool
tiger3] <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM String -> Symbolic SBool
sBool [String
"tiger1", String
"tiger2", String
"tiger3"]
forall (m :: * -> *). SolverContext m => SBool -> m ()
constrain forall a b. (a -> b) -> a -> b
$ SBool
sign1 SBool -> SBool -> SBool
.<=> SBool
tiger1
forall (m :: * -> *). SolverContext m => SBool -> m ()
constrain forall a b. (a -> b) -> a -> b
$ SBool
sign2 SBool -> SBool -> SBool
.<=> SBool -> SBool
sNot SBool
tiger2
forall (m :: * -> *). SolverContext m => SBool -> m ()
constrain forall a b. (a -> b) -> a -> b
$ SBool
sign3 SBool -> SBool -> SBool
.<=> SBool
tiger2
forall (m :: * -> *). SolverContext m => SBool -> m ()
constrain forall a b. (a -> b) -> a -> b
$ [SBool
sign1, SBool
sign2, SBool
sign3] [SBool] -> Int -> SBool
`pbAtMost` Int
1
forall (m :: * -> *). SolverContext m => SBool -> m ()
constrain forall a b. (a -> b) -> a -> b
$ [SBool
tiger1, SBool
tiger2, SBool
tiger3] [SBool] -> Int -> SBool
`pbExactly` Int
2