Prove weighted independent set DP has optimal substructure

Prove the optimal-substructure recurrence for a maximum-weight independent set on a path. The input is JSON of the form { "weights": number[] }. For a prefix ending at vertex i, an optimum either skips i, or takes i and combines it with an optimum for the prefix ending at i - 2. Thus, with F(0) = 0 and F(1) = weights[0], prove F(i) = max(F(i - 1), F(i - 2) + weights[i - 1]).

This statement is for a path, not an arbitrary graph. The executable companion computes the maximum weight for the supplied path, but that computation is evidence for examples only and is not a substitute for the proof.

Examples
Input: "{\"weights\":[1,4,5,4]}"
Output: 8
Hints

Prove weighted independent set DP has optimal substructure

Prove the optimal-substructure recurrence for a maximum-weight independent set