I'm trying to understand why exactly the 0/1 knapsack problem actually has the optimal substructure property.
Let $E$ be the set of items to consider and $v$ and $w$ the value and weight functions defined over $E$.
Now, suppose that, among all solutions weighing at most $W$, $S \subseteq E$ is the best solution. How can I prove that $S - \{x\}$ is the best solution weighing at most $W - w(x)$, considering the set of possible items as $E - \{x\}$? I tried to suppose that $S' \subseteq E - \{x\}$ is a better solution (that is, $v(S') > v(S - \{x\})$ and $w(S') \leq W - w(x)$), but I get stuck when I try to find a contradiction.
Any help?
Thanks in advance!