Search code examples
regexfinite-automata

Why can I transform the regular expression 1*0 + 1*0(0+1)*(0+1) to 1*0(0+1)*?


I can't quite understand, why I can transform the regex 1*0 + 1*0(0+1)*(0+1) to 1*0(0+1)*. Anyone able to help me?


Solution

  • You can use the law of distributivity:

      (1*0)+(1*0(0+1)*(0+1))
    = (1*0ε)+(1*0(0+1)*(0+1))
    = (1*0)(ε+(0+1)*(0+1))
    

    and then apply the definition of the the Kleene star a* = ε+a*a:

    = (1*0)((0+1)*)
    = 1*0(0+1)*