Straightforward contradiction spoken by the judge, from which anything whatsoever follows.
The statement "you will be hanged on a weekday next week" which we can express as
H(weekday)
means precisely this:
H(F) or H(Th) or H(W) or H(Tu) or H(M)
The statement "you will not know until the knock on the door whether you are hanged on that day" means exactly this:
~H(F) and ~H(Th) and ~H(W) and ~H(Tu) and ~H(M)
Well, no, not quite! It only has that meaning conditionally. That is to say:
H(weekday) -> ~H(F) and ~H(Th) and ~H(W) and ~H(Tu) and ~H(M)
By De Morgan's, this right side rearranges to:
H(weekday) -> ~(H(F) or H(Th) or H(W) or H(Tu) or H(M))
and that is of course
H(weekday) -> ~H(weekday)
This is equivalent to ~H(weekday), since P -> ~P is ~P v ~P, which is just ~P. So, what the judge said in total is equivalent to the conjunction of these two propositions:
H(weekday) ^ (H(weekday) -> ~H(weekday))
Where the right side reduces as above, leaving:
H(weekday) ^ ~H(weekday)
A direct contradiction: you will be hanged and you won't be hanged.
The prisoner choose to believe that he won't be hanged.