cse 105
play

CSE 105 THEORY OF COMPUTATION Fall 2016 - PowerPoint PPT Presentation

CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/ T oday's learning goals Sipser Ch 1.4, 2.1 Introduction to T uring Machines Confjgurations and computations Deciders and Recognizers ??? ???


  1. CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/

  2. T oday's learning goals Sipser Ch 1.4, 2.1 • Introduction to T uring Machines • Confjgurations and computations • Deciders and Recognizers

  3. ??? ??? Context-free languages Context-free languages Regular Regular languages languages

  4. T uring machines • Unlimited input • Unlimited (read/write) memory • Unlimited time

  5. T uring machine computation • Read/write head starts at leftmost position on tape • Input string written on leftmost squares of tape, rest is blank • Computation proceeds according to transition function: • Given current state of machine, and current symbol being read • the machine • transitions to new state • writes a symbol to its current position (overwriting existing symbol) • moves the tape head L or R • Computation ends if and when it enters either the accept or the reject state.

  6. Formal defjnition of TM Is this a deterministic model? A) Yes B) No C) It depends on the state diagram D) It depends on the input E) I don’t know q reject ≠ q accept q reject ≠ q accept

  7. T uring Machine example ● L = {w#w | w in {a,b}*} (No CFG/PDA!) ● Informal description: Γ = {a,b,#,c,[_]} 1) If input is # 1) Move right skipping all c’s 2) If input is [_], then accept, else reject 2) Read a or b, store in internal state, and change it to c 3) Move right until read # 4) Move right skipping all c’s 5) Read a or b, matching the symbol read in step 1. 1) If mismatch → reject 2) If match, overwrite with c 6) Move left until read # 7) Move left until read c 8) Go back to 1).

  8. T uring Machine (formal) ● L = {w#w | w in {a,b}*} (No CFG/PDA!) ● Draw state diagram in JFLAP

  9. T uring Machine Computations ● Confjguration: all the information store by the system at any point during computation Internal state (Q) – T ape content (Γ*) – Position of tape head – ● Formally: (α,q,β) in Γ* x Q x Γ* q: internal state – α: tape content to the left of tape head – β: tape content from tape head to the right –

  10. TM Computations ● Fix TM M=(Q,Σ,Γ,δ,q s ,q a ,q r ) ● Computation of M on input w: Sequence of confjgurations – Start from initial confjguration C0=(ε,q s ,w) – Move from one confjguration C i to the next C i+1 according to δ – Until reaching halting confjguration (…,q a ,…) or (…,q r ,…) – ● Input is accepted if fjnal state is q a ● Input is rejected if fjnal state is q r

  11. TM Computations What is the maximum length of a computation? ● Fix TM M=(Q,Σ,Γ,δ,q s ,q a ,q r ) A) Same as input length ● Computation of M on input w: B) At most length of input Sequence of confjgurations – C) May be longer than input, Start from initial confjguration C 0 =(ε,q s ,w) – but it is always fjnite Move from one confjguration C i to the next C i+1 according to δ D) May be fjnite or infjnite – E) I don’t know Until reaching halting confjguration (…,q a ,…) or (…,q r ,…) – ● Input is accepted if fjnal state is q a ● Input is rejected if fjnal state is q r

  12. TM Computations Does M need to read the whole input w before halting? ● Fix TM M=(Q,Σ,Γ,δ,q s ,q a ,q r ) A) Yes, computation terminates ● Computation of M on input w: only after reading w Sequence of confjgurations – B) Only before accepting w Start from initial confjguration C0=(ε,q s ,w) C) No. M may accept or reject – without reading w entirely Move from one confjguration C i to the next C i+1 according to δ – D) I don’t know Until reaching halting confjguration (…,q a ,…) or (…,q r ,…) – ● Input is accepted if fjnal state is q a ● Input is rejected if fjnal state is q r

  13. Which of the following is true? TM Computations ● Fix TM M=(Q,Σ,Γ,δ,q s ,q a ,q r ) A) Computation may visit both qa and qr ● Computation of M on input w: B) Computation may visit q a Sequence of confjgurations – more than once Start from initial confjguration C0=(ε,q s ,w) – C)Computation may visit q b Move from one confjguration C i to the next C i+1 according to δ – more than once D) Computation may visit q s Until reaching halting confjguration (…,q a ,…) or (…,q r ,…) – ● Input is accepted if fjnal state is q a more than once E) None of the above ● Input is rejected if fjnal state is q r

  14. Language of a TM ● L(M) = {w | M accepts w} ● M may reject or loop on strings not in L(M) ● A language X is recognizable if X=L(M) for some TM M ● A TM M is a decider if M(w) halts on every input w ● A language X is decidable is X=L(M) for some decider M

  15. Language of a TM Which of the following is true? ● L(M) = {w | M accepts w} A) If X is decidable, then X is recognizable ● M may reject or loop on strings not in L(M) B) If X is recognizable, then X ● A language X is recognizable if X=L(M) for some is recognizable TM M C) If X is decidable, then X is decidable ● A TM M is a decider if M(w) halts on every input w D) A and C, but not C ● A language X is decidable is X=L(M) for some E) I can’t decide, I do not decider M recognize this question :(

  16. Reminders • Reading: Sipser Chapter 3 • HW5 due Monday Oct 31 • Review for Exam 2 • T uesday Nov 1 TBA • Exam 2 Wednesday Nov 2 • Seating chart: see Piazza • Study guide: see Piazza • Haskell 3 on CFG is out. Due Nov 7.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend