From an abstract point of view (i.e., forgetting about the hardware
limitations), programming is like proving a theorem in a constructive way
(i.e., constructing an actual solution to the problem). That actually is the
fundamental reason why software, like mathematics, should not be patentable.
The abstract problem is instantiated in a way that makes it solve *your*
particular problem. It is crunching *your* numbers. You deserve control over
it. All four freedoms.
As for the function declarations, I agree. An API should never be
copyrightable. At least for interoperability purposes.