sbv-13.1: SMT Based Verification: Symbolic Haskell theorem prover using SMT solving.
Copyright(c) Levent Erkok
LicenseBSD3
Maintainererkokl@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Documentation.SBV.Examples.Puzzles.Murder

Description

Solution to "Malice and Alice," from George J. Summers' Logical Deduction Puzzles:

A man and a woman were together in a bar at the time of the murder.
The victim and the killer were together on a beach at the time of the murder.
One of Alice’s two children was alone at the time of the murder.
Alice and her husband were not together at the time of the murder.
The victim's twin was not the killer.
The killer was younger than the victim.

Who killed who?
Synopsis

Documentation

data Location Source #

Locations

Constructors

Bar 
Beach 
Alone 

Instances

Instances details
Arbitrary Location Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Show Location Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

SymVal Location Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

HasKind Location Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

EnumSymbolic Location Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

SatModel Location Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

parseCVs :: [CV] -> Maybe (Location, [CV]) Source #

cvtModel :: (Location -> Maybe b) -> Maybe (Location, [CV]) -> Maybe (b, [CV]) Source #

OrdSymbolic (SBV Location) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

HasInductionSchema (Forall ta Location -> SBool) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

inductionSchema :: (Forall ta Location -> SBool) -> ProofObj Source #

SymVal extraT => HasInductionSchema (Forall ta Location -> Forall extraS extraT -> SBool) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

inductionSchema :: (Forall ta Location -> Forall extraS extraT -> SBool) -> ProofObj Source #

(SymVal extraT1, SymVal extraT2) => HasInductionSchema (Forall ta Location -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> SBool) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

inductionSchema :: (Forall ta Location -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> SBool) -> ProofObj Source #

(SymVal extraT1, SymVal extraT2, SymVal extraT3) => HasInductionSchema (Forall ta Location -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> Forall extraS3 extraT3 -> SBool) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

inductionSchema :: (Forall ta Location -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> Forall extraS3 extraT3 -> SBool) -> ProofObj Source #

(SymVal extraT1, SymVal extraT2, SymVal extraT3, SymVal extraT4) => HasInductionSchema (Forall ta Location -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> Forall extraS3 extraT3 -> Forall extraS4 extraT4 -> SBool) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

inductionSchema :: (Forall ta Location -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> Forall extraS3 extraT3 -> Forall extraS4 extraT4 -> SBool) -> ProofObj Source #

(SymVal extraT1, SymVal extraT2, SymVal extraT3, SymVal extraT4, SymVal extraT5) => HasInductionSchema (Forall ta Location -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> Forall extraS3 extraT3 -> Forall extraS4 extraT4 -> Forall extraS5 extraT5 -> SBool) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

inductionSchema :: (Forall ta Location -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> Forall extraS3 extraT3 -> Forall extraS4 extraT4 -> Forall extraS5 extraT5 -> SBool) -> ProofObj Source #

data Sex Source #

Sexes

Constructors

Male 
Female 

Instances

Instances details
Arbitrary Sex Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

arbitrary :: Gen Sex #

shrink :: Sex -> [Sex] #

Show Sex Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

showsPrec :: Int -> Sex -> ShowS #

show :: Sex -> String #

showList :: [Sex] -> ShowS #

SymVal Sex Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

HasKind Sex Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

EnumSymbolic Sex Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

SatModel Sex Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

parseCVs :: [CV] -> Maybe (Sex, [CV]) Source #

cvtModel :: (Sex -> Maybe b) -> Maybe (Sex, [CV]) -> Maybe (b, [CV]) Source #

OrdSymbolic (SBV Sex) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

HasInductionSchema (Forall ta Sex -> SBool) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

inductionSchema :: (Forall ta Sex -> SBool) -> ProofObj Source #

SymVal extraT => HasInductionSchema (Forall ta Sex -> Forall extraS extraT -> SBool) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

inductionSchema :: (Forall ta Sex -> Forall extraS extraT -> SBool) -> ProofObj Source #

(SymVal extraT1, SymVal extraT2) => HasInductionSchema (Forall ta Sex -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> SBool) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

inductionSchema :: (Forall ta Sex -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> SBool) -> ProofObj Source #

(SymVal extraT1, SymVal extraT2, SymVal extraT3) => HasInductionSchema (Forall ta Sex -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> Forall extraS3 extraT3 -> SBool) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

inductionSchema :: (Forall ta Sex -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> Forall extraS3 extraT3 -> SBool) -> ProofObj Source #

(SymVal extraT1, SymVal extraT2, SymVal extraT3, SymVal extraT4) => HasInductionSchema (Forall ta Sex -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> Forall extraS3 extraT3 -> Forall extraS4 extraT4 -> SBool) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

inductionSchema :: (Forall ta Sex -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> Forall extraS3 extraT3 -> Forall extraS4 extraT4 -> SBool) -> ProofObj Source #

(SymVal extraT1, SymVal extraT2, SymVal extraT3, SymVal extraT4, SymVal extraT5) => HasInductionSchema (Forall ta Sex -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> Forall extraS3 extraT3 -> Forall extraS4 extraT4 -> Forall extraS5 extraT5 -> SBool) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

inductionSchema :: (Forall ta Sex -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> Forall extraS3 extraT3 -> Forall extraS4 extraT4 -> Forall extraS5 extraT5 -> SBool) -> ProofObj Source #

data Role Source #

Roles

Constructors

Victim 
Killer 
Bystander 

Instances

Instances details
Arbitrary Role Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

arbitrary :: Gen Role #

shrink :: Role -> [Role] #

Show Role Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

showsPrec :: Int -> Role -> ShowS #

show :: Role -> String #

showList :: [Role] -> ShowS #

SymVal Role Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

HasKind Role Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

EnumSymbolic Role Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

SatModel Role Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

parseCVs :: [CV] -> Maybe (Role, [CV]) Source #

cvtModel :: (Role -> Maybe b) -> Maybe (Role, [CV]) -> Maybe (b, [CV]) Source #

OrdSymbolic (SBV Role) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

HasInductionSchema (Forall ta Role -> SBool) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

inductionSchema :: (Forall ta Role -> SBool) -> ProofObj Source #

SymVal extraT => HasInductionSchema (Forall ta Role -> Forall extraS extraT -> SBool) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

inductionSchema :: (Forall ta Role -> Forall extraS extraT -> SBool) -> ProofObj Source #

(SymVal extraT1, SymVal extraT2) => HasInductionSchema (Forall ta Role -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> SBool) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

inductionSchema :: (Forall ta Role -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> SBool) -> ProofObj Source #

(SymVal extraT1, SymVal extraT2, SymVal extraT3) => HasInductionSchema (Forall ta Role -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> Forall extraS3 extraT3 -> SBool) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

inductionSchema :: (Forall ta Role -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> Forall extraS3 extraT3 -> SBool) -> ProofObj Source #

(SymVal extraT1, SymVal extraT2, SymVal extraT3, SymVal extraT4) => HasInductionSchema (Forall ta Role -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> Forall extraS3 extraT3 -> Forall extraS4 extraT4 -> SBool) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

inductionSchema :: (Forall ta Role -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> Forall extraS3 extraT3 -> Forall extraS4 extraT4 -> SBool) -> ProofObj Source #

(SymVal extraT1, SymVal extraT2, SymVal extraT3, SymVal extraT4, SymVal extraT5) => HasInductionSchema (Forall ta Role -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> Forall extraS3 extraT3 -> Forall extraS4 extraT4 -> Forall extraS5 extraT5 -> SBool) Source # 
Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

Methods

inductionSchema :: (Forall ta Role -> Forall extraS1 extraT1 -> Forall extraS2 extraT2 -> Forall extraS3 extraT3 -> Forall extraS4 extraT4 -> Forall extraS5 extraT5 -> SBool) -> ProofObj Source #

cv2Location :: String -> [CV] -> Location Source #

Conversion from SMT values to Location values.

_undefiner_Location :: a Source #

Autogenerated definition to avoid unused-variable warnings from GHC.

type SLocation = SBV Location Source #

Symbolic version of the type Location.

sBar :: SBV Location Source #

Symbolic version of the constructor Bar.

sBeach :: SBV Location Source #

Symbolic version of the constructor Beach.

sAlone :: SBV Location Source #

Symbolic version of the constructor Alone.

isBar :: SBV Location -> SBool Source #

Field recognizer predicate.

isBeach :: SBV Location -> SBool Source #

Field recognizer predicate.

isAlone :: SBV Location -> SBool Source #

Field recognizer predicate.

sCaseLocation :: Mergeable result => SBV Location -> result -> result -> result -> result Source #

Case analyzer for the type Location.

cv2Sex :: String -> [CV] -> Sex Source #

Conversion from SMT values to Sex values.

_undefiner_Sex :: a Source #

Autogenerated definition to avoid unused-variable warnings from GHC.

type SSex = SBV Sex Source #

Symbolic version of the type Sex.

sMale :: SBV Sex Source #

Symbolic version of the constructor Male.

sFemale :: SBV Sex Source #

Symbolic version of the constructor Female.

isMale :: SBV Sex -> SBool Source #

Field recognizer predicate.

isFemale :: SBV Sex -> SBool Source #

Field recognizer predicate.

sCaseSex :: Mergeable result => SBV Sex -> result -> result -> result Source #

Case analyzer for the type Sex.

cv2Role :: String -> [CV] -> Role Source #

Conversion from SMT values to Role values.

_undefiner_Role :: a Source #

Autogenerated definition to avoid unused-variable warnings from GHC.

type SRole = SBV Role Source #

Symbolic version of the type Role.

sVictim :: SBV Role Source #

Symbolic version of the constructor Victim.

sKiller :: SBV Role Source #

Symbolic version of the constructor Killer.

sBystander :: SBV Role Source #

Symbolic version of the constructor Bystander.

isVictim :: SBV Role -> SBool Source #

Field recognizer predicate.

isKiller :: SBV Role -> SBool Source #

Field recognizer predicate.

isBystander :: SBV Role -> SBool Source #

Field recognizer predicate.

sCaseRole :: Mergeable result => SBV Role -> result -> result -> result -> result Source #

Case analyzer for the type Role.

data Person (f :: Type -> Type) Source #

A person has a name, age, together with location and sex. We parameterize over a function so we can use this struct both in a concrete context and a symbolic context. Note that the name is always concrete.

Constructors

Person 

Fields

Instances

Instances details
Show (Person Const) Source #

Show a person

Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

newtype Const a Source #

Helper functor

Constructors

Const 

Fields

Instances

Instances details
Show (Person Const) Source #

Show a person

Instance details

Defined in Documentation.SBV.Examples.Puzzles.Murder

newPerson :: String -> Symbolic (Person SBV) Source #

Create a new symbolic person

getPerson :: Person SBV -> Query (Person Const) Source #

Get the concrete value of the person in the model

killer :: IO () Source #

Solve the puzzle. We have:

>>> killer
Alice     48  Bar    Female  Bystander
Husband   47  Beach  Male    Killer
Brother   48  Beach  Male    Victim
Daughter  21  Alone  Female  Bystander
Son       20  Bar    Male    Bystander

That is, Alice's brother was the victim and Alice's husband was the killer.

puzzle :: IO [Person Const] Source #

Constraints of the puzzle, coded following the English description.