I need help shortening this regex

I'm currently trying to get regular expressions for school and have to work on a task to shorten this regular expression:

r = 0(e + 0 + 1)* + (e + 1)(1 + 0)* + e

where e is the empty word epsilon.

So far I got to this:

r = 0(0 + 1)* + 1(1 + 0)* + e

subject to the rule

r* = (e + r)*

However, I do not know how to proceed. If this were not for wedge star operators, I could use the distribution law, but this will not apply here. I cannot find a suitable law to continue this regular expression.

Any helpful tips?

Edit:

I think I took another step by forming r on

r = 0(1 + 0)* + 1(1 + 0)* + e

and then the ability to combine it with

r = (0 + 1)(0 + 1)* + e

Is it correct?

In addition, we could say

r = (0+1)*

which should be the final form

+4
source share
1

, , .

r = 0(e + 0 + 1)* + (e + 1)(1 + 0)* + e

e, ,

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

0 followed by any number of 0 or 1 1 followed by any number of 1 or 0. , 0, - 1. , 0 1. - , , , one or more ( +), ,

r = [01]+

at least one 0 or 1 repeated any number of times.

.

+1

Source: https://habr.com/ru/post/1609351/


All Articles