This question already has an answer here:
- Unexpected hanging paradox 8 answers
The unexpected hanging is described in the Wikipedia article Unexpected hanging paradox.
A hanging is said to be a surprise of on the morning that the prisoner is hanged, he cannot deduce that he will be hanged that day. I don't see the ability to derive a contradiction. If you assume that the judge is telling the truth, then you can deduce that the prisoner won't be hanged any of the days of the week. However, he gets hanged on Wednesday. Since he deduced that he won't get hanged on Wednesday, that must mean he cannot deduce that he will get hanged on Wednesday. Therefore, his hanging on Wednesday was a surprize. However, he also deduced that if he gets hanged on Wednesday, that won't be a surprize. The solution then is to break the assumption that the judge was telling the truth. Since the judge's statement was contradictory, it's totally possible that the prisoner can deduce that he won't be hanged on Wednesday but can also deduce that he will be hanged on Wendesday. Since he can also deduce that he will be hanged on Wednesday, the hanging wasn't a surprize. The judge did not tell the truth that the hanging would be a surprize. That seems like a perfectly good solution to the problem. I see no paradox in that solution.