Write a CFG (
which will be ambiguous) generating the words of the form
an0ban1b…anm−1banm, with
m≥1, for which
n0
is equal to the sum of a selection of naturals from
n1,n2,…,nm, i.e.,
n0=∑i∈Ini where
I⊆{1,…,m}. Note that, in
particular, the selection might be empty, and therefore a word where
n0 is
0 is necessarily correct.