计算理论20110421y
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
计算理论导引与算法复杂性
Introduction to the Theory of Computation and Algorithm Complexities
主讲: 主讲:刘国华 (学院楼①225室,ghliu@dhu.edu.cn) 学院楼①225室 ) 助教: 助教:辛婷婷 学院楼①153室 (学院楼①153室,xtt.moon@163.com) ) FTP:222.204.215.3
CHAPTER 3 ALGORITHEMS(2)
2 THE HAITING PROBLEM(ACCEPTANCE PROBLEM) ATM={<M, w>|M is a TM and M accepts w} THEORM 3.9 ATM is undecidable. PROOF IDEA accept if M accepts w H(<M, w>)= reject if M does not accept w D=“On input <M>, where M is a TM: 1. Run H on input <M, <M>>. 2.Output the opposite of what H output; that is, if H accepts, reject and if H rejects, accept.”
CHAPTER 3 ALGORITHEMS(2)
COROLARY 3.2 ATM is not Turing-recognizable. • REDUCIBILITY A way of converting one problem to another problem in such a way that a solution to the second problem can be used to solve the first problem. If problem A can reduce to problem B. We can know: 1.Solving problem A can not be harder than problem B. 2.If B is decidable, then A also is decidable. 3.If A is undecidable, then B also is undecidable.
CHAPTER 3 ALGORITHEMS(2)
•UNDECIDABLE PROBLEMS FROM LANGUEAGE THEORY 1. HALTTM={<M, w>|M is a TM and M halts on input w}. THEOREM 3.11 HALTTM is undecidable. PROOF IDEA METHOD: contradiction Problem A is ATM, problem B is HALTTM, if A reduces to B, then we can know: If B is decidable, then A also is decidable. To assume that we have a TM R that decides HALTTM S=“On input <M, w>, an encoding of a TM M and a string w: 1.Run TM R on input<M, w>. 2.If R rejects, reject. 3.If R accepts, simulate M on w until it halts. 4.If M has accepted, accept; if M has rejected, reject.”
CHAPTER 3 ALGORITHEMS(2)
n 1 2 3 4 f(n) 3.14159… 55.55555… 0.12345… 0.50000…
…
…Baidu Nhomakorabea
x=0. 2111 …
CHAPTER 3 ALGORITHEMS(2)
COROLLARY 3.1 Some language are not Turing-recognizable. PROOF IDEA 1)The set of all Turing machine is countable; 2)The set of all language is uncountable; (1)The set of all infinite binary sequences is uncountable; (2) The set of all language and the set of all infinite binary sequences are the same size.
On input <D>: 1. Run H on input <D, <D>>. 2. D rejects <D>, if D accepts <D>; D accepts <D>,if D rejects <D>.”
CHAPTER 3 ALGORITHEMS(2)
The universe of languages Turing-recognizable languages
CHAPTER 3 ALGORITHEMS(2)
3. REGULARTM={<M>|M is a TM and L(M) is a regular language}. THEOREM 3.13 EREGULARTM is undecidable. 4.EQTM={<M1,M2>|M1 and M2 are TMs and L(M1) =L(M2)}. THEOREM 3.13 EQTM is undecidable.
CHAPTER 3 ALGORITHEMS(2)
2. ETM={<M>|M is a TM and L(M)=∅}. ∅ THEOREM 3.12 ETM is undecidable. PROOF IDEA METHOD: contradiction Problem A is ATM, problem B is ETM, if A reduces to B, then we can know: If B is decidable, then A also is decidable. To assume that we have a TM R that decides ETM S=“On input <M, w>, an encoding of a TM M and a string w: S=“On input <M, M1=“On input x: w>, an encoding of a TM M and a string w: 1.Run w, reject. input<M>. and w to construct the TM M1. 1.Use TM R on 1.If x≠ the description of M 2.If R accepts, reject. w and accept if M does.” 2.Run TM R on on input 3.If x=w, run M input<M1>. 3.If R rejects, ??????.” R rejects, accepts. 3.If R accepts, reject; if
CHAPTER 3 ALGORITHEMS(2)
• THE HAITING PROBLEM(ACCEPTANCE PROBLEM) 1 THE DIAGONALIZATION METHOD 1)Correspondence:a function that is both one-to-one and onto. 2)Countable set: a set A is countable if either it is finite or it has the same size as N. THEOREM 3.8 R is incountable. PROOF IDEA. To show that no correspondence exists between N and R. METHOD:contradiction To construct a real number x whose ith fractional digit is different from f(i)’s,1≤i≤n.
CHAPTER 3 ALGORITHEMS(2)
PROOF IDEA M for B. f is the reduction of A to B. N=“ On input w: 1.Compute f(w). 2.Run M on input f(w) and output whatever M ouputs.” COROLLARY 3.3 If A≤ mB and is A undecidable, then B is undecidable. ≤ THEOREM 3.15 If A≤ mB and B is Turing-recognizable, then A is Turing≤ recognizable. COROLLARY 3.4 If A≤ B and A is not Turing-recognizable, then B is not ≤ Turing-recognizable.
CHAPTER 3 ALGORITHEMS(2)
• THE HAITING PROBLEM(ACCEPTANCE PROBLEM) ATM={<M,w>|M is a TM and M accepts w} U=“On input<M,w>,where M is a TM and w is a string: 1.Simulate M on input w. 2.If M ever enters its accept state, accept; if M ever enter its reject state, reject.” If M loops, what will we do?
CHAPTER 3 ALGORITHEMS(2)
• MAPPING REDUCIBILITY
* 1.Computable function: A function f:Σ→Σ*is a computable Σ→Σ function if some Turing machine M, on every input w, halts with just f(w) on its tape. 2.Mapping reducible language: Language A is mapping reducible to language B, written A≤m B ,if there is a ≤ * computable function f: Σ→Σ* , where for every w, w∈A⇔f(w)∈B. ∈ ⇔ ∈ The function f is called the reduction of A to B. THEOREM 3.14 If A≤ mB and B is decidable, then A is decidable. ≤
The complement of Turing-recognizable languages
CHAPTER 3 ALGORITHEMS(2)
3 A TURING-UNRECOGNIZABLE LANGUAGE Co-Turing-recognizable language: a language is co-Turingrecognizable if it is the complement of a Turingrecognizable language and Turing-recognizable. THEOREM 3.10 A language is decidable iff it is Turing-recognizable and coTuring-recognizable. PROOF IDEA M=“On input w: 1.Run both M1 and M2 on input w in parallel. 2.If M1 accepts, accept; if M2 accept, reject.”
Introduction to the Theory of Computation and Algorithm Complexities
主讲: 主讲:刘国华 (学院楼①225室,ghliu@dhu.edu.cn) 学院楼①225室 ) 助教: 助教:辛婷婷 学院楼①153室 (学院楼①153室,xtt.moon@163.com) ) FTP:222.204.215.3
CHAPTER 3 ALGORITHEMS(2)
2 THE HAITING PROBLEM(ACCEPTANCE PROBLEM) ATM={<M, w>|M is a TM and M accepts w} THEORM 3.9 ATM is undecidable. PROOF IDEA accept if M accepts w H(<M, w>)= reject if M does not accept w D=“On input <M>, where M is a TM: 1. Run H on input <M, <M>>. 2.Output the opposite of what H output; that is, if H accepts, reject and if H rejects, accept.”
CHAPTER 3 ALGORITHEMS(2)
COROLARY 3.2 ATM is not Turing-recognizable. • REDUCIBILITY A way of converting one problem to another problem in such a way that a solution to the second problem can be used to solve the first problem. If problem A can reduce to problem B. We can know: 1.Solving problem A can not be harder than problem B. 2.If B is decidable, then A also is decidable. 3.If A is undecidable, then B also is undecidable.
CHAPTER 3 ALGORITHEMS(2)
•UNDECIDABLE PROBLEMS FROM LANGUEAGE THEORY 1. HALTTM={<M, w>|M is a TM and M halts on input w}. THEOREM 3.11 HALTTM is undecidable. PROOF IDEA METHOD: contradiction Problem A is ATM, problem B is HALTTM, if A reduces to B, then we can know: If B is decidable, then A also is decidable. To assume that we have a TM R that decides HALTTM S=“On input <M, w>, an encoding of a TM M and a string w: 1.Run TM R on input<M, w>. 2.If R rejects, reject. 3.If R accepts, simulate M on w until it halts. 4.If M has accepted, accept; if M has rejected, reject.”
CHAPTER 3 ALGORITHEMS(2)
n 1 2 3 4 f(n) 3.14159… 55.55555… 0.12345… 0.50000…
…
…Baidu Nhomakorabea
x=0. 2111 …
CHAPTER 3 ALGORITHEMS(2)
COROLLARY 3.1 Some language are not Turing-recognizable. PROOF IDEA 1)The set of all Turing machine is countable; 2)The set of all language is uncountable; (1)The set of all infinite binary sequences is uncountable; (2) The set of all language and the set of all infinite binary sequences are the same size.
On input <D>: 1. Run H on input <D, <D>>. 2. D rejects <D>, if D accepts <D>; D accepts <D>,if D rejects <D>.”
CHAPTER 3 ALGORITHEMS(2)
The universe of languages Turing-recognizable languages
CHAPTER 3 ALGORITHEMS(2)
3. REGULARTM={<M>|M is a TM and L(M) is a regular language}. THEOREM 3.13 EREGULARTM is undecidable. 4.EQTM={<M1,M2>|M1 and M2 are TMs and L(M1) =L(M2)}. THEOREM 3.13 EQTM is undecidable.
CHAPTER 3 ALGORITHEMS(2)
2. ETM={<M>|M is a TM and L(M)=∅}. ∅ THEOREM 3.12 ETM is undecidable. PROOF IDEA METHOD: contradiction Problem A is ATM, problem B is ETM, if A reduces to B, then we can know: If B is decidable, then A also is decidable. To assume that we have a TM R that decides ETM S=“On input <M, w>, an encoding of a TM M and a string w: S=“On input <M, M1=“On input x: w>, an encoding of a TM M and a string w: 1.Run w, reject. input<M>. and w to construct the TM M1. 1.Use TM R on 1.If x≠ the description of M 2.If R accepts, reject. w and accept if M does.” 2.Run TM R on on input 3.If x=w, run M input<M1>. 3.If R rejects, ??????.” R rejects, accepts. 3.If R accepts, reject; if
CHAPTER 3 ALGORITHEMS(2)
• THE HAITING PROBLEM(ACCEPTANCE PROBLEM) 1 THE DIAGONALIZATION METHOD 1)Correspondence:a function that is both one-to-one and onto. 2)Countable set: a set A is countable if either it is finite or it has the same size as N. THEOREM 3.8 R is incountable. PROOF IDEA. To show that no correspondence exists between N and R. METHOD:contradiction To construct a real number x whose ith fractional digit is different from f(i)’s,1≤i≤n.
CHAPTER 3 ALGORITHEMS(2)
PROOF IDEA M for B. f is the reduction of A to B. N=“ On input w: 1.Compute f(w). 2.Run M on input f(w) and output whatever M ouputs.” COROLLARY 3.3 If A≤ mB and is A undecidable, then B is undecidable. ≤ THEOREM 3.15 If A≤ mB and B is Turing-recognizable, then A is Turing≤ recognizable. COROLLARY 3.4 If A≤ B and A is not Turing-recognizable, then B is not ≤ Turing-recognizable.
CHAPTER 3 ALGORITHEMS(2)
• THE HAITING PROBLEM(ACCEPTANCE PROBLEM) ATM={<M,w>|M is a TM and M accepts w} U=“On input<M,w>,where M is a TM and w is a string: 1.Simulate M on input w. 2.If M ever enters its accept state, accept; if M ever enter its reject state, reject.” If M loops, what will we do?
CHAPTER 3 ALGORITHEMS(2)
• MAPPING REDUCIBILITY
* 1.Computable function: A function f:Σ→Σ*is a computable Σ→Σ function if some Turing machine M, on every input w, halts with just f(w) on its tape. 2.Mapping reducible language: Language A is mapping reducible to language B, written A≤m B ,if there is a ≤ * computable function f: Σ→Σ* , where for every w, w∈A⇔f(w)∈B. ∈ ⇔ ∈ The function f is called the reduction of A to B. THEOREM 3.14 If A≤ mB and B is decidable, then A is decidable. ≤
The complement of Turing-recognizable languages
CHAPTER 3 ALGORITHEMS(2)
3 A TURING-UNRECOGNIZABLE LANGUAGE Co-Turing-recognizable language: a language is co-Turingrecognizable if it is the complement of a Turingrecognizable language and Turing-recognizable. THEOREM 3.10 A language is decidable iff it is Turing-recognizable and coTuring-recognizable. PROOF IDEA M=“On input w: 1.Run both M1 and M2 on input w in parallel. 2.If M1 accepts, accept; if M2 accept, reject.”