Glossary
This is because it is almost always impossible to prove that castling is indeed allowed, e.g. any proof game can be made to start with 1. Nf3 ... 2. Rg1 ... 3. Rh1 ... 4. Ng1. (Observe that the convention for justification of en-passant capture is just the opposite.)
Samuel Loyd Musical World, 1859
2+4. Mate in 2
Here White has the move. Thus Black has just moved his K or his R and can't castle anymore. Therefore 1. Qa1 ... 2. Qa8# can't be countered by the (illegal) 1 ... O-O-O.
Leonid Borodatov Krimskaja Pravda, 1970
6+1. What did Black just play?
The bK just came from g1, where he was in check by Rd1. If we retract the tempting 0 ... Kg1-h2? then we must go on and retract -1. O-O-O. Doing this we fall into the composer's trap: there is no way to extract the bK from his southern cage. This is because the Ke1 cannot be moved once we retracted White's castling ! This Ke1 together with Pg2 and Pg3 (possibily brought back to its original f2 or h2) are an unbreakable barrier.
Solution: Really, the last move was 0 ... Kg1xNh2!. Now White does not retract -1. O-O-O? Rather, -1. Nf1-h2! (possibly with a capture) is mandatory.
Due to changes in the Codex of Chess Composition 2009 this article is outdated; but on the other hand it may still be valid for problems prior to these changes. See also Castling and En-passant capture.
The rule for castling is clear. But it leads to some strange consequences. First there are some complex interactions when castlings are mutually exclusive, or when an en-passant capture is only legal if castling is (and then the A Posteriori rule is used).
Also the rule may entail some apparent paradoxes
Jean Oudot "Supplément Problèmes", L'échiquier de France, 1957
14+7. Mate in 2
The white P structure requires that all nine missing black men have been captured by Ps, towards the center of the board. One of the two missing white men has been taken on c5 or c6 so that at most one of the two black Ps a and h could leave its original column. Therefore one of the two black Ps a and h had to be promoted (to a1 or to h1) before it could be captured by a white P. Thus one white R had to leave its home square, a1 or h1.
Now that we see that one white R has moved, there is no difficulty showing that the other one could very well have been left undisturbed. So that, the right of castling K-side and of castling Q-side cannot be ruled out, though their conjunction can be.
Therefore you can pick any of the valid solutions: 1. O-O (2. Rf6#) and 1. O-O-O (2. Rd6# or 1 ... Qd3 2. Nxc5#), though you can't say that the problem has two solutions.