Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Unit – 5 : STATE MACHINES Syllabus: Languages and Grammars – Finite State Machines State machines and languages – Turing Machines – Computational Complexity.

Similar presentations


Presentation on theme: "1 Unit – 5 : STATE MACHINES Syllabus: Languages and Grammars – Finite State Machines State machines and languages – Turing Machines – Computational Complexity."— Presentation transcript:

1 1 Unit – 5 : STATE MACHINES Syllabus: Languages and Grammars – Finite State Machines State machines and languages – Turing Machines – Computational Complexity – computability Decidability – Church's Thesis

2 2 Language A language L over an alphabet ∑ is a subset of ∑*,L ⊆ ∑*. A language may be empty. Here you should note a point L = { ∊ },a language containing an empty string is not an empty language. Languages and Grammars

3 3 Grammar A grammar is a 4-tuple (V, , P, S), where:  is an alphabet (characters  are called terminals) V is a set (elements in V are called variables) P is a set of Production rules S, the start variable, is one of the variables in V

4 4

5 5

6 6

7 7 type 3 (regular langs) CFLs (type 2 langs) CSLs (type 1 Langs) Recursive Languages Recursively Enumerable(type 0) languages All Languages

8 8 Finite State Machines Input String Output String Finite Automaton Finite Automaton

9 9 State machines and languages : set of states : input alphabet : transition function : initial state Deterministic Finite Accepter (DFA) : set of final states

10 10 : set of states : input alphabet : transition function : initial state : set of final states Non-Deterministic Finite Accepter (NFA) For any string x, there may exist none or more than one path from initial state and associated with x.

11 11

12 12

13 13

14 14

15 15

16 16

17 17

18 18

19 19 Turing Machines 1. Finite automata (DFAs, NFAs, etc.): 1.limited input tape: one-way, read-only 2.no working-memory 3.finite-control store (program) 2. PDAs: 1.limited input tape: one-way, read-only 2.one additional stack as working memory 3.finite-control store (program) 3. Turing machines (TMs): 1.a semi-infinite tape storing input and supplying additional working storage. 2.finite control store (program) 3.can read/write and two-way(move left and right) depending on the program state and input symbol scanned.

20 20 left-end x 1 x 2 x 3 x 4 x 5.. x n input: x …. additional working memory.... accept final state reject final state current state initial state control store (program) r/w & movable tape head memory is a one-dimensional tape permitted actions: 1. write 2. move left/right depending on scanned symbol and current state no right-end for TM The model of a Turing machine

21 21 An instruction of a TM is a tuple: (q, a, p, d)  Q x G x Q x (G U {L,R}) where 1.q is the current state 2.a is the symbol scanned by the tape head 3.(q,a) define a precondition that the machine may encounter 4.(p,d) specify the actions to be done by the TM once the machine is in a condition matching the precondition (i.e., the symbol scanned by the tape head is ‘a’ and the machine is at state q ) 5.p is the next state that the TM will enter 6.d is the action to be performed: 1.d = b  G means “write the symbol b to the tape cell currently scanned by the tape head”. 2.d = R (or L) means “move the tape head one tape cell in the right (or left, respectively) direction. A Deterministic TM program d is simply a set of TM instructions (or more formally a function: d: Q x G --> Qx (G U{L,R}))

22 22 A deterministic 1-tape Turing machine (STM) is a 9-tuple M = (Q,S,G, [, , d, s, t,r ) where 1.Q : is a finite set of (program) states with a role like labels in traditional programs 2.G : tape alphabet 3.S  G : input alphabet 4.[  G - S : The left end-of-tape mark 5.  G - S is the blank tape symbol 6.s  Q : initial state 7.t  Q : the accept state 8.r  t  Q: the reject state and 9.d: Q - {t,r} --> Qx(G U {L,R}) is a total transition function with the restriction: if d(p, [ ) =(q, d) then d = R. i.e., the STM cannot write any symbol at left-end and never move off the tape to the left. Formal Definition of a standard TM (STM)

23 23 1. M is said to halt on input x if either M accepts x or rejects x. 2. M is said to loop on x if it does not halt on x. 3. A TM is said to be total if it halts on all inputs. 4. The language accepted by a TM M, L(M) = def {x in S* | x is accepted by M, i.e., (s, [x  w,0) |--* M (t, -,- ) } 5. If L = L(M) for some STM M ==> L is said to be recursively enumerable (r.e.) 6. If L = L(M) for some total STM M ==> L is said to be recursive 7. If ~ L= def S* - L = L(M) for some STM M (or total STM M) ==> L is said to be Co-r.e. (or Co-recursive, respectively) Languages accepted by a STM

24 24 Languagerecognition modelgeneration model Regular languages (type 3) languages Finite automata (DFA, NFA) regular expressions linear grammars CFL ( type 2, Context Free ) languages Pushdown automataCFG ; type 2 ( context free) grammars CSL (type 1, Context sensitive) Languages LBA (Linear Bound Automata) CSG (Context sensitive, type 1 Grammars) Recursive LanguagesTotal Turing machines- R.E. (Recursively enumerative, type 0) Languages Turing machinesGPSG(type 0, general phrase-structure, unrestricted) grammar Relationship of Languages, Grammars and machines

25 25 Computational Complexity

26 26

27 27

28 28 Decidability

29 29

30 30

31 31

32 32

33 33 Church's Thesis Any mechanical computation can be performed by a Turing Machine There is a TM-n corresponding to every computable problem We can model any mechanical computer with a TM The set of languages that can be decided by a TM is identical to the set of languages that can be decided by any mechanical computing machine If there is no TM that decides problem P, there is no algorithm that solves problem P.

34 34 [Last class and PS4] Equivalence of TM and 2- stack deterministic PDA + ε-transitions [PS4] Making the tape infinite in both directions adds no power [Soon] Adding a second tape adds no power [Church] Lambda Calculus is equivalent to TM [Chomsky] Unrestricted replacement grammars are equivalent to TM [Takahara and Yokomori] DNA is at least as powerful as a TM [Hotly Debated] Is the human brain equivalent to a TM? Examples

35 35 “Since a precise mathematical definition of the term effectively calculable (effectively decidable) has been wanting, we can take this thesis... as a definition of it...” As stated by Kleene: Every effectively calculable function (effectively decidable predicate) is general recursive.

36 36 Published On Computable Numbers, with an Application to the Entscheidungsproblem (1936) –Introduced the Halting Problem –Formal model of computation (now known as “Turing Machine”) Codebreaker at Bletchley Park –Involved in breaking Enigma Cipher After the war: convicted of homosexuality (then a crime in Britain), committed suicide eating cyanide apple Alan Turing (1912-1954)


Download ppt "1 Unit – 5 : STATE MACHINES Syllabus: Languages and Grammars – Finite State Machines State machines and languages – Turing Machines – Computational Complexity."

Similar presentations


Ads by Google