Skip to content

Instantly share code, notes, and snippets.

@solomon-b
Last active January 18, 2019 01:54
Show Gist options
  • Save solomon-b/ea55c19ac43d0033e84a85f6c7a9c39c to your computer and use it in GitHub Desktop.
Save solomon-b/ea55c19ac43d0033e84a85f6c7a9c39c to your computer and use it in GitHub Desktop.

Whodunnit

Victor has been murdered, and Art, Bob, and Carl are suspects. Art says he did not do it. He says that Bob was the victim's friend but that Carl hated the victim. Bob says he was out of town the day of the murder, and besides he didn't even know the guy. Carl says he is innocent and he saw Art and Bob with the victim just before the murder. Assuming that everyone - except possibly for the murderer - is telling the truth, encode the facts of the case so that you can use the tools of Propositional Logic to convince people that Bob killed Victor.

The key to using Logic to solve this problem is to make the suspects' statements conditional on their innocence. Let's use the symbol ia to mean that Art is innocent; we use ib to mean that Bob is innocent; and we use ic to mean that carl is innocent. We use fa, fb, and fc to mean that Art, Bob, and Carl (respectively) were friends of Victor. We use ka, kb, and kc to mean Art, Bob, and Carl (respectively) knew Victor. We use la, lb, and lc to mean Art, Bob, and Carl (respectively) like Victor. We use ta, tb, and tc to mean Art, Bob, and Carl (respectively) were in town the day of the murder. We use wa, wb, and wc to mean Art, Bob, and Carl (respectively) were with Victor on the day of the murder.

Key

innocent:
ia ib ic

friends:
fa fb fc

knew:
ka kb kc

liked:
la lb lc

in town:
ta tb tc

with:
wa wb wc

Axioms

- if art is innocnet then bob was friends with victor:

ia => fb


- if art is innocent then carl did not like victor:
ia => ~lc


- if bob is innocent then bob was not in town:

ib => ~tb

- if bob is innocent then bob didn't know victor:
ib => ~kb


- if carl is innocent then art was with victor:
ic => wa


- if carl is innocent then bob was with victor:
ic => wb


- Anyone who was with Victor was in town:
wa => ta
wb => tb
wc => tc

- Anyone who was friends with Victor also knew him:
fa => ka
fb => kb
fc => kc

- There is only one guilty party
ia | ib
ia | ic
ib | ic

Proof that Bob is Guilty

1. (ic => wb) => (~wb => ~ic)
2. (ia => fb) => (~fb => ~ia)
3. ib => ~tb => ~wb => ~ic
4. ib => ~kb => ~fb => ~ia

Therefore: ~ic & ~ia contradicts (ia | ic)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment