Let's take a look at a minimal example:
$$P = \frac 1 2\left[\begin{array}{ccc|ccc}
2&1&0&0&0&0\\
0&0&1&0&0&0\\
0&1&1&\color{red} 2&0&0\\\hline
0&0&0&\color{red} \uparrow&1&0\\
0&0&0&0&0&1\\
0&0&0&0&1&1
\end{array}\right]$$
- Basic "building blocks" as in the answer here on the "diagonal" we can easily implement with Kronecker product with $\bf I$, the "storage states" are the 2s.
- Now let but the upper leftmost block have storage state displaced 1 row to the block above.
- This way each displacement will slow down (1 lower exponent than the previous part of the chain).
Any elegant way to avoid the displacement latency will be welcome!
Crazy checker (first time we get non-zero prob for 1 and 2 resp):
$${\bf v} = \left[\begin{array}{cccccc}0&0&0&0&0&1\end{array}\right]^T$$
$${\bf P}^2{\bf v} = \left[\begin{array}{cccccc}
0&0&0&0.25&0.25&0.5\end{array}\right]^T\\{\bf P}^5{\bf v} = \left[\begin{array}{cccccc}0.0625&0.125&0.3125&0.09375&0.15625&0.25\end{array}\right]^T$$
The chance for 2 heads in a row is $1/4 = 0.25$
The chance for 4 heads in a row is $1/16 = 0.0625$
So assuming $H{\bf H}H{\bf H}$ counts as two heads in a row twice then the solution works!
We can also calculate the probability of not having any two H in a row in a string of 2 and 5 respectively, and if we do, we do indeed get the sum of the two last states: $$1-\frac 1 4\approx 0.25+0.5 = 0.75 \\ 1-\frac {19}{32} \approx 0.15625+0.25= 0.40625$$
The systematic construction of matrices for arbitrary $k,l,m$ should now be obvious.