CSE 105 THEORY OF COMPUTATION

Similar documents
CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

CSE 105 Theory of Computation

V Honors Theory of Computation

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

CSE 105 THEORY OF COMPUTATION

CSCE 551 Final Exam, Spring 2004 Answer Key

CSE 105 THEORY OF COMPUTATION

Decidability (What, stuff is unsolvable?)

CPSC 421: Tutorial #1

ACS2: Decidability Decidability

CSE 105 Theory of Computation

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Intro to Theory of Computation

1 Showing Recognizability

CSCE 551: Chin-Tser Huang. University of South Carolina

CSE 105 THEORY OF COMPUTATION

} Some languages are Turing-decidable A Turing Machine will halt on all inputs (either accepting or rejecting). No infinite loops.

Decidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement:

CP405 Theory of Computation

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

CSE 105 THEORY OF COMPUTATION

Decidability and Undecidability

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

Midterm II : Formal Languages, Automata, and Computability

Undecidability. We are not so much concerned if you are slow as when you come to a halt. (Chinese Proverb)

CSE 105 THEORY OF COMPUTATION

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

DM17. Beregnelighed. Jacob Aae Mikkelsen

Computational Models Lecture 8 1

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Reducability. Sipser, pages

CSE 105 THEORY OF COMPUTATION

Chap. 4,5 Review. Algorithms created in proofs from prior chapters

Decidability: Church-Turing Thesis

Final exam study sheet for CS3719 Turing machines and decidability.

Computational Models Lecture 8 1

Theory Bridge Exam Example Questions

CS 125 Section #10 (Un)decidability and Probability November 1, 2016

acs-07: Decidability Decidability Andreas Karwath und Malte Helmert Informatik Theorie II (A) WS2009/10

CS20a: Turing Machines (Oct 29, 2002)

CSE 105 THEORY OF COMPUTATION

Computational Models Lecture 8 1

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

Computability and Complexity

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012

Theory of Computation (IX) Yijia Chen Fudan University

Pumping Lemma for CFLs

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

6.045 Final Exam Solutions

CSCE 551: Chin-Tser Huang. University of South Carolina

Decidable Languages - relationship with other classes.

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

2.1 Solution. E T F a. E E + T T + T F + T a + T a + F a + a

Exam Computability and Complexity

CS 154 Introduction to Automata and Complexity Theory

Theory of Computation p.1/?? Theory of Computation p.2/?? We develop examples of languages that are decidable

CS20a: Turing Machines (Oct 29, 2002)

Introduction to Languages and Computation

6.045J/18.400J: Automata, Computability and Complexity Final Exam. There are two sheets of scratch paper at the end of this exam.

CSE 105 Theory of Computation Professor Jeanne Ferrante

CSE 105 THEORY OF COMPUTATION

Turing Machines Part III

Mapping Reducibility. Human-aware Robotics. 2017/11/16 Chapter 5.3 in Sipser Ø Announcement:

Homework Assignment 6 Answers

Lecture 24: Randomized Complexity, Course Summary

Lecture Notes: The Halting Problem; Reductions

CSE 105 Theory of Computation

SCHEME FOR INTERNAL ASSESSMENT TEST 3

What languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable?

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2016, face-to-face day section Prof. Marvin K. Nakayama

Please give details of your answer. A direct answer without explanation is not counted.

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

CS154, Lecture 10: Rice s Theorem, Oracle Machines

CSE 105 THEORY OF COMPUTATION

Theory of Computation

CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS

CSE 105 THEORY OF COMPUTATION

NODIA AND COMPANY. GATE SOLVED PAPER Computer Science Engineering Theory of Computation. Copyright By NODIA & COMPANY

Computability and Complexity

Decidability. Linz 6 th, Chapter 12: Limits of Algorithmic Computation, page 309ff

Part I: Definitions and Properties

Introduction to Turing Machines. Reading: Chapters 8 & 9

16.1 Countability. CS125 Lecture 16 Fall 2014

Foundations of Informatics: a Bridging Course

Answers to the CSCE 551 Final Exam, April 30, 2008

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

Before We Start. The Pumping Lemma. Languages. Context Free Languages. Plan for today. Now our picture looks like. Any questions?

Functions on languages:

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 8 Nancy Lynch

Transcription:

CSE 105 THEORY OF COMPUTATION Spring 2017 http://cseweb.ucsd.edu/classes/sp17/cse105-ab/

Today's learning goals Summarize key concepts, ideas, themes from CSE 105. Approach your final exam studying with confidence. Identify areas to focus on while studying for the exam. Reminders CAPE and TA evaluations open Final exam Saturday June 10 11:30am-2:29pm Seat map & study guide on Piazza. Discussion tomorrow will go over some of study guide.

Recognizable Decidable NP? P CF Regular

Model of computation Formal definition? Design? Describe language? Finite automata -- DFA -- NFA equiv to Regular expressions Push-down automata CFGs TMs that always halt in polynomial time Nondeterministic TMs that halt in polynomial time TMs that always halt aka Deciders Turing Machines (in general; may not halt) Class of languages Closure properties? Which languages not in class? Regular languages To show not in class: Pumping lemma Context-free languages P NP Decidable languages To show not in class: Diagonalization, reduction Recognizable languages

Where to next? JFLAP reboot interest: email me CSE198: More models of computation (lambda calculus, Post correspondence systems, register machines, oracle machines, probabilistic computation, approximation algorithms) etc. https://goo.gl/forms/06l9vemjs5qx64o43

Roadmap of examples A. Regular language design B. Undecidability via reduction C. Closure proofs D. Determining the language of a PDA /CFG E. Using Pumping Lemma

Given L, prove it is regular Construction Strategy 1: Construct DFA Strategy 2: Construct NFA Strategy 3: Construct regular expression Proof of correctness WTS 1 if w is in L then w is accepted by. WTS 2 if w is not in L then w is rejected by

Ex: L= { w in {0,1}* w has odd # of 1s OR starts with 0} NFA: Regular expression:

To show a language is not regular, we can A. Show there is a CFG generating A. B. Use the pumping lemma for regular languages. C. Show A is undecidable. D. More than one of the abve. E. I don't know.

To show a language L is Recognizable Show there is a TM M with L(M) = L. Not recognizable Prove that L is not decidable and that the complement of L is recognizable. Use closure properties. Use closure properties.

To show a language L is Decidable Show there is a TM D that always halts and L(D) = L. Find a decidable problem L' and show L reduces to L' Not decidable Use diagonalization Find an undecidable problem L' and show L' reduces to L. Use closure properties. Use closure properties.

Undecidability via reduction Theorem: Problem T is undecidable. Proof Common pattern for many of these proofs. Assume (towards a contradiction) that T is decidable by TM M T. Goal: use M T to build a machine which will decide A TM. Define M ATM = "On input <M,w>: 1. Using the parameters M and w, construct a different TM X such that if M accepts w, then <X> is in T; if M does not accept w, then <X> is not in T. 2. Run M T on <X> and accept if M T accepts, reject if M T rejects." Claim: M ATM is decider and L(M ATM ) = A TM, Then A TM is decidable, contradicting the known fact that A TM is undecidable.

T = { <M> M is TM and L(M) = 1} Theorem: Problem T is undecidable. Proof Assume (towards a contradiction) that T is decidable by TM M T. Goal: use M T to build a machine which will decide A TM. Define M ATM = "On input <M,w>: 1. Using the parameters M and w, construct a different TM X such that if M accepts w, then <X> is in T; if M does not accept w, then <X> is not in T. 2. Run M T on <X> and accept if accepts, reject if rejects. Claim: M ATM is decider and L(M ATM ) = A TM, Then A TM is decidable, contradicting the known fact that A TM is undecidable.

Undecidability via reduction Theorem: Problem T is undecidable. Proof Common pattern for many of these proofs. Assume (towards a contradiction) that T is decidable by TM M T. Goal: use M T to build In reduction a machine proofs, which will decide A TM. Define M ATM = "On input <M,w>: 1. Using the parameters A. We always M and need w, construct to build a different new TM TM X. X such that if M accepts B. The auxiliary w, then <X> machine is X T; must if M does be run not as accept w, then <X> part is of not our in algorithm. T. 2. Run M T on <X> C. and The accept auxiliary if accepts, machine reject X runs if rejects. only on w. Claim: M ATM is decider D. None and of L(M the ATM above. ) = A TM, Then A TM is decidable, contradicting the known fact that A TM is undecidable. E. I don't know.

Countable and uncountable Countable Find bijection with N Find a countable superset Examples Any language over Σ Set of all regular languages Set of rational numbers Set of integers Uncountable Diagonalization Find an uncountable subset Examples Set of all subsets of Σ* Set of infinite binary sequences Set of real numbers [0,1]

Closure properties Regular Languages CFL Decidable Languages Union Recognizable Languages Intersection Complement Star Concatenation

Proving closure Goal: "The class of languages is closed under " In other words Given a language in specific class, is the result of applying the operation to this language still guaranteed to be in the class?

Proving closure Given: What does it mean for L to be in class? e.g. L a regular language, so given a DFA M L = (Q L, Σ L, δ L,q L,F L ) with L(M L ) = L. Name each of the pieces! WTS: The result of applying the operation to L is still in this class. Construction: Build a machine that recognizes the result of applying the operation to L. Start with description in English! e.g. Let M = (Q, Σ, δ, q 0, F) where Q= Σ= δ= q 0 = F=.. M could be DFA or NFA Correctness: Prove L(M) = result of applying operation to L WTS1 if w is in set then w is accepted by M WTS2 if w is not in the set then w rejected by M.

Claim: The class of recognizable languages is closed under concatenation Given WTS Construction Correctness

Claim: The class of recognizable languages is closed under concatenation Given Two recognizable languages A,B and TMs that recognize them: M A with L(M A ) = A and M B with L(M B ) = B. WTS The language AB is recognizable. Construction Define the TM M as "On input w, 1. Nondeterministically split w into w = xy. 2. Simulate running M A on x. If rejects, reject; if accepts go to 3. 3. Simulate running M B on y. If rejects, reject; if accepts, accept. Correctness

Construction Define the TM M as "On input w, 1. Nondeterministically split w into w = xy. 2. Simulate running M A on x. If rejects, reject; if accepts go to 3. 3. Simulate running M B on y. If rejects, reject; if accepts, accept. Correctness Claim that w is in AB iff w is in L(M). Part 1: Assume w is in AB. Then there are strings x,y such that w = xy and x is in A, y is in B. Running M on w, one of the nondeterministic ways we split w will be into these x,y. In step 2, the computation of M A on x will halt and accept (because L(M A ) = A) so we go to step 3. In that step, the computation of M B on y will halt and accept (because L(M B ) = B so M accepts w.

Construction Define the TM M as "On input w, 1. Nondeterministically split w into w = xy. 2. Simulate running M A on x. If rejects, reject; if accepts go to 3. 3. Simulate running M B on y. If rejects, reject; if accepts, accept. Correctness Claim that w is in AB iff w is in L(M). Part 2: Assume w is not in AB. Then there are no strings x,y such that w = xy and x is in A, y is in B. In other words, for each way of splitting w into xy, at least one of the following is true: M A running on x will reject or loop, M B running on y will reject or loop. Tracing the computation of M on w, in each one of the nondeterministic computation paths, there is some split w=xy. For each of these splits, in step 2, the computation of M A on x either loops (in which case M loops on w, so w is not in L(M)) or rejects (in which case M rejects w) or accepts (in which case M goes to step 3). If the computation of M enters step 3, this means that x is in L(M A ) so by our assumption, y is not in L(M B ) so M B on y must either loop or reject. In either case, M rejects. Thus w is not in L(M).

Proving closure Given: What does it mean for L to be in class? e.g. L a regular language, so given a DFA M L = (Q L, Σ L, δ L,q L,F L ) To prove the class of recognizable languages with L(M is L closed ) = L. Name under each of the the pieces! constructions may WTS: The result involve of applying building the a operation to L is still in this class. Construction: Build a machine that recognizes the result of applying the operation to L. Start with description in English! A. Two-tape Turing machine. e.g. Let M = (Q, Σ, δ, q 0, F) where Q= Σ= δ= q 0 = F=.. B. Nondeterministic decider. M could be DFA or NFA C. Enumerator. Correctness: Prove L(M) = result of applying operation to L D. All of the above. WTS1 if w is in set then w is accepted by M E. I don't know. WTS2 if w is not in the set then w rejected by M.

Claim: The class of decidable languages is closed under reversal Given WTS Construction Correctness

Claim: The class of decidable languages is closed under reversal Given A decidable language L, with a decider TM D: L(D)=L WTS There is a decider that decides L R = {w w R is in L} Construction Define the TM M as "On input w: 1. Make a copy of w in reverse. 2. Simulate running D on this copy. 3. If D accepts, accept. If D rejects, reject. Correctness If w is in L R then in step 1, M builds w R and in step 2, the computation of D on w R will accept (because L(D) = L), so in step 3, M accepts w. If w is not in L R then in step 1, M builds w R and in step 2, the computation of D on w R will rejept (because L(D) = L), so in step 3, M rejects w.

Claim: The class of decidable languages is closed under reversal Given A decidable language L, with a decider TM D: L(D)=L WTS There is a decider that decides L R = {w w R is in L} Construction Define Is this the TM how M we as proved "On input that w: the class of regular 1. Make a copy of languages w in reverse. is closed under reversal? 2. Simulate running D on this copy. 3. If D accepts, accept. A. Yes. If D rejects, reject. Correctness If w is B. in No L R then but in we step could 1, M modify builds our w R earlier and in proof step 2, the computation of D on to make w R will a accept copy of (because w R and then L(D) run = L), the so in step 3, M accepts w. If DFA w is on not it. in L R then in step 1, M builds w R and in step 2, the computation C. No and of this D on strategy w R will won't rejept work (because for L(D) = L), so in step 3, M rejects w. automata. D. I don't know.

What is the language of this PDA? A. {w # of b's in w # of a's in w} B. {w w = a n b n+1 for some n 0} C. {w w = a n b n+2 for some n 0} D. {w w = a n b 2n for some n 0} E. {w w = 0a n b 2n 0 for some n 0}

What is the language of CFG with rules S asb by Ya Y by Ya ε

(Using) Pumping Lemma Theorem: L = {w w R w is in {0,1}* } is not regular. Proof (by contradiction): Assume, towards a contradiction, that L is regular. Then by the Pumping Lemma, there is a pumping length, p, for L. Choose s to be the string. The Pumping Lemma guarantees that s can be divided into parts s=xyz such that xy p, y >0, and for any i 0, xy i z is in L. But, if we let i=, we get the string which is not in L, a contradiction. Thus L is not regular.

(Using) Pumping Lemma A. s = 000000111111, i=6 B. s=0 p 0 p, i=2 C. s=0 p 110 p, i=2 Theorem: L = {w w R w is in {0,1}* } is not regular. Proof (by contradiction): D. More Assume, than one of towards the above. a contradiction, that L is regular. Then E. I don't by the know. Pumping Lemma, there is a pumping length, p, for L. Choose s to be the string. The Pumping Lemma guarantees that s can be divided into parts s=xyz such that xy p, y >0, and for any i 0, xy i z is in L. But, if we let i=, we get the string which is not in L, a contradiction. Thus L is not regular.

P and NP P: Languages decidable in polynomial time on deterministic Turing machines. e.g. PATH, Simple arithmetic, CFL's, etc. NP: Languages decidable in polynomial time on nondeterministic Turing machines. e.g. TSP, SAT, CLIQUE, etc. Know P NP and if an NP-complete problem is in P, then P=NP.

Recognizable Decidable NP? P CF Regular

Recognizable