INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.

Slides:



Advertisements
Similar presentations
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Advertisements

Lecture 3 Universal TM. Code of a DTM Consider a one-tape DTM M = (Q, Σ, Γ, δ, s). It can be encoded as follows: First, encode each state, each direction,
CS 461 – Nov. 9 Chomsky hierarchy of language classes –Review –Let’s find a language outside the TM world! –Hints: languages and TM are countable, but.
The Recursion Theorem Sipser – pages Self replication Living things are machines Living things can self-reproduce Machines cannot self reproduce.
Turing -Recognizable vs. -Decidable
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
1 COMP 382: Reasoning about algorithms Unit 9: Undecidability [Slides adapted from Amos Israeli’s]
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
1 Section 14.1 Computability Some problems cannot be solved by any machine/algorithm. To prove such statements we need to effectively describe all possible.
February 11, 2015CS21 Lecture 161 CS21 Decidability and Tractability Lecture 16 February 11, 2015.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)
CS 302: Discrete Math II A Review. An alphabet Σ is a finite set (e.g., Σ = {0,1}) A string over Σ is a finite-length sequence of elements of Σ For x.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
1 The Chomsky Hierarchy. 2 Unrestricted Grammars: Rules have form String of variables and terminals String of variables and terminals.
Fall 2004COMP 3351 The Chomsky Hierarchy. Fall 2004COMP 3352 Non-recursively enumerable Recursively-enumerable Recursive Context-sensitive Context-free.
Homework #9 Solutions.
Computability and Complexity 10-1 Computability and Complexity Andrei Bulatov Gödel’s Incompleteness Theorem.
Theory of Computing Lecture 20 MAS 714 Hartmut Klauck.
1 Reducibility. 2 Problem is reduced to problem If we can solve problem then we can solve problem.
MA/CSSE 474 Theory of Computation The Halting Problem.
The Recursion Theorem Pages 217– ADVANCED TOPICS IN C O M P U T A B I L I T Y THEORY.
MA/CSSE 474 Theory of Computation More Reduction Examples Non-SD Reductions.
Course Overview and Road Map Computability and Logic.
Great Theoretical Ideas in Computer Science.
Great Theoretical Ideas in Computer Science.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 7 Undecidability cont. Jan Maluszynski, IDA, 2007
Computation Motivating questions: What does “computation” mean? What are the similarities and differences between computation in computers and in natural.
Turing -Recognizable vs. -Decidable
Lecture 21 Reducibility. Many-one reducibility For two sets A c Σ* and B c Γ*, A ≤ m B if there exists a Turing-computable function f: Σ* → Γ* such that.
Thales’ Legacy: What Is A Proof? Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2004 Lecture 27April 22, 2004Carnegie Mellon.
The Church-Turing Thesis Chapter Are We Done? FSM  PDA  Turing machine Is this the end of the line? There are still problems we cannot solve:
MA/CSSE 474 Theory of Computation Universal Turing Machine Church-Turing Thesis (Winter 2016, these slides were also used for Day 33)
Costas Busch - RPI1 Decidability. Costas Busch - RPI2 Another famous undecidable problem: The halting problem.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Undecidable.
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
Decidability.
MA/CSSE 474 Theory of Computation Universal Turing Machine Church-Turing Thesis Delayed due dates for HWs See updated schedule page. No class meeting.
CIS Automata and Formal Languages – Pei Wang
Gödel's Legacy: The Limits Of Logics
Discrete Mathematics for Computer Science
Automata, Grammars and Languages
Undecidable Problems Costas Busch - LSU.
Theory of Computability
CS154, Lecture 11: Self Reference, Foundation of Mathematics
Great Theoretical Ideas in Computer Science
Homework: Friday Read Section 4.1. In particular, you must understand the proofs of Theorems 4.1, 4.2, 4.3, and 4.4, so you can do this homework. Exercises.
CS154, Lecture 10: Rice’s Theorem, Oracle Machines
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
CS154, Lecture 10: Rice’s Theorem, Oracle Machines
Decidability of logical theories
CSCI 2670 Introduction to Theory of Computing
Decidable Languages Costas Busch - LSU.
Decidability and Undecidability
CS21 Decidability and Tractability
Proposed in Turing’s 1936 paper
Great Theoretical Ideas in Computer Science
Theory of Computability
Decidability of logical theories
Theory of Computability
Theory of Computability
Instructor: Aaron Roth
CS154, Lecture 11: Self Reference, Foundation of Mathematics
Theory of Computability
Instructor: Aaron Roth
More Undecidable Problems
CIS Automata and Formal Languages – Pei Wang
Presentation transcript:

INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011

RICE ’ S THEOREM Let P be a language of Turing machine encodings. IF P satisfies the following properties: For all TMs M 1 and M 2, where L(M 1 ) = L(M 2 ), 〈 M 1 〉  P if and only if 〈 M 2 〉  P There exist TMs 〈 M IN 〉  P and 〈 M OUT 〉  P THEN P is undecidable. EXTREMELY POWERFUL (i.e. P is a “nontrivial property of the r.e. languages.”)

EXAMPLES CF TM = { 〈 M 〉 | M is a TM and L(M) is context-free} A ε = { 〈 M 〉 | M is a TM and L(M) = {ε} } OL TM = { 〈 M 〉 | M is a TM and accepts only odd length strings} Use Rice’s Theorem to prove that A ε, CF TM, and OL TM are undecidable.

Let EH = { 〈 M 〉 | M is a TM and ∃ w. M(w) halts } Rice’s Theorem does not apply to EH: Then L(M 1 ) = L(M 2 ) but 〈 M 1 〉∈ EH and 〈 M 2 〉  EH. EH is undecidable. ƒ( 〈 M,w 〉 ) = “P Mw (s): if (s  w): loop forever. else: return M(s).” WITH GREAT POWER COMES GREAT RESPONSIBILITY! Proof: HALT TM ≤ m EH: Let M 1 (s) = “reject.”, M 2 (s) = “loop forever.”

GREAT RESPONSIBILITY WRITE-2-1s = { 〈 M 〉 | M is a TM that writes exactly two ones to its tape on some input} Prove that Rice’s Theorem does not apply to: Let UL TM = { 〈 M 〉 | M is a TM with a useless state } *state q is useless if for all s, M(s) is never in state q

((lambda (x) (list x (list (quote quote) x))) (quote (lambda (x) (list x (list (quote quote) x))))) Print the next sentence twice, the second time in quotes. “Print the next sentence twice, the second time in quotes.” Can we make a TM that does the same? WARNING: HEADACHES AHEAD

Theorem: There is a computable q : Σ*  Σ*, where for any string w, q(w) is the description of a TM P w that on any input, prints out w and then accepts Q w PwPw s w

A TM THAT MAKES CANNIBALS CM 〈M〉〈M〉 s P〈M〉P〈M〉 M M( 〈 M 〉 )

A TM THAT PRINTS ITSELF CM P 〈 CM 〉 w s CM SELF Run the “cannibal maker” on itself!

SELF-REFERENCE UNDECIDABILITY There are problems that no computer can solve INCOMPLETENESS There are true theorems that have no proof

THE RECURSION THEOREM Theorem: Let T be a Turing machine that computes a function t : Σ*  Σ*  Σ*. There is a Turing machine R that computes a function r : Σ*  Σ*, where for every w r(w) = t( 〈 R 〉, w) T (a,b)t(a,b) R w t( 〈 R 〉,w)

Proof: T (a,b) t(a,b) CM’ CM 〈M〉〈M〉 P’〈M〉P’〈M〉 s M M( 〈 M 〉,s) 〈 M,s 〉, w 〈 M,w 〉

Proof: T (a,b) t(a,b) CM’ P’ 〈 CM’ → T 〉 w CM’ t( 〈 R 〉,w), w P’ 〈 CM’ → T 〉 s T t( 〈 P’ → CM’ → T 〉,s) CM’ T

A Turing machine can obtain its own description and then go on to compute with it 1.Design TM t(M,w) that assumes M is code for t(w) 2. Use recursion theorem to get TM R(w) = t( 〈 R 〉,w)

Theorem: A TM is undecidable Proof (using the recursion theorem): Assume H decides A TM 1. Obtains, via the recursion theorem, its own description B Construct machine B such that on input w: 2. Runs H on 〈 B,w 〉 and flips the output Running B on input w does the opposite of what H says it should!

INCOMPLETENESS There are true statements that have no proof

GREAT LOGICIANS OF THE TWENTIETH CENTURY “This sentence is a lie.” James T. Kirk “This sentence has no proof.” Kurt Gödel Like Gödel, we will build a formal statement that is true but unprovable

STATEMENTS We want to express mathematical statements, eg: “There are infinitely many prime numbers” “If x < y and y < z then x < z” ∀ x,y,z [ (x < y) ∧ (y < z) → (x < z) ] ∀ q ∃ p ∀ x,y [ p > q ∧ (x,y > 1 → xy  p) ]

STATEMENTS We can make a formal grammar for statements: Σ = { ∨, ∧, ¬, [, ], (, ), ∀, ∃, x, R, ;} S → Q [ F ] Q → ∀ X Q | ∃ X Q | ∀ X | ∃ X F → A | F ∧ F | F ∨ F |¬F | (F) A → RA | R(L) X → xX | x L → X | X; L A statement is a string from this grammar with: no free variables: if x i appears in F, it appears in Q well-formed relations: each appearance of R i has the same number of arguments.

STATEMENTS ∀ x 1 ∃ x 2 ∃ x 3 [ R 1 (x 1 ) ∧ R 2 (x 1 ;x 2 ;x 3 ) ] ∀ x 1 ∃ x 2 [ R 1 (x 1 ;x 2 ) ∨ R 1 (x 2 ;x 1 ) ] ∃ x [ R(x) ] NOT STATEMENTS R 1 (x) ∨ ¬R 2 (x) ∀ x 1 [ R(x 1 ; x 2 ) ] ∀ x 1 ∃ x 2 [ R(x 1 ) ∧ R(x 1 ;x 2 ) ]

TRUTH & MODELS M assigns “meaning” or “truth” to a statement: A model M is a k-tuple (U, P 1, …, P k ) where: U is the universe of values each x i can have P 1 … P k are relations over U R i (u 1,u 2,…) is true iff (u 1,u 2 …) ∈ P i ∀ xS is true iff for every x ∈ U, S is true ∃ xS is true iff for some x ∈ U, S is true. ∧, ∨,¬ have the usual meanings.

EXAMPLE Let M = ( ℝ, {(x,y,z) : x+y=z}). Then: “ ∀ x Ǝ y [ R(y,y,x) ]” is “ Ǝ y ∀ x [ R(y,y,x) ]” is “ ∀ y ∃ x [ R(y,x) ]” is ill-formed. true. false.

EXAMPLE Let M = ( ℕ, {(x,y) : x≤y}, {(x,y,z) : z = xy} ). Then: “ ∀ x ∀ y [ R 1 (y,x) ∨ R 1 (x,y) ]” is true. “ ∃ y ∀ x [ R 1 (x,y) ]” is false. “ ∃ y ∀ x [ R 1 (y,x,x) ]” is ill-formed.

LANGUAGE & THEORY The language of M, L( M ) is the set of well-formed statements under M. The theory of M, Th( M ) is the set of true statements in L( M ). Let M = (U, P 1, …, P k ) be a model.

PROOFS …are sequences of statements that “logically follow” from each other. For example S follows from T in first-order logic if: S is a tautology; or S is an axiom; or S = ∀ x T ( where x  T); or S ≡  and T ≡ (  ) ∧ (  ⇒  ); etc… In general, a logic  is a decidable subset of S S A sequence S 1 …S m where for each i, (S j<i, S i ) ∈  or (ε, S i ) ∈ , is a proof of S m in logic .

Given a logic  and a model M, define the set Provable  ( M ) = { S ∈ L( M ): S has a proof in  } Theorem: Provable  ( M ) is Turing recognizable. Proof: Since a proof is just a string, we can check if S is provable by checking all possible proofs:

def is_provable(S): for π in {0,1,00,01,10,11,100,…}: (S 1,…,S m ) = parse_as_stmt_list(π) S 0 = None is_proof = True for i in {1,…,m}: follows[i] = S[i] ∈ L( M ) and (S[:i],S[i]) ∈ . is_proof = is_proof and follows[i] if (is_proof and (S[m] == S)): return True

INCOMPLETENESS I Theorem: For every TM M and string w, there is a computable formula  M,w (x) 2 L(N,+,) such that ∃ x  M,w (x) is true iff M(w) accepts. Proof: We make a sentence that says “x encodes an accepting computation history of M on w:” ƎλƎλ (x mod b λ = q 0 w) ∧∀i [ (u = x div b iλ mod b λ ) ∧ (v = x div b (i+1)λ mod b λ )  (u ⇒ M v) ] ∧ Ǝ j [ x div b j mod b = q accept ]

INCOMPLETENESS II Theorem: For every TM M and string w, there is a computable formula  M,w (x)  L( ℕ,+,  ) such that Ǝ x  M,w (x) is true iff M(w) accepts. Corollary: Th( ℕ, +, ) is undecidable. Proof: Suppose Th( ℕ,+,  ) was decidable. Then we could write a program accepts to decide A TM as follows: def accepts(M,w): if “ Ǝ x  M,w (x)”  Th( ℕ,+,  ): return True else: return False

INCOMPLETENESS III Corollary: Th( ℕ, +, ) is undecidable. Corollary: There is a sentence in Th( ℕ,+,) that is not provable. Proof: Suppose Th( ℕ,+,) ⊆ Provable( ℕ,+,). Then for all 〈 M,w 〉, either “ ∃ x  M,w (x)” ∈ Provable or “ ∀ x¬  M,w (x)” ∈ Provable. This gives an algorithm for A TM ! Theorem: For every TM M and string w, there is a computable formula  M,w (x)  L( ℕ,+,  ) such that Ǝ x  M,w (x) is true iff M(w) accepts.

accepts(M,w): In parallel: accept if is_provable(“ ∃ x  M,w (x)”) accepts reject if is_provable(“ ∀ x¬  M,w (x)”) accepts accepts(M,w) works if  is: sound: you cannot prove “false” in . complete: Every true  is provable in . This gives “Gödel’s incompleteness theorem:” every logic for ( ℕ,+,) is unsound or incomplete.

THIS SLIDE HAS NO PROOF Theorem: the statement ψ K,ε ≝ “ ∀ x ¬  K,ε (x)” is true but not provable, where: K(w) = 1.Use recursion theorem to obtain code for K 2.Use code for K to construct  K,w (x). 3.Run is_provable(“ ∀ x ¬  K,w (x)”) Proof: Suppose that K(ε) accepts. If  is sound, then K(ε) cannot accept. Thus is_provable(ψ K,ε ) must loop forever without finding a proof. But this means ψ K,ε is true: K(ε) does not accept!