sbv-5.7: SMT Based Verification: Symbolic Haskell theorem prover using SMT solving.

Data.SBV.Examples.Puzzles.Fish

Description

Solves the following logic puzzle:

• 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

# Documentation

data Color Source

Colors of houses

Constructors

 Red Green White Yellow Blue

Instances

 Source Source Source Source Source Source Source

Nationalities of the occupants

Constructors

 Briton Dane Swede Norwegian German

data Beverage Source

Beverage choices

Constructors

 Tea Coffee Milk Beer Water

data Pet Source

Pets they keep

Constructors

 Dog Horse Cat Bird Fish

Instances

 Source Source Source Source Source Source Source

data Sport Source

Sports they engage in

Constructors

 Football Baseball Volleyball Hockey Tennis

Instances

 Source Source Source Source Source Source Source

We have:

````>>> ````fishOwner
```German
```

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!