Presentation is loading. Please wait.

Presentation is loading. Please wait.

Theory of Computation - Lecture 3 Regular Languages What is a computer? Complicated, we need idealized computer for managing mathematical theories... Hence:

Similar presentations


Presentation on theme: "Theory of Computation - Lecture 3 Regular Languages What is a computer? Complicated, we need idealized computer for managing mathematical theories... Hence:"— Presentation transcript:

1 Theory of Computation - Lecture 3 Regular 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 Automaton Dr. Maamoun Ahmed

2 Finite Automaton Good models for computers with extremely limited memories. With such limited memories, what the computers can do? Give examples of such computers! …..

3 Example – Automatic Door Door Front pad Rear pad

4 FSM/FA of Auto-door CLOSEDOPEN FRONT NEITHER REAR BOTH NIETHER FRONT REAR BOTH

5 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!

6 Closer look at Finite Automata Abstracting, application-independent: Example: A finite automaton called M1 with 3 states: q1q2q3 1 0 0,1 0 1 State Diagram State Diagram

7 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?

8 What strings will M1 accept? What will it reject? Can you describe the language consisting of all strings that M1 accepts? …..Go on!

9 Formal definition of a FA Why 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 ?

10 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

11 Formal definition of FA A finite automaton is a 5-tuple (Q, ∑, δ, q 0, F) where: Q is a finite set called the states ∑ is a finite set called the alphabet δ:Q X ∑ → Q is the transition function q 0 ∈ Q is the start state, and F ⊆ Q is the set of accept states(sometimes called Final states).

12 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 q2 q3 q2 q3 q2

13 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 ϕ

14 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


Download ppt "Theory of Computation - Lecture 3 Regular Languages What is a computer? Complicated, we need idealized computer for managing mathematical theories... Hence:"

Similar presentations


Ads by Google