What would the notation for this binary string look like?

95 Views Asked by At

Every block of 1's of length $\ge 4$ cannot be followed by a block of 0's of length $\ge 4$, and any block of 1s of length 1, 2 or 3 must be followed by a block of 0s whose length is congruent to 1 mod 4.

The answer I came up with is this: $$\{0\}^*\{(1111)(1)^*\{0, 00, 000\}, \{1, 11, 111\}0(0000)^*\}^*$$

The problem is, it cannot produce some strings like $11111$. What would the proper notation look like.

1

There are 1 best solutions below

2
On BEST ANSWER

It appears to me that you’re just missing the possibility of terminating with a string of ones. You can fix that by adding one more piece:

$$\{0\}^*\{(1111)(1)^*\{0,00,000\},\{1,11,111\}0(0000)^*\}^*\{(1111)(1)^*,\lambda\}$$

Here $\lambda$ is the empty word.