295695

Counting strings containing specified appearances of words

$$Lin(X + Y + C(X,Y))$$

$$C = tYXY \cdot Lin (tXY))$$

I have studied for a while the Goulden-Jackson method and I find it kind of bully.

Imagine there is a soup S and here comes a guy throwing a potato 101 in the soup. "Fellows, there is *at least* one potato in the soup !" says, then he throws another potato in the soup. "Fellows, there are *at least* two potatoes in the soup" ! Then he applies the inclusion-exclusion principle $$N(t)= E(t+1)$$ and he gets the *exact* potatoes amount there were in the soup.

The generating functions for the language of the above automaton is given by solving.

Here, the power of $$x$$ counts the length of a word and the power of $$t$$ the number of added 101's

The "at least" generating function is

$$N(x,t) = S(x,t) = {1-tx^2 \over 1-2x-x^2t+x^3t}$$

The "exact" generating function is

$$E(x,t) = N(x,t-1)= {1+x^2-tx^2 \over 1-2x+ x^2 -x^3 -x^2t - x^3t}$$

$$\frac{1}{1 - 2x - \frac{x^3(y-1)}{1 - x^2 (y-1)}}$$