On the functional equation of dynamic programming