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
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.
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.
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!
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!
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!
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}
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
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
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 ≤
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.
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.
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?
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.
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
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.
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.
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 yesyes no no Algoracle gives the yes/no answer for his input Ioracle. Algalg returns the same answer.
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 yesyes no no To ensure Algalg works, Ioracle = InstanceMap(Ialg) must map yes instances to yes instances and no to no.
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 yesyes no no Must prove Algalg works. Ialg is a yes input Ioracle is a yes input Algoracle says yes Algalg says yes
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
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 ? ?? ?
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
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.”
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
Reductions Computable Halting Exp Poly Learn that a new problem is hard, from knowing a known problem is hard.
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,
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.
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.
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.
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'
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'
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'
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'
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
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
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
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
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
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
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!
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.
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.
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.
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
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.
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
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.
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.
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.
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
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
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
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
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
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
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
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}
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}
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.
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.
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.
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
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
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
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
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
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
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 #
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}
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
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 0110010bbbbbbb# #1q3010010bbbbbbbbb# #10q710010bbbbbbbbb# #100q60010bbbbbbbbb# #10 …. bbbbbbbbbbbb# #qacceptbbbbbbbbbbbbb# Form a collection of tiles to capture the ways that these characters can fit together.
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}
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
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!
CFG Generates Everything P = { ω#ω' | where ω = ω' } Can’t be done by a CFG P = { ω#ω' | where ω ≠ ω' } Can be done by a CFG! See practice CFG assignment.
CFG Generates Everything Consider some computation of a TM M on I 1 q C = … # 01001001qi01011 # 010010011qj1011 # … TM configuration at time t. at time t+1. P = { C | where C is a computation of M on I }
CFG Generates Everything Consider some computation of a TM M on I 1 q C = … # 01001001qi01011 # 010010011qj1011 # … ω = 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
CFG Generates Everything Consider some computation of a TM M on I 1 q C = … # 01001001qi01011 # 010010011qj1011 # … ω = 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
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}
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}
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 = 3 comes alive
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 = 3 comes alive Life Problem: Input: An initial configuration Output: Does it go on forever? Undecidable! I would love to see the proof.
Hilbert’s 10th Problem Input: a multi-variate polynomial 2x2y8z3 + 7x3y2 - 8x4y2z5 - 89= 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.
End
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
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
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}
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}
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
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
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}
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}
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 …
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 …
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}
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.
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.
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}
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}
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.
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}
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}
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.
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.
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.
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..
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
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.
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
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
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 ≤
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}
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'
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'
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'
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'
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'
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
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
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 ≤
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
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
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}
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}
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
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
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
Material for CSE 4111 but not for CSE2001
Reductions for Undecidability Wait until we do Rice’s Theorem Wait until we do Rice’s Theorem
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.
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
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}
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
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 ‘#’ #qstart0110010#1q3010010#10q710010#100q60010#10 …. #qaccept# I TM accepts by halting in the accept state with the tape empty
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 ‘#’ #qstart0110010#1q3010010#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
The Post Correspondence Problem Consider some configuration of a TM 1 q The first domino in P is # #qstart0110010# 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.
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#
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#
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:
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#
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 #
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
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#
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#
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.
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.
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.
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.
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.
The Post Correspondence Problem Consider some configuration of a TM 1 q The first domino in P is # #qstart0110010# I Lets temporarily assume that the domino solution must start with this domino. We now need to consider the problem with this restriction removed.
The Post Correspondence Problem Consider these dominoes # qaccept## # , 1 b # b# b# # qi1 cqj 0qi1 qj0c 1qi1 qj1c #qstart0110010# , & 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?
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.
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*#*
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
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
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}
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
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 0110010bbbbbbb# #1q3010010bbbbbbbbb# #10q710010bbbbbbbbb# #100q60010bbbbbbbbb# #10 …. bbbbbbbbbbbb# #qacceptbbbbbbbbbbbbb# Form a collection of tiles to capture the ways that these characters can fit together.
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!
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 a1a2a3 ..... an T C A Ask Little Bird: For first rule For the split. b a e a a d b b d a
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 a1a2a3 ..... 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
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 a1a2a3 ..... 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
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 a1a2a3 ..... 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
= ( # 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+1 ..... aj non-terminals T’ & i,j [1,n] sub-Instances: gives: First rule and split Done
? 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!
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}
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}
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
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 ‘#’ #qstart0110010#1q3010010#10q710010#100q60010#10 …. #qaccept# I TM accepts by halting in the accept state with the tape empty
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 ‘#’ #qstart0110010#1q3010010#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
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 ‘#’ #qstart0110010#1q3010010#10q710010#100q60010#10 …. #qaccept# α # β α≠β Can a CFG generate every string but this string? Yes
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 ‘#’ #qstart0110010#1q3010010#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
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 ‘#’ #qstart0110010#1q3010010#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
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 ‘#’ #qstart0110010#1q3010010#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.
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
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 1A {qi} A # A A CA | ε C 0 | 1 B CBC 0A{qi}A# The rest is similar
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}
? 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!
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?
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 ε.
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 ε.
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 ε.
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 ε.
CFG G Generates Some String S S | ε | C C CS | CS | ε Does G5 generate ε? Yes using S ε Hence, G generates some string!
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?
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 ε.
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!
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!
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')}
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!
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 = 3 comes alive
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 = 3 comes alive Life Problem: Input: An initial configuration Output: Does it go on forever? Undecidable! I would love to see the proof.
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.
The End