[ 0/1 Knapsack] Book example 5.6

Let gj(y) be the value of an optimal solution to KNAP(j+1,n,y). Clearly, g0(m) is the value of an optimal solution to KNAP(l,n,m). The possible Decisions for xi are 0 and 1 (D1 = {0,1}). From the principle of optimality it follows that

Now, while the principle of optimality has been stated only with respect to the initial state and decision, it can be applied equally well to intermediate states and decisions. (example 5.10)