SMS dit: The mathematical theory of optimal processes