Extending Mechanics to Minds: The Mechanical Foundations of