The two generals who cannot agree
Two generals command armies on opposite sides of a city. They win only if both attack at the same time; an attack by one alone is a disaster. They can communicate only by messengers who must pass through the city and may be captured, in which case the message never arrives, and the sender does not know whether it arrived.
General A sends "attack at dawn". If the messenger gets through, B knows the plan, but A does not know that B knows, so B sends a confirmation; but B does not know whether the confirmation arrived, so A sends an acknowledgement; and so on.
Prove that no finite sequence of messages can guarantee that both generals attack.
Show a hint
Suppose some protocol works and always ends with both attacking. Look at the very last message that is sent. Could it have been captured without changing what the generals do?
Your answer
Solving needs a free account
Answers, streaks and solutions unlock when you are signed in. Reading the question and the hint stays free.
Discussion
💡 Discussion rules
- No full solutions here. Hints and approaches only.
- Complexity, edge cases and intuition are the point.
- Interview experiences are welcome. Respect your NDAs.
Loading discussion…
Learn the concepts
The theory behind this question.