The Maximum Principle: Discrete Time