Proofs can be represented as programs, not the other way around. Also, USA allows for algorithm parents, and algorithms are maths.
While I agree with you, your reasoning is not correct.
Judges and Justices are not that precise. They aim to preserved public order before anything else. If a whole industry is based on a questionable interpretation of patent, they is a lot of chances that judges would agree on it.
Even in countries where you could not patent algorythm, industries patent the documentation, the "software design", the brand name, the illustrations used, and aggregates everything together, to say they own it. And it works.