SlideShare une entreprise Scribd logo
1  sur  42
WELCOME TO A
JOURNEY TO
CS419

Dr. Hussien Sharaf
Computer Science Department

dr.sharaf@from-masr.com
Dr. Hussien M. Sharaf

NON DETERMINISTIC FINITE AUTOMATA NFA


There is a fixed number of states but we can be in multiple states at one
time.

NFA = “a 5-tuple “ (Q, Σ, , q0, F)

Q A finite set of states
Σ
A finite 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 total function from Q x Σ to 2Q ,
this function:

Takes a state and input symbol as arguments.

Returns a set of states instead a single state as in DFA.
δ: (Q x Σ) –> 2Q -2Q is the power set of Q, the set of all subsets of Q
δ(q,s) is a function from Q x S to 2Q (but not to Q)
2
NFA
A finite automaton is deterministic if
 It has no edges/transitions labeled with
epsilon/lamda.
 For each state and for each symbol in the
alphabet, there is exactly one edge labeled
with that symbol.
Dr. Hussien M. Sharaf

NFA


NFA travels all possible paths, and so it remains in many states at once.
As long as at least one of the paths results in an accepting state, the NFA
accepts the input.

Alphabet = {a }
a

q0

q1

a

q2

a

q3
4
Dr. Hussien M. Sharaf

NFA
Alphabet =

{a }

Two choices

a

q0

q1

a

q2

a

q3
5
Dr. Hussien M. Sharaf

NFA
Alphabet =

{a }

Two choices

a

q0

q1

a

q2

No transition

a

q3

No transition

6
Dr. Hussien M. Sharaf

NFA
An NFA accepts a string:
if there is a computation of the NFA
that accepts the string

i.e., all the input string is processed and
the automaton is in an accepting state

7
Dr. Hussien M. Sharaf

Acceptance Example 1

NFA
a

a

a

q0

q1

a

q2

a

q3
8
Dr. Hussien M. Sharaf

First Choice

NFA
a

a

a

q0

q1

a

q2

a

q3
9
Dr. Hussien M. Sharaf

First Choice

NFA
a

a

All input is consumed

a

q0

q1

a

q3

a

q2

“accept”
Dr. Hussien M. Sharaf

Second Choice

NFA
a

a

a

q0

q1

a

q3

a

q2
Dr. Hussien M. Sharaf

Second Choice

NFA
a

a

Input cannot be consumed

a

q1

a

q2

Automaton Halts

q0

a

q 3 “reject”
Dr. Hussien M. Sharaf

NFA

aa is accepted by the NFA:
“accept”

a

q0

q1

q2

a

q0

a

q3

because this
computation
accepts aa

a

q1

a

q2

a

q3

“reject”

this computation
is ignored
13
Dr. Hussien M. Sharaf

NFA
An NFA rejects a string:
if there is no computation of the NFA
that accepts the string.
For each computation:

• All the input is consumed and the
automaton is in a non final state

OR
• The input cannot be consumed
14
Dr. Hussien M. Sharaf

NFA

a

is rejected by the NFA:

“reject”

a

q0

q1

a

q2

a

q0

a

q 3 “reject”

q1

a

q2

a

q3

All possible computations lead to rejection
15
Dr. Hussien M. Sharaf

NFA
aaa is rejected by the NFA:
“reject”

a

q0

q1

a

q2

a

q0

a

q3

q1

a

q2

a

q3

“reject”

All possible computations lead to rejection
16
Dr. Hussien M. Sharaf

LAMBDA TRANSITIONS

q0

a

q1



q2

a

q3

17
Dr. Hussien M. Sharaf

LAMBDA TRANSITIONS

Acceptance Example 2
a

a

q0

a

q1



q2

a

q3

18
Dr. Hussien M. Sharaf

LAMBDA TRANSITIONS

a

a

q0

a

q1



q2

a

q3

19
Dr. Hussien M. Sharaf

LAMBDA TRANSITIONS
input tape head does not move

a

a

q0

a

q1



q2

a

q3
Dr. Hussien M. Sharaf

LAMBDA TRANSITIONS
all input is consumed

a

a

“accept”

q0

a

q1



q2

a

q3

String aa is accepted
21
Dr. Hussien M. Sharaf

LAMBDA TRANSITIONS

Rejection Example 3
a

a

a

q0

a

q1



q2

a

q3

22
Dr. Hussien M. Sharaf

LAMBDA TRANSITIONS

a

a

a

q0

a

q1



q2

a

q3

23
Dr. Hussien M. Sharaf

LAMBDA TRANSITIONS
(read head doesn’t move)

a

a

a

q0

a

q1



q2

a

q3

24
Dr. Hussien M. Sharaf

LAMBDA TRANSITIONS
Input cannot be consumed

a

a

a

Automaton halts

“reject”

q0

a

q1



q2

a

q3

String aaa is rejected
25
Dr. Hussien M. Sharaf

LAMBDA TRANSITIONS

Language accepted:

q0

a

q1



L  {aa }

q2

a

q3

26
Dr. Hussien M. Sharaf

Example 4

q0

a

b

q1

q2



q3


27
Dr. Hussien M. Sharaf

a b

q0

a

b

q1

q2



q3


28
Dr. Hussien M. Sharaf

a b

q0

a

b

q1

q2



q3


29
Dr. Hussien M. Sharaf

a b

“accept”

q0

a

b

q1

q2



q3


30
Dr. Hussien M. Sharaf

Another String

a b a b

q0

a

b

q1

q2



q3


31
Dr. Hussien M. Sharaf

a b a b

q0

a

b

q1

q2



q3


32
Dr. Hussien M. Sharaf

a b a b

q0

a

b

q1

q2



q3


33
Dr. Hussien M. Sharaf

a b a b

q0

a

b

q1

q2



q3


34
Dr. Hussien M. Sharaf

a b a b

q0

a

b

q1

q2



q3


35
Dr. Hussien M. Sharaf

a b a b

q0

a

b

q1

q2



q3


36
Dr. Hussien M. Sharaf

a b a b

“accept”

q0

a

b

q1

q2



q3


37
Dr. Hussien M. Sharaf

Language accepted

L  ab , abab , ababab , ... 
 ab 

q0

a



b

q1

q2



q3


38
Dr. Hussien M. Sharaf

EXAMPLE 5

0
q0

1

q1

0, 1

q2


39
Dr. Hussien M. Sharaf

Language accepted

L ( M ) = {λ , 10 , 1010 , 101010 , ... }
= {10 } *

0
q0

1

q1

0, 1

q2

(redundant
state)


40
DETERMINISTIC AND
NONDETERMINISTIC AUTOMATA


Deterministic Finite Automata (DFA)
 One

transition per input per state
 No -moves


Nondeterministic Finite Automata (NFA)
 Can

have multiple transitions for one input in a
given state
 Can have -moves

41
THANK YOU

Dr. Hussien M. Sharaf

42

Contenu connexe

Tendances

Tendances (20)

String Matching Finite Automata & KMP Algorithm.
String Matching Finite Automata & KMP Algorithm.String Matching Finite Automata & KMP Algorithm.
String Matching Finite Automata & KMP Algorithm.
 
Formal Logic - Lesson 7 - Rules of Inference
Formal Logic - Lesson 7 - Rules of InferenceFormal Logic - Lesson 7 - Rules of Inference
Formal Logic - Lesson 7 - Rules of Inference
 
Theory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping LemmaTheory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping Lemma
 
γ Regular-open sets and γ-extremally disconnected spaces
γ Regular-open sets and γ-extremally disconnected spacesγ Regular-open sets and γ-extremally disconnected spaces
γ Regular-open sets and γ-extremally disconnected spaces
 
Formal Logic - Lesson 4 - Tautology, Contradiction and Contingency
Formal Logic - Lesson 4 - Tautology, Contradiction and ContingencyFormal Logic - Lesson 4 - Tautology, Contradiction and Contingency
Formal Logic - Lesson 4 - Tautology, Contradiction and Contingency
 
applications of first order non linear partial differential equation
applications of first order non linear partial differential equationapplications of first order non linear partial differential equation
applications of first order non linear partial differential equation
 
Truth table
Truth tableTruth table
Truth table
 
25 String Matching
25 String Matching25 String Matching
25 String Matching
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
 
Mathematical Logic
Mathematical LogicMathematical Logic
Mathematical Logic
 
Truth, deduction, computation; lecture 5
Truth, deduction, computation;  lecture 5Truth, deduction, computation;  lecture 5
Truth, deduction, computation; lecture 5
 
Proofs by contraposition
Proofs by contrapositionProofs by contraposition
Proofs by contraposition
 
Indices & logarithm
Indices & logarithmIndices & logarithm
Indices & logarithm
 
Formal Logic - Lesson 8 - Predicates and Quantifiers
Formal Logic - Lesson 8 - Predicates and QuantifiersFormal Logic - Lesson 8 - Predicates and Quantifiers
Formal Logic - Lesson 8 - Predicates and Quantifiers
 
Computer Organization and Assembly Language
Computer Organization and Assembly LanguageComputer Organization and Assembly Language
Computer Organization and Assembly Language
 
Formal Logic - Lesson 6 - Switching Circuits
Formal Logic - Lesson 6 - Switching CircuitsFormal Logic - Lesson 6 - Switching Circuits
Formal Logic - Lesson 6 - Switching Circuits
 
Math 189 Exam 1 Solutions
Math 189 Exam 1 SolutionsMath 189 Exam 1 Solutions
Math 189 Exam 1 Solutions
 
Method of direct proof
Method of direct proofMethod of direct proof
Method of direct proof
 
Fourier Series - Engineering Mathematics
Fourier Series -  Engineering MathematicsFourier Series -  Engineering Mathematics
Fourier Series - Engineering Mathematics
 
Formal Logic - Lesson 5 - Logical Equivalence
Formal Logic - Lesson 5 - Logical EquivalenceFormal Logic - Lesson 5 - Logical Equivalence
Formal Logic - Lesson 5 - Logical Equivalence
 

Plus de Arab Open University and Cairo University

Plus de Arab Open University and Cairo University (20)

Infos2014
Infos2014Infos2014
Infos2014
 
File Organization & processing Mid term summer 2014 - modelanswer
File Organization & processing Mid term summer 2014 - modelanswerFile Organization & processing Mid term summer 2014 - modelanswer
File Organization & processing Mid term summer 2014 - modelanswer
 
Model answer of compilers june spring 2013
Model answer of compilers june spring 2013Model answer of compilers june spring 2013
Model answer of compilers june spring 2013
 
Model answer of exam TC_spring 2013
Model answer of exam TC_spring 2013Model answer of exam TC_spring 2013
Model answer of exam TC_spring 2013
 
Theory of computation Lec6
Theory of computation Lec6Theory of computation Lec6
Theory of computation Lec6
 
Theory of computation Lec3 dfa
Theory of computation Lec3 dfaTheory of computation Lec3 dfa
Theory of computation Lec3 dfa
 
Theory of computation Lec2
Theory of computation Lec2Theory of computation Lec2
Theory of computation Lec2
 
Theory of computation Lec1
Theory of computation Lec1Theory of computation Lec1
Theory of computation Lec1
 
Theory of computation Lec7 pda
Theory of computation Lec7 pdaTheory of computation Lec7 pda
Theory of computation Lec7 pda
 
Setup python with eclipse
Setup python with eclipseSetup python with eclipse
Setup python with eclipse
 
Cs419 lec8 top-down parsing
Cs419 lec8    top-down parsingCs419 lec8    top-down parsing
Cs419 lec8 top-down parsing
 
Cs419 lec11 bottom-up parsing
Cs419 lec11   bottom-up parsingCs419 lec11   bottom-up parsing
Cs419 lec11 bottom-up parsing
 
Cs419 lec12 semantic analyzer
Cs419 lec12  semantic analyzerCs419 lec12  semantic analyzer
Cs419 lec12 semantic analyzer
 
Cs419 lec9 constructing parsing table ll1
Cs419 lec9   constructing parsing table ll1Cs419 lec9   constructing parsing table ll1
Cs419 lec9 constructing parsing table ll1
 
Cs419 lec10 left recursion and left factoring
Cs419 lec10   left recursion and left factoringCs419 lec10   left recursion and left factoring
Cs419 lec10 left recursion and left factoring
 
Cs419 lec7 cfg
Cs419 lec7   cfgCs419 lec7   cfg
Cs419 lec7 cfg
 
Cs419 lec3 lexical analysis using re
Cs419 lec3   lexical analysis using reCs419 lec3   lexical analysis using re
Cs419 lec3 lexical analysis using re
 
Compilers Final spring 2013 model answer
 Compilers Final spring 2013 model answer Compilers Final spring 2013 model answer
Compilers Final spring 2013 model answer
 
Compilers midterm spring 2013 model answer
Compilers midterm spring 2013   model answerCompilers midterm spring 2013   model answer
Compilers midterm spring 2013 model answer
 
Cs419 Compiler lec1&2 introduction
Cs419 Compiler lec1&2  introductionCs419 Compiler lec1&2  introduction
Cs419 Compiler lec1&2 introduction
 

Dernier

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
fonyou31
 

Dernier (20)

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 

Cs419 lec6 lexical analysis using nfa

  • 1. WELCOME TO A JOURNEY TO CS419 Dr. Hussien Sharaf Computer Science Department dr.sharaf@from-masr.com
  • 2. Dr. Hussien M. Sharaf NON DETERMINISTIC FINITE AUTOMATA NFA  There is a fixed number of states but we can be in multiple states at one time. NFA = “a 5-tuple “ (Q, Σ, , q0, F) Q A finite set of states Σ A finite 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 total function from Q x Σ to 2Q , this function:  Takes a state and input symbol as arguments.  Returns a set of states instead a single state as in DFA. δ: (Q x Σ) –> 2Q -2Q is the power set of Q, the set of all subsets of Q δ(q,s) is a function from Q x S to 2Q (but not to Q) 2
  • 3. NFA A finite automaton is deterministic if  It has no edges/transitions labeled with epsilon/lamda.  For each state and for each symbol in the alphabet, there is exactly one edge labeled with that symbol.
  • 4. Dr. Hussien M. Sharaf NFA  NFA travels all possible paths, and so it remains in many states at once. As long as at least one of the paths results in an accepting state, the NFA accepts the input. Alphabet = {a } a q0 q1 a q2 a q3 4
  • 5. Dr. Hussien M. Sharaf NFA Alphabet = {a } Two choices a q0 q1 a q2 a q3 5
  • 6. Dr. Hussien M. Sharaf NFA Alphabet = {a } Two choices a q0 q1 a q2 No transition a q3 No transition 6
  • 7. Dr. Hussien M. Sharaf NFA An NFA accepts a string: if there is a computation of the NFA that accepts the string i.e., all the input string is processed and the automaton is in an accepting state 7
  • 8. Dr. Hussien M. Sharaf Acceptance Example 1 NFA a a a q0 q1 a q2 a q3 8
  • 9. Dr. Hussien M. Sharaf First Choice NFA a a a q0 q1 a q2 a q3 9
  • 10. Dr. Hussien M. Sharaf First Choice NFA a a All input is consumed a q0 q1 a q3 a q2 “accept”
  • 11. Dr. Hussien M. Sharaf Second Choice NFA a a a q0 q1 a q3 a q2
  • 12. Dr. Hussien M. Sharaf Second Choice NFA a a Input cannot be consumed a q1 a q2 Automaton Halts q0 a q 3 “reject”
  • 13. Dr. Hussien M. Sharaf NFA aa is accepted by the NFA: “accept” a q0 q1 q2 a q0 a q3 because this computation accepts aa a q1 a q2 a q3 “reject” this computation is ignored 13
  • 14. Dr. Hussien M. Sharaf NFA An NFA rejects a string: if there is no computation of the NFA that accepts the string. For each computation: • All the input is consumed and the automaton is in a non final state OR • The input cannot be consumed 14
  • 15. Dr. Hussien M. Sharaf NFA a is rejected by the NFA: “reject” a q0 q1 a q2 a q0 a q 3 “reject” q1 a q2 a q3 All possible computations lead to rejection 15
  • 16. Dr. Hussien M. Sharaf NFA aaa is rejected by the NFA: “reject” a q0 q1 a q2 a q0 a q3 q1 a q2 a q3 “reject” All possible computations lead to rejection 16
  • 17. Dr. Hussien M. Sharaf LAMBDA TRANSITIONS q0 a q1  q2 a q3 17
  • 18. Dr. Hussien M. Sharaf LAMBDA TRANSITIONS Acceptance Example 2 a a q0 a q1  q2 a q3 18
  • 19. Dr. Hussien M. Sharaf LAMBDA TRANSITIONS a a q0 a q1  q2 a q3 19
  • 20. Dr. Hussien M. Sharaf LAMBDA TRANSITIONS input tape head does not move a a q0 a q1  q2 a q3
  • 21. Dr. Hussien M. Sharaf LAMBDA TRANSITIONS all input is consumed a a “accept” q0 a q1  q2 a q3 String aa is accepted 21
  • 22. Dr. Hussien M. Sharaf LAMBDA TRANSITIONS Rejection Example 3 a a a q0 a q1  q2 a q3 22
  • 23. Dr. Hussien M. Sharaf LAMBDA TRANSITIONS a a a q0 a q1  q2 a q3 23
  • 24. Dr. Hussien M. Sharaf LAMBDA TRANSITIONS (read head doesn’t move) a a a q0 a q1  q2 a q3 24
  • 25. Dr. Hussien M. Sharaf LAMBDA TRANSITIONS Input cannot be consumed a a a Automaton halts “reject” q0 a q1  q2 a q3 String aaa is rejected 25
  • 26. Dr. Hussien M. Sharaf LAMBDA TRANSITIONS Language accepted: q0 a q1  L  {aa } q2 a q3 26
  • 27. Dr. Hussien M. Sharaf Example 4 q0 a b q1 q2  q3  27
  • 28. Dr. Hussien M. Sharaf a b q0 a b q1 q2  q3  28
  • 29. Dr. Hussien M. Sharaf a b q0 a b q1 q2  q3  29
  • 30. Dr. Hussien M. Sharaf a b “accept” q0 a b q1 q2  q3  30
  • 31. Dr. Hussien M. Sharaf Another String a b a b q0 a b q1 q2  q3  31
  • 32. Dr. Hussien M. Sharaf a b a b q0 a b q1 q2  q3  32
  • 33. Dr. Hussien M. Sharaf a b a b q0 a b q1 q2  q3  33
  • 34. Dr. Hussien M. Sharaf a b a b q0 a b q1 q2  q3  34
  • 35. Dr. Hussien M. Sharaf a b a b q0 a b q1 q2  q3  35
  • 36. Dr. Hussien M. Sharaf a b a b q0 a b q1 q2  q3  36
  • 37. Dr. Hussien M. Sharaf a b a b “accept” q0 a b q1 q2  q3  37
  • 38. Dr. Hussien M. Sharaf Language accepted L  ab , abab , ababab , ...   ab  q0 a  b q1 q2  q3  38
  • 39. Dr. Hussien M. Sharaf EXAMPLE 5 0 q0 1 q1 0, 1 q2  39
  • 40. Dr. Hussien M. Sharaf Language accepted L ( M ) = {λ , 10 , 1010 , 101010 , ... } = {10 } * 0 q0 1 q1 0, 1 q2 (redundant state)  40
  • 41. DETERMINISTIC AND NONDETERMINISTIC AUTOMATA  Deterministic Finite Automata (DFA)  One transition per input per state  No -moves  Nondeterministic Finite Automata (NFA)  Can have multiple transitions for one input in a given state  Can have -moves 41
  • 42. THANK YOU Dr. Hussien M. Sharaf 42