Deterministic Finite Automata (DFA)

21
Automata Theory and Logic Deterministic Finite Automata (DFA) A TUTORIAL BY ANIMESH CHATURVEDI AT INDIAN INSTITUTE OF TECHNOLOGY INDORE (IIT-I)

Transcript of Deterministic Finite Automata (DFA)

Page 1: 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 )

Page 2: Deterministic Finite Automata (DFA)

Deterministic Finite Automata (DFA)

Page 3: 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

Page 4: Deterministic Finite Automata (DFA)

Example: Testing Membership

4

Start

1

0

A CB1

0 0,1

0 1 0 1 1

Nextsymbol

Currentstate

Page 5: Deterministic Finite Automata (DFA)

Example: Testing Membership

5

Start

1

0

A CB1

0 0,1

0 1 0 1 1

Nextsymbol

Currentstate

Page 6: Deterministic Finite Automata (DFA)

Example: Testing Membership

6

Start

1

0

A CB1

0 0,1

0 1 0 1 1

Nextsymbol

Currentstate

Page 7: Deterministic Finite Automata (DFA)

Example: Testing Membership

7

Start

1

0

A CB1

0 0,1

0 1 0 1 1

Nextsymbol

Currentstate

Page 8: Deterministic Finite Automata (DFA)

Example: Testing Membership

8

Start

1

0

A CB1

0 0,1

0 1 0 1 1

Nextsymbol

Currentstate

Page 9: Deterministic Finite Automata (DFA)

Example: Testing Membership

9

0 1 0 1 1

Nextsymbol

Currentstate

Start

1

0

A CB1

0 0,1

Page 10: Deterministic Finite Automata (DFA)

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

Page 11: Deterministic Finite Automata (DFA)

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

Computer Science GATE 2009

Page 12: Deterministic Finite Automata (DFA)

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

Computer Science GATE 2009

Page 13: Deterministic Finite Automata (DFA)

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

Computer Science GATE 2011

Page 14: Deterministic Finite Automata (DFA)

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

Computer Science GATE 2011

Page 15: Deterministic Finite Automata (DFA)

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

Page 16: Deterministic Finite Automata (DFA)

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

Page 17: Deterministic Finite Automata (DFA)

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

Page 18: Deterministic Finite Automata (DFA)

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

Page 19: Deterministic Finite Automata (DFA)

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

Page 20: Deterministic Finite Automata (DFA)

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)

Page 21: Deterministic Finite Automata (DFA)