1 / 15

Intro to Theory of Computation

L ECTURE 10 Theory of Computation Review Constructing PDAs Turing Machines. Intro to Theory of Computation. CS 464. Sofya Raskhodnikova. Context-free or not?. L₁ = { xy | x,y ∈ {0,1}* and x=y}. NOT. YES. L₂ = {xy | x,y ∈ {0,1}*, |x|=|y| and x ≠ y}.

Download Presentation

Intro to Theory of Computation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. LECTURE10 • Theory of Computation • Review • Constructing PDAs • Turing Machines Intro to Theory of Computation CS 464 Sofya Raskhodnikova Sofya Raskhodnikova; based on slides by Nick Hopper

  2. Context-free or not? L₁ = { xy | x,y ∈ {0,1}* and x=y} NOT YES L₂ = {xy | x,y ∈ {0,1}*, |x|=|y| and x ≠ y}

  3. Give an algorithmic description of a PDA for and but Hint:

  4. Give an algorithmic description of a PDA for and but Hint:

  5. CMPSC 464 so far First model of a program: DFA / Regexp Solvable Problems: Regular Languages Unsolvable Problems: { 0n1n | n ¸ 0 } Next model of a program: PDA / CFG Solvable Problems: Context-Free Languages Unsolvable Problems: { w#w | w 2* } defis_duplicate(s): n = len(s)/2 if (s[n]!=‘#’): return False return s[:n] == s[n+1:]

  6. FINITE STATE CONTROL TURING MACHINE (TM) q0 q1 I N P U T A UNBOUNDED (on the right) TAPE

  7. qreject read write move  → , R 0 → 0, R qaccept 0→ 0, R  → , R 0→ 0, R  → , L A TM can loop forever

  8. TM versus PDA TM can both write to and read from the tape The head can move left and right The input does not have to be read entirely Accept and Reject take immediate effect Infinite tape on the right, stick on the left TM is deterministic (will consider NTMs later)

  9. STATE Testing membership in B = { w#w | w  {0,1}* } q1, FIND  qGO LEFT q1, FIND # q0, FIND # q#, FIND  q0, FIND  x x 0 0 x 0 1 0 1 # 1 # 1 1 1

  10. Definition of a TM A TM is a 7-tuple T = (Q, Σ, Γ, , q0, qaccept, qreject): Q is a finite set of states Σ is the input alphabet, where   Σ Γ is the tape alphabet, where   Γ and Σ½Γ  : Q Γ→ Q Γ  {L,R} q0 Q is the start state qaccept Q is the accept state qreject Q is the reject state, and qreject qaccept

  11. q7 0 0 0 1 1 1 0 1 1 0 CONFIGURATIONS 11010q700110

  12. qreject x → x, L 2n 0 → 0, L { 0 | n ≥ 0 } q2  → , R  → , L x → x, R x → x, R q0 q1 q3 0 → , R 0 → x, R x → x, R 0 → 0, R  → , R 0 → x, R  → , R qaccept q4 x → x, R  → , R

  13. x → x, L 2n 0 → 0, L { 0 | n ≥ 0 } q2  → , R  → , L x → x, R x → x, R q0 q1 q3 0 → , R 0 → x, R x → x, R 0 → 0, R  → , R qreject 0 → x, R  → , R qaccept q4 x → x, R  → , R q00000 q1000 xq300 x0q40 x0xq3 x0q2x xq20x q2x0x q2x0x

  14. Accepting and rejecting A TM on input sting w may either halt (enter qacceptorqreject) or never halt (loop) A TM is a decider if it halts on every input.

  15. Language of a TM A TM recognizesa language L if it accepts all strings in L and no other strings. • A language is called recognizable (or enumerable) if some TM recognizes it. A TM decides a language L if it accepts all strings in L and rejects all strings not in L. • A language is called decidable(or recursive) if some TM decides it.

More Related