Need Regular Expression for Finite Automata: Even number of 1s and Even number of 0s

前端 未结 3 1497
臣服心动
臣服心动 2020-11-29 03:44

My problem may sounds different to you.

I am a beginner and I am learning Finite Automata. I am googing over Internet to find the Regular Expression for Finite Aut

3条回答
  •  鱼传尺愫
    2020-11-29 04:15

    Let E is the language with even number of a's and even number of b's, and below is the Regular expression for language E.

    [00 + 11 + (01+10)(11+00)(01+10)]

    00 = type1

    11 = type2

    (01+10)(00+11)*(01+10) = type3

    Suppose that we are scanning along a word in the language of E from left to right reading the letters two at a time. First we come to a double 0 (type1), then to a double 1 (type2) , then to another double 0 (type 1 again). Then perhaps we come upon a pair of letters that are not the same. Say, for instance, that the next two letters are 10. This must begin a substring of type3. It starts with an undoubled pair (either 01 or 10), then it has a section of doubled letters (many repetitions of either 00 or 11), and then it finally ends with another undoubled pair (either 01 or 10 again). One property of this section of the word is that it has an even number of 0's and an even number of 1's. If the section started with a 10, it could end with an 01 still giving two 0's and two 1's on the ends with only doubled letters in between. If it started with a 10 and ended with an 01, again, it would give an even number of 0's and an even number of 1's. After this section of type3 we could proceed with more sections of type, or type2 until we encountered another undoubled pair, starting another type3 section. We know that another undoubled pair will be coming up to balance off the initial one. The total effect is that every word of the language of E contains an even number of 0's and an even number of 1's

提交回复
热议问题