Download presentation

Presentation is loading. Please wait.

Published byBlaze Gorbet Modified over 3 years ago

1
David Evans http://www.cs.virginia.edu/evans cs302: Theory of Computation University of Virginia Computer Science Lecture 13: Turing Machines

2
2 The Story So Far Regular Languages Context-Free Languages Violates Pumping Lemma For RLs Violates Pumping Lemma For CFLs Described by DFA, NFA, RegExp, RegGram Described by CFG, NDPDA 0n1n0n1n 0n1n2n0n1n2n 0n0n w Deterministic CFLs LL(k) Languages Described by LL(k) Grammar Indexed Grammars

3
3 Lecture 13: Turing Machines The Story So Far (Simplified) Regular Languages Context-Free Languages Violates Pumping Lemma For RLs Violates Pumping Lemma For CFLs Described by DFA, NFA, RegExp, RegGram Described by CFG, NDPDA 0n1n0n1n 0n0n w

4
4 Lecture 13: Turing Machines Computability Story: This Week Languages recognizable by any mechanical computing machine

5
5 Lecture 13: Turing Machines Computability Story: Next Week Undecidable Problems Decidable Problems Recognizable Languages

6
6 Lecture 13: Turing Machines Computability Complexity (April) Decidable Problems Problems that can be solved by a computer (eventually). Problems that can be solved by a computer in a reasonable time. NP P Note: not known if P NP or P = NP

7
7 Lecture 13: Turing Machines Exam 1

8
8 Lecture 13: Turing Machines Exam 1 Problem 4c: Prove that the language {0 n 1 n 2 } is not context-free. Lengths of strings in L : n = 00 + 0 2 = 0 n = 11 + 1 2 = 2 n = 2 2 + 2 2 = 6 n = 33 + 3 2 = 12... n = kk + k 2 Pumping lemma for CFLs says there must be some way of picking s = uvxyz such that m = |v| + |y| > 0 and uv i xy i z in L for all i. So, increasing i by 1 adds m symbols to the string, which must produce a string of a length that is not the length of a string in L.

9
9 Lecture 13: Turing Machines Recognizing {0 n 1 n 2 } DPDA with two stacks? DPDA with three stacks?... ?

10
10 Lecture 13: Turing Machines 3-Stack DPDA Recognizing {0 n 1 n 2 } 0, ε/ε/ε $/$/$ 0, ε/ε/ε +/ ε /+ 1, $/$/$ ε/ε/ε 1, +/ε/ε ε/+/ε 1, $/+/+ $/ε/ε 1, ε/+/ε +/ε/ε Start Done Count 0s 1s b->r 1s r->b 1, ε/$/$ ε/ε/ε 1, + /$/+ ε /+/ε 1, $/ ε /$ ε/ε/ε

11
11 Lecture 13: Turing Machines Can it be done with 2 Stacks?

12
12 Lecture 13: Turing Machines Simulating 3-DPDA with 2-DPDA # # A B

13
13 Lecture 13: Turing Machines Simulating 3-DPDA with 2-DPDA 3-DPDA # # pop green push B ($) push B (pop A ())... push B (pop A (#)) push B (pop A ())... push B (pop A (#)) res = pop A () push A (pop B (#)) push A (pop B ())... pop B ($) A B $ +

14
14 Lecture 13: Turing Machines 2-DPDA + Forced ε -Transitions A B Need to do lots of stack manipulation to simulate 3-DPDA on one transition: need transitions with no input symbol (but not nondeterminism!) # # $

15
15 Lecture 13: Turing Machines Impact of Forced ε -Transitions A B # # $ What is the impact of adding non-input consuming transitions? DPDA in length n input: runs for n steps DPDA+ ε in length n input: can run forever!

16
16 Lecture 13: Turing Machines Is there any computing machine we can’t simulate with a 2-DPDA+?

17
17 Lecture 13: Turing Machines What about an NDPDA? A B Use one stack to simulate the NDPDA’s stack. Use the other stack to keep track of nondeterminism points: copy of stack and decisions left to make.

18
18 Lecture 13: Turing Machines Turing Machine? A B Tape Head

19
19 Lecture 13: Turing Machines Turing Machine... Infinite tape: Γ* Tape head: read current square on tape, write into current square, move one square left or right FSM:like PDA, except: transitions also include direction (left/right) final accepting and rejecting states FSM

20
20 Lecture 13: Turing Machines Turing Machine Formal Description... FSM 7-tuple: (Q, , Γ, δ, q 0, q accept, q reject ) Q : finite set of states : input alphabet (cannot include blank symbol, _) Γ : tape alphabet, includes and _ δ : transition function: Q Γ Q Γ {L, R} q 0 : start state, q 0 Q q accept : accepting state, q accept Q q reject : rejecting state, q reject Q (Sipser’s notation)

21
21 Lecture 13: Turing Machines Turing Machine Computing Model... FSM q0q0 input ____ blanks Initial configuration: xxxxxxx x TM Configuration: Γ* Q Γ * tape contents left of head tape contents head and right current FSM state

22
22 Lecture 13: Turing Machines TM Computing Model δ *: Γ* Q Γ * Γ* Q Γ * δ*(L, q accept, R) (L, q accept, R) δ*(L, q reject, R) (L, q reject, R) The q accept and q reject states are final:

23
23 Lecture 13: Turing Machines TM Computing Model δ *: Γ* Q Γ * Γ* Q Γ *... FSM q a u, v Γ*, a, b Γ u b v δ*(ua, q, bv) = (uac, q r, v) if δ(q, b) = (q r, c, R) δ*(ua, q, bv) = (u, q r, acv) if δ(q, b) = (q r, c, L) Also: need a rule to cover what happens at left edge of tape

24
24 Lecture 13: Turing Machines Thursday’s Class Robustness of TM model Church- Turing Thesis Read Chapter 3: It contains the most bogus sentence in the whole book. Identify it for +25 bonus points (only 1 guess allowed!)

Similar presentations

OK

Introduction to CS Theory Lecture 15 –Turing Machines Piotr Faliszewski

Introduction to CS Theory Lecture 15 –Turing Machines Piotr Faliszewski

© 2018 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google