-1

I'm completely new to finite automata and kind of struggling to understand the topic.

I'm able to draw simple ones but I have a practice question that asks to:

Design a Non- Deterministic Finite Automata that accepts ∑={0,1}. The Non-Deterministic Finite Automata should be able to determine all strings that have at most two zeroes and at least two ones.

How do I do this?

Nisarg Shah
  • 14,151
  • 6
  • 34
  • 55
John Diggle
  • 21
  • 1
  • 7

1 Answers1

0

Here is a minimal DFA for the language (minimal DFAs are DFAs are NFAs):

              0         0          0
----->(0,0)----->(1,0)----->(2,0)-------+
        |          |          |         |
        | 1        | 1        | 1       |  __
        |          |          |         | /  \
        V    0     V    0     V    0    V V   | 0, 1
      (0,1)----->(1,1)----->(2,1)----->dead--/   
        |          |          |         ^
        | 1        | 1        | 1       |
        |          |          |         |
        V    0     V    0     V    0    |
      (0,2)----->(1,2)----->(2,2)-------+
     /  ^       /  ^       /  ^
  1 |   |    1 |   |    1 |   |
     \_/        \_/        \_/

The idea is that state (x,y) is visited after seeing x zeroes and y ones; if you've seen two zeroes and you see another, the string is rejected by transitioning to a dead state; if you've seen two ones, you can see as many more as you like. States of the form (x,2) are accepting.

Patrick87
  • 27,682
  • 3
  • 38
  • 73
  • @JohnDiggle The 2s you see are just part of the names of states. All transitions are labeled with either 0 or 1. (0,2) is the name of a state and has no relation to the language's alphabet. You could rename all of these states q0, q1, ..., q10 and the machine would behave exactly the same. I only named the states like this in order to try to make it clear *why* the transitions are what they are. It looks like I may not have succeeded in that. – Patrick87 Nov 29 '17 at 15:25