0

I am looking for an expression that uniquely determines the following set: $S$ is the set of binary strings such that each block of $0$'s is congruent modulo $3$ to the length of block of $1$'s that follows it (if it exists)...that is, (length of $0$) = (length of $1$) mod $3$.

I am thinking to start from $0^*(\{1\}\{1\}^*\{0\}\{0\}^*)^*1^*$, but soon I realize that, the length of block of $1$ is arbitrary, then I got stuck....Could you please give me some hints?

J.-E. Pin
  • 40,163

1 Answers1

1

Writing the words in the form $0^{n_1}1^{m_1}0^{n_2}1^{m_2} \dotsm$, your condition can be written as $n_k \equiv m_k \bmod 3$ for every $k > 0$. This leads to the followig regular expression $$ \bigl((000)^*(111)^* + (000)^*0(111)^*1 + (000)^*00(111)^*11 \bigr)^* 0^* $$

J.-E. Pin
  • 40,163