The Foundations of Fairness