Earlier quoted context omitted.
But that's the whole point, patents are awarded to things deemed inventions not things deemed discoveries. If you can't delineate between the two you can't say what is and what is not patentable. Fourier analysis couldn't have been patented, despite numerous commercial applications. It's just the patent system is setup to only reward low-level innovation, so it arbitrarily excludes research level innovation by termin…
Yes, what is patented is some commercial application of some knowledge, and that application is the invention. It doesn't matter whether the knowledge itself is invented or discovered. When an algorithm is patented, we're no more patenting math than we're patenting Newton's laws when a car brake is invented. We're patenting a commercial application of either, and that must be the invention.
Also, algorithms are a bad example, as they are just mathematical functions, i.e. "abstract ideas." They should not be patentable. Although I realize patent law is not actually logically consistent.