First-Principles AI Foundations