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

bu cs 332 theory of computation
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

BU CS 332 – Theory of Computation

Lecture 13:

  • Mid‐Semester Feedback
  • Enumerators
  • Decidable Languages

Reading: Sipser Ch 4.1

Mark Bun March 16, 2020

slide-2
SLIDE 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

slide-3
SLIDE 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

slide-4
SLIDE 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

slide-5
SLIDE 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

slide-6
SLIDE 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

slide-7
SLIDE 7

Enumerators

3/16/2020 CS332 ‐ Theory of Computation 7

slide-8
SLIDE 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

slide-9
SLIDE 9

Enumerators

  • 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

Finite control Work tape “Printer”

slide-10
SLIDE 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

slide-11
SLIDE 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

slide-12
SLIDE 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

slide-13
SLIDE 13

Decidable Languages

3/16/2020 CS332 ‐ Theory of Computation 13

slide-14
SLIDE 14

1928 – The Entscheidungsproblem

3/16/2020 CS332 ‐ Theory of Computation 14

The “Decision Problem” Is there an algorithm which takes as input a formula (in first‐

  • rder logic) and decides whether it’s logically valid?
slide-15
SLIDE 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

slide-16
SLIDE 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

slide-17
SLIDE 17

A “universal” algorithm for recognizing regular languages

  • Theorem:

is decidable

Proof: Define a 3‐tape TM

  • n input
  • 1. Check if

is a valid encoding (reject if not)

  • 2. Simulate
  • n , 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

slide-18
SLIDE 18

Other decidable languages

  • 3/16/2020

CS332 ‐ Theory of Computation 18

slide-19
SLIDE 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

slide-20
SLIDE 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

slide-21
SLIDE 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

slide-22
SLIDE 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
  • n input
  • 2. Accept if the decider accepts; reject otherwise

3/16/2020 CS332 ‐ Theory of Computation 22

slide-23
SLIDE 23

Classes of Languages

3/16/2020 CS332 ‐ Theory of Computation 23

context free regular recognizable decidable

slide-24
SLIDE 24

More Examples

3/16/2020 CS332 ‐ Theory of Computation 24

slide-25
SLIDE 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

slide-26
SLIDE 26

3/16/2020 CS332 ‐ Theory of Computation 26

slide-27
SLIDE 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

slide-28
SLIDE 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

slide-29
SLIDE 29

Symmetric Difference

3/16/2020 CS332 ‐ Theory of Computation 29