1
$\begingroup$

I'm having trouble understanding the wording of one of my homework questions. Since this question appears early in the chapter, I have a feeling that I'm misinterpreting it.

Give a finite automaton that that accepts the following language: The language over $\{a, b\}$ of any even number of $a$'s and any odd number of $b$'s.

I'm having trouble with the usage of "and". Is it asking for an FA that accepts any string that is either an even number of $a$'s or an odd number of $b$'s, e.g. $aa$, $bbb$, $aaaa$, etc, but not accept strings like $aabbb$, $abbab$.

Or, is it asking for an FA that accepts any string that contains an even number of $a$'s or an odd number of $b$'s, e.g. $aabbb$, $ababb$, etc.

The first case is relatively simple, but I've been struggling with the second. I haven't even managed to convince myself that it is a regular language (because I haven't been able to come up with a regular expression that matches it).

My questions: Which interpretation seems most likely. Is the second case a regular language, if so, give a regular expression that recognizes it.

  • 1
    I understand this that an even number of $a$'s and odd number of $b$'s in any order are valid, e.g., $aabbababbbaabbb$ becasue that's six $a$'s and nine $b$'s2017-02-04
  • 0
    @HagenvonEitzen that was my initial interpretation as well, but is that regular?2017-02-05
  • 0
    All somewhat feasible interpretations (either an even number of $a$'s or an odd number of $b$'s; an even number of $a$'s followed by an odd number of $b$'s; an even number of $a$'s mixed with an odd number of $b$'s) are regular and it is straightforward to write down automata. (The first interpretation needs five states, the others need four states)2017-02-05

1 Answers 1

1

The second interpretation seems adequate here like the comment mentionned it. It's not very difficult though if you consider a modulo 2 calculus for number of a's or b's. There are only four possibilities so a four state automata is perfect to do the job: enter image description here