Presentation is loading. Please wait.

Presentation is loading. Please wait.

Jeff Edmonds York University

Similar presentations


Presentation on theme: "Jeff Edmonds York University"— Presentation transcript:

1 Jeff Edmonds York University
Reductions to the Halting Problem CSE 2001 CSE 4111 Different Models Reductions Simple Reductions Rice's Theorem Harder Problems Quick Recognizable Recognizable Complete The Post Correspondence Prob Tiling CFG G Generates I CFG G Generates Every String CFG G Generates Some String CFG L(G)=L(G') Game of Life Hilbert's 10th Problem Not covered Jeff Edmonds York University Lecture 5.2 CSE 2001/4111

2 Reductions for Undecidability
A  Halting Problem is uncomputable. B  My favorite Problem P is uncomputable. Proved already Want to prove. Assume you know: A B  A Can B be false? No, because then A would be false. B same as A  B Proving: B  A B  P is computable MP computes P Design an algorithm MHalt that computes Halting Problem (Using MP as a subroutine)  Halting Problem is computable A But A is true. So B is true.

3 Reductions for Undecidability
Undecidable problems: Halting Problem = {“M”,I | TM M halts on input I} = {“J”,I | Java program J halts on input I} = {“P”,I | Primitive Recursive Program P halts on input I} = {“P”,I | Recursive Program P halts on input I} = {“M”,I | Register Machine halts on input I} = {“C”,I | Uniform circuit C halts on input I} = {“M”,I | Quantum Machine M Java halts on input I} = {“G”,I | Context Sensitive Grammar G generates string input I} = {“H”,I | Human H halts on input I} Every primitive recursive program halts. n, circuit computed in time size(n) Every human dies.

4 Reductions for Undecidability
Halting Problem = {“M”,I | M halts on I} is undecidable Will prove: {“M”,I | M prints “Hi” at some point in computation on I} {“M” | M halts empty string} {“M” | I, M halts on I} {“M” | I, M halts on I} {“M”,“M'” | I M(I)=M'(I)} {“M” | L(M) is regular} There is a fixed TM M* {I | M* halts on I} {“M” | based on what M does, not on how it does it} {“M”,I | M does not halt on I} X Is Undecidable, but the reduction requires switching Yes & No Recognizable & Co-Recognizable. ≥comp {“M”,I | M halts on I} Hence, all are undecidable!

5 Reductions for Undecidability
{“M”,I | M halts on I} ≥comp {“M”,I | M prints “Hi” at some point in computation on I} {“M” | M halts empty string} {“M” | I, M halts on I} {“M” | I, M halts on I} {“M”,“M'” | I M(I)=M'(I)} {“M” | L(M) is regular} There is a fixed TM M* {I | M* halts on I} {“M” | based on what M does, not on how it does it} X Some how harder. Funny that these have different complexities! ≥comp {“M”,I | M halts on I} Hence, all are undecidable!

6 Reductions for Undecidability
Hence, equivalent. {“M”,I | M halts on I} ≥comp {“M”,I | M prints “Hi” at some point in computation on I} {“M” | M halts empty string} {“M” | I, M halts on I} There is a fixed TM M* {I | M* halts on I} ≥comp {“M”,I | M halts on I} Hence, all are undecidable!

7 Reductions for Undecidability
{“M” | I, M halts on I} {“M”,“M'” | I M(I)=M'(I)} {“M” | L(M) is regular} {“M” | based on what M does, not on how it does it} X Some how harder. ≥comp {“M”,I | M halts on I} ≥comp {“M”,I | M does not halt on I}

8 Reductions for Recognizablity
Yes instance  Halt and answer “yes” No instance  Run forever or answer “no” Recognizable Yes instance  Run forever or answer “yes” No instance  Halt and answer “no” Computable/Decidable Co-Recognizable Reductions for Recognizablity Halting Halting

9 Reductions for Recognizablity
Recognizable Co-Recognizable Yes instance  Run forever or answer “yes” No instance  Halt and answer “no” Yes instance  Halt and answer “yes” No instance  Run forever or answer “no” Halting Halting Computable/Decidable {“M”,I | M prints “Hi” on I} {“M” | M halts empty string} {“M” | I, M halts on I}  TM M* {I | M* halts on I} Halting ≤ ≤ Halting

10 Reductions for Recognizablity
Recognizable Co-Recognizable Yes instance  Run forever or answer “yes” No instance  Halt and answer “no” Yes instance  Halt and answer “yes” No instance  Run forever or answer “no” Halting Halting Computable/Decidable {“M” | I, M halts on I} {“M”,“M'” | I M(I)=M'(I)} {“M” | L(M) is regular} {“M” | based on what M does, not on how it does it} Halting ≤ Halting ≤

11 Reductions Ieasier Iharder Peasier Pharder
Ieasier yes Peasier Ieasier no Iharder Iharder yes Pharder Iharder no Two problems/languages Peasier and Pharder each with their own definitions of what a legal input is (Ieasier vs Iharder) and which are yes-inputs and which no-inputs.

12 Reductions Ieasier Iharder Peasier Pharder
Ieasier yes Peasier Ieasier no Iharder Iharder yes Pharder Iharder no Peasier(Ieasier) Ieasier Algeasier Algharder Pharder(Iharder) Iharder We want machines that decide them.

13 Reductions Peasier ≤comp Pharder Ieasier Iharder Peasier Pharder
Ieasier yes Peasier Ieasier no Iharder Iharder yes Pharder Iharder no Peasier ≤comp Pharder Computable/Decidable Exp Poly NP Co-NP Recognizable Co-Recognizable How do their complexities/difficulties compare?

14 Reductions Peasier ≤comp Pharder Ieasier Iharder Peasier Pharder
Ieasier yes Peasier Ieasier no Iharder Iharder yes Pharder Iharder no Peasier ≤comp Pharder It is hard to prove problem is Pharder hard. It is easier to prove Peasier is easy. by design an algorithm Algeasier for it. But you only need to prove Peasier is at least as easy as Pharder . Pretend you have an algorithm Algharder for Pharder to use as a subroutine.

15 We often call the algorithm assumed to exist, an Oracle.
Reductions Ialg Ialg yes Palg Ialg no Ioracle Ioracle yes Poracle Ioracle no Palg ≤comp Poracle We often call the algorithm assumed to exist, an Oracle. Given Algoracle Poracle(Ioracle) Ioracle

16 Reductions Palg ≤comp Poracle Ialg Ioracle Palg Poracle
Ialg yes Palg Ialg no Ioracle Ioracle yes Poracle Ioracle no Palg ≤comp Poracle Build AlgAlg Palg(Ialg) Ialg Given Algoracle Poracle(Ioracle) Ioracle We use Algoracle as an subroutine in an algorithm Algalg for solving Palg.

17 Reductions Palg ≤comp Poracle Ialg Ioracle
InstanceMap Ioracle Build AlgAlg Palg(Ialg) Ialg Given Algoracle Poracle(Ioracle) Ioracle Ioracle = InstanceMap(Ialg) Algalg is given an input Ialg. It maps it to input Ioracle. and gives this to Algoracle.

18 Reductions Palg ≤comp Poracle Ialg Ioracle Poracle
Ioracle yes Poracle Ioracle no InstanceMap Build AlgAlg Palg(Ialg) Ialg Given Algoracle Poracle(Ioracle) Ioracle Ioracle = InstanceMap(Ialg) Return same answer yesyes no no Algoracle gives the yes/no answer for his input Ioracle. Algalg returns the same answer.

19 Reductions Palg ≤comp Poracle Ialg Ioracle Palg Poracle
Ioracle yes Poracle Ioracle no InstanceMap Ialg yes Ialg no Build AlgAlg Palg(Ialg) Ialg Given Algoracle Poracle(Ioracle) Ioracle Ioracle = InstanceMap(Ialg) Return same answer yesyes no no To ensure Algalg works, Ioracle = InstanceMap(Ialg) must map yes instances to yes instances and no to no.

20 Must prove Algalg works.
Reductions Ialg Ioracle Palg ≤comp Poracle Palg Ioracle yes Poracle Ioracle no InstanceMap Ialg yes Ialg no Build AlgAlg Palg(Ialg) Ialg Given Algoracle Poracle(Ioracle) Ioracle Ioracle = InstanceMap(Ialg) Return same answer yesyes no no Must prove Algalg works. Ialg is a yes input  Ioracle is a yes input  Algoracle says yes  Algalg says yes

21 Reductions Palg ≤comp Poracle Algorithm Algalg(Ialg )
pre-cond: Ialg is an instance of Palg post-cont: Determine if Palg (Ialg) = yes begin Ioracle = InstanceMap(Ialg) ansoracle = Algoracle (Ioracle) ansalg = ansoracle return(ansalg) end

22 Reductions We give an algorithm for Palg using a supposed algorithm for Poracle as a subroutine. If there is an algorithm for Palg If there is not an algorithm for Palg ? ?? then there is not an algorithm for Poracle ? If there is an algorithm for Poracle If there is not an algorithm for Poracle then there is an algorithm for Palg ? ?? ?

23 Notation: Palg ≤comp Poracle
Reductions computable We give an algorithm for Palg using a supposed algorithm for Poracle as a subroutine. Conclusions: Palg is “at least as easy as” Poracle (Modulo polynomial terms.) Poracle is “at least as hard as” Palg (Modulo polynomial terms.) Notation: Palg ≤comp Poracle

24 Reductions Palg ≤comp Poracle
Reduction: Design an algorithm for one computational problem, using a supposed algorithm for another problem as a subroutine. Used to create a new algorithm from a known algorithm. Learn that a new problem is hard, from knowing a known problem is hard. Learn that two problems have a similar “structure.”

25 Reductions Who loves who Matching ≤comp Network Flows Max matching
Ann Fred Sue John Beth Bob Mary Sam Matching ≤comp Network Flows Max matching A network s t GIVEN: Network Flow Oracle BUILD: Matching Oracle Max Flow s t

26 Reductions Computable Halting Exp Poly
Learn that a new problem is hard, from knowing a known problem is hard.

27 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M”,I | M prints “Hi” on I at some point in computation } = Poracle Proof Poracle is undecidable. By way of contradiction assume Poracle is decidable. Given an algorithm for Poracle, I construct a working algorithm for the halting problem. Contradiction because the halting problem is undecidable. Contrapositive: I can’t have a working algorithm for the halting problem, hence I can’t have an algorithm for Poracle,

28 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M”,I | M prints “Hi” on I at some point in computation } “M'”,I “M”,I <M'Hi ,I> PHi <Mhalts,I> Phalting <M¬halts,I> <M'¬Hi,I> Consider the form of the instances of each problem and which are yes-instances.

29 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M”,I | M prints “Hi” on I at some point in computation } “M'”,I “M”,I <M'Hi ,I> PHi <Mhalts,I> Phalting <M¬halts,I> <M'¬Hi,I> InstanceMap To ensure Algalg works, Ioracle = InstanceMap(Ialg) must map yes instances to yes instances and no to no.

30 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M”,I | M prints “Hi” on I at some point in computation } InstanceMap: Given <“M”,I>, I can built “M'”. Note: Given a description of M, I must construct the description of M'. This does not need a universal TM. M and M' will have similar states. M'(I') = { Ignore input I' M is built in Run M(I), Print(“Hi”) } suppressing any output To ensure Algalg works, Ioracle = InstanceMap(Ialg) must map yes instances to yes instances and no to no.

31 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M”,I | M prints “Hi” on I at some point in computation } InstanceMap: Given <“M”,I>, I can built “M'”. M'(I') = { Ignore input I' M is built in Run M(I), Print(“Hi”) } suppressing any output To ensure Algalg works, Ioracle = InstanceMap(Ialg) must map yes instances to yes instances and no to no. M(I) halts  M'(I') says “Hi” on every I' M(I) ¬halt  M'(I') no “Hi” on every I'

32 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M”,I | M prints “Hi” on I at some point in computation } Given an algorithm for Poracle, I construct a working algorithm for the halting problem. M(I) halts  M'(I') says “Hi” on every I' M(I) ¬halt  M'(I') no “Hi” on every I'

33 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M”,I | M prints “Hi” on I at some point in computation } “M”,I Yes/No “M'”,I M'(I') = { Ignore input I' M is built in Run M(I), Print(“Hi”) } suppressing any output BUILD: Oracle for GIVEN: Oracle for Must prove Alg works. Yes/No {“M”,I | M halts on I} {“M”,I | M prints “Hi” on I} M(I) halts  M'(I') says “Hi” on every I' M(I) ¬halt  M'(I') no “Hi” on every I'

34 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M”,I | M prints “Hi” on I at some point in computation } Case: M(I) halts “M”,I Yes “M'”,I M'(I') = { Ignore input I' M is built in Run M(I), Print(“Hi”) } suppressing any output BUILD: Oracle for GIVEN: Oracle for Must prove Alg works. Yes, prints “Hi” {“M”,I | M halts on I} {“M”,I | M prints “Hi” on I} M(I) halts  M'(I') says “Hi” on every I' Oracle: Yes  Alg: Yes M(I) ¬halt  M'(I') no “Hi” on every I'

35 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M”,I | M prints “Hi” on I at some point in computation } Case: M(I) ¬halts “M”,I No “M'”,I M'(I') = { Ignore input I' M is built in Run M(I), Print(“Hi”) } suppressing any output BUILD: Oracle for GIVEN: Oracle for Must prove Alg works. No “Hi” {“M”,I | M halts on I} {“M”,I | M prints “Hi” on I} M(I) halts  M'(I') says “Hi” on every I' Oracle: Yes  Alg: Yes M(I) ¬halt  M'(I') no “Hi” on every I' Oracle: No  Alg: No

36 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M”,I | M prints “Hi” on I at some point in computation } Given an algorithm for Poracle, I have a working algorithm for the halting problem. But I can’t have a working algorithm for the halting problem, hence I can’t have an algorithm for Poracle, Done Proof! M(I) halts  M'(I') says “Hi” on every I' Oracle: Yes  Alg: Yes M(I) ¬halt  M'(I') no “Hi” on every I' Oracle: No  Alg: No

37 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | M halts empty string} M(I) halts or not “M”,I “M'” M'(I') = { Ignore input I' M & I are built in Run M(I) } BUILD: Oracle for GIVEN: Oracle for Must prove Alg works. Yes or No {“M”,I | M halts on I} {“M” | M halts empty string} M(I) halts  M'(I') halt for every I' Oracle: Yes  Alg: Yes M(I) ¬halt  M'(I') ¬halt for every I' Oracle: No  Alg: No

38 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | I, M halts on I} M(I) halts or not “M”,I “M'” M'(I') = { Ignore input I' M & I are built in Run M(I) } BUILD: Oracle for GIVEN: Oracle for Must prove Alg works. Yes or No {“M”,I | M halts on I} {“M” | I, M halts on I} M(I) halts  M'(I') halt for every I' Oracle: Yes  Alg: Yes M(I) ¬halt  M'(I') ¬halt for every I' Oracle: No  Alg: No

39 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | I, M halts on I} M(I) halts or not “M”,I “M'” M'(I') = { Ignore input I' M & I are built in Run M(I) } BUILD: Oracle for GIVEN: Oracle for Must prove Alg works. Yes or No {“M”,I | M halts on I} {“M” | I, M halts on I} M(I) halts  M'(I') halt for every I' Oracle: Yes  Alg: Yes M(I) ¬halt  M'(I') ¬halt for every I' Oracle: No  Alg: No

40 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M”,“M'” | I M(I)=M'(I)} M(I) halts or not “M”,I “M'”,“M''” M''(I') halts and accepts M'(I') = { Ignore input I' M & I are built in Run M(I) } BUILD: Oracle for GIVEN: Oracle for Must prove Alg works. Yes or No {“M”,I | M halts on I} {“M”,“M'” | I M(I)=M'(I)} M(I) halts  M'(I') halt for every I' Oracle: Yes  Alg: Yes M(I) ¬halt  M'(I') ¬halt for every I' Oracle: No  Alg: No

41 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | L(M) is regular} M(I) halts or not “M”,I “M'” M'(I') = { Ignore input I' M & I are built in Run M(I) } BUILD: Oracle for GIVEN: Oracle for Must prove Alg works. Yes or No {“M” | L(M) is regular} {“M”,I | M halts on I} M(I) halts  M'(I') halt for every I' L(M') = {0,1}* Oracle: Yes M(I) ¬halt  M'(I') ¬halt for every I' L(M') = {} Oracle: Yes!

42 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | L(M) is regular} “M'” “M”,I “M'reg” Preg <Mhalts,I> Phalting <M¬halts,I> “M'¬reg ” Consider the form of the instances of each problem and which are yes-instances.

43 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | L(M) is regular} “M'” “M”,I “M'reg” Preg <Mhalts,I> Phalting <M¬halts,I> “M'¬reg ” I Iyes Ino 01101 L(M'reg) Irun forever A yes-input of Preg is the description of a TM M'reg whose language L(M'reg) is regular. i.e. can be computed by a DFA.

44 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | L(M) is regular} “M'” “M”,I “M'reg” Preg <Mhalts,I> Phalting <M¬halts,I> “M'¬reg ” I Iyes Ino 01101 L(M'¬reg) Irun forever A no-input of Preg is the description of a TM M'¬reg whose language L(M'¬reg) is not regular. i.e. cannot be computed by a DFA.

45 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | L(M) is regular} “M'” “M”,I Preg <Mhalts,I> Phalting <M¬halts,I> 0n1n “M' ” 1n0n “M' ” “M'all” “M'none” Lets be more discerning

46 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | L(M) is regular} “M'” “M”,I Preg <Mhalts,I> Phalting <M¬halts,I> 0n1n “M' ” 1n0n “M' ” “M'all” “M'none” I 000111 0n1n 10 Any input “M' ” is the description of a TM whose language L(M' ) is 0n1n which is not regular. 0n1n There are many such TM.

47 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | L(M) is regular} “M'” “M”,I Preg <Mhalts,I> Phalting <M¬halts,I> 0n1n “M' ” 1n0n “M' ” “M'all” “M'none” I 000111 0n1n 10 The TM M' does not care to distinguish whether its input has the form 1n0n or not. 0n1n 1n0n 101

48 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | L(M) is regular} “M'” “M”,I Preg <Mhalts,I> Phalting <M¬halts,I> 0n1n “M' ” 1n0n “M' ” “M'all” “M'none” I 000111 {0,1}* 10 Any input “M'all” is the description of a TM whose language L(M'all) is {0,1}* which is regular.

49 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | L(M) is regular} “M'” “M”,I Preg <Mhalts,I> Phalting <M¬halts,I> 0n1n “M' ” 1n0n “M' ” “M'all” “M'none” InstanceMap To ensure Algalg works, Ioracle = InstanceMap(Ialg) must map yes instances to yes instances and no to no. It is ok that Ioracle = InstanceMap(Ialg) maps only instances that we like.

50 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | L(M) is regular} InstanceMap: Given <“M”,I>, I can built “M'”. M'(I') = { If I’ has the form 0n1n halt and accept else run M(I) halt and accept } M(I) ¬halt  L(M') = ? If I’ has the form 0n1n  M' accepts If I’ has the form 1n0n  M' runs forever.

51 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | L(M) is regular} InstanceMap: Given <“M”,I>, I can built “M'”. M'(I') = { If I’ has the form 0n1n halt and accept else run M(I) halt and accept } M(I) ¬halt  L(M') = ? If I’ has the form 0n1n  M' accepts If I’ not have form 0n1n  M' runs forever. M' recognizes 0n1n, but “computes” no language L(M') = 0n1n L(M') is not regular

52 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | L(M) is regular} InstanceMap: Given <“M”,I>, I can built “M'”. M'(I') = { If I’ has the form 0n1n halt and accept else run M(I) halt and accept } M(I) halt  L(M') = ? If I’ has the form 0n1n  M' accepts If I’ not have form 0n1n  M' accepts L(M') = {0,1}* L(M') is regular

53 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | L(M) is regular} InstanceMap: Given <“M”,I>, I can built “M'”. M'(I') = { If I’ has the form 0n1n halt and accept else run M(I) halt and accept } M(I) halts  L(M') is regular M(I) ¬halt  L(M') is not regular

54 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | L(M) is regular} “M'” M'(I') = { If I’ has the form 0n1n halt and accept else run M(I) halt and accept } suppressing any output “M”,I Yes/No BUILD: Oracle for GIVEN: Oracle for Must prove Alg works. Yes/No {“M”,I | M halts on I} {“M” | L(M) is regular} M(I) halts  L(M') is regular M(I) ¬halt  L(M') is not regular

55 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | L(M) is regular} “M'” M'(I') = { If I’ has the form 0n1n halt and accept else run M(I) halt and accept } suppressing any output Case: M(I) halts “M”,I Yes BUILD: Oracle for GIVEN: Oracle for Must prove Alg works. L(M') = {everything} Yes , L(M') is regular {“M”,I | M halts on I} {“M” | L(M) is regular} M(I) halts  L(M') is regular Oracle: Yes  Alg: Yes M(I) ¬halt  L(M') is not regular

56 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | L(M) is regular} “M'” M'(I') = { If I’ has the form 0n1n halt and accept else run M(I) halt and accept } suppressing any output Case: M(I) ¬halts “M”,I No BUILD: Oracle for GIVEN: Oracle for Must prove Alg works. L(M') = No, L(M') is not regular 0n1n {“M”,I | M halts on I} {“M” | L(M) is regular} M(I) halts  L(M') is regular Oracle: Yes  Alg: Yes M(I) ¬halt  L(M') is not regular Oracle: No  Alg: No

57 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {“M” | L(M) is regular} Given an algorithm for Poracle, I have a working algorithm for the halting problem. But I can’t have a working algorithm for the halting problem, hence I can’t have an algorithm for Poracle, Done Proof! M(I) halts  L(M') is regular Oracle: Yes  Alg: Yes M(I) ¬halt  L(M') is not regular Oracle: No  Alg: No

58 Reductions for Undecidability
{“M”,I | M halts on I} ≤ {I | M* halts on I} where M* is a special TM M(I) halts or not “M”,I "I'" Need to tell oracle about M and I I' = “M”,I M* is the universal TM simulates M on I. BUILD: Oracle for GIVEN: Oracle for Yes or No {“M”,I | M halts on I} {I | M* halts on I}

59 Reductions for Recognizablity
{“M”,I | M halts on I} ≤ {“M”,I | M does not halt on I} No: Does not halt “M”,I BUILD: Oracle for GIVEN: Oracle for “M”,I Yes: Does not halt. {“M”,I | M halts on I} {“M”,I | M does not halt on I}

60 Reductions for Recognizablity
{“M”,I | M halts on I} ≤ {“M”,I | M does not halt on I} Yes: Does halt “M”,I BUILD: Oracle for GIVEN: Oracle for “M”,I No: Does halt. {“M”,I | M halts on I} {“M”,I | M does not halt on I} To prove undecidable this is good.

61 Reductions for Recognizablity
Yes instance  Halt and answer “yes” No instance  Run forever or answer “no” Recognizable Computable/Decidable No instance  Halt and answer “no” Yes instance  Run forever or answer “yes” Co-Recognizable Halting Halting Run M on I and say yes if it halts run forever if no. Reductions for Recognizablity If we care about Recognizable switching yes and no is not allowed.

62 Palg ≤comp Poracle Reductions for Recognizablity Karp Reduction:
Yes  Yes & No  No Algorithm Algalg(Ialg ) pre-cond: Ialg is an instance of Palg post-cont: Determine if Palg (Ialg) = yes begin Ioracle = InstanceMap(Ialg) ansoracle = Algoracle (Ioracle) ansalg = ansoracle return(ansalg) end Cook Reduction: Design any algorithm for Palg using a supposed algorithm for Poracle as a subroutine. if( ansoracle==yes ) ansalg = yes if( ansoracle==no) ansalg = no We do not care about Recognizable so switching yes and no is allowed.

63 Reductions for Undecidability
Rice’s Theorem {“M”,I | M halts on I} ≤ P = {“M” | based on what M does, not on how it does it} Rice’s Theorem: If P = {“M” | L(M) has some stated property} and P ≠ {everything} & P ≠ {nothing} P is undecidable. Eg P = {“M” | L(M) is regular} Note that L(M) states what M does on each input but not how. Proof: Consider any two TM, M and M'. If L(M) =L(M'), then MϵP iff M'ϵP (Because this L either has the stated property or does not) Let Mempty = just say no. L(Mempty) = {nothing} Assume “Mempty”  P (Else switch to P) Because P ≠ {nothing}, we can assume “Myes” is something in P

64 Reductions for Undecidability
Rice’s Theorem {“M”,I | M halts on I} ≤ P = {“M” | based on what M does, not on how it does it} Yes/No “M”,I “M'” M'(I') = { Run M(I) Run Myes(I') respond as Myes(I') does } BUILD: Oracle for GIVEN: Oracle for Must prove Alg works. Yes/No {“M”,I | M halts on I} P

65 Reductions for Undecidability
Rice’s Theorem {“M”,I | M halts on I} ≤ P = {“M” | based on what M does, not on how it does it} Case: M(I) halts Yes “M”,I “M'” M'(I') = { Run M(I) Run Myes(I') respond as Myes(I') does } BUILD: Oracle for GIVEN: Oracle for Must prove Alg works. L(M') = L(Myes) Myes ϵ P  M' ϵ P {“M”,I | M halts on I} Yes P

66 Reductions for Undecidability
Rice’s Theorem {“M”,I | M halts on I} ≤ P = {“M” | based on what M does, not on how it does it} Case: M(I) ¬halts No “M”,I “M'” M'(I') = { Run M(I) Run Myes(I') respond as Myes(I') does } BUILD: Oracle for GIVEN: Oracle for Must prove Alg works. L(M') = {nothing} = L(Mempty) Mempty ϵ P  M' ϵ P {“M”,I | M halts on I} P No

67 Reductions for Undecidability
Now that we have established that the Halting Problem and its friends are undecidable, we can use it for a jumping off point for more “natural” undecidability results. Jump to Long versions of these for 4111

68 The Post Correspondence Problem
The input is a finite collection of dominos b ca , a ab abc c P = A solution is a finite sequence of the dominoes (with repeats) b ca a ab abc c So that the combined string on the top is the same as that on the bottom a b c a a a b c PCP = {“P” | P is a collection of dominoes with a solution} PCP is undecidable

69 The Post Correspondence Problem
This maintains the loop invariant that in the only domino solution the combined string so far on the top consists of the first t TM configurations and on the bottom the first t+1. …0# …0#10qi1001b# 1 qi1 0qj 1 b #

70 The Post Correspondence Problem
{“M”,I | M halts on I} ≤ {“P” | dominos P has a solution} Yes M(I) halts “M”,I BUILD: Oracle for GIVEN: Oracle for “P” dominos in P mimic the rules of the TM M on input I Yes, there is a solution {“M”,I | M halts on I} {“P” | dominos P has a solution}

71 Tiling Problem The input is a finite collection of tiles A solution is a tiling of a finite square with these tiles without rotating them. (with repeats) Tiling = {“τ” | τ is a collection tiles with a solution} Tiling is undecidable

72 Consider some configuration of a TM
Tiling Problem Consider some configuration of a TM 1 q Encode the halting computation of M on I with time T as a list configurations on separate lines padded with blanks to form a square. ################### #qstart bbbbbbb# #1q bbbbbbbbb# #10q710010bbbbbbbbb# #100q60010bbbbbbbbb# #10 …. bbbbbbbbbbbb# #qacceptbbbbbbbbbbbbb# Form a collection of tiles to capture the ways that these characters can fit together.

73 Tiles in τ mimic the rules of the TM M on input I
Tiling Problem {“M”,I | M halts on I} ≤ {“τ” | Tiles τ have a solution} Yes M(I) halts “M”,I BUILD: Oracle for GIVEN: Oracle for <τ> Tiles in τ mimic the rules of the TM M on input I Yes, there is a solution {“M”,I | M halts on I} {“τ” | Tiles τ have a solution}

74 L(G) = L(G') Halting Problem = {“M”,I | M halts on I} is undecidable
{“G”,I | CFG generates I} {“G” | CFG G generates every string} {“G” | CFG G generates no string} {“G”,“G'” | L(G) = L(G')} O(n3) time Undecidable O(n) time Undecidable

75 CFG Generates Everything
P = { ω#ω' | where ω = ω' } Can’t be done by a CFG Grammar for S  α1 α2 … αn # α1 α2 … αn Linked because must be the same string. Links over lap and hence can’t be done by a CFG!

76 CFG Generates Everything
P = { ω#ω' | where ω = ω' } Can’t be done by a CFG P = { ω#ω' | where ω ≠ ω' } Can be done by a CFG! See practice CFG assignment.

77 CFG Generates Everything
Consider some computation of a TM M on I 1 q C = … # qi01011 # qj1011 # … TM configuration at time t. at time t+1. P = { C | where C is a computation of M on I }

78 CFG Generates Everything
Consider some computation of a TM M on I 1 q C = … # qi01011 # qj1011 # … ω = contents of tape before head at time t. ω' = contents of same tape at time t+1. Linked P = { C | where C is a computation of M on I } need ω = ω' Can’t be done by a CFG

79 CFG Generates Everything
Consider some computation of a TM M on I 1 q C = … # qi01011 # qj1011 # … ω = contents of tape before head at time t. ω' = contents of same tape at time t+1. P = { C | where C is not a computation of M on I } could have ω ≠ ω' Can be done by a CFG

80 CFG Generates Everything
{“M”,I | M halts on I} ≤ {“G” | CFG G generates every string} Yes, M(I) does halt “M”,I BUILD: Oracle for GIVEN: Oracle for “G” Grammar G rules mimic the rules of the TM M on input I No, the string corresponding to the computation cant be parsed {“M”,I | M halts on I} {“G” | CFG G generates every string}

81 CFG Generates Everything
{“M”,I | M halts on I} ≤ {“G” | CFG G generates every string} No, M(I) does not halt “M”,I BUILD: Oracle for GIVEN: Oracle for “G” Grammar G rules mimic the rules of the TM M on input I Yes, there is a parsing of everything {“M”,I | M halts on I} {“G” | CFG G generates every string}

82 Game of Life The Game of Life: Grid of square cells, each live or dead. The initial pattern is the seed of the system. At each step in time, every live cell # live neighbours ϵ {2,3}  dies every dead cell # live neighbours =  comes alive

83 Game of Life The Game of Life: Grid of square cells, each live or dead. The initial pattern is the seed of the system. At each step in time, every live cell # live neighbours ϵ {2,3}  dies every dead cell # live neighbours =  comes alive Life Problem: Input: An initial configuration Output: Does it go on forever? Undecidable! I would love to see the proof.

84 Hilbert’s 10th Problem Input: a multi-variate polynomial 2x2y8z3 + 7x3y2 - 8x4y2z = 0 Output: Does it have integer values giving zero? If one of the variables could be a real, then fix the others and do calculous to find the real one. You could just try different integer values. If you found a solution great. But if you have not yet, how do you know whether there is a solution with larger integers. Undecidable! Proof took many years for people to fine. Its something that Jeff managed to understand in about an hour.

85 End

86 Reductions for Undecidability
Computable/Decidable {“M”,I | M prints “Hi” on I} {“M” | M halts empty string} {“M” | I, M halts on I}  TM M* {I | M* halts on I} Proved Halting ≤ Halting

87 Reductions for Undecidability
{“M”,I | M prints “Hi” on I} {“M” | M halts empty string} {“M” | I, M halts on I}  TM M* {I | M* halts on I} Want to prove = ≤ Halting ≤ Halting Halting Computable/Decidable

88 Reductions for Undecidability
Other direction {“M”,I | M prints “Hi” on I at some point in computation } ≤ {“M”,I | M halts on I} M(I) prints “Hi” on I “M”,I “M'”,I M'(I) = { Run M(I) if “Hi” is printed halt Loop forever } BUILD: Oracle for GIVEN: Oracle for Yes halts {“M”,I | M prints “Hi” on I} {“M”,I | M halts on I}

89 Reductions for Undecidability
Other direction {“M”,I | M prints “Hi” on I at some point in computation } ≤ {“M”,I | M halts on I} M(I) does not print “Hi” “M”,I “M'”,I M'(I) = { Run M(I) if “Hi” is printed halt Loop forever } BUILD: Oracle for GIVEN: Oracle for No, does not halt {“M”,I | M prints “Hi” on I} {“M”,I | M halts on I}

90 Reductions for Undecidability
{“M”,I | M prints “Hi” on I} {“M” | M halts empty string} {“M” | I, M halts on I}  TM M* {I | M* halts on I} Proved = ≤ Halting Halting Computable/Decidable

91 Recognizable Recognizable (Turing Machines)
On Yes instances, TM must halt and accept. On No instances may run forever. Recognizable (Turing Machines) Decidable: Computable/Decidable (Turing Machines) The TM must halt on every input and give the correct answer. Halting(M,I) Input: TM M and input I Output: Yes if M halts on I Run M on I if( it halts ) halt and accept end loop Halting

92 Recognizable Recognizable (Turing Machines)
On Yes instances, TM must halt and accept. On No instances may run forever. Recognizable (Turing Machines) Halting Decidable: Computable/Decidable (Turing Machines) The TM must halt on every input and give the correct answer. HasSolution(M) Input: TM M Output: Yes if I, M halts on I loop I Run M on I. if( it halts ) halt and accept end loop If M does not halt on the first I, then we never get to the second. {“M” | I, M halts on I}

93 Recognizable Recognizable (Turing Machines)
On Yes instances, TM must halt and accept. On No instances may run forever. Recognizable (Turing Machines) Halting Decidable: Computable/Decidable (Turing Machines) The TM must halt on every input and give the correct answer. HasSolution(M) Input: TM M Output: Yes if I, M halts on I loop I,t if( M halts on I after t time steps ) halt and accept end loop If M halts on I after t time steps, the tuple I,t will eventually be reached and this algorithm will halt and accept. {“M” | I, M halts on I}

94 Recognizable I,t t=8 7 6 5 4 3 2 1 I1 I2 I3 I4 I5 I6 I7 I8 …
HasSolution(M) Input: TM M Output: Yes if I, M halts on I loop I,t if( M halts on I after t time steps ) halt and accept end loop 2 1 I1 I2 I3 I4 I5 I6 I7 I8 …

95 Recognizable I,t t=8 7 6 5 4 3 2 1 I1 I2 I3 I4 I5 I6 I7 I8 …
HasSolution(M) Input: TM M Output: Yes if I, M halts on I loop i loop j = 1..i if( M halts on Ij after t=i-j time steps ) halt and accept end loop 2 1 I1 I2 I3 I4 I5 I6 I7 I8 …

96 Recognizable Recognizable (Turing Machines)
On Yes instances, TM must halt and accept. On No instances may run forever. Recognizable (Turing Machines) Halting Decidable: Computable/Decidable (Turing Machines) The TM must halt on every input and give the correct answer. HasSolution(M) Input: TM M Output: Yes if I, M halts on I loop i loop j = 1..i if( M halts on Ij after t=i-j time steps ) halt and accept end loop If M halts on I after t time steps, the tuple I,t will eventually be reached and this algorithm will halt and accept. {“M” | I, M halts on I}

97 Recognizable/Enumerable
On Yes instances, TM must halt and accept. On No instances may run forever. MAccept Recognizable/Enumerable (Turing Machines) Halting Problem The TM must output yes instances. They will never all be outputted. But each Iyes eventually will be. Enumerable: Computable/Decidable (Turing Machines) MEnumerate() loop I,t if(MAccept(I) halts after t time steps ) output I end loop I is a yes instance iff MAccept halts on I after some t time steps, (the tuple I,t will eventually be reached) iff this algorithm will eventually output I.

98 Recognizable/Enumerable
On Yes instances, TM must halt and accept. On No instances may run forever. Recognizable/Enumerable (Turing Machines) Halting Problem The TM must output yes instances. They will never all be outputted. But each Iyes eventually will be. Enumerable: Computable/Decidable (Turing Machines) MEnumerate MAccept(I) Run Menumerate if( I gets outputted ) halt and accept If I is a yes instances Menumerate will eventually output it.

99 Reductions for Undecidability
{“M”,I | M prints “Hi” on I} {“M” | M halts empty string} {“M” | I, M halts on I}  TM M* {I | M* halts on I} Halting = = Easy to prove Computable/Decidable Halting = {“M”,I | M does not halt on I}

100 Reductions for Recognizablity
{“M”,I | M halts on I} ≤ {“M”,I | M does not halt on I} No: Does not halt “M”,I BUILD: Oracle for GIVEN: Oracle for “M”,I Yes: Does not halt. {“M”,I | M halts on I} {“M”,I | M does not halt on I}

101 Reductions for Recognizablity
{“M”,I | M halts on I} ≤ {“M”,I | M does not halt on I} Yes: Does halt “M”,I BUILD: Oracle for GIVEN: Oracle for “M”,I No: Does halt. {“M”,I | M halts on I} {“M”,I | M does not halt on I} To prove undecidable this is good. But let us now consider Recognizable.

102 Reductions for Recognizablity
Yes instance  Halt and answer “yes” No instance  Run forever or answer “no” Recognizable Reductions for Recognizablity Yes instance  Run forever or answer “yes” No instance  Halt and answer “no” Co-Recognizable Computable/Decidable Yes instance  Halt and answer “yes” No instance  Halt and answer “no” Run M on I and say yes if it halts run forever if no. Halting Halting = {“M”,I | M does not halt on I}

103 Reductions for Recognizablity
{“M”,I | M halts on I} ≤ {“M”,I | M does not halt on I} No: Does not halt “M”,I BUILD: Oracle for GIVEN: Oracle for “M”,I Yes: Does not halt. {“M”,I | M halts on I} {“M”,I | M does not halt on I}

104 Reductions for Recognizablity
{“M”,I | M halts on I} ≤ {“M”,I | M does not halt on I} Yes: Does halt “M”,I BUILD: Oracle for GIVEN: Oracle for “M”,I No: Does halt. {“M”,I | M halts on I} {“M”,I | M does not halt on I} If we care about Recognizable switching yes and no is not allowed.

105 Palg ≤comp Poracle Reductions for Recognizablity Karp Reduction:
Yes  Yes & No  No Algorithm Algalg(Ialg ) pre-cond: Ialg is an instance of Palg post-cont: Determine if Palg (Ialg) = yes begin Ioracle = InstanceMap(Ialg) ansoracle = Algoracle (Ioracle) ansalg = ansoracle return(ansalg) end Cook Reduction: Design any algorithm for Palg using a supposed algorithm for Poracle as a subroutine. if( ansoracle==yes ) ansalg = yes if( ansoracle==no) ansalg = no If we care about Recognizable switching yes and no is not allowed.

106 P Reductions for Recognizablity Recognizable Co-Recognizable
Yes instance  Halt and answer “yes” No instance  Run forever or answer “no” Recognizable Yes instance  Run forever or answer “yes” No instance  Halt and answer “no” Computable/Decidable Co-Recognizable Reductions for Recognizablity P If P can be Recognized and Co-Recognized  then P can be Decided. MDecide(I) In parallel (alternating moves) Run MRecognize(I) and MCo-Recognize(I) First to halt and accept give that answer.

107 Computable/Decidable Co-Recognizable Reductions for Recognizablity
Yes instance  Halt and answer “yes” No instance  Run forever or answer “no” Recognizable Yes instance  Run forever or answer “yes” No instance  Halt and answer “no” Computable/Decidable Co-Recognizable Reductions for Recognizablity Halting If P can be Recognized and Co-Recognized  then P can be Decided. Halting can be Recognized and cannot be Decided  it cannot be Co-Recognized..

108 Reductions for Recognizablity Recognizable Co-Recognizable
Yes instance  Run forever or answer “yes” No instance  Halt and answer “no” Yes instance  Halt and answer “yes” No instance  Run forever or answer “no” Halting Halting Computable/Decidable Halting ≤ P P has an algorithm  Halting has an algorithm. Halting does not have an algorithm  P does not have an algorithm Halting does not have a Deciding algorithm  P does not have a Deciding algorithm P

109 Reductions for Recognizablity Recognizable Co-Recognizable
Yes instance  Run forever or answer “yes” No instance  Halt and answer “no” Yes instance  Halt and answer “yes” No instance  Run forever or answer “no” P Halting Halting Computable/Decidable Halting ≤ P P has an algorithm  Halting has an algorithm. Halting does not have an algorithm  P does not have an algorithm Halting does not have a Co-Recognizing algorithm  P does not have a Co-Recognizing algorithm Halting does have an Recognizing algorithm  We don’t know about P does.

110 Reductions for Recognizablity P Recognizable Co-Recognizable
Yes instance  Run forever or answer “yes” No instance  Halt and answer “no” Yes instance  Halt and answer “yes” No instance  Run forever or answer “no” Halting Halting Computable/Decidable P ≤ Halting Halting has an algorithm  P has an algorithm. Halting does have an Recognizing algorithm  P does have an Recognizing algorithm

111 Reductions for Recognizablity
Recognizable Co-Recognizable Yes instance  Run forever or answer “yes” No instance  Halt and answer “no” Yes instance  Halt and answer “yes” No instance  Run forever or answer “no” Halting Halting Computable/Decidable {“M”,I | M prints “Hi” on I} {“M” | M halts empty string} {“M” | I, M halts on I}  TM M* {I | M* halts on I} Halting ≤ ≤ Halting

112 Reductions for Recognizablity
Recognizable Co-Recognizable Yes instance  Run forever or answer “yes” No instance  Halt and answer “no” Yes instance  Halt and answer “yes” No instance  Run forever or answer “no” Halting Halting Computable/Decidable Want to prove {“M” | I, M halts on I} {“M”,“M'” | I M(I)=M'(I)} {“M” | L(M) is regular} {“M” | based on what M does, not on how it does it} Halting ≤ Halting ≤

113 Reductions for ¬Halting
{“M”,I | M does not halt on I} ≤ {“M” | I, M halts on I} Yes M(I) does not halt “M”,I “M'” BUILD: Oracle for GIVEN: Oracle for Must switch halt and not halt! Yes, I', M'(I') halts {“M”,I | M halts on I} {“M” | I, M halts on I}

114 Reductions for ¬Halting
{“M”,I | M does not halt on I} ≤ {“M” | I, M halts on I} Given <“M”,I>, I can built “M'”. M'(I') = { Run M(I) for |I'| time steps if( M(I) halts ) M'(I') does not halt else M'(I') halts } InstanceMap: not M(I) ¬halt  I' M' halts on I'

115 Reductions for ¬Halting
{“M”,I | M does not halt on I} ≤ {“M” | I, M halts on I} Given <“M”,I>, I can built “M'”. M'(I') = { Run M(I) for |I'| time steps if( M(I) halts ) M'(I') does not halt else M'(I') halts } InstanceMap: M(I) halts  t M(I) halt in t time steps Let I' be such that |I'|=t.  I' M' not halt on I'

116 Reductions for ¬Halting
{“M”,I | M does not halt on I} ≤ {“M” | I, M halts on I} Given <“M”,I>, I can built “M'”. M'(I') = { Run M(I) for |I'| time steps if( M(I) halts ) M'(I') does not halt else M'(I') halts } InstanceMap: M(I) ¬halt  I' M' halts on I' M(I) halts  I' M' not halt on I'

117 Reductions for ¬Halting
{“M”,I | M does not halt on I} ≤ {“M” | I, M halts on I} “M'” M'(I') = { Run M(I) for |I'| time steps if( M(I) halts ) M'(I') does not halt else M'(I') halts } “M”,I Yes/No BUILD: Oracle for GIVEN: Oracle for Must prove Alg works. Yes/No {“M”,I | M does not halt on I} {“M” | I, M halts on I} M(I) ¬halt  I' M' halts on I' M(I) halts  I' M' not halt on I'

118 Reductions for ¬Halting
{“M”,I | M does not halt on I} ≤ {“M” | I, M halts on I} “M'” Case: M(I) ¬halt M'(I') = { Run M(I) for |I'| time steps if( M(I) halts ) M'(I') does not halt else M'(I') halts } “M”,I Yes BUILD: Oracle for GIVEN: Oracle for Must prove Alg works. Yes {“M”,I | M does not halt on I} {“M” | I, M halts on I} M(I) ¬halt  I' M' halts on I' Oracle: Yes  Alg: Yes M(I) halts  I' M' not halt on I'

119 Reductions for ¬Halting
{“M”,I | M does not halt on I} ≤ {“M” | I, M halts on I} “M'” Case: M(I) halts M'(I') = { Run M(I) for |I'| time steps if( M(I) halts ) M'(I') does not halt else M'(I') halts } “M”,I No BUILD: Oracle for GIVEN: Oracle for Must prove Alg works. No {“M”,I | M does not halt on I} {“M” | I, M halts on I} M(I) ¬halt  I' M' halts on I' Oracle: Yes  Alg: Yes M(I) halts  I' M' not halt on I' Oracle: No  Alg: No

120 Reductions for ¬Halting
{“M”,I | M does not halt on I} ≤ {“M” | I, M halts on I} Given an algorithm for Poracle, I have a working algorithm for the ¬halting problem. But I can’t have a working algorithm for the ¬halting problem, hence I can’t have an algorithm for Poracle, Done Proof! M(I) ¬halt  I' M' halts on I' Oracle: Yes  Alg: Yes M(I) halts  I' M' not halt on I' Oracle: No  Alg: No

121 Reductions for Recognizablity
Recognizable Co-Recognizable Yes instance  Run forever or answer “yes” No instance  Halt and answer “no” Yes instance  Halt and answer “yes” No instance  Run forever or answer “no” Halting Halting Computable/Decidable Proved {“M” | I, M halts on I} {“M”,“M'” | I M(I)=M'(I)} {“M” | L(M) is regular} {“M” | based on what M does, not on how it does it} Halting ≤ Halting ≤

122 Recognizable Complete
Yes instance  Halt and answer “yes” No instance  Run forever or answer “no” Halting Defn: Problem Pcomplete is Recognizable Complete iff Pcomplete  Recognizablity P  Recognizablity, P ≤comp Pcomplete I.e. Pcomplete is one of the hardest problems in Recognizable. If we had an algorithm for Pcomplete, then we would have one for every problem in Recognizable. Claim: Halting is Recognizable Complete. Pcomplete

123 Recognizable Complete
Yes instance  Halt and answer “yes” No instance  Run forever or answer “no” Halting Claim: Halting is Recognizable Complete. Halting  Recognizable P  Recognizable, There is a TM MP such that We must now prove P ≤comp Halting

124 Recognizable Complete
≤ {“M”,I | M halts on I} I  P “MP”,I (Change: If say no run forever.) I BUILD: Oracle for GIVEN: Oracle for Halts P {“M”,I | M halts on I}

125 Recognizable Complete
≤ {“M”,I | M halts on I} I  P “MP”,I (Change: If say no run forever.) I BUILD: Oracle for GIVEN: Oracle for Runs forever P {“M”,I | M halts on I}

126 Recognizable Complete
Halting Claim: Halting is Recognizable Complete. Halting  Recognizable P  Recognizable, There is a TM MP such that Yes instance  Halt and answer “yes” No instance  Run forever or answer “no” We proved P ≤comp Pcomplete

127 Recognizable Complete
Halting Claim: They all are Recognizable Complete. They  Recognizable P  Recognizable, {“M”,I | M prints “Hi” on I} {“M” | M halts empty string} {“M” | I, M halts on I}  TM M* {I | M* halts on I} We proved P ≤comp Halting ≤comp These problems

128 Recognizable Complete
Halting Claim: These are Recognizable Hard, but not Complete. This  Recognizable P  Recognizable, {“M” | I, M halts on I} {“M”,“M'” | I M(I)=M'(I)} {“M” | L(M) is regular} {“M” | based on what M does, not on how it does it} We proved P ≤comp Halting ≤comp This problem

129 Material for CSE 4111 but not for CSE2001

130 Reductions for Undecidability
Wait until we do Rice’s Theorem Wait until we do Rice’s Theorem

131 Reductions for Undecidability
Now that we have established that the Halting Problem and its friends are undecidable, we can use it for a jumping off point for more “natural” undecidability results.

132 The Post Correspondence Problem
The input is a finite collection of dominoes b ca , a ab abc c P = A solution is a finite sequence of the dominoes (with repeats) b ca a ab abc c So that the combined string on the top is the same as that on the bottom a b c a a a b c PCP = {“P” | P is a collection of dominoes with a solution} PCP is undecidable

133 The Post Correspondence Problem
{“M”,I | M halts on I} ≤ {“P” | dominos P has a solution} Yes M(I) halts “M”,I BUILD: Oracle for GIVEN: Oracle for “P” dominos in P mimic the rules of the TM M on input I Yes, there is a solution {“M”,I | M halts on I} {“P” | dominos P has a solution}

134 The Post Correspondence Problem
Consider some configuration of a TM 1 q Encode configuration of the TM as a string giving the contents of the tape and the current state inserted where the head is. 10qi10010

135 The Post Correspondence Problem
Consider some configuration of a TM 1 q Encode the halting computation of M on I as the string of configurations separated by ‘#’ #qstart #1q #10q710010#100q60010#10 …. #qaccept# I TM accepts by halting in the accept state with the tape empty

136 The Post Correspondence Problem
Consider some configuration of a TM 1 q Encode the halting computation of M on I as the string of configuration separated by ‘#’ #qstart #1q #10q710010#100q60010#10 …. #qaccept# M halts on I iff there is such a computation string iff the dominoes P has a solution with this string as the combined string on the top and on the bottom

137 The Post Correspondence Problem
Consider some configuration of a TM 1 q The first domino in P is # #qstart # I Lets temporarily assume that the domino solution must start with this domino. The loop invariant is that in the only domino solution the combined string so far on the top consists of the first t TM configurations and on the bottom the first t+1.

138 The Post Correspondence Problem
Consider some configuration of a TM 1 q TM is in state qi and sees a 1. Transition (qi,1) = <qj,c,right> qj c 1 qi1 cqj #10qi11010# Config: Related domino: #10qj11010# #10qjc1010# #10cqj1010#

139 The Post Correspondence Problem
Consider some configuration of a TM 1 q TM is in state qi and sees a 1. Transition (qi,1) = <qj,c,left> qj c 1 #10qi11010# Config: Related dominoes: 0qi1 qj0c 1qi1 qj1c & #10qj11010# #10qjc1010# #1qj0c1010#

140 The Post Correspondence Problem
Consider some configuration of a TM 1 q Related dominoes: , 1 , & b Copy unchanged characters: # Start a new configuration: # b# b# # & Add and removing trailing blanks: qaccept## # Accepting:

141 The Post Correspondence Problem
The loop invariant is that in the only domino solution the combined string so far on the top consists of the first t TM configurations and on the bottom the first t+1. …0# …0#10qi1001b#

142 The Post Correspondence Problem
For the top string to match the bottom string this t+1st configuration must be produced by dominoes on the top. …0# …0#10qi1001b# 1 qi1 b #

143 The Post Correspondence Problem
With transition (qi,1) = <qj,0,right> the only way to match the “qi1” on top is with the domino Then the remain characters can be copied down. …0# …0#10qi1001b# 1 b # 1 qi1 b # 0qj

144 The Post Correspondence Problem
This maintains the loop invariant that in the only domino solution the combined string so far on the top consists of the first t TM configurations and on the bottom the first t+1. …0# …0#10qi1001b# 1 qi1 0qj 1 b # …0#10qi1001b# …0#10qi1001b#100qj001b#

145 The Post Correspondence Problem
The TM is allowed to use as much tape as it likes. The extra cells are assumed to initially contain blanks. Towards this end, suppose you would like to insert a blank at the end of this configuration before the #. …0# …0#10qi1001b# 1 b # 1 qi1 b # 0qj …0# …0#10qi1001b# 1 qi1 b 0qj # b# This also maintains the loop invariant …0#10qi1001b# …0#10qi1001b#100qj001bb#

146 The Post Correspondence Problem
The TM is expected to leave the tape containing only blanks before it halts. Suppose towards that goal, you would like to delete that last trailing blank. …0# …0#10qi1001b# 1 b # 1 qi1 b # 0qj …0# …0#10qi1001b# 1 qi1 0qj # b # This also maintains the loop invariant …0#10qi1001b# …0#10qi1001b#100qj001# Hence the LI is always maintained.

147 The Post Correspondence Problem
Suppose the TM halts and accepts after t+1 time steps, then the first t+1 TM configurations end like this: …0#qaccept# The loop invariant is that in the only domino solution the combined string so far on the top consists of the first t TM configurations and on the bottom the first t+1.

148 The Post Correspondence Problem
We know that this loop invariant has been maintained Hence, we know that the only domino solution ends like this: …0# …0#qaccept# The loop invariant is that in the only domino solution the combined string so far on the top consists of the first t TM configurations and on the bottom the first t+1.

149 The Post Correspondence Problem
To this we can add a last domino to complete the solution …0# …0#qaccept# qaccept## # …0#qaccept## And this completes the solution with the combined string on the top being the same as that on the bottom.

150 The Post Correspondence Problem
Consider some configuration of a TM 1 q …0#qaccept## Of course such a solution is impossible, if TM M does not halt and accept input I.

151 The Post Correspondence Problem
Consider some configuration of a TM 1 q The first domino in P is # #qstart # I Lets temporarily assume that the domino solution must start with this domino. We now need to consider the problem with this restriction removed.

152 The Post Correspondence Problem
Consider these dominoes # qaccept## # , 1 b # b# b# # qi1 cqj 0qi1 qj0c 1qi1 qj1c #qstart # , & A solution is a finite sequence of the dominoes (with repeats) so that the combined string on the top is the same as that on the bottom Can you find a nice easy solution?

153 The Post Correspondence Problem
Insert *s into the dominoes *# #* *qaccept*#*#* #* , *0 0* *1 1* *b b* *# b*#* *b*# #* *qi*1 c*qj* *0*qi*1 qj0c* *1*qi*1 qj*1*c* *#*qstart*0*1*1*0*0*1*0*#* , & A solution is a finite sequence of the dominoes (with repeats) so that the combined string on the top is the same as that on the bottom Can you now find a nice easy solution? This first domino must go first because it is the only one with its first character on top and bottom the same.

154 The Post Correspondence Problem
Insert *s into the dominoes *# #* *qaccept*#*#* #* , *0 0* *1 1* *b b* *# b*#* *b*# #* *qi*1 c*qj* *0*qi*1 qj0c* *1*qi*1 qj*1*c* *#*qstart*0*1*1*0*0*1*0*#* , & A solution is a finite sequence of the dominoes (with repeats) so that the combined string on the top is the same as that on the bottom The rest of the proof is the same, producing: *#*qstart*0*1*1*0*0*1*0*#*1*…q3*0*1*0*0* …. *#*qaccept*#*

155 The Post Correspondence Problem
{“M”,I | M halts on I} ≤ {“P” | dominos P has a solution} Yes M(I) halts “M”,I BUILD: Oracle for GIVEN: Oracle for “P” dominos in P mimic the rules of the TM M on input I Yes, there is a solution {“M”,I | M halts on I} {“P” | dominos P has a solution} Done

156 Tiling Problem The input is a finite collection of tiles A solution is a tiling of a finite square with these tiles without rotating them. (with repeats) Tiling = {“τ” | τ is a collection tiles with a solution} Tiling is undecidable

157 Tiles in τ mimic the rules of the TM M on input I
Tiling Problem {“M”,I | M halts on I} ≤ {“τ” | Tiles τ have a solution} Yes M(I) halts “M”,I BUILD: Oracle for GIVEN: Oracle for “τ” Tiles in τ mimic the rules of the TM M on input I Yes, there is a solution {“M”,I | M halts on I} {“τ” | Tiles τ have a solution}

158 Consider some configuration of a TM
Tiling Problem Consider some configuration of a TM 1 q Encode configuration of the TM as a string giving the contents of the tape and the current state inserted where the head is. 10qi10010

159 Consider some configuration of a TM
Tiling Problem Consider some configuration of a TM 1 q Encode the halting computation of M on I with time T as a list configurations on separate lines padded with blanks to form a square. ################### #qstart bbbbbbb# #1q bbbbbbbbb# #10q710010bbbbbbbbb# #100q60010bbbbbbbbb# #10 …. bbbbbbbbbbbb# #qacceptbbbbbbbbbbbbb# Form a collection of tiles to capture the ways that these characters can fit together.

160 Hence, all are undecidable!
Context Free Grammars Halting Problem = {“M”,I | M halts on I} is undecidable Will prove: {<G,I> | CFG generates I} {“G” | CFG G generates every string} {“G” | CFG G generates no string} {<G,G'> | L(G) = L(G')} O(n3) time ? ≥comp {“M”,I | M halts on I} Hence, all are undecidable!

161 CFG G Generates I Input: T  a1a2a3 ..... an T C A Ask Little Bird:
(Parsing) A  AA  BT  a B  TA  BC  b  e C  CB  AC  c  d T  AB  CA  TT Input: T  a1a2a an T C A Ask Little Bird: For first rule For the split. b a e a a d b b d a

162 Solution: Left parsing C
CFG G Generates I (Parsing) A  AA  BT  a B  TA  BC  b  e C  CB  AC  c  d T  AB  CA  TT Input: T  a1a2a an T b d a A Ask left friend: Instance: C  baeaadb Solution: Left parsing C A B C T b a e a a d b

163 Solution: Right parsing A
CFG G Generates I (Parsing) A  AA  BT  a B  TA  BC  b  e C  CB  AC  c  d T  AB  CA  TT Input: T  a1a2a an T C b a e a a d b Ask right friend: Instance: A  bda Solution: Right parsing A B T C A b d a

164 CFG G Generates I Input: T  a1a2a3 ..... an T b d a b a e a a d b C A
(Parsing) A  AA  BT  a B  TA  BC  b  e C  CB  AC  c  d T  AB  CA  TT Input: T  a1a2a an T b d a b a e a a d b C A Combine: Instance: Bird’s Answer Left Friend’s Answer Right Friend’s Answer B T C A A B C T

165 = ( # of sub-instances × # bird answers )
CFG G Generates I (Parsing) Running time = ( # of sub-instances × # bird answers ) = ( # of non-terminals × n2 × # of rules · n ) T’  aiai aj  non-terminals T’ &  i,j  [1,n] sub-Instances: gives: First rule and split Done

166 ? CFG Generates Everything
Halting Problem = {“M”,I | M halts on I} is undecidable Will prove: {<G,I> | CFG generates I} {“G” | CFG G generates every string} {“G” | CFG G generates no string} {<G,G'> | L(G) = L(G')} O(n3) time ? Undecidable ≥comp {“M”,I | M halts on I} Hence, all are undecidable!

167 CFG Generates Everything
{“M”,I | M halts on I} ≤ {“G” | CFG G generates every string} No, M(I) does not halt “M”,I BUILD: Oracle for GIVEN: Oracle for “G” Grammar G rules mimic the rules of the TM M on input I Yes, there is a parsing of everything {<“M”,I> | M halts on I} {“G” | CFG G generates every string}

168 CFG Generates Everything
{“M”,I | M halts on I} ≤ {“G” | CFG G generates every string} Yes, M(I) does halt “M”,I BUILD: Oracle for GIVEN: Oracle for “G” Grammar G rules mimic the rules of the TM M on input I No, the string corresponding to the computation cant be parsed {<“M”,I> | M halts on I} {“G” | CFG G generates every string}

169 CFG Generates Everything
Consider some configuration of a TM 1 q Encode configuration of the TM as a string giving the contents of the tape and the current state inserted where the head is. 10qi10010

170 CFG Generates Everything
Consider some configuration of a TM 1 q Encode the halting computation of M on I as the string of configurations separated by ‘#’ #qstart #1q #10q710010#100q60010#10 …. #qaccept# I TM accepts by halting in the accept state with the tape empty

171 CFG Generates Everything
Consider some configuration of a TM 1 q Encode the halting computation of M on I as the string of configurations separated by ‘#’ #qstart #1q #10q710010#100q60010#10 …. #qaccept# α # α Linked because must be the same string Linked because must be the same string Can a CFG generate this string? No

172 CFG Generates Everything
Consider some configuration of a TM 1 q Encode the halting computation of M on I as the string of configurations separated by ‘#’ #qstart #1q #10q710010#100q60010#10 …. #qaccept# α # β α≠β Can a CFG generate every string but this string? Yes

173 CFG Generates Everything
Consider some configuration of a TM 1 q Encode the halting computation of M on I as the string of configurations separated by ‘#’ #qstart #1q #10q710010#100q60010#10 …. #qaccept# M halts on I  there is such a computation string CFG can generate every string but this string CFG does not generate every string Oracle says no

174 CFG Generates Everything
Consider some configuration of a TM 1 q Encode the halting computation of M on I as the string of configurations separated by ‘#’ #qstart #1q #10q710010#100q60010#10 …. #qaccept# M does not halt on I  there is no such a computation string CFG can generate every string Oracle says yes

175 CFG Generates Everything
Consider some configuration of a TM 1 q Encode the halting computation of M on I as the string of configurations separated by ‘#’ #qstart #1q #10q710010#100q60010#10 …. #qaccept# A string is not this string if at least one of: It does not start with #qstartI# It does not end with #qaccept# Some time step #10q710010#100q60010# is not according to the TM M.

176 CFG Generates Everything
Consider some configuration of a TM 1 q {0,1}* #10q710010#100q60010# {0,1}* Some time step is not according to the TM M. This is correct, but we need it to be wrong Not according to the TM M if at least one of: Not (#{0,1}*qi{0,1}*)*# Transition rule incorrect. Early unchanged tape not copied correctly Late unchanged tape not copied correctly

177 CFG Generates Everything
Consider some configuration of a TM 1 q Early unchanged tape not copied correctly {0,1}* #10q710010#100q60010# {0,1}* {0,1}* # {0,1}i 0 {0,1}*{qi}{0,1}*# {0,1}i 1{0,1}*{qi}{0,1}*#{0,1}* Linked because same size B A S'  A# B A {qi} A # A A  CA | ε C  0 | 1 B  CBC  0A{qi}A# The rest is similar

178 CFG Generates Everything
{“M”,I | M halts on I} ≤ {“G” | CFG G generates every string} No, M(I) does not halt “M”,I BUILD: Oracle for GIVEN: Oracle for “G” Grammar G rules mimic the rules of the TM M on input I Yes, there is a parsing of everything {“M”,I | M halts on I} {“G” | CFG G generates every string}

179 ? CFG G Generates Some String
Halting Problem = {“M”,I | M halts on I} is undecidable Will prove: O(n3) time {“G”,I | CFG generates I} {“G” | CFG G generates every string} {“G” | CFG G generates no string} {“G”,“G'” | L(G) = L(G')} Undecidable ? O(~n) time ≥comp {“M”,I | M halts on I} Hence, all are undecidable!

180 CFG G Generates Some String
Input: CFG G Output: Whether generates any string Algorithm by example G = S  abAcdSaaAef | acAadBddAa | cCdAe A aaAbbBb | baBcd B  aaBssSsa | funwow | aAbCc C  ccCcSdAd | efCghAqSr | bBbAbBb Does this G generate any string?

181 CFG G Generates Some String
S  abAcdSaaAef | acAadBddAa | cCdAe A aaAbbBb | baBcd B  aaBssSsa | funwow | aAbCc C  ccCcSdAd | efCghAqSr | bBbAbBb We only care if G generates some string. We don’t care which. Delete all terminals G2 = S  ASA | ABA | CA A AB | B B  BS | ε | AC C  CSA | CAS | BAB G generates some string iff G2 generates ε.

182 CFG G Generates Some String
S  ASA | ABA | CA A AB | B B  BS | ε | AC C  CSA | CAS | BAB Does G2 generate ε? We need a parsing that gets rid of all non-terminals. Non-terminal B can be replaced with ε. Why ever use the rule B  AC instead of B  ε G3 = S  ASA | ABA | CA A AB | B B  ε C  CSA | CAS | BAB G2 generates ε iff G3 generates ε.

183 CFG G Generates Some String
S  ASA | ABA | CA A AB | B B  ε C  CSA | CAS | BAB Does G3 generate ε? Lets just plug in B  ε G4 = S  ASA | AA | CA A A | ε C  CSA | CAS | A G3 generates ε iff G4 generates ε.

184 CFG G Generates Some String
S  ASA | AA | CA A A | ε C  CSA | CAS | A Does G4 generate ε? Why use A A instead of A ε Lets just plug in A  ε G5 = S  S | ε | C C  CS | CS | ε G4 generates ε iff G5 generates ε.

185 CFG G Generates Some String
S  S | ε | C C  CS | CS | ε Does G5 generate ε? Yes using S ε Hence, G generates some string!

186 CFG G Generates Some String
Input: CFG G Output: Whether generates any string Algorithm by another example G = S  abAcdSaaAef | acAadBddAa | cCdAe A aaAbbBb | baBcd B  aaBssSsa | aAbCc C  ccCcSdAd | efCghAqSr | bBbAbBb Does this G generate any string?

187 CFG G Generates Some String
S  abAcdSaaAef | acAadBddAa | cCdAe A aaAbbBb | baBcd B  aaBssSsa | aAbCc C  ccCcSdAd | efCghAqSr | bBbAbBb We only care if G generates some string. We don’t care which. Delete all terminals G2 = S  ASA | ABA | CA A AB | B B  BS | AC C  CSA | CAS | BAB G generates some string iff G2 generates ε.

188 CFG G Generates Some String
S  ASA | ABA | CA A AB | B B  BS | AC C  CSA | CAS | BAB Does G2 generate ε? The number non-terminals in our string never goes down G2 does not generate ε. Hence, G does not generate any strings!

189 Hence, all are undecidable!
L(G) = L(G') Halting Problem = {“M”,I | M halts on I} is undecidable Will prove: {“G”,I | CFG generates I} {“G” | CFG G generates every string} {“G” | CFG G generates no string} {<G,G'> | L(G) = L(G')} O(n3) time Undecidable O(~n) time ? Undecidable ≥comp {“M”,I | M halts on I} Hence, all are undecidable!

190 L(G) = L(G') {“G” | CFG G generates every string}
≤ {<G,G'> | L(G) = L(G')} Yes, G generates every string “G” BUILD: Oracle for GIVEN: Oracle for <G,G'> G' = S  AS | ε A  0| 1 Yes, L(G) = L(G') {“G” | CFG G generates every string} {<G,G'> | L(G) = L(G')}

191 Hence, all are undecidable!
Context Free Grammars Halting Problem = {“M”,I | M halts on I} is undecidable Will prove: {<G,I> | CFG generates I} {“G” | CFG G generates every string} {“G” | CFG G generates no string} {“G”,“G'” | L(G) = L(G')} O(n3) time Undecidable O(~n) time Undecidable ≥comp {“M”,I | M halts on I} Hence, all are undecidable!

192 Game of Life The Game of Life: Grid of square cells, each live or dead. The initial pattern is the seed of the system. At each step in time, every live cell # live neighbours ϵ {2,3}  dies every dead cell # live neighbours =  comes alive

193 Game of Life The Game of Life: Grid of square cells, each live or dead. The initial pattern is the seed of the system. At each step in time, every live cell # live neighbours ϵ {2,3}  dies every dead cell # live neighbours =  comes alive Life Problem: Input: An initial configuration Output: Does it go on forever? Undecidable! I would love to see the proof.

194 Hilbert’s 10th Problem Input: a multi-variate polynomial 2x2y8z3 + 7x3y2 - 8x4y2z5 = 0 Output: Does it have integer values giving zero? Undecidable! Proof not hard. Maybe we will cover it.

195 The End


Download ppt "Jeff Edmonds York University"

Similar presentations


Ads by Google