We have a set $S_n$ containing $n$ binary values, lets say $S_6$ = [0,0,1,1,0,1].
I want to make sure that only one consecutive 0 may occur between the 1's.
$P_6$ = [1,0,1,1,0,1] Allowed.
$Q_6$ = [1,1,0,0,0,0] Allowed.
$U_6$ = [1,1,0,0,0,1] Not allowed.
The problem can be divided into two parts:
- Look for occurrence of sequence [1,0,0].
- If found, make sure that the sum of all the consecutive elements adds up to 0.
How do you express this in mathematical terms?