bu cs 332 theory of computation
play

BU CS 332 Theory of Computation Lecture 13: Reading: Mid Semester - PowerPoint PPT Presentation

BU CS 332 Theory of Computation Lecture 13: Reading: Mid Semester Feedback Sipser Ch 4.1 Enumerators Decidable Languages Mark Bun March 16, 2020 What aspects of the course help you learn best? Examples in class


  1. BU CS 332 – Theory of Computation Lecture 13: Reading: • Mid ‐ Semester Feedback Sipser Ch 4.1 • Enumerators • Decidable Languages Mark Bun March 16, 2020

  2. What aspects of the course help you learn best? • Examples in class • Reviewing past homeworks/exams in class • Textbook • Posting materials online • Lecture, generally • Office hours • In ‐ depth problem ‐ solving in discussion section • Top Hat questions • Piazza discussions / instructor response 3/16/2020 CS332 ‐ Theory of Computation 2

  3. What in the class so far has hindered your learning? • Pace of information transmission / workload • Criteria for formality of proofs on homework and exams • Poor handwriting • Questions in class not fully answered • Lack of organization in discussion • Broad concepts • “Bureaucratic descriptions” • “All materials concluded” 3/16/2020 CS332 ‐ Theory of Computation 3

  4. What specific changes can we make to improve your learning? • More examples • Post solutions / other materials online • Discussion solutions • More Top Hat questions • Go slower • More guidelines for how to solve each type of problem • Looser grading • Midterm too long • More detailed slides 3/16/2020 CS332 ‐ Theory of Computation 4

  5. Do you understand what is expected from you in this class? • Reading the book before vs. after class • Need to do every problem in the book to succeed? • Lack of coordination between readings and lectures • “I have to attend lectures, read the material in the book, do some practice problems and then attempt the homework” • Exam grading critical over formatting vs. looser standards on homework 3/16/2020 CS332 ‐ Theory of Computation 5

  6. How can you improve your own learning? • Read the book • Solve more practice problems • Review HW solutions • Come to office hours • Time management • Open mind to more abstract ways of thinking 3/16/2020 CS332 ‐ Theory of Computation 6

  7. Enumerators 3/16/2020 CS332 ‐ Theory of Computation 7

  8. TMs are equivalent to… • TMs with “stay put” • TMs with 2 ‐ way infinite tapes • Multi ‐ tape TMs • Nondeterministic TMs • Random access TMs • Enumerators • Finite automata with access to an unbounded queue = 2 ‐ stack PDAs • Primitive recursive functions • Cellular automata • “Turing ‐ complete” programming languages (C, Python, Java…) … 3/16/2020 CS332 ‐ Theory of Computation 8

  9. Enumerators Finite Work tape control “Printer” • Starts with two blank tapes • Prints strings to printer strings eventually printed by • May never terminate (even if language is finite) • May print the same string many times 3/16/2020 CS332 ‐ Theory of Computation 9

  10. Enumerator Example 1. Initialize 2. Repeat forever: � • Calculate (in binary) • Send to printer • Increment What language does this enumerator enumerate? 3/16/2020 CS332 ‐ Theory of Computation 10

  11. Enumerable = Turing ‐ Recognizable Theorem: A language is Turing ‐ recognizable some enumerator enumerates it Start with an enumerator for and give a TM 3/16/2020 CS332 ‐ Theory of Computation 11

  12. Enumerable = Turing ‐ Recognizable Theorem: A language is Turing ‐ recognizable some enumerator enumerates it Start with a TM for and give an enumerator 3/16/2020 CS332 ‐ Theory of Computation 12

  13. Decidable Languages 3/16/2020 CS332 ‐ Theory of Computation 13

  14. 1928 – The Entscheidungsproblem The “Decision Problem” Is there an algorithm which takes as input a formula (in first ‐ order logic) and decides whether it’s logically valid? 3/16/2020 CS332 ‐ Theory of Computation 14

  15. Questions about regular languages Design a TM which takes as input a DFA and a string , and determines whether accepts How should the input to this TM be represented? Let . List each component of the tuple � separated by ; • Represent by , ‐ separated binary strings • Represent by , ‐ separated binary strings • Represent by a , ‐ separated list of triples , … Denote the encoding of by 3/16/2020 CS332 ‐ Theory of Computation 15

  16. Representation independence Computability (i.e., decidability and recognizability) is not affected by the choice of encoding Why? A TM can always convert between different encodings For now, we can take to mean “any reasonable encoding” 3/16/2020 CS332 ‐ Theory of Computation 16

  17. A “universal” algorithm for recognizing regular languages ��� Theorem: ��� is decidable Proof: Define a 3 ‐ tape TM on input 1. Check if is a valid encoding (reject if not) 2. Simulate on , i.e., • Tape 2: Maintain 𝑥 and head location of 𝐸 • Tape 3: Maintain state of 𝐸 , update according to 𝜀 3. Accept iff ends in an accept state 3/16/2020 CS332 ‐ Theory of Computation 17

  18. Other decidable languages ��� ��� ��� ��� 3/16/2020 CS332 ‐ Theory of Computation 18

  19. CFG Generation Theorem: is Turing ‐ ��� recognizable Proof idea: Define a TM recognizing ��� On input : 1. Enumerate all strings that can be generated from (i.e., all length ‐ 1 derivations, all length ‐ 2 derivations, …) 2. If any of these strings equal , accept 3/16/2020 CS332 ‐ Theory of Computation 19

  20. CFG Generation Theorem: is decidable ��� Chomsky Normal Form for CFGs: • Can have a rule 𝑇 → 𝜁 • All remaining rules of the form 𝐵 → 𝐶𝐷 or 𝐵 → 𝑏 • Cannot have 𝑇 on the RHS of any rule Lemma: Any CFG can be converted into an equivalent CFG in Chomsky Normal Form Lemma: If is in Chomsky Normal Form, any nonempty string w that can be derived from has a derivation with at most steps 3/16/2020 CS332 ‐ Theory of Computation 20

  21. CFG Generation Theorem: is decidable ��� Proof idea: Define a TM recognizing ��� On input : 1. Convert into Chomsky Normal Form 2. Enumerate all strings derivable in steps 3. If any of these strings equal , accept 3/16/2020 CS332 ‐ Theory of Computation 21

  22. Context Free Languages are Decidable Theorem: Every CFL is decidable Proof: Let be a CFG generating . The following TM decides On input : 1. Run the decider for ��� on input 2. Accept if the decider accepts; reject otherwise 3/16/2020 CS332 ‐ Theory of Computation 22

  23. Classes of Languages recognizable decidable context free regular 3/16/2020 CS332 ‐ Theory of Computation 23

  24. More Examples ��� ��� 3/16/2020 CS332 ‐ Theory of Computation 24

  25. Decidability of Theorem: is ��� decidable Proof: The following TM decides ��� On input , where is a DFA with states: 1. Perform steps of breadth ‐ first search on state diagram of to determine if an accept state is reachable from the start state 2. Accept if an accept state reachable; reject otherwise 3/16/2020 CS332 ‐ Theory of Computation 25

  26. 3/16/2020 CS332 ‐ Theory of Computation 26

  27. Decidability of Theorem: is ��� decidable Proof: The following TM decides ��� On input , where is a CFG with states: 1. Mark all terminal symbols in 2. Repeat until no new variable is marked: Mark any variable 𝐵 where 𝐻 has a rule 𝐵 → 𝑉 � 𝑉 � … 𝑉 � and every symbol 𝑉 � , … , 𝑉 � is marked 3. Accept if the start variable is unmarked; else reject 3/16/2020 CS332 ‐ Theory of Computation 27

  28. New Deciders from Old ��� � � � � � � Theorem: ��� is decidable Proof: The following TM decides ��� On input � , where � are DFAs: � � 1. Construct a DFA that recognizes the symmetric difference � � 2. Run the decider for ��� on and return its output 3/16/2020 CS332 ‐ Theory of Computation 28

  29. Symmetric Difference 3/16/2020 CS332 ‐ Theory of Computation 29

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