The Algebraic Foundations of Mathematics