The Foundations of Celestial Mechanics