Mathematical Foundations for AI and Machine Learning