1.9k likes | 2.12k Views
Reductions to the Halting Problem. CSE 4111. CSE 2001. Different Models Reductions Simple Reductions Rice's Theorem Reductions with NotHalting Recognizable/Enumerable Recognizablity Complete The Rest Quick for 2001. The Post Correspondence Prob Tiling CFG G Generates I
E N D
Reductions to the Halting Problem • CSE 4111 • CSE 2001 • Different Models • Reductions • Simple Reductions • Rice's Theorem • Reductions with NotHalting • Recognizable/Enumerable • Recognizablity Complete • The Rest Quick for 2001 • 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 Jeff Edmonds York University Lecture5.2 CSE 2001/4111
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} Is Undecidable, butthe reduction requires switching Yes & No Recognizable & Co-Recognizable. X ≥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 Funny that these have different complexities! Some how harder. X X X ≥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. X X X ≥comp {“M”,I | M halts on I} ≥comp {“M”,I | M does not halt on I}
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” Computable/Decidable • Yes instance Halt and answer “yes” • No instance Halt and answer “no” 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 • Two problems/languages Peasierand Phardereach with their own definitions of Iharder Ieasier • what a legal input is (Ieasiervs Iharder) and • which are yes-inputs and which no-inputs. Pharder Peasier Iharder yes Ieasieryes Iharder no Ieasierno
Reductions Iharder Ieasier Pharder(Iharder) Peasier(Ieasier) Iharder Ieasier Pharder Peasier Algharder Algeasier Iharder yes Ieasieryes • We want machines that decide/accept them. Iharder no Ieasierno
Reductions • Computable/Decidable • Exp • Poly • Recognizable • Co-Recognizable Peasier≤compPharder • Co-NP • NP Ieasier Iharder • How do their complexities/difficulties compare? Pharder Peasier Ieasieryes Iharder yes Ieasierno Iharder no
Reductions Peasier≤compPharder • It is hard to prove problem is Pharderhard. • It is easier to prove Peasieris easy. • by design an algorithm Algeasier for it. • But you only need to prove Peasieris at least as easy as Pharder . • Pretend you have an algorithm Algharder for Pharderto use as a subroutine. Iharder Ieasier Pharder Peasier Iharder yes Ieasieryes Iharder no Ieasierno
Reductions Palg≤compPoracle • We often call the algorithm assumed to exist, an Oracle. Ioracle Ialg Poracle(Ioracle) Ioracle Poracle Palg GivenAlgoracle Ioracle yes Ialgyes Ioracle no Ialgno
Reductions Palg≤compPoracle BuildAlgAlg Ioracle Ialg Poracle(Ioracle) Ioracle Ialg Palg Poracle GivenAlgoracle Ioracle yes Ialgyes Palg(Ialg) • We useAlgoracle as an subroutinein an algorithm Algalg for solving Palg. Ialgno Ioracle no
Reductions Palg≤compPoracle InstanceMap Ioracle BuildAlgAlg Ioracle Ialg Poracle(Ioracle) Ioracle Ioracle=InstanceMap(Ialg) Ialg GivenAlgoracle Ialg Palg(Ialg) • Algalgis given an input Ialg. It maps it to input Ioracle.and gives this to Algoracle.
Reductions Palg≤compPoracle Poracle InstanceMap Ioracle yes Ioracle no BuildAlgAlg Ioracle Ialg Poracle(Ioracle) Ioracle Ioracle=InstanceMap(Ialg) Ialg GivenAlgoracle Return same answer yesyes no no Ialg Palg(Ialg) • Algoracle gives the yes/no answer for his input Ioracle. Algalg returns the same answer.
Reductions Palg≤compPoracle Palg Poracle InstanceMap Ialgyes Ioracle yes Ialgno Ioracle no BuildAlgAlg Ioracle Ialg Poracle(Ioracle) Ioracle Ioracle=InstanceMap(Ialg) Ialg GivenAlgoracle Return same answer yesyes no no Palg(Ialg) • To ensure Algalg works, Ioracle=InstanceMap(Ialg)must map yes instances to yes instances and no to no.
Reductions Palg≤compPoracle Palg Poracle InstanceMap Ialgyes Ioracle yes Ialgno Ioracle no BuildAlgAlg Ioracle Ialg Poracle(Ioracle) Ioracle Ioracle=InstanceMap(Ialg) Ialg GivenAlgoracle Return same answer yesyes no no Palg(Ialg) • Must prove Algalg works. Ialgis a yes input Ioracleis a yes input Algoraclesays yesAlgalgsays yes
Reductions Palg≤compPoracle
Reductions Palg≤compPoracle • 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 likely hard, from knowing a known problem is likely hard. • Learn that two problems have a similar “structure.”
Reductions Sam Mary s t Bob Beth Who loves who Max matching John Sue Fred Ann A network s t Max Flow BUILD:MatchingOracle GIVEN:NetworkFlow Oracle Matching ≤compNetwork Flows
Reductions Computable Exp Poly Halting • Learn that a new problem is likely hard, from knowing a known problem is likely hard.
Reductions We give an algorithm for Palg using a supposed algorithm for Poracle as a subroutine. If there is not an algorithm for Palg If there is an algorithm for Palg ? ?? then there is not fast 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 ?? ? ?
Reductions computable We give an algorithm for Palg using a supposed algorithm for Poracle as a subroutine. Conclusions: Palgis “at least as easy as”Poracle (Modulo polynoM'al terms.) Poracleis “at least as hard as”Palg (Modulo polynoM'al terms.) Notation: Palg≤compPoracle
Reductions for Undecidability {“M”,I | M prints “Hi” on I at some point in computation } = Poracle {“M”,I | M halts on I} ≤ • 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 prints “Hi” on I at some point in computation } {“M”,I | M halts on I} ≤ “M'”,I PHi Phalting <M'Hi ,I> <Mhalts,I> “M”,I <M'¬Hi,I> <M¬halts,I> • Consider the form of the instances of each problemand which are yes-instances.
Reductions for Undecidability {“M”,I | M prints “Hi” on I at some point in computation } {“M”,I | M halts on I} ≤ “M'”,I PHi Phalting InstanceMap <M'Hi ,I> <Mhalts,I> “M”,I <M'¬Hi,I> <M¬halts,I> • To ensure Algalg works, Ioracle=InstanceMap(Ialg)must map yes instances to yes instances and no to no.
Reductions for Undecidability {“M”,I | M prints “Hi” on I at some point in computation } {“M”,I | M halts on I} ≤ 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 prints “Hi” on I at some point in computation } {“M”,I | M halts on I} ≤ 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 prints “Hi” on I at some point in computation } {“M”,I | M halts on I} ≤ • 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'
Yes/No Yes/No BUILD:Oracle for GIVEN:Oracle for Reductions for Undecidability {“M”,I | M prints “Hi” on I at some point in computation } {“M”,I | M halts on I} ≤ “M”,I “M'”,I M'(I') = { Ignore input I' M is built in Run M(I), Print(“Hi”) } Must prove Alg works. suppressing any output {“M”,I | M prints “Hi” on I} {“M”,I | M halts on I} M(I) halts M'(I') says “Hi” on every I' M(I) ¬halt M'(I') no “Hi” on every I'
Yes Yes, prints “Hi” BUILD:Oracle for GIVEN:Oracle for Reductions for Undecidability {“M”,I | M prints “Hi” on I at some point in computation } {“M”,I | M halts on I} ≤ Case: M(I) halts “M”,I “M'”,I M'(I') = { Ignore input I' M is built in Run M(I), Print(“Hi”) } Must prove Alg works. suppressing any output {“M”,I | M prints “Hi” on I} {“M”,I | M halts 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'
No No “Hi” BUILD:Oracle for GIVEN:Oracle for Reductions for Undecidability {“M”,I | M prints “Hi” on I at some point in computation } {“M”,I | M halts on I} ≤ Case: M(I) ¬halts “M”,I “M'”,I M'(I') = { Ignore input I' M is built in Run M(I), Print(“Hi”) } Must prove Alg works. suppressing any output {“M”,I | M prints “Hi” on I} {“M”,I | M halts 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 prints “Hi” on I at some point in computation } {“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) 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
M(I) halts or not Yes or No BUILD:Oracle for GIVEN:Oracle for Reductions for Undecidability {“M” | M halts empty string} {“M”,I | M halts on I} ≤ “M”,I “M'” M'(I') = { Ignore input I' M & I are built in Run M(I) } Must prove Alg works. {“M” | M halts empty string} {“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
M(I) halts or not Yes or No BUILD:Oracle for GIVEN:Oracle for Reductions for Undecidability {“M” | I, M halts on I} {“M”,I | M halts on I} ≤ “M”,I “M'” M'(I') = { Ignore input I' M & I are built in Run M(I) } Must prove Alg works. {“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
M(I) halts or not Yes or No BUILD:Oracle for GIVEN:Oracle for Reductions for Undecidability {“M” | I, M halts on I} {“M”,I | M halts on I} ≤ “M”,I “M'” M'(I') = { Ignore input I' M & I are built in Run M(I) } Must prove Alg works. {“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
M(I) halts or not Yes or No BUILD:Oracle for GIVEN:Oracle for Reductions for Undecidability {“M”,“M'” | I M(I)=M'(I)} {“M”,I | M halts on I} ≤ “M”,I “M'”,“M''” M''(I') halts and accepts M'(I') = { Ignore input I' M & I are built in Run M(I) } Must prove Alg works. {“M”,“M'” | I M(I)=M'(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
M(I) halts or not Yes or No BUILD:Oracle for GIVEN:Oracle for Reductions for Undecidability {“M” | L(M) is regular} {“M”,I | M halts on I} ≤ “M”,I “M'” M'(I') = { Ignore input I' M & I are built in Run M(I) } Must prove Alg works. {“M” | L(M) is regular} {“M”,I | M halts on I} • L(M') = {0,1}* M(I) halts M'(I') halt for every I' • Oracle: Yes • L(M') = {} M(I) ¬halt M'(I') ¬halt for every I' • Oracle: Yes!
Reductions for Undecidability {“M” | L(M) is regular} {“M”,I | M halts on I} ≤ “M'” Phalting Preg “M'reg” <Mhalts,I> “M”,I “M'¬reg ” <M¬halts,I> • Consider the form of the instances of each problemand which are yes-instances.
Reductions for Undecidability {“M” | L(M) is regular} {“M”,I | M halts on I} ≤ “M'” Phalting Preg “M'reg” <Mhalts,I> I “M”,I • 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. “M'¬reg ” <M¬halts,I> L(M'reg) 01101 Iyes Ino Irun forever
Reductions for Undecidability {“M” | L(M) is regular} {“M”,I | M halts on I} ≤ “M'” Phalting Preg “M'reg” <Mhalts,I> I “M”,I • 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. “M'¬reg ” <M¬halts,I> L(M'¬reg) 01101 Iyes Ino Irun forever
Reductions for Undecidability {“M” | L(M) is regular} {“M”,I | M halts on I} ≤ “M'” “M'” “M'” 0n1n 1n0n “M'all” “M'none” Phalting Preg <Mhalts,I> “M”,I <M¬halts,I> • Lets be more discerning
Reductions for Undecidability {“M” | L(M) is regular} {“M”,I | M halts on I} ≤ “M'” “M'” “M'” 0n1n 1n0n “M'all” “M'none” Phalting Preg <Mhalts,I> I “M”,I • Any input “M' ” • is the description of a TM • whose language L(M') is 0n1n • which is not regular. <M¬halts,I> 0n1n 0n1n 0n1n 000111 There are many such TM. 10
Reductions for Undecidability {“M” | L(M) is regular} {“M”,I | M halts on I} ≤ “M'” “M'” “M'” 0n1n 1n0n “M'all” “M'none” Phalting Preg <Mhalts,I> I “M”,I • The TM M' • does not care to distinguish whether its input has the form 1n0n or not. <M¬halts,I> 0n1n 0n1n 000111 101 1n0n 10
Reductions for Undecidability {“M” | L(M) is regular} {“M”,I | M halts on I} ≤ “M'” “M'” “M'” 0n1n 1n0n “M'all” “M'none” Phalting Preg <Mhalts,I> I “M”,I {0,1}* • Any input “M'all” • is the description of a TM • whose language L(M'all) is {0,1}* • which is regular. <M¬halts,I> 000111 10
Reductions for Undecidability {“M” | L(M) is regular} {“M”,I | M halts on I} ≤ “M'” “M'” InstanceMap “M'” 0n1n 1n0n “M'all” “M'none” Phalting Preg <Mhalts,I> “M”,I • To ensure Algalg works, Ioracle=InstanceMap(Ialg)must <M¬halts,I> 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” | L(M) is regular} {“M”,I | M halts on I} ≤ 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') = ? M' accepts If I’ has the form 0n1n M' runs forever. If I’ has the form 1n0n
Reductions for Undecidability {“M” | L(M) is regular} {“M”,I | M halts on I} ≤ 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') = ? M' accepts If I’ has the form 0n1n M' runs forever. If I’ not have form 0n1n M'recognizes 0n1n, but “computes” no language L(M') = 0n1n • L(M') is not regular