system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: The Unexpected Hanging Paradox.
gpt
In the Unexpected Hanging Paradox a judge sentences a man to die by hanging at dawn one of the days in the following week—Monday, Tuesday, Wednesday, Thursday, or Friday—but specifies that the condemned will not know what day he will be hanged.

The prisoner looks at this information and determines that he cannot be hanged on Friday:  as soon as Thursday Dawn comes and goes he knows that Friday will be the day.  Thus, he eliminates that as a possibility.

However, since Friday is out he knows that Thursday cannot be the day either:  if Wednesday passes without the hanging then it can only be Thursday or Friday, but he already knows that it cannot be Friday so he would be expecting it on Thursday.

By similar logic he rules out Wednesday, then Tuesday, then Monday.  Having ruled out all possible days he declares that he cannot be hanged, so it is a complete surprise to him when the hangman shows up on Tuesday to take him to his execution.

The paradox is compelling because every logical step that the prisoner takes is sound.  This form of reasoning is completely valid in logic and none of the steps contains an error.  Furthermore, it appears that the Judge's requirements have both been met and were reasonable:  the prisoner was hanged at one of the possible times and was not expecting it.

Clearly something is wrong, though.  Starting from a premise of an imminent hanging the prisoner deduced that such a hanging would not occur, which is a contradiction.  With such a contradiction you could go on to prove whatever you want; this is the "principle of explosion."  For example:  "It is true that he will be executed" (the premise); "It is therefore true that *either* he will be executed or Santa Claus is real" (true OR anything is true); "It is false that he will be executed" (what he deduced); "Therefore, Santa Claus is real" (that's the only way to make the previous OR statement true).

The flaw in the setup comes from the Judge's claims.  The first part is simple enough:  he will be executed by hanging at dawn on M/Tu/W/Th/F.  It's the second part that turns out to be impossible to state formally without being recursive (which isn't allowed in formal logic, lest you get things like "the set of all sets that do not contain themselves" for which you get a paradox when asking if that set contains itself).   If you disallow recursion then the claim becomes "The prisoner will not be able to deduce the day of execution using just the fact that he will be executed at dawn on M/Tu/W/Th/F."  This claim is obvious and boring.

It's also worth pointing out that the judge's claim needn't even come true in the first place.  By the prisoner's logic he must be expecting the hanging 100% on Friday if he survives Thursday, must be expecting it 100% on Thursday if he survives Wednesday, and so on.  By that approach he expects the hanging each day and the judge is wrong.