Deterministic Finite Automata (DFA)

Post on 11-Apr-2017

100 views 7 download

Transcript of Deterministic Finite Automata (DFA)

Automata Theory and LogicDeterministic Finite Automata (DFA)

A TUTORIAL

BY

ANIMESH CHATURVEDI

AT

INDIAN INSTITUTE OF TECHNOLOGY INDORE ( I IT - I )

Deterministic Finite Automata (DFA)

Representation of DFAM1 = (Q, Σ, δ, q1, F ) whereQ = {q1, q2, q3}, Σ = {0, 1},

the transition function δ is

Final state F = {q2}.

q1 is the start state, and F = {q2}.

0 1

q1 q1 q2

q2 q3 q2

q3 q2 q2

Example: Testing Membership

4

Start

1

0

A CB1

0 0,1

0 1 0 1 1

Nextsymbol

Currentstate

Example: Testing Membership

5

Start

1

0

A CB1

0 0,1

0 1 0 1 1

Nextsymbol

Currentstate

Example: Testing Membership

6

Start

1

0

A CB1

0 0,1

0 1 0 1 1

Nextsymbol

Currentstate

Example: Testing Membership

7

Start

1

0

A CB1

0 0,1

0 1 0 1 1

Nextsymbol

Currentstate

Example: Testing Membership

8

Start

1

0

A CB1

0 0,1

0 1 0 1 1

Nextsymbol

Currentstate

Example: Testing Membership

9

0 1 0 1 1

Nextsymbol

Currentstate

Start

1

0

A CB1

0 0,1

SLIDE BY STEVEN RUDICH: WWW.CS.CMU.EDU/~RUDICH RUDICH0123456789

00,1

00

1

1

1

0111 111

11

1

The machine accepts a string if the

process ends in a double circle

Build a DFAaccepts the set of all strings over {0,1} that end with 00

Computer Science GATE 2009

Build a DFAaccepts the set of all strings over {0,1} that end with 00

Computer Science GATE 2009

Minimal DFADraw a minimal DFA which accepts the same language as a DFA with alphabet ∑ = {a,b} is given below

Computer Science GATE 2011

Minimal DFADraw a minimal DFA which accepts the same language as a DFA with alphabet ∑ = {a,b} is given below

Computer Science GATE 2011

Number of statesDefinition of a language L with alphabet {a} is given as followingL = {ank | k > 0, and n is a positive integer constant}What is the minimum number of states needed in a DFA to recognize L?

Computer Science GATE 2011

Number of statesDefinition of a language L with alphabet {a} is given as followingL = {ank | k > 0, and n is a positive integer constant}What is the minimum number of states needed in a DFA to recognize L?

n+1 states are needed in a DFA to recognize L

Let n = 3 and k=1

3+1 = 4 states

Computer Science GATE 2011

Find missing arksConsider the set of strings on {0,1} in which, every substring of 3 symbols has at most twozeros. For example, 001110 and 011001 are in the language, but 100010 is not. All strings oflength less than 3 are also in the language. Draw the missing arks to complete a partially completed DFA given belowlanguage is shown below.

Computer Science GATE 2012

Find missing arksConsider the set of strings on {0,1} in which, every substring of 3 symbols has at most twozeros. For example, 001110 and 011001 are in the language, but 100010 is not. All strings oflength less than 3 are also in the language. Draw the missing arks to complete a partially completed DFA given below

Missing arksComputer Science GATE 2012

Find missing arksConsider the set of strings on {0,1} in which, every substring of 3 symbols has at most twozeros. For example, 001110 and 011001 are in the language, but 100010 is not. All strings oflength less than 3 are also in the language. Draw the missing arks to complete a partially completed DFA given below

Missing arksComputer Science GATE 2012

Up NextA DFA represent a Regular Expression language

Deterministic finite automata (DFA) and Non-deterministic finite automata (NFA) have sameexpressive power.

Deterministic and non-deterministic finite automata accept exactly the same set of languages.

DFA or NDFA has less expressive power than Deterministic push down automata (DPDA)