The Mathematics of Thought