Symmetric Discrete Optimal Control and Deep Learning