One of my all-time favorite books is Chess Curiosities by Tim Krabbe, now outdone by his website http://timkr.home.xs4all.nl//chess/chess.html.
Chess Curiosities' first chapter is on castling. In the problem world the convention is: if you see a problem where it looks like a player can castle, then castling is legal unless you can prove (by retrograde analysis) that it wasn't but the convention for en passant is just the opposite - you can't capture en passant unless you can prove that on the previous move the pawn being captured advanced two squares. Fair enough. But, as Tim pointed out, several problemists have shown there is a "problem" with that. Here is one of his simpler examples:
"If White plays 1.Ke6, threatening 2.Rd8 mate, Black castles. Castling proves, however, his last move was g7-g5 [DH: because if Black castles, then neither the king nor rook could have moved before, and g6-g5 is impossible because the white king would have been in check]. But if White accordingly switches plans and starts with 1.hxg6, Black protests that his last move was Rh7-h8. This again proves White could have mated in 2 with 1.Ke6 after all as Black has lost the right to castle, but if he tries, Black again answers 1...O-O, claiming his last move was g7-g5. Which proves that...and so on.
"This leads us to the baffling conclusion that if Ke6 is the key, hxg6 isn't - but if hxg6 is, Ke6 is not. If White attempts one solution, Black has a defence which shows the other would have worked. Or to put it differently again: it is perfectly true g7-g5 and Rh7-h8 cannot both be Black's last move, but White (or the solver) has no way of determining which one was..."
For those who want to see each mate, if Black cannot castle, then 1.Ke6 mates in 2 because the threat is the unstoppable 2.Rd8#. In this case you can't play 1.hxg6 e.p. since, if Black can't castle, it is possible that he could have moved the king or rook on the previous move instead.
If Black can castle, then he could not have moved his king or rook, so en passant is legal and necessary, and 1.hxg6 e.p. will mate next move because 2.Rd8# is still a threat, but if 1...O-O then 2.h7#
So next time a friend shows you a problem and the solution involves castling perhaps, when you have finished that problem, you can give him this one to show that in problems it isn't always so easy to determine if you can castle!