Stochastic Adaptive Optimization and Martingales