You are on page 1of 24

Introduction to Finite Automata

Types of FA:
• Deterministic Finite Automata (DFA)
- The machine can exist in only one state at any given time

• Non-deterministic Finite Automata (NFA)


- The machine can exist in multiple states at the same time
Deterministic Finite Automata
Outline:
• Formal Definition
• How a DFA processes strings?
• Simpler notations for DFA
• Example of DFA
• Extending the transition function to strings
• Language of a DFA
Deterministic Finite Automata
Formal Definition of DFA:

For a given input


symbol, there will
be unique transition
from a state. Such
automaton is called
deterministic finite
automaton.
Deterministic Finite Automata (cont.)
How a DFA Processes Strings?
• Input: a string w=a1a2…an in Σ*
• Question: Is w acceptable by the DFA?
Deterministic Finite Automata (cont.)
Simpler notations for DFA
• There are two notations for describing automata
1) Transition diagram and 2) Transition table
Transition Diagram: A transition diagram for a DFA M = (Q, Σ, δ, q0, F) is a graph defined as
follows:
• For each state in Q there is a node.
• For each state q in Q and each input symbol a in Σ, let δ(q, a) = p. Then the transition
diagram has an arc from node q to node p, labeled a. If there are several input symbols that
cause transitions from q to p, then the transition diagram can have one arc labeled by the list
of these symbols.
• There is an arrow into the start state q0, labeled start.
• Nodes corresponding to accepting states (those in F) are marked by a double circle. States
not in F have a single circle.
Deterministic Finite Automata (cont.)
Simpler notations for DFA (cont.)
• There are two notations for describing automata
2) Transition table: A transition table is a conventional tabular representation of a function
like δ that takes two arguments and returns a value. The rows of the table correspond to the
states, and the columns correspond to the inputs. The entry for the row corresponding to state
q and the column corresponding to input a is the state δ(q, a)
Deterministic Finite Automata (cont.)
Example #1:
a b
Deterministic Finite Automata (cont.)
Example #1 (cont.): q0 a q1 b q2

b a
q3

a, b
a b
Deterministic Finite Automata (cont.)
Example #1 (cont.): q0 a q1 b q2

b a
q3

a, b
Deterministic Finite Automata (cont.)
Extension of δ to Strings
Extended transition function (Delta cap or Delta hat) describes what happens when we start
in any state and follow any sequence of inputs.
Deterministic Finite Automata (cont.)
Extension of δ to Strings (cont.)
We define by induction on the length of the input string as follows:
Deterministic Finite Automata (cont.) a b
Extension of δ to Strings (cont.) q0 a q1 b q2
The check involves computing (q0, w) for each prefix w of
aaabb, starting at ε and going in increasing size. b a
q3

a, b
Deterministic Finite Automata (cont.)
Language of a DFA
Nondeterministic Finite State Automata (NFA)
Nondeterministic Finite State Automata (cont.)
• An NFA is a five-tuple: NFA M = (Q, Σ, δ, q0, F)

Q A finite set of states


Σ A finite set of input symbols or input alphabet
q0 The initial/starting state, q0 is in Q
F A set of final/accepting states, which is a subset of Q
δ A transition function, which is a mapping function from Q x Σ  2Q

Each state can have zero, one, or more transitions out labeled by the same symbol
Nondeterministic Finite State Automata (cont.)
Example #1:
Nondeterministic Finite State Automata (cont.)
Example #1 (cont.):
Nondeterministic Finite State Automata (cont.)
Example #1 (cont.): a
b
a b
q0 q1 q2
Nondeterministic Finite State Automata (cont.)
Example #1 (cont.): a
b
a b
q0 q1 q2
Nondeterministic Finite State Automata (cont.)
Extension of δ to Strings
Nondeterministic Finite State Automata (cont.)
Extension of δ to Strings (cont.)
We define by induction on the length of the input string as follows:
Nondeterministic Finite State Automata (cont.)
Extension of δ to Strings (cont.) a b
We use to describe how the string aaabb is a b
q0 q1 q2
processed by above NFA.
Nondeterministic Finite State Automata (cont.)
Extension of δ to Strings (cont.) a b
a b q2
q0 q1
Nondeterministic Finite State Automata (cont.)
The Language of an NFA

You might also like