lecture 2 theory of computation
DESCRIPTION
Lecture 2 Theory of Computation. Yasir Imtiaz Khan. Finite automata. Finite automata. Formal definition. Draw state diagrams. Transition Graph. Abba -Finite Accepter. initial state. final state “accept”. transition. state. Initial Configuration. Input String. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/1.jpg)
LECTURE 2THEORY OF COMPUTATION
Yasir Imtiaz Khan
![Page 2: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/2.jpg)
FINITE AUTOMATA
![Page 3: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/3.jpg)
FINITE AUTOMATA
![Page 4: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/4.jpg)
FORMAL DEFINITION
![Page 5: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/5.jpg)
DRAW STATE DIAGRAMS
![Page 6: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/6.jpg)
TRANSITION GRAPH
initialstate
final state“accept”
statetransition
Abba -Finite Accepter
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
![Page 7: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/7.jpg)
INITIAL CONFIGURATION
1q 2q 3q 4qa b b a
5q
a a bb
ba,
Input String
a b b a
ba,0q
![Page 8: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/8.jpg)
READING THE INPUT
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b b a
ba,
![Page 9: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/9.jpg)
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b b a
ba,
![Page 10: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/10.jpg)
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b b a
ba,
![Page 11: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/11.jpg)
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b b a
ba,
![Page 12: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/12.jpg)
0q 1q 2q 3q 4qa b b a
Output: “accept”
5q
a a bb
ba,
a b b a
ba,
Input finished
![Page 13: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/13.jpg)
REJECTION
1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b a
ba,0q
![Page 14: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/14.jpg)
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b a
ba,
![Page 15: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/15.jpg)
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b a
ba,
![Page 16: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/16.jpg)
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b a
ba,
![Page 17: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/17.jpg)
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,Output:“reject”
a b a
ba,
Input finished
![Page 18: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/18.jpg)
ANOTHER REJECTION
1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,0q
![Page 19: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/19.jpg)
1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,0q
Output:“reject”
![Page 20: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/20.jpg)
MORE EXAMPLES
a
b ba,
ba,
0q 1q 2q
}0:{ nbaML n
accept trap state
![Page 21: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/21.jpg)
ML = { all strings with prefix }ab
a b
ba,
0q 1q 2qaccept
ba,3q
ab
![Page 22: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/22.jpg)
ML = { all strings without
substring }001
0 00 001
1
0
110
0 1,0
![Page 23: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/23.jpg)
NON DETERMINISTIC AUTOMATA
![Page 24: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/24.jpg)
FORMAL DEFINITION NFA
![Page 25: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/25.jpg)
1q 2q
3q
a
a
a
0q
}{aAlphabet =
Nondeterministic Finite Accepter (NFA)
![Page 26: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/26.jpg)
1q 2q
3q
a
a
a
0q
Two choices
}{aAlphabet =
Nondeterministic Finite Accepter (NFA)
![Page 27: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/27.jpg)
No transition
1q 2q
3q
a
a
a
0q
Two choicesNo transition
}{aAlphabet =
Nondeterministic Finite Accepter (NFA)
![Page 28: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/28.jpg)
a a
0q
1q 2q
3q
a
a
First Choice
a
![Page 29: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/29.jpg)
a a
0q
1q 2q
3q
a
a
a
First Choice
![Page 30: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/30.jpg)
a a
0q
1q 2q
3q
a
a
First Choice
a
![Page 31: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/31.jpg)
a a
0q
1q 2q
3q
a
a
a “accept”
First Choice
All input is consumed
![Page 32: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/32.jpg)
a a
0q
1q 2q
3q
a
a
Second Choice
a
![Page 33: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/33.jpg)
a a
0q
1q 2qa
a
Second Choice
a
3q
![Page 34: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/34.jpg)
a a
0q
1q 2qa
a
a
3q
Second Choice
No transition:the automaton hangs
![Page 35: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/35.jpg)
a a
0q
1q 2qa
a
a
3q
Second Choice
“reject”
Input cannot be consumed
![Page 36: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/36.jpg)
LAMBDA TRANSITIONS
1q 3qa0q 2q a
![Page 37: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/37.jpg)
a a
1q 3qa0q 2q a
![Page 38: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/38.jpg)
a a
1q 3qa0q 2q a
![Page 39: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/39.jpg)
a a
1q 3qa0q 2q a
(read head does not move)
![Page 40: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/40.jpg)
a a
1q 3qa0q 2q a
![Page 41: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/41.jpg)
a a
1q 3qa0q 2q a
“accept”
String is acceptedaa
all input is consumed
![Page 42: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/42.jpg)
a a
1q 3qa0q 2q a
Rejection Example
a
![Page 43: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/43.jpg)
a a
1q 3qa0q 2q a
a
![Page 44: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/44.jpg)
a a
1q 3qa0q 2q a
(read head doesn’t move)
a
![Page 45: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/45.jpg)
a a
1q 3qa0q 2q a
a
No transition:the automaton hangs
![Page 46: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/46.jpg)
a a
1q 3qa0q 2q a
“reject”
String is rejectedaaa
a
Input cannot be consumed
![Page 47: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/47.jpg)
Language accepted: }{aaL
1q 3qa0q 2q a
![Page 48: Lecture 2 Theory of Computation](https://reader036.vdocument.in/reader036/viewer/2022062410/5681634b550346895dd3ddd7/html5/thumbnails/48.jpg)
Another NFA Example
0q 1q 2qa b
3q