Undecidability and Rice s Theorem. Lecture 26, December 3 CS 374, Fall 2015

Similar documents
Turing Machine Recap

Lecture 23: Rice Theorem and Turing machine behavior properties 21 April 2009

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

CS154, Lecture 10: Rice s Theorem, Oracle Machines

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

Computability Crib Sheet

CS20a: Turing Machines (Oct 29, 2002)

SD & Turing Enumerable. Lecture 33: Reductions and Undecidability. Lexicographically Enumerable. SD & Turing Enumerable

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

CSE 105 THEORY OF COMPUTATION

Turing Machines Part III

CS151 Complexity Theory. Lecture 1 April 3, 2017

CS5371 Theory of Computation. Lecture 14: Computability V (Prove by Reduction)

There are two main techniques for showing that problems are undecidable: diagonalization and reduction

CSE 105 THEORY OF COMPUTATION

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

Automata Theory CS S-FR2 Final Review

Polynomial Space. The classes PS and NPS Relationship to Other Classes Equivalence PS = NPS A PS-Complete Problem

NP-Completeness Part II

Lecture Notes Each circuit agrees with M on inputs of length equal to its index, i.e. n, x {0, 1} n, C n (x) = M(x).

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

CSCI3390-Lecture 6: An Undecidable Problem

CS481F01 Solutions 8

Decidability and Undecidability

CS154, Lecture 17: conp, Oracles again, Space Complexity

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

Decidability: Church-Turing Thesis

Midterm II : Formal Languages, Automata, and Computability

Final Exam (Version B) December 16, 2014 Name: NetID: Section: 1 2 3

Final Exam Version A December 16, 2014 Name: NetID: Section: # Total Score

Lecture 20: conp and Friends, Oracles in Complexity Theory

Computational Models Lecture 9, Spring 2009

Computability and Complexity

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Umans Complexity Theory Lectures

CS154, Lecture 12: Kolmogorov Complexity: A Universal Theory of Data Compression

CSE 105 THEORY OF COMPUTATION

1 Showing Recognizability

Undecidable Problems and Reducibility

Definition: Alternating time and space Game Semantics: State of machine determines who

conp, Oracles, Space Complexity

Week 3: Reductions and Completeness

Lecture 14: IP = PSPACE

Lecture 17: Cook-Levin Theorem, NP-Complete Problems

: Computational Complexity Lecture 3 ITCS, Tsinghua Univesity, Fall October 2007

CSE 105 Theory of Computation

The Unsolvability of the Halting Problem. Chapter 19

Lecture Notes: The Halting Problem; Reductions

A Note on Turing Machine Design

CSE 105 Theory of Computation

CpSc 421 Homework 9 Solution

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

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

Introduction to Turing Machines. Reading: Chapters 8 & 9

1 Propositional Logic

Exam Computability and Complexity

CS154 Final Examination

Definition: Alternating time and space Game Semantics: State of machine determines who

Nondeterministic finite automata

Solutions to Old Final Exams (For Fall 2007)

Lecture 22: PSPACE

Further discussion of Turing machines

1 Circuit Complexity. CS 6743 Lecture 15 1 Fall Definitions

uring Reducibility Dept. of Computer Sc. & Engg., IIT Kharagpur 1 Turing Reducibility

COL 352 Introduction to Automata and Theory of Computation Major Exam, Sem II , Max 80, Time 2 hr. Name Entry No. Group

Definition: conp = { L L NP } What does a conp computation look like?

Problems, and How Computer Scientists Solve Them Manas Thakur

Essential facts about NP-completeness:

6.045: Automata, Computability, and Complexity (GITCS) Class 15 Nancy Lynch

CSE 311 Lecture 28: Undecidability of the Halting Problem. Emina Torlak and Kevin Zatloukal

NP-Completeness Part II

Lecture 24: Randomized Complexity, Course Summary

Lecture 12: Mapping Reductions

Limits of Computability

1 Deterministic Turing Machines

CSE 105 THEORY OF COMPUTATION

1 Reductions and Expressiveness

Turing Machines. Lecture 8

CPSC 421: Tutorial #1

Final Exam Comments. UVa - cs302: Theory of Computation Spring < Total

Most General computer?

6.045 Final Exam Solutions

Complexity. Complexity Theory Lecture 3. Decidability and Complexity. Complexity Classes

Undecidability. Almost all Languages are undecidable. Question: Is it just weird languages that no one would care about which are undecidable?

Complexity Theory Part I

Lecture 3: Reductions and Completeness

Complexity Theory: The P vs NP question

15-251: Great Theoretical Ideas in Computer Science Fall 2016 Lecture 6 September 15, Turing & the Uncomputable

CS 154 Introduction to Automata and Complexity Theory

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

A non-turing-recognizable language

problem X reduces to Problem Y solving X would be easy, if we knew how to solve Y

Lecture 13: Foundations of Math and Kolmogorov Complexity

Complexity Theory Part I

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

(a) Definition of TMs. First Problem of URMs

CSE 105 THEORY OF COMPUTATION

Reducability. Sipser, pages

Turing & the Uncomputable; Intro to Time Complexity

Turing Machines Decidability

Transcription:

Undecidability and Rice s Theorem Lecture 26, December 3 CS 374, Fall 2015

UNDECIDABLE EXP NP P R E RECURSIVE

Recap: Universal TM U We saw a TM U such that L(U) = { (z,w) M z accepts w} Thus, U is a stored-program computer It reads a program z and executes it on data w L(U) = { (z,w) M z accepts w} is re

Recap: Universal TM U L(U) = { (z,w) M z accepts w} is re We proved the following: Theorem: L(U) is undecidable (ie, not recursive) No algorithm for L(U)

UNDECIDABLE EXP NP P R E RECURSIVE L(U)

Polytime Reductions X p Y X reduces to Y in polytime X-solver (polytime) I x REDUCTION (poly time) I Y Y-solver (poly time) YES NO If Y can be decided in poly time, then X can be decided in poly time If X can t be decided in poly time, then Y can t be decided in poly time

Polytime Reductions X Y X reduces to Y in polytime X-solver (polytime) I x REDUCTION (poly time) I Y Y-solver (poly time) YES NO If Y can be decided in poly time, then X can be decided in poly time If X can t be decided in poly time, then Y can t be decided in poly time

Reduction X Y X reduces to Y X-solver I x I Y REDUCTION Y-solver YES NO If Y can be decided, then X can be decided If X can t be decided, then Y can t be decided

Halting Problem Does given M halt when run on blank input? HALT = { z M z halts when run on blank input} Show HALT is undecidable by showing L(U) HALT L(U)-decider REDUCTION HALT decider YES NO What are input and output of the reduction?

L(U) HALT L(U)-decider (z,w) z REDUCTION HALT decider YES NO Need: M z halts on blank input iff M z accepts w TM M z const z const w run M z on w and halt if it accepts otherwise run for ever The REDUCTION doesn t run M z on w It produces code for M z!

L(U) HALT L(U)-decider (z,w) z REDUCTION HALT decider YES NO Need: M z halts on blank input iff M z accepts w TM M z const z const w run M z on w and halt if it accepts Correctness: L(U)-decider say yes iff M z halts on blank input iff M z accepts w iff (z,w) is in L(U)

UNDECIDABLE EXP NP P R E RECURSIVE L(U) HALT

Who cares about halting TMs? Remember, TMs = programs Virtually all math conjectures can be expressed as a halting-tm question Example: Goldbach s conjecture: Every even number > 2 is the sum of two primes

Program Goldbach goldbach() n = 4 WHILE is-sum-of-two-primes(n) n = n+2 STOP AND SAY NO is-sum-of-two-primes(n): boolean FOR p q < n IF p,q, prime AND p+q=n THEN RETURN TRUE RETURN FALSE goldbach() halts iff Goldbach s conjecture is false

Deciding mathematical truth prove-theorem(t) w = WHILE NOT is-a-proof-of (w,t) w = lexicographically-next-string(w) OUTPUT T + is true prove-theorem(t) halts iff there is a proof of T

CS 125 assignment: Write a program that outputs Hello world main() { printf( Hello world ); } Can we write an auto-grader? If so; we can solve Goldbach s conjecture

goldbach() n = 4 WHILE is-sum-of-two-primes(n) n = n+2 STOP AND SAY NO is-sum-of-two-primes(n): boolean FOR p q < n IF p,q, prime AND p+q=n RETURN FALSE THEN RETURN TRUE main() goldbach(); { printf( Hello world ); } AUTOGRADER CORRECT INCORRECT

Deciding halting problem Given string z, to determine if program M z halts, do the following: So, deciding if a program prints Hello world is solving the halting problem main() M z () { printf( Hello world ); } AUTOGRADER CORRECT INCORRECT Using same ideas, we can show that deciding anything about code behavior is not possible

More reductions about languages We ll show other languages involving program behavior are undecidable: L 374 = {<M> L(M) = {0 374 } } L Ø = {<M> L(M) is nonempty} L pal = {<M> L(M) = palindromes} many many others

L 374 = { z L(M z ) = {0 374 } } is undecidable Given a TM M, telling whether it accepts only the string 0 374 is not possible Proved by showing HALT L 374 z z = REDUCTION: BUILD z instance of HALT instance of L 374 What is L(M z )? If M z halts, L(M z ) = If M z doesn t L(M z ) = {0 374 } Ø x M z : constant: z On input x, 0 if x 0 374, reject 1 if x = 0 374, then 2 run M z accept x iff M z halts Q: How does the reduction know whether or not M z halts? A: It doesn t have to It just builds (code for) M z

If there is a decider M 374 to tell if a TM accepts the language {0 374 } Decider for HALT z z YES: REDUCTION: BUILD z M 374 L(M z ) = {0 374 } iff M z halts M z : constant: z x On input x, 0 if x 0 374, reject 1 if x = 0 374, then 2 run M z accept x iff M z halts Recall L(M ) = {0 374 } iff M(w) accepts NO: L(M ) = Ø {0 374 } iff M z does not halt Since HALT is not decidable, M 374 doesn t exist, and L 374 is undecidable

L Ø = {<M> L(M) is nonempty} is undecidable Given a TM M, telling whether it accepts any string is undecidable Proved by showing HALT L Ø z instance of HALT REDUCTION: BUILD z We want M z to satisfy: If M z halts, L(M z ) If M z doesn t L(M z ) Ø = Ø z = instance of L Ø x M z : constant: z On input x, Run M z Accept x if M z halts If M z halts, L(M z ) = Σ * hence Ø If M z doesn t, L(M z ) = Ø

L pal = { z L(M z ) = palindromes} is undecidable Given a TM M, telling whether it accepts the set of palindromes is undecidable Proved by showing HALT L pal z REDUCTION: BUILD z instance of HALT We want M z to satisfy: If M z halts, L(M z ) If M z doesn t L(M z ) z = instance of L pal = {palindromes} {palindromes} x M z : constant: z On input x, Run M z Accept x if M z halts and x is a palindrome

Lots of undecidable problems about languages accepted by programs Given M, is L(M) = {palindromes}? Given M, is L(M) Ø? Given M, is L(M) = {0 374 }? Given M, is L(M) = {0 p p is prime}? Given M, does L(M) contain any prime? Given M, does L(M) contain any word? Given M, does L(M) meet these formal specs? Given M, does L(M) = Σ *?

Rice s Theorem Q: What can we decide about the languages accepted by programs? A: NOTHING! except trivial things

Properties of re languages A Property of re languages is a predicate P of re languages ie, P: {L L is re} à {true, false} Important: we are only interested in re languages Examples: P(L) = L contains 0 374 P(L) = L contains at least 5 strings P(L) = L is empty P(L) = L = {0 n 1 n n 0}

Properties of re languages A Property of re languages is a predicate P of re languages ie, P: {L L is re} à {true, false} L = L(M) for some TM iff L is re by definition We will thus think of a Property of re languages as a set { z L(M z ) satisfies predicate P} Note that each property P is thus a set of strings L(P) = { z L(M z ) satisfies predicate P} Question: For which P is L(P) decidable?

Trivial Properties A property is trivial if either all re languages satisfy it, or no re languages satisfy it { z L(M z ) is re} why is this trivial? EVERY language accepted by an M is re by def n { z L(M z ) is not re} why is this trivial? { z L(M z ) = Ø or L(M z ) Ø} why trivial? Clearly, trivial properties are decidable Because if P is trivial then L(P) = Ø or L(P) = Σ*

Rice s Theorem Every nontrivial property of re languages is undecidable So, there is virtually nothing we can decide about behavior (language accepted) by programs Example: auto-graders don t exist (if submissions are allowed to run an arbitrary (but finite) amount of time)

Proof Let P be a non-trivial property Let L(P) = { z L(M z ) satisfies predicate P} ShowL(P) is undecidable Assume Ø does not satisfy P Assume L(M P-sat ) satisfies P for some TM M P-sat There must be at least one such TM (why?)

If there is a decider M P to tell if a TM accepts a language satisfying P Decider for HALT z z YES: REDUCTION: BUILD z M P L(M z ) satisfies P iff M z halts M z : constant: z x On input x, Run M z Accept x if?? M z blah halts blah and blah M P-sat?? accepts x NO: L(M z ) = Ø doesn t satisfy P iff M z does not halt If M z doesn t halt then L(M z ) = If M z does halt then L(M z ) = Ø L(M P-sat ) Since HALT is not decidable, M P doesn t exist, and L(P) is undecidable

What about assumption We assumed Ø does not satisfy P What if Ø does satisfy P? Then consider L(P ) = { <M> L(M) doesn t satisfy predicate P} Then Ø isn t in L(P ) Show L(P ) is undecidable So L(P) isn t either (by closure under complement)

Properties of re Languages are Not properties of programs/tms P is defined on languages, not the machines which might accept them {<M> M at some point moves its head left} is a property of the machine behavior, not the language accepted {<Apy> program A has 374 lines of code} {<Apy> A accepts Hello World } this really is a predicate on L(A)

Properties about TMs sometimes decidable: { z M z has 374 states} { z M z uses 374 tape cells on blank input} 374 x Γ 32 x Q M { z M z never moves head to left} sometimes undecidable { z M z halts on blank input} { z M z, on input 0110, eventually writes 2 }

Today Quick recap halting & undecidability Undecidability via reductions Rice s theorem ICES pick up TWO forms (Chandra + Manoj) return to same location

Final Thoughts Theory of Computation and Algorithms are fundamental to Computer Science Of immense pragmatic importance Of great interest to mathematics Of great interest to natural sciences (physics, biology, chemistry) Of great interest to social sciences too!

Final Thoughts Grades are important but only in short term No one will ask you how well you did in CS 374 in a year or two Use your algorithmic/theory/analytical skills to differentiate yourself from other IT professionals

Other Theory Courses new 473 (Theory 2) Jeff in Spring 16, Chandra in Fall 16 Approximation algorithms (Chandra Spring 16) Computational Complexity (Kolla, Spring 16) Algorithmic Game Theory (Mehta, Spring 16) Randomized algorithms, Data structures, Computational Geometry, Algorithms for Big Data

Other Theory ish Courses Machine learning, statistical learning, Logic and formal methods Graph theory, combinatorics, Coding theory, information theory, signal processing Computational biology

Thanks!