[Math] Generating series of binary strings that don’t contain substring $1100$

generating-functionsregular expressions

I am working on a combinatorics assignment and one of the questions that is asked is

Find the generating series of binary strings of length $n$ that do not contain the substring $1100$.

I started by saying: Let $S$ be the set of all binary strings with no occurences of substring $1100$. Then $S = 0^*(1\{e, 0, 10\})^*$.

However, I'm unsure as to whether this set $S$ is the correct one. If it is correct, I can find the generating series, but I would like clarification as to whether this is the correct set.

Best Answer

I think the strings can be defined out of two type of "words".

$a=(100^*)\qquad 10,100,1000,10000,...$

$b=(111^*0)\qquad 110,1110,11110,111110,...$

The criterion is to split the string where a one occurs just after a zero.

  • a one followed by a zero, can be followed by as many zeroes as we want, this is $a$
  • a one followed by at least another one should avoid the $1100$ pattern, thus it can be followed by just another single zero, this is $b$.

So since $a$ and $b$ are starting with $1$ the $1100$ substring cannot be produced.

$\color{green}{0000}\color{red}110\color{red}10\color{red}110\color{red}1000 \color{red}1000\color{red}10\color{red}10\color{red}11110\color{red}100 \color{red}1111110\color{red}1110\color{red}1000\color{red}100\color{red}111110\color{red}100\color{red}100\color{red}10\color{red}110 \color{red}100\color{red}100000\\\color{red}110\color{red}10\color{red}100000 \color{red}10000\color{red}111110\color{red}110\color{red}10\color{red}10 \color{red}110\color{red}110\color{red}100\color{red}11110\color{red}110 \color{red}100\color{red}1110\color{red}1110\color{red}110\color{red}10\color{blue}{1111111}$

Thus we have $\{a,b\}^*$

To complete the representation we also have to take care of:

  • the prefix in green, which are leading zeroes $(0^*)$
  • the suffix in blue, which are trailing ones, $(1^*)$

Note, we do not have to care about trailing zeroes, because it is already accounted into $a$, and we also do not have to care about a possibly ultimate zero because it is already accounted in $b$.

To arrive to $S=0^*\{(100^*),(111^*0)\}^*\,1^*$

I hope I have made no mistake, this is a bit complicated to deal with all the cases.


So if I have understood what a generating function for a regexp is, it should be: $g(x)=\left(\dfrac 1{1-x}\right)\left(\dfrac 1{1-\left(\left(\dfrac {x^2}{1-x}\right)+\left(\dfrac{x^3}{1-x}\right)\right)}\right)\left(\dfrac 1{1-x}\right)=\dfrac 1{(1-x)(1-x-x^2-x^3)}\\\phantom{g(x)}=\dfrac 1{1-2x+x^4}$