Simplify $R:=0^*+0^*1\left(1+000^*1\right)^*0^*$

118 Views Asked by At

I'm trying to simplify the following REGEX:

$$R:=0^*+0^*1\left(1+000^*1\right)^*0^*$$

$R$ is the result of transforming a GNFA that recognizes $L:= \{w \in \{0,1\}^* | \left(\forall \ i \in \left[1,|w|-2\right]\cap \mathbb{N}\right)\ w_iw_{i+1}w_{i+2} \neq 101\}$

I already know that there exists $R':=0^*\left(1+000^*1\right)^*0^*$ such that $L(R)=L(R')=L$

Any hints?

1

There are 1 best solutions below

3
On BEST ANSWER

$$R:=0^*+0^*1\left(1+000^*1\right)^*0^*$$ $$R=0^*+\left(\epsilon + 00^*\right)1\left(1+000^*1\right)^*0^*$$ $$R=0^*+\left(\epsilon + 0\left(\epsilon + 00^*\right)\right)1\left(1+000^*1\right)^*0^*$$ $$R=0^*+\left(\epsilon + 0+ 000^*\right)1\left(1+000^*1\right)^*0^*$$ $$R=0^*+\left(1 + 01 + 000^*1\right)\left(1+000^*1\right)^*0^*$$

By the commutativity of $+$ in $\{0,1\}^*$ $$R=0^*+\left(1 + 000^*1 + 01\right)\left(1+000^*1\right)^*0^*$$

By the associativity of $+$ in $\{0,1\}^*$ $$R=0^*+\left(\left(1 + 000^*1\right) + 01\right)\left(1+000^*1\right)^*0^*$$

Since the concatenation is distributive over the union, then

$$R=0^*+\left(1 + 000^*1\right)\left(1+000^*1\right)^*0^* + 01\left(1+000^*1\right)^*0^*$$

$$R=\left( \epsilon +\left(1 + 000^*1\right)\left(1+000^*1\right)^*\right)0^* + 01\left(1+000^*1\right)^*0^*$$

$$R=\left(1+000^*1\right)^*0^* + 01\left(1+000^*1\right)^*0^*$$

$$R=\left(\epsilon + 01 \right)\left(1+000^*1\right)^*0^*$$