theory of computation - lecture 3 regular languages what is a computer? complicated, we need...
TRANSCRIPT
![Page 1: Theory of Computation - Lecture 3 Regular Languages What is a computer? Complicated, we need idealized computer for managing mathematical theories... Hence:](https://reader035.vdocuments.mx/reader035/viewer/2022062719/56649ec95503460f94bd75cb/html5/thumbnails/1.jpg)
Theory of Computation - Lecture 3Regular Languages
What is a computer?
Complicated, we need idealized computer for managing mathematical theories...
Hence: Computational Models. Comp. Models vary, depending on the
features we want them to focus on. Simplest Comp. Model is Finite State
Machine, or Finite AutomatonDr. Maamoun Ahmed
![Page 2: Theory of Computation - Lecture 3 Regular Languages What is a computer? Complicated, we need idealized computer for managing mathematical theories... Hence:](https://reader035.vdocuments.mx/reader035/viewer/2022062719/56649ec95503460f94bd75cb/html5/thumbnails/2.jpg)
Finite Automaton
Good models for computers with extremely limited memories.
With such limited memories, what the computers can do? Give examples of such computers!
…..
![Page 3: Theory of Computation - Lecture 3 Regular Languages What is a computer? Complicated, we need idealized computer for managing mathematical theories... Hence:](https://reader035.vdocuments.mx/reader035/viewer/2022062719/56649ec95503460f94bd75cb/html5/thumbnails/3.jpg)
Example – Automatic Door
Do
or
Front pad Rear pad
![Page 4: Theory of Computation - Lecture 3 Regular Languages What is a computer? Complicated, we need idealized computer for managing mathematical theories... Hence:](https://reader035.vdocuments.mx/reader035/viewer/2022062719/56649ec95503460f94bd75cb/html5/thumbnails/4.jpg)
FSM/FA of Auto-door
CLOSED OPEN
FRONT
NEITHER
REARBOTH
NIETHER
FRONTREARBOTH
![Page 5: Theory of Computation - Lecture 3 Regular Languages What is a computer? Complicated, we need idealized computer for managing mathematical theories... Hence:](https://reader035.vdocuments.mx/reader035/viewer/2022062719/56649ec95503460f94bd75cb/html5/thumbnails/5.jpg)
Cont. How many bits required for auto-door
implementation? More examples: Elevator, what are the
states and inputs? Dishwasher, Washing machine,
Thermostats, digital watches and calculators, etc....
Finite Automata was in mind when all of above were designed!
![Page 6: Theory of Computation - Lecture 3 Regular Languages What is a computer? Complicated, we need idealized computer for managing mathematical theories... Hence:](https://reader035.vdocuments.mx/reader035/viewer/2022062719/56649ec95503460f94bd75cb/html5/thumbnails/6.jpg)
Closer look at Finite Automata
Abstracting, application-independent:
Example: A finite automaton called M1 with 3 states:
q1 q2 q3
1 0
0,1
0
1
State Diagram
State Diagram
![Page 7: Theory of Computation - Lecture 3 Regular Languages What is a computer? Complicated, we need idealized computer for managing mathematical theories... Hence:](https://reader035.vdocuments.mx/reader035/viewer/2022062719/56649ec95503460f94bd75cb/html5/thumbnails/7.jpg)
Closer Look – Cont. Start State Accept State Transitions
- When 1101 is entered from the input to Start State (one by one, L2R), the output will be either Accept/Reject or for now, Yes/No respectively.
Will 1101 output Accept or Reject in our example?
What about 1? 01?11?101001001?
What about 100? 0100? 1000000?
![Page 8: Theory of Computation - Lecture 3 Regular Languages What is a computer? Complicated, we need idealized computer for managing mathematical theories... Hence:](https://reader035.vdocuments.mx/reader035/viewer/2022062719/56649ec95503460f94bd75cb/html5/thumbnails/8.jpg)
What strings will M1 accept? What will it reject?
Can you describe the language consisting of all strings that M1 accepts?
…..Go on!
![Page 9: Theory of Computation - Lecture 3 Regular Languages What is a computer? Complicated, we need idealized computer for managing mathematical theories... Hence:](https://reader035.vdocuments.mx/reader035/viewer/2022062719/56649ec95503460f94bd75cb/html5/thumbnails/9.jpg)
Formal definition of a FAWhy do we need a formal definition?
1- It is precise: Uncertain whether some FA allowed to have 0 accept states or not? Formal definition helps you decide.
2- It provides Notations, and they help you think and express your thoughts clearly.
Formal definition says that FA is a list of five objects: Set of states, input alphabet, rules for moving, start state, and accept states
What do we call a list of 5 elements ?
![Page 10: Theory of Computation - Lecture 3 Regular Languages What is a computer? Complicated, we need idealized computer for managing mathematical theories... Hence:](https://reader035.vdocuments.mx/reader035/viewer/2022062719/56649ec95503460f94bd75cb/html5/thumbnails/10.jpg)
Formal definition of FA – cont.
We define a FA to be a 5-tuple consisting of these five parts.
Transition function ( δ) defines the rules of moving.
Ex.: 2 states x, y. and an arrow from x to y with a label=1, then moving from x to y is ruled by reading 1 as an input, which can be written as : δ(x,1)=y
![Page 11: Theory of Computation - Lecture 3 Regular Languages What is a computer? Complicated, we need idealized computer for managing mathematical theories... Hence:](https://reader035.vdocuments.mx/reader035/viewer/2022062719/56649ec95503460f94bd75cb/html5/thumbnails/11.jpg)
Formal definition of FA A finite automaton is a 5-tuple (Q, ∑ , δ, q0,
F) where: Q is a finite set called the states ∑ is a finite set called the alphabet δ:Q X ∑ → Q is the transition function q0 Q is the start state, and∈ F Q is the set of accept ⊆
states(sometimes called Final states).
![Page 12: Theory of Computation - Lecture 3 Regular Languages What is a computer? Complicated, we need idealized computer for managing mathematical theories... Hence:](https://reader035.vdocuments.mx/reader035/viewer/2022062719/56649ec95503460f94bd75cb/html5/thumbnails/12.jpg)
Example
Go back to slide no.6 (M1 FA), we can describe M1 formally by writing
M1 = (Q, ∑, δ, q1, F), where:
1. Q = {q1, q2, q3}
2. ∑ = {0,1}
3. δ is described as
0 1
q1 q1 q2
q2 q3 q2
q3 q2 q2
![Page 13: Theory of Computation - Lecture 3 Regular Languages What is a computer? Complicated, we need idealized computer for managing mathematical theories... Hence:](https://reader035.vdocuments.mx/reader035/viewer/2022062719/56649ec95503460f94bd75cb/html5/thumbnails/13.jpg)
Example – cont.
4. q1 is the start state, and
5. F = {q2} Note: A is a set of all strings that machine M
accepts, we say: A is the language of machine M and write L(M)=A. We say: M recognizes A.
A machine may accept several strings, but it always recognizes only one language.
If the machine accepts no strings, it still recognizes one language, the empty language ϕ
![Page 14: Theory of Computation - Lecture 3 Regular Languages What is a computer? Complicated, we need idealized computer for managing mathematical theories... Hence:](https://reader035.vdocuments.mx/reader035/viewer/2022062719/56649ec95503460f94bd75cb/html5/thumbnails/14.jpg)
Example – cont.
So, in our example let:
A = {w | w contains at least one 1 and an even number of 0s follows the last 1}.
Then L(M1) = A, or equivalently, M1 recognizes A.
Examples of FA (1.7 – 1.15) pages 37-40