Optimal Transport I: Foundations