Mathematical Foundations of Reinforcement Learning