Can the impossibility of perpetual motion be expressed as a mathematical theorem? What are some relevant books or other sources?
Yes. If by 'perpetual motion' you mean a machine which runs for ever which produces some nonzero output power (that is, you can extract energy from it at some nonzero rate), then to prove it impossible you merely need to prove energy conservation, and this follows as a result of Noether's theorem as a result of the invariance of the laws of physics under time translation.
In other words, if the laws of physics remain the same over time, then such a machine can not exist.