Upload
aubrey-matthews
View
214
Download
0
Embed Size (px)
Citation preview
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
Finite Automaton
Good models for computers with extremely limited memories.
With such limited memories, what the computers can do? Give examples of such computers!
…..
Example – Automatic Door
Do
or
Front pad Rear pad
FSM/FA of Auto-door
CLOSED OPEN
FRONT
NEITHER
REARBOTH
NIETHER
FRONTREARBOTH
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!
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
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?
What strings will M1 accept? What will it reject?
Can you describe the language consisting of all strings that M1 accepts?
…..Go on!
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 ?
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
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).
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
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 ϕ
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