I have come across an interesting logic puzzle from my newsfeed. Here is the puzzle.
Ben and Mark are students of Mr. Tan. Mister Tan’s birthday is on and both of them know that Mr. Tan’s birthday is one of these 10 dates.
Mr. Tan tells Ben the value of and tells Mark the value of . Then Mr. Tan asks them, “Do you know when is my birthday?”
Ben says,”I don’t know, but I can ensure that Mark doesn’t know too.”
Mark says,”Initially I don’t know, but I know it now.”
Ben says,”Oh, then I know it too.”
Base of the dialogue and the dates given, can you figure out which date is Mr. Tan’s birthday?
When I first read this puzzle, I remember again the Muddy Children puzzle, back when I was undergraduate students. These two puzzles has one common property: they require the reasoning about knowledge. And what could be more powerful than using logic to reason about knowledge! The question remains: which logic to reason about knowledge?
Well, if you are a logician, philosopher, or theoretical computer scientist, you might have encountered the course of Modal Logic. We can use Epistemic Logic, a variant of Modal Logic, to reason about knowledge. And that is what we are going to use to solve this puzzle.
As usual, when we learn about logic, we need to know two things: the language and its meaning. The language is the syntax, and its meaning is the semantics. The following Backus Naur Form (BNF) formalises the syntax.
Letter denotes an atomic proposition, , and is an agent, .
Anyone with a basic knowledge of logic must have known that the connective is read as “not”, the connective is read as “and”, and so on. Two new connectives in the formal syntax are and . The formulae is read as “agent believes that is true”, and formulae is read as “agent considers it is possible that is true”.
To define its semantics, we need another mathematical structure called state model. The state model for the Epistemic Logic is a triple
- is a set, or usually called the set of all possible worlds,
- is a relation over , such that means that the agent considers the state is possible at the state ,
- is a labelling function which maps from the set to the power set . It assigns to each atomic proposition, a set of states in which the atomic proposition is true.
Here is the semantics of the Epistemic Logic.
Using the Epistemic Logic to solve the puzzle
To solve this puzzle, we build a state model first. Here is one possible solution.
In creating the state model, I list all the possible birthdays. We have two relations, with which I colour them red and blue. We also assume that there are blue and red arcs from a state to itself.
Ben’s relations are coloured with red, while Mark’s with blue. For example, if Mr Tan’s birthday is , then Ben could only know that Mr Tan’s birthday is March, but not the day. Therefore, Ben would consider and are possible, and we draw red arcs from to these two states. Likewise, Mark could only know that Mr Tan’s birthday is on the fourth day, but not the month. Thus, Mark would consider state is possible and, hence, we draw the blue arc from to .
The next step is to define the set of agents, the set of atomic propositions , and the label function . The set of agents, of course, consists of Ben and Mark, . We use the letter to denote the atomic proposition “Ben knows Mr Tan’s birthday”, and the letter to the atomic proposition “Mark knows Mr Tan’s birthday”. Thus, the set of atomic propositions are .
Now, no matter which month Mr Tan has told Ben, Ben definitely could not be certain on which day Mr Tan’s was born. Therefore, we set the label function for with . However, if Mark was told that Mr Tan’s birthday falls on the second or seventh day of the month, Mark could easily be certain that Mr Tan’s birthday is either or . This is, obviously, because no other month with these days could possibly be Mr Tan’s birthday. Therefore, we set the label function for with .
Ben’s first remark
Let’s analyse what Ben says in the first place.
“I don’t know, but I can ensure that Mark doesn’t know too.”
This is translated into the formulae . What we need to do next is to eliminate any state in our state model which contradicts with Ben’s first remark. We do this by removing the state which .
From the semantics of Epistemic Logic, , De Morgan’s rule , and equality , we need to remove the state such that or .
Since we know that there is no state such that Ben could know Mr Tan’s birthday, , there cannot be any state such that . Therefore, we can safely ignore the first disjunct.
We, then, analyse for the second disjunct. The state satisfy if the following quantifier holds true.There are only two states such that , that is, and . This implies that a state satisfying the quantifier above is the state which has at least one red arc to either states or , that is, . Here is the resulting state model.
From this new state model, we update again the label function for with , and keep the old label function for . This is because, given this new state model, each day is unique except day five. There is also no unique month and, therefore, the label function for remains empty set.
Mark’s first remark
Now we analyse what Marks says.
“Initially I don’t know. But I know it now.”
We use the formulae to represent this remark. (We only translate the second sentence, since the first sentence belong to the previous state model.) Again, what we have to do is to remove any state such that . That is any state satisfying . Since the set of states where is , then we have to remove all states which have at least one blue arc to any member of this set. Surprisingly, they are the members of the set themselves. We update again the state model as follows.
The label function becomes and .
Ben’s last remark
Lastly, Ben replies as follows.
“Oh, then I know it too.”
This translates into the formulae . With this last remark, we remove the states which at least have a red arc to any state which satisfies . That is we have to remove the states and , which leaves us with a single state.
By quoting the famous Sherlock Holmes,
When you have eliminated the impossible, whatever remains, however improbable, must be the truth.
we know that Mr Tan’s birthday is the remaining state: the first September of 1970.