The Statistical Mechanics of k-Satisfaction