| Copyright | (c) Levent Erkok |
|---|---|
| License | BSD3 |
| Maintainer | erkokl@gmail.com |
| Stability | experimental |
| Safe Haskell | None |
| Language | Haskell2010 |
Documentation.SBV.Examples.Puzzles.Fish
Description
Solves the following logic puzzle, attributed to Albert Einstein:
- The Briton lives in the red house.
- The Swede keeps dogs as pets.
- The Dane drinks tea.
- The green house is left to the white house.
- The owner of the green house drinks coffee.
- The person who plays football rears birds.
- The owner of the yellow house plays baseball.
- The man living in the center house drinks milk.
- The Norwegian lives in the first house.
- The man who plays volleyball lives next to the one who keeps cats.
- The man who keeps the horse lives next to the one who plays baseball.
- The owner who plays tennis drinks beer.
- The German plays hockey.
- The Norwegian lives next to the blue house.
- The man who plays volleyball has a neighbor who drinks water.
Who owns the fish?
Synopsis
- data Color
- cv2Color :: String -> [CV] -> Color
- _undefiner_Color :: a
- type SColor = SBV Color
- sRed :: SBV Color
- sGreen :: SBV Color
- sWhite :: SBV Color
- sYellow :: SBV Color
- sBlue :: SBV Color
- isRed :: SBV Color -> SBool
- isGreen :: SBV Color -> SBool
- isWhite :: SBV Color -> SBool
- isYellow :: SBV Color -> SBool
- isBlue :: SBV Color -> SBool
- sCaseColor :: Mergeable result => SBV Color -> result -> result -> result -> result -> result -> result
- data Nationality
- cv2Nationality :: String -> [CV] -> Nationality
- _undefiner_Nationality :: a
- type SNationality = SBV Nationality
- sBriton :: SBV Nationality
- sDane :: SBV Nationality
- sSwede :: SBV Nationality
- sNorwegian :: SBV Nationality
- sGerman :: SBV Nationality
- isBriton :: SBV Nationality -> SBool
- isDane :: SBV Nationality -> SBool
- isSwede :: SBV Nationality -> SBool
- isNorwegian :: SBV Nationality -> SBool
- isGerman :: SBV Nationality -> SBool
- sCaseNationality :: Mergeable result => SBV Nationality -> result -> result -> result -> result -> result -> result
- data Beverage
- cv2Beverage :: String -> [CV] -> Beverage
- _undefiner_Beverage :: a
- type SBeverage = SBV Beverage
- sTea :: SBV Beverage
- sCoffee :: SBV Beverage
- sMilk :: SBV Beverage
- sBeer :: SBV Beverage
- sWater :: SBV Beverage
- isTea :: SBV Beverage -> SBool
- isCoffee :: SBV Beverage -> SBool
- isMilk :: SBV Beverage -> SBool
- isBeer :: SBV Beverage -> SBool
- isWater :: SBV Beverage -> SBool
- sCaseBeverage :: Mergeable result => SBV Beverage -> result -> result -> result -> result -> result -> result
- data Pet
- cv2Pet :: String -> [CV] -> Pet
- _undefiner_Pet :: a
- type SPet = SBV Pet
- sDog :: SBV Pet
- sHorse :: SBV Pet
- sCat :: SBV Pet
- sBird :: SBV Pet
- sFish :: SBV Pet
- isDog :: SBV Pet -> SBool
- isHorse :: SBV Pet -> SBool
- isCat :: SBV Pet -> SBool
- isBird :: SBV Pet -> SBool
- isFish :: SBV Pet -> SBool
- sCasePet :: Mergeable result => SBV Pet -> result -> result -> result -> result -> result -> result
- data Sport
- = Football
- | Baseball
- | Volleyball
- | Hockey
- | Tennis
- cv2Sport :: String -> [CV] -> Sport
- _undefiner_Sport :: a
- type SSport = SBV Sport
- sFootball :: SBV Sport
- sBaseball :: SBV Sport
- sVolleyball :: SBV Sport
- sHockey :: SBV Sport
- sTennis :: SBV Sport
- isFootball :: SBV Sport -> SBool
- isBaseball :: SBV Sport -> SBool
- isVolleyball :: SBV Sport -> SBool
- isHockey :: SBV Sport -> SBool
- isTennis :: SBV Sport -> SBool
- sCaseSport :: Mergeable result => SBV Sport -> result -> result -> result -> result -> result -> result
- fishOwner :: IO ()
Documentation
Colors of houses
Instances
_undefiner_Color :: a Source #
Autogenerated definition to avoid unused-variable warnings from GHC.
sCaseColor :: Mergeable result => SBV Color -> result -> result -> result -> result -> result -> result Source #
Case analyzer for the type Color.
data Nationality Source #
Nationalities of the occupants
Instances
cv2Nationality :: String -> [CV] -> Nationality Source #
Conversion from SMT values to Nationality values.
_undefiner_Nationality :: a Source #
Autogenerated definition to avoid unused-variable warnings from GHC.
type SNationality = SBV Nationality Source #
Symbolic version of the type Nationality.
sNorwegian :: SBV Nationality Source #
Symbolic version of the constructor Norwegian.
isNorwegian :: SBV Nationality -> SBool Source #
Field recognizer predicate.
sCaseNationality :: Mergeable result => SBV Nationality -> result -> result -> result -> result -> result -> result Source #
Case analyzer for the type Nationality.
Beverage choices
Instances
_undefiner_Beverage :: a Source #
Autogenerated definition to avoid unused-variable warnings from GHC.
sCaseBeverage :: Mergeable result => SBV Beverage -> result -> result -> result -> result -> result -> result Source #
Case analyzer for the type Beverage.
Pets they keep
Instances
_undefiner_Pet :: a Source #
Autogenerated definition to avoid unused-variable warnings from GHC.
sCasePet :: Mergeable result => SBV Pet -> result -> result -> result -> result -> result -> result Source #
Case analyzer for the type Pet.
Sports they engage in
Constructors
| Football | |
| Baseball | |
| Volleyball | |
| Hockey | |
| Tennis |
Instances
_undefiner_Sport :: a Source #
Autogenerated definition to avoid unused-variable warnings from GHC.
sVolleyball :: SBV Sport Source #
Symbolic version of the constructor Volleyball.
sCaseSport :: Mergeable result => SBV Sport -> result -> result -> result -> result -> result -> result Source #
Case analyzer for the type Sport.
We have:
>>>fishOwnerGerman
It's not hard to modify this program to grab the values of all the assignments, i.e., the full
solution to the puzzle. We leave that as an exercise to the interested reader!
NB. We use the allSatTrackUFs configuration to indicate that the uninterpreted function
changes do not matter for generating different values. All we care is that the fishOwner changes!