All the heavylifting is improving the optimal substructure lemma, that gave us the correctness of our occurrence given that our magic formula is correct and we're just applying it systematically, correctness of the dynamic programming algorithm follows in a straightforward way, just by induction. 