Optimal substructure in DP