Presentation is loading. Please wait.

Presentation is loading. Please wait.

INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.

Similar presentations


Presentation on theme: "INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011."— Presentation transcript:

1 INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011

2 QUIZ 4 (a) If A and B are languages, then A is mapping reducible to B, or A ≤ m B, if there is a computable function ƒ such that: w  A ⇔ ƒ(w)  B (b) The acceptance problem A TM is the language: { 〈 M,w 〉 | M is a TM that accepts on input w }

3 QUIZ 4 (b) The identity function ƒ(w)=w is a reduction from the set { 0 n 1 n | n ≥ 0 } to the set { w | w has an equal number of 0s and 1s }. FALSE: the string 10 ∉ A but ƒ(10) = 10 ∈ B. (a) The recursion theorem states that a program cannot compute on its own code. FALSE: this is the negation of the theorem.

4 QUIZ 4 Let A 101 = { 〈 M 〉 | M is a TM and L(M) = {101} }. Let’s use Rice’s Theorem to prove that A ε is undecidable. For any TMs such that L(M 1 )=L(M 2 ), 〈 M 1 〉∈ A 101 ⇔ 〈 M 2 〉∈ A 101 : If L(M 1 ) = L(M 2 ), 〈 M 1 〉  A 101 ⇔ L(M 1 ) = {101} ⇔ L(M 2 ) = {101} ⇔〈 M 2 〉  A 101 There exist TMs 〈 M IN 〉 ∈ A 101 and 〈 M OUT 〉  A 101 : Let M IN (s) = “if s = 101 accept, else reject.” Then L(M IN )= {101}, so 〈 M IN 〉  A 101. Let M OUT (s) = “reject on any input.” Then L(M OUT ) = Ø ≠ {101}, so 〈 M OUT 〉  A 101. a. Prove A 101 is a language property: b. Prove that A 101 is nontrivial:

5 Why these stuff are important for reality? Who was phone? Recursion Theorem. Are some of these topics actually taught in like a Linguistics class? What do we actually need to know? What are the answers to the next homework? Another refresher on reducibility would be nice. What ARE mapping reductions? Star Wars or Star Trek? Kirk or Picard? Banana? Why didn’t the book cover Rice’s theorem? Why did it get so crazy all of a sudden? Can you parse HTML with RegEx? Is “The Princess Bride” your favorite movie?

6 Office hours: Today 4-5:30pm Wed. 11am-noon,2:30-4pm and Thurs. 9am-11am HW8 SOLUTIONS POSTED TOMORROW AFTERNOON.

7 0 → 0, R readwritemove  → , R q accept q reject 0 → 0, R  → , R 0 → 0, R  → , L TURING MACHINES UNBOUNDED TAPE 0 q0q0 q0q0 q1q1 q2q2 q1q1 qaqa 0

8 Definition: A Turing Machine is a 7-tuple T = (Q, Σ, Γ, , q 0, q accept, q reject ), where: Q is a finite set of states; q 0 is the start state Σ is the input alphabet, Γ is the tape alphabet  : Q  Γ → Q  Γ  {L,R} is the transition function q accept  q reject are the accept and reject states We can encode a TM as a string of 0s and 1s:

9 Terminology Every TM recognizes a language. The language of M is the set L(M) = { w | M(w) eventually accepts } A TM decides L if it accepts all strings in L and rejects all strings not in L A language is decidable if some TM decides it A language is recursively enumerable if some TM recognizes it. THE CHURCH-TURING THESIS: There is a program for L iff there is a TM for L

10 UN DECIDABILITY A language is a set of strings. It is a mathematical way of expressing a problem: given an input, is it in the set L? If a language is decidable, there is a computer program (TM) that can always solve the problem correctly – it terminates and has the right answer. If a language is undecidable, then no matter how smart you are, and no matter how long you give it, you cannot program a computer to always solve the problem correctly.

11 Let S be any set and P(S) be the power set of S Theorem: There is no onto map from S to P(S) Proof: Assume, for a contradiction, that there is an onto map ƒ : S  P(S) Let D ƒ = { d  S | d  ƒ(d) } If D ƒ = ƒ(y) then y  D ƒ if and only if y  D ƒ Turing Machines Strings of 0s and 1s Sets of strings of 0s and 1s Languages over {0,1} S P(S)

12 UNDECIDABLE PROBLEMS D TM = {  M  | M is a TM that does not accept  M  } Theorem. D TM is undecidable. Proof. Suppose machine N decides D TM. Then N accepts  N  ⇔  N   D TM ⇔ N does not accept  N  A TM = {  M,w  : M is a TM that accepts on input w } Theorem. If A TM is decidable, so is D TM. Proof. If ¬A TM is decided by the program nAccept we can decide if  M   D TM by calling nAccept(M,  M  ). Here we have reduced deciding D TM to deciding A TM. Since we know D TM is undecidable, A TM must also be undecidable.

13 MAPPING REDUCTIONS ƒ : Σ*  Σ* is a computable function if there is a TM that on input w, halts with ƒ(w) on its tape A  m B if there is a computable ƒ, such that w  A  ƒ(w)  B ƒ is called a reduction from A to B

14 HALT TM = {  M,w  | M is a TM that halts on string w } Theorem: HALT TM is undecidable THE HALTING PROBLEM Proof: We prove that A TM ≤ m HALT TM : Let M’ = M, with q loop in place of q reject. Let F = “On input  M,w  : Output  M’,w  ” F is a reduction. Suppose M accepts w. Then M’ halts on w. So  M,w   A TM ⇒  M’,w   HALT TM. M’ can only halt on w by accepting, and if M’ accepts w so does M. So  M’,w   HALT TM ⇒  M,w   A TM.

15 0 → 0, R  → , R q accept q reject 0 → 0, R  → , R q0q0 q1q1 0q10q1 q00q00 0q rej q10q10  q rej q0q0 q1q1  q acc 0 0   # # # #q 0 0# # ## q acc  q acc q acc 0q acc q acc q acc  q acc q acc 0 # #q 0 0#0q10q1 q00q00# ## 0 0 q1q1  q acc # # 0 0q acc  q acc # q acc ## # #q acc 0q acc # #

16 RICE ’ S THEOREM Let P be a set of Turing machines. If P satisfies the following two properties: For any 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.”)

17

18 DIAGONAL ARGUMENTS 100 200 300 DECIDABLE LANGUAGES 100 200 300 REDUCTIONS 100 200 300 FINAL JEOPARDY

19 The next configuration of the following TM after □ x0q 2 x □. 0 → , R  → , R q accept q reject 0 → x, R x → x, R  → , R x → x, R 0 → 0, L x → x, L x → x, R  → , L  → , R 0 → x, R 0 → 0, R  → , R x → x, R { 0 | n ≥ 0 } 2n2n q0q0 q1q1 q2q2 q3q3 q4q4

20 Show that if L 1 and L 2 are decidable, then so is L 1 – L 2.

21 The state diagram of a TM that decides the language { a n b m : n ≤ m }.

22 A proof that the set {0,1,2}* is countable.

23 If ƒ: ℕ  P( ℕ ) is defined by ƒ(n) = { j | j ≤ n and j is not prime }, the “diagonal set” that is not output by ƒ on any natural number.

24 A proof that no PDA recognizes D CFG, where D CFG = { 〈 G 〉 | G is a CFG that does not generate 〈 G 〉. }

25 A proof that ODD ≤ m EVEN, where Σ = {0,1} ODD = { 1 i | i is odd} EVEN = { 1 i | i is even}

26 A proof, using Rice’s Theorem, that P 3 = { 〈 M 〉 | M accepts all strings of length 3 } is undecidable.

27 A proof that A TM ≤ m A JAVA, where A JAVA = { 〈 J,w 〉 | J is a Java program with method “public boolean test(String s)” that returns true on string w. }

28 FINAL JEOPARDY TRUE


Download ppt "INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011."

Similar presentations


Ads by Google