0% found this document useful (0 votes)
14 views15 pages

Lecture 5

The document discusses deterministic finite automata (DFA), including definitions, examples of DFAs for different languages, applications of DFAs, and properties of DFAs such as transition functions.

Uploaded by

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

Lecture 5

The document discusses deterministic finite automata (DFA), including definitions, examples of DFAs for different languages, applications of DFAs, and properties of DFAs such as transition functions.

Uploaded by

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

Finite Automata

DETERMINISTIC FINITE AUTOMATA (DFA)


Deterministic Finite Automaton (DFA)

 An informal definition
o A diagram with a finite number of states represented by circles
o An arrow points to one of the states, the unique start state
o Double circles mark any number of the states as accepting states

a
A B A → aB
Deterministic Finite Automaton (DFA)

a
A B A→aB

Start Final
Finite Automaton (FA)

 For every state, for every symbol in Σ, there is exactly one arrow
labeled with that symbol going to another state (or back to the
same state).
 Given any string over Σ, a DFA can read the string and follow its
state-to-state transitions.
 At the end of the string, if it is in an accepting state, we say it
accepts the string. Otherwise it rejects.
 The language defined by a DFA is the set of strings in Σ * that it
accepts.
Deterministic Finite Automaton (DFA)

is the transition function


A function (q,a) that takes the current state q and next input symbol a, and
returns the next state
Deterministic Finite Automaton (DFA)

 Example1:
 This DFA defines {xa | x {a,b}*}
 Formally, M = (Q, Σ, , q0, F), where
 Q = {q0,q1}
a b
 Σ = {a,b} Give the transition table
q0 q1 q0
 F = {q1}
q1 q1 q0
 Start sate q0
 (q0,a) = q1, (q0,b) = q0, (q1,a) = q1, (q1,b) = q0
 We could just say M = ({q0, q1}, {a,b}, , q0, {q1})
Deterministic Finite Automaton (DFA)

 Example2:
 Q = {q0 , q1 ,q2},
 Σ = {a,b,c}
 Start sate q0
a b c
 F = {q2}
q0 q0 q0 q1
q1 q1 q1 q2
q2 q2 q2 q2

 Since δ is a function, at each step M has exactly one option.


Deterministic Finite Automaton (DFA)

 Example3:

 Which of the string acccb and aac accepted by Machine M ???


acccb
• Ⱶ [q0 , acccb]
• Ⱶ [q0 , cccb]
• Ⱶ [q1 , ccb]
• Ⱶ [q2 , cb]
• Ⱶ [q2 , b]
• Ⱶ [q2 , λ]
accepted
Deterministic Finite Automaton (DFA)

 Example3:

aac
• Ⱶ [q0 , aac]
• Ⱶ [q0 , ac]
• Ⱶ [q0 , c]
• Ⱶ [q1 , λ]
rejected

Accepts those strings that contain at least two c’s


Finite Automaton (FA)

 Example4:
Give finite automata for the set of strings over {a, b, c } which all the a’s precede
the b’s, which in turn precede the c’s. without the null string .
a+b+c+

 G: q0 → a q1
q1 → a q1 / b q2
q2 → b q2 / c q3
q3 → c q3 / λ
Deterministic Finite Automaton (DFA)

 Example5:
Give finite automata for the set of strings over {a, b,}
i) that contain bb. ii) that contain bbb

i) that contain bb. (a U b)* bb (a U b)*


Deterministic Finite Automaton (DFA)

 Example5:
Deterministic Finite Automaton (DFA)

 DFA Applications
We have seen how DFAs can be used to define formal
languages. In addition to this formal use, DFAs have
practical applications. DFA-based pieces of code lie at the
heart of many commonly used computer programs.
Deterministic Finite Automaton (DFA)

 DFA Applications
 Programming language processing
• Scanning phase: dividing source file into "tokens" (keywords, identifiers, constants, etc.),
skipping whitespace and comments

 Command language processing


• Typed command languages often require the same kind of treatment

 Text pattern matching


• Unix tools like awk, egrep, and sed, mail systems like ProcMail, database systems like
MySQL, and many others
Deterministic Finite Automaton (DFA)

 More DFA Applications

 Signal processing
• Speech processing and other signal processing systems use finite state models to
transform the incoming signal

 Controllers for finite-state systems


• Hardware and software
• A wide range of applications, from industrial processes to video games

You might also like