Search code examples
regular-languagecomputation-theory

Finding a complement of a regular language


Could you help me please to find a complement of a language, which ends with abab - (a|b)*abab (over an alphabet {a,b})

I guess, the complement must contain all string, that don't end with abab. One can try to do it with Rij-Algorithm after building a DFA for complement of (a|b)*abab, but pleaseee, help me to understand how it works without Automaton and Rij (because that Automaton has 5 states).

Ok, the words are not allowed to end with abab. There are 24 ways for four letters of a's and b's at the end. Okay, abab must be erased so there are 15 combinations. Does it mean, that the complement-language is (a|b)*.(union of all those combinations of a's and b's without abab)? But does (a|b) still stay the same at the beginning?

Help me please to understand this.


Solution

  • Maybe I quiet don't understand you, but isn't it much simplier. I'e (a|b)*(a|bb|aab|bbab) or event (a|b)*(a|(b|(a|bb)a)b)?

    P.S. Don't forget that there is words shorter than abab and all of them should be included too. I.e. (a|b){0,3} (where {0,3} denotes amount of repeats [0; 3])