lecture-10.md (3281B)
1 +++ 2 title = "Lecture 10" 3 template = "page-math.html" 4 +++ 5 6 # Decidability 7 8 Decision problem P is language P ⊂ Σ<sup>\*</sup> 9 10 Decidable: P is recursive Semidecidable: P is recursively enumerable Undecidable: otherwise 11 12 Decidable problem: 13 14 - algorithm that always halts 15 - always returns yes or no 16 17 Semidecidable problem: 18 19 - algorithm halts eventually if the answer is yes (w ∈ P) 20 - may or may nto halt if answer is no 21 - but you don\'t know how long you\'ll have to wait for an answer 22 23 Decision problem is decidable if: 24 25 - P is semidecidable, and 26 - $\overline{P}$ is semidecidable 27 28 The halting problem: given deterministic Turing machine and a word, does the machine halt when started with the word as input? It\'s undecidable, as the language H = { (M, x) \| M reaches halting state on input x } is not recursive. 29 30 Rice\'s theorem: every non-trivial property of recursively enumerable languages is undecidable. A property of class K is trivial if it holds for all or no k ∈ K. 31 32 ## Post correspondence problem 33 34 Given n pairs of words (w<sub>1</sub>, v<sub>1</sub>)...(w<sub>n</sub>, v<sub>n</sub>), are there indices i<sub>1</sub>...i<sub>k</sub> st $w_{i_{1}}...w_{i_{k}} = v_{i_{1}}...v_{i_{k}}$? 35 36 Modified: is there a way to make the first words the same? 37 38 The PCP is undecidable, as evidenced by Joerg spending 2 hours in a lecture trying to make us decide it. 39 40 ## Undecidable properties of context-free languages 41 42 Stuff that\'s undecidable: 43 44 - the question L<sub>1</sub> ∩ L<sub>2</sub> = ∅ 45 - ambiguity of context-free grammars 46 - whether a context-free language contains a palindrome 47 - the question L = Σ<sup>\*</sup> (and hence equality of languages) 48 49 ## Semidecidability 50 51 A decision P ⊂ Σ<sup>\*</sup> is: 52 53 - decidable if P recursive 54 - semidecidable if P recursively enumerable 55 56 Examples of semidecidable: halting problem, PCP, non-empty intersection of context-free languages, ambiguity of context-free grammars 57 58 Examples of undecidable: 59 60 - derivability of formula φ in predicate logic 61 - Hilbert\'s 10th problem (algorithm to decide if system of Diophantine equations has solution in Z) 62 63 # Complexity 64 65 ## Big O notation 66 67 Wtf is this definition. TODO: find a better definition. 68 69 The highest exponent is what matters. e.g. n<sup>3</sup> is in O(n<sup>3</sup>) but also in O(n<sup>5</sup>) List of big Os: 70 71 - exponentials are in O(n<sup>e</sup>), where e is the exponent 72 - polynomials are O(n<sup>e</sup>), where e is the largest exponent 73 74 ## Time complexity 75 76 Let f,g : N → N. Nondeterministic Turing machine (M) runs in time f if for every input (w), every computation of M reaches a halting state after at most f(\|w\|) steps. 77 78 A Turing machine has time complexity O(g) if there exists f ∈ O(g) st the machine runs in time f. 79 80 ### Complexity classes P and NP 81 82 Nondeterministic Turing machine is in polynomial time if it has time complexity O(n<sup>k</sup>) for some k. 83 84 NP are languages accepted by **nondeterministic** polynomial time Turing machines. 85 86 P is class of languages accepted by **deterministic** polynomial time Turing machines. 87 88 P ⊂ NP, but nobody knows if P = NP. 89 90 A problem is in NP if: 91 92 - every instance has finite set of possible solutions 93 - correctness of solution can be checked in polynomial time