0

The FA I tried

This is the simple finite automata I tried, what am I doing it wrong?

ndnenkov
  • 35,425
  • 9
  • 72
  • 104
user
  • 53
  • 2
  • 7

4 Answers4

4

This matches (ab)^n, not a^nb^n. Aka ababab, not aaabbb.

ndnenkov
  • 35,425
  • 9
  • 72
  • 104
0

The b transition leads to a final state which halts the machine. Your machine will only halt if given a sequence of 'ab' of length 1 or more.

Pétur Ingi Egilsson
  • 4,368
  • 5
  • 44
  • 72
  • I think the machine is halted only if the input sequence ends/ delimiter is identified.am i wrong? – user Dec 28 '15 at 06:20
0

The language a^n b^n where n>=1 is not regular, and it can be proved using the pumping lemma. Assume there is a finite state automaton that can accept the language. This finite automaton has a finite number of states k, and there is string x in the language such that n > k. According to the pumping lemma, x can be decomposed such that x=uvw, and any finite automaton that accepts x must also accept uv*w. v is non-empty and can be made to consist of only a's or only b's since n > k. Let v consist of only a's. If the finite automaton accepts x = uvw, it must also accept x = uvvw, which has more a's than b's and is not of the form a^n b^n. This is a contradiction, so a^n b^n cannot be a regular language.

SwiftMatt
  • 949
  • 1
  • 9
  • 19
0

This matches (ab)^n, not a^nb^n.

What you're looking for is Pumping lemma for regular languages.

Examples:
Let L = {a^mb^m | m ≥ 1}.
Then L is not regular.
Proof: Let n be as in Pumping Lemma.
Let w = a^nb^n.
Let w = xyz be as in Pumping Lemma.
Thus, xy^2z ∈ L, however, xy^2z contains more a’s than b’s.

Divyesh Jesadiya
  • 1,105
  • 4
  • 30
  • 68