The "principal if least action" is a physics principle not a mathematics principle.

What you talking about is the "Calculus of Variations" but I note that, according to Wikipedia, Calculus of variations can be used to prove the "principle of least action"- under reasonable physical assumptions: Principle of least action - Wikipedia, the free encyclopedia