Comput Ability Decid Ability Complexity

Download Comput Ability Decid Ability Complexity

Post on 06-Dec-2015

15 views

Category:

Documents

2 download

Embed Size (px)

DESCRIPTION

Comput Ability Decid Ability Complexity

TRANSCRIPT

<ul><li><p>Alberto Pettorossi</p><p>Elements of Computability,</p><p>Decidability, and Complexity</p><p>Third Edition</p><p>ARACNE</p></li><li><p>Table of Contents</p><p>Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7</p><p>Chapter 1. TURING MACHINES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9</p><p>1. Basic Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9</p><p>2. Turing Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10</p><p>3. Techniques for Constructing Turing Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18</p><p>3.1 Use of States to Store Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18</p><p>3.2 Use of Multiple Tracks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19</p><p>3.3 Test of String Equality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20</p><p>3.4 Shift of Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23</p><p>3.5 Use of Subroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23</p><p>4. Extensions of Turing Machines Which Do Not Increase Their Power . . . . . . . . . . . . 24</p><p>4.1 Two-way Infinite Tape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24</p><p>4.2 Multitape Turing Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26</p><p>4.3 Multihead Turing Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27</p><p>4.4 Off-line and On-line Turing Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27</p><p>4.5 Bidimensional and Multidimensional Turing Machines . . . . . . . . . . . . . . . . . . . . . 28</p><p>4.6 Nondeterministic versus Deterministic Turing Machines . . . . . . . . . . . . . . . . . . . . 29</p><p>5. Restrictions to Turing Machines Which Do Not Diminish Their Power . . . . . . . . . . 31</p><p>5.1 One Tape = One Tape + One Read-only Input Tape = Two Stacks . . . . . . . . 32</p><p>5.2 Two Stacks = Four Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33</p><p>5.3 Four Counters = Two Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35</p><p>5.4 Turing Machines with Three or Two States Only . . . . . . . . . . . . . . . . . . . . . . . . . . . 37</p><p>5.5 Turing Machines with Three or Two Tape Symbols Only . . . . . . . . . . . . . . . . . . . 38</p><p>6. Turing Machines as Language Generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38</p><p>7. Turing Computable Functions and Type 0 Languages . . . . . . . . . . . . . . . . . . . . . . . . . . 40</p><p>8. Multitape Turing Machines and Random Access Memory Machines . . . . . . . . . . . . . 42</p><p>9. Other Models of Computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43</p><p>10. Church Thesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52</p><p>Chapter 2. PARTIAL RECURSIVE FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . . . 55</p><p>11. Preliminary Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55</p><p>12. Primitive Recursive Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57</p><p>13. Partial Recursive Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68</p><p>14. Partial Recursive Functions and Recursively Enumerable Sets . . . . . . . . . . . . . . . . . 72</p><p>15. Recursive Enumerable Sets and Turing Computable Functions . . . . . . . . . . . . . . . . . 79</p></li><li><p>616. Partial Recursive Functions on Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80</p><p>17. Partial Recursive Functions and Turing Computable Functions . . . . . . . . . . . . . . . . 80</p><p>18. Subrecursive Classes of Partial Recursive Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 80</p><p>Chapter 3. DECIDABILITY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87</p><p>19. Universal Turing Machines and Undecidability of the Halting Problem . . . . . . . . . 87</p><p>20. Rice Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94</p><p>21. Post Correspondence Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97</p><p>22. Decidability and Undecidability in Formal Languages . . . . . . . . . . . . . . . . . . . . . . . . . 98</p><p>22.1 Decidable Properties of Deterministic Context-free Languages . . . . . . . . . . . 103</p><p>22.2 Undecidable Properties of Deterministic Context-free Languages . . . . . . . . 104</p><p>22.3 Summary of Decidability and Undecidability Results in Formal Languages 104</p><p>23. Decidability and Undecidability of Tiling Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . 105</p><p>24. Arithmetical Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108</p><p>Chapter 4. COMPUTATIONAL COMPLEXITY . . . . . . . . . . . . . . . . . . . . . . . . . . 113</p><p>25. Preliminary Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113</p><p>26. P and NP Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115</p><p>27. Problem Reducibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125</p><p>28. NP-complete Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128</p><p>28.1 Logarithmic-Space versus Polynomial-Time Reductions . . . . . . . . . . . . . . . . . 134</p><p>28.2 NP-Complete Problems and Strongly NP-Complete Problems . . . . . . . . . . . 135</p><p>28.3 NP Problems and co-NP Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136</p><p>28.4 Complete Problems and Hard Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136</p><p>28.5 Approximation Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137</p><p>28.6 Stratification of Complexity Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137</p><p>29. Computational Complexity Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142</p><p>29.1 Deterministic Space and Deterministic Time Hierarchies . . . . . . . . . . . . . . . . 142</p><p>29.2 Relationships among Complexity Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143</p><p>29.3 Nondeterministic Space and Nondeterministic Time Hierarchies . . . . . . . . . 144</p><p>29.4 Properties of General Complexity Measures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144</p><p>29.5 Computations with Oracles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145</p><p>30. Polynomial Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145</p><p>31. Invariance with respect to the Computational Model . . . . . . . . . . . . . . . . . . . . . . . . . 147</p><p>32. Complexity Classes Based on Randomization and Probability . . . . . . . . . . . . . . . . 153</p><p>33. Complexity Classes of Interactive Proofs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158</p><p>34. Complexity Classes of Parallel Computations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161</p><p>Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165</p><p>References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171</p></li><li><p>Preface</p><p>These lecture notes are intended to introduce the reader to the basic notions of com-putability theory, decidability, and complexity. More information on these subjects canbe found in classical books such as [6,8,15,16,33]. The results reported in these notes aretaken from those books and in various parts we closely follow their style of presentation.The reader is encouraged to look at those books for improving his/her knowledge onthese topics. Some parts of the chapter on complexity are taken from the lecture notesof a beautiful course given by Prof. Leslie Valiant at Edinburgh University, Scotland, in1979. It was, indeed, a very stimulating and enjoyable course.</p><p>For the notions of Predicate Calculus we have used in this book the reader may referto [26].</p><p>I would like to thank Dr.Maurizio Proietti at IASI-CNR (Roma, Italy), my colleagues,and my students at the University of Roma Tor Vergata and, in particular, MicheleMartone. They have been for me a source of continuous inspiration and enthusiasm.</p><p>Finally, I would like to thank Dr.Gioacchino Onorati and Lorenzo Costantini of theAracne Publishing Company for their helpful cooperation.</p><p>Roma, July 2006</p><p>Preface to the Second Edition.Some typographical errors which were present in the first edition have been corrected.The chapters on Turing Machines and Decidability Theory have been revised.</p><p>Roma, July 2007</p><p>Preface to the Third Edition.The chapter on Computational Complexity has been revised and some minor misprintshave been corrected.</p><p>Roma, October 2009</p><p>Alberto PettorossiDepartment of Informatics, Systems, and ProductionUniversity of Roma Tor VergataVia del Politecnico 1,I-00133 Roma, Italyemail: adp@info.uniroma2.itURL: http://www.iasi.cnr.it/~adp</p></li><li><p>Chapter 1</p><p>Turing Machines</p><p>1 Basic Definitions</p><p>N = {0, 1, 2, . . .} is the set of natural numbers. In what follows we will feel free to saynumber, instead of natural number.</p><p>Given a set A and a number k 0, let Ak denote the set of all k-tuples of elements ofA. Thus, by definition, we have that:(i) A0 is the singleton made out of the 0-tuple (also called empty tuple or empty stringor empty word and denoted by ), that is, A0 = {},(ii) A1 = {x | x A}, and(iii) Ak = {x1, . . . , xk | x1, . . . , xk A} for any k &gt; 1.We identify x with x for each x A. Thus, A1 = A. Sometimes a tuple x1, . . . , xk isalso denoted by x1 . . . xk.Let A denote the set of all finite k -tuples of elements of A, with k 0, that is,</p><p>A = A0 A1 A2 . . . Ak . . .An element of A is also called a string or a word . A is also said to be the set of stringsor words over A. The length of an element w of A, denoted |w|, is k iff w belongs to Ak,for any k 0.</p><p>A set A is said to be denumerable (or countable) iff A has the cardinality of N or thereexists a natural number n such that A has the same cardinality of n. The cardinality ofa set A will be denoted by |A|.</p><p>We have that A is denumerable iff A is denumerable. The proof is based on thedove-tailing technique [32, Chapter 1].</p><p>Definition 1. [Irreflexive Total Order] Given a set A we say that a binary rela-tion &lt; A A is an irreflexive total order (or a total order, for short) on A iff (i) &lt; isa transitive relation, and (ii) for any two elements a, b A we have that exactly one ofthese three cases occurs: either a</p></li><li><p>10 1. Turing Machines</p><p>For instance, if A = {a, b} and a &lt; b then the canonical order on A is the one whichis denoted by the sequence: &lt; a &lt; b &lt; aa &lt; ab &lt; ba &lt; bb &lt; aaa &lt; aab &lt; aba &lt; . . . 0} of cells cis, and(iii) a tape head which at any given time is on a single cell. When the tape head is onthe cell ci we will also say that the tape head scans the cell ci.</p><p>The cell which the tape head scans, is called the scanned cell and it can be readand written by the tape head. Each cell contains exactly one of the symbols of the tapealphabet . The states of the automaton FA are also called internal states, or simplystates, of the Turing Machine M .</p><p>We say that the Turing Machine M is in state q, or q is the current state of M , if theautomaton FA is in state q, or q is the current state of FA, respectively.</p><p>We assume a left-to-right orientation of the tape by stipulating that for any i &gt; 0, thecell ci+1 is immediately to the right of the cell ci.</p><p>A Turing MachineM behaves as follows. It starts with a tape containing in its leftmostn ( 0) cells c1 c2 . . . cn a sequence of n input symbols from the input alphabet , whileall other cells contain the symbol B, called blank, belonging to . We assume that: {B}. If n = 0 then, initially, the blank symbol B is in every cell of the tape. The TuringMachine M starts with its tape head on the leftmost cell, that is, c1, and its control, thatis, the automaton FA in its initial state q0.</p><p>An instruction (or a quintuple) of the Turing Machine is a structure of the form:</p><p>qi, Xh 7 qj , Xk, m</p></li><li><p>2. Turing Machines 11</p><p>where: (i) qi Q is the current state of the automaton FA,(ii) Xh is the scanned symbol, that is, the symbol of the scanned cell that is read bythe tape head,</p><p>(iii) qj Q is the new state of the automaton FA,(iv) Xk is the printed symbol, that is, the non-blank symbol of which replaces Xhon the scanned cell when the instruction is executed, and</p><p>(v) m {L,R} is a value which denotes that, after the execution of the instruction, thetape head moves either one cell to the left, if m=L, or one cell to the right, if m=R.Initially and when the tape head of a Turing Machine scans the leftmost cell c1 of thetape, m must be R. (Alternatively, as we will see below, we may assume that if m is Lthen the new state qj of the automaton FA is not a final state and there are no quintuplesin which qj occurs in the first position.)</p><p>Given a Turing Machine M , if no two instructions of that machine have the same cur-rent state qi and scanned symbol Xh, we say that the Turing Machine M is deterministic.</p><p>Since it is assumed that the printed symbol Xk is not the blank symbol B, we havethat if the tape head scans a cell with a blank symbol then: (i) every symbol to the left ofthat cell is not a blank symbol, and (ii) every symbol to the right of that cell is a blanksymbol.</p><p>Now we give the formal definition of a Turing Machine.</p><p>Definition 3. [Turing Machine] A Turing Machine is a septuple of the form Q,, ,q0, B, F, , where:- Q is the set of states,- is the input alphabet ,- is the tape alphabet ,</p><p>- q0 is the initial state,- B is the blank symbol ,- F is the set of the final stat...</p></li></ul>