0% found this document useful (0 votes)
22 views

Chapter 2 - DFA

This document summarizes key concepts about deterministic finite automata (DFAs) from Chapter 2 of the textbook "Discrete Structures II". It defines DFAs using quintuples and transition functions. Examples are provided to illustrate DFA definitions, transition graphs, accepted languages, and determining if strings are accepted or rejected. The document also discusses that some languages are not regular and cannot be recognized by any DFA.

Uploaded by

tamerkobba12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Chapter 2 - DFA

This document summarizes key concepts about deterministic finite automata (DFAs) from Chapter 2 of the textbook "Discrete Structures II". It defines DFAs using quintuples and transition functions. Examples are provided to illustrate DFA definitions, transition graphs, accepted languages, and determining if strings are accepted or rejected. The document also discusses that some languages are not regular and cannot be recognized by any DFA.

Uploaded by

tamerkobba12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 13

MTH 307: Discrete Structures II

(Theory of Computation)
Chapter 2: Finite State Automata
Part 1 - DFA
Dr. Maroun Abi Assaf

1
Chapter 2 Finite State Automata
•Types of Finite State
Automata
• Deterministic automata (DFA): each move is uniquely determined.
Nondeterministic automata (NFA): the moves are not uniquely determined.
• An automata is called an accepter if its output response is limited to “yes” or “no”.
• An automata is called a transducer if it is capable of producing strings of symbols
as output.
2.1 Deterministic Finite State Automata
• Rule 1: At every state, there should be a transition for every
character of the alphabet
•Give two FSA examples (deter vs non-deter) with alphabet {a,b}

•Rule 2: At every state, there should not be two transitions with the
same character.
•Give two FSA examples (deter vs non-deter) with alphabet {a,b}

•Rule 3: There should not be epsilon transitions or empty transitions.


•Give two FSA examples (deter vs non-deter) with alphabet {a,b}
Definition 2.1
A deterministic finite state automaton or dfa
is defined by the quintuple
M  (Q, ,  , q0 , F )
where
Q is a finite set of internal states,
 is a finite set of symbols called the input
alphabet,
 : Q    Q is a function called
th e transition function,
q 0  Q is the initial state,
F  Q is a set of final states.

•Give a DFA example with alphabet {a,b}


• Transition graphs
Deterministic finite state automaton
M  (Q,, δ, q0 , F)
Transition
0 0 1 function: δ ( q1 ,1)  q 2

q0 q1 q2 0
1
1
Initial state Final state

Example 2.1
The above transition graph represents the dfa
M  ({q0 , q1 , q2 },{0,1},δ , q0 , {q1}),
where δ is given by It accepts 01, 101,0111,11001,….
δ (q0 ,0)  q0, δ (q0 ,1)  q1,
But not 00, 100,1100,….
δ (q1 ,0)  q0, δ (q1 ,1)  q2,
δ (q2 ,0)  q2, δ (q2 ,0)  q1,
To accept a string: all the input string is scanned and the last state is accepting

To reject a string: all the input string is scanned and the last state is non-
accepting

Definition 2.2
The language accepted by
a dfa M  (Q,,  , q0 F ) is
the set of all string on Σ
accepted by M. In formal notation,
L(M)  {w  * :  * (q0 , w)  F}.

Let w  a1a2  an .
If  (q1 , a1 )  q2 ,  (q2 , a2 )  q3 , ,  (qn , an )  qn 1 ,
then we write δ * (q1,w)  qn 1.
Especially,δ * (q,ε )  q.
Example 2.2 Consider the dfa in the following transition graph.
What is the accepted language?
a

q0 q1 q2 a,b
b a,b
Solution: Trap state

L  {a nb: n  0}
Example 2.3 Find a dfa that recognizes the set of all strings
on   {a, b} starting with the prefix ab.

Solution:

q0 a q1 b q2 a,b
b Trap state

q3 a,b
Example 2.4 Find a dfa that recognizes the set of all strings
on {0,1}, except those containing the substring 001.

1 0 0,1
1

ε
0 1 001
0 00
0

1 0 0,1
1
or
q0 q1 0 q2 1 q3
0
Definition 2.3 A language L is called regular if and only if there
exists some deterministic finite accepter M such that L = L(M).

Example 2.5 b a
Show that language L={awa: w  {a, b}* is regular.
a
q0 q2 a q3
b
b
a,b
Example 2.6 q1
Let L be the language in Example 2.5. Show that L  {aw1aaw2 a} is regular.
2

b a b a

a
q0 q2 a q3 a
q4 a q5
b b
b
a,b
q1
Example 2.6 Given the following DFA:

a, b

q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4

Show if the following strings are accepted or rejected:


-abba
-abb
-aba
-epsilon
Example 2.7 Given the following DFA:

a a, b

q0 b q1 a, b q2

Show if the following strings are accepted or rejected:


-aab
-bab
• A language that is not recognized by DFA

• Can you think of a language that is not regular?

• A language that is not regular is a language that cannot be recognized by any


DFA.

You might also like