Computability
Total Page:16
File Type:pdf, Size:1020Kb
Computability COMP2600 — Formal Methods for Software Engineering Katya Lebedeva Australian National University Semester 2, 2016 Slides created by Katya Lebedeva COMP 2600 — Turing Machines 1 Definition of “Computability” Church-Turing Thesis The “Church-Turing thesis” is the general belief that the notion of “computable in principle” can be expressed in terms of • Turing’s Machines • Church’s Lambda Calculus • Godel’s¨ Recursive Functions • Kleene’s Formal Systems • Markov’s Algorithms • ::: COMP 2600 — Turing Machines 2 Definition of computability in terms of TMs: A computable function is a function that can be implemented by a TM. Definition of computability in terms of l-calculus: A computable function is a function that can be implemented as a l-term. These definitions are equivalent because • for every TM, we can write a l-term that simulates it • for every l-term, we can build a TM that simulates it We could also give definitions of computable function in terms of other models of computation. Thus, the “Church-Turing thesis” is the belief that any of these definitions is an adequate characterisation of “computability in principle”. COMP 2600 — Turing Machines 3 Why TMs? TMs are a terrible model for thinking about fast computation. But when talking about computability, we are not interested in finding fast algorithms, or even finding algorithms at all! We are interested to prove that some problems cannot be solved by any com- putational device, i.e. that they are undecidable. TM is an extremely simple model, but powerful enough to describe arbitrary algorithms. Importantly, TMs are powerful enough to simulate other TMs and simple enough to build up this simulation from scratch. COMP 2600 — Turing Machines 4 Definition A Turing Machine has the form (Q;q0;F; G;S;L; d), where • Q is the finite set of states q0 2 Q is the initial state F ⊆ Q is the set of final/accepting states • G is the tape alphabet (the finite set of tape symbols) S ⊆ G is the input alphabet (the finite set of input symbols) L 2 G=S is the blank symbol • d is a (partial) transition function d : Q × G ! Q × G × fL;R;Sg COMP 2600 — Turing Machines 5 Halting A state q is halting for a symbol x 2 G if d(q;x) is not defined. A state q is halting if it is halting for all symbols in G. We can assume without loss of generality that all final states are halting. COMP 2600 — Turing Machines 6 Recursively Enumerable Languages The language recognised by a TM M ∗ ∗ ∗ L(M) = fw 2 S j q0w ` a1 pa2 with p 2 F;a1;a2 2 G g A language L is recursively enumerable if there exists a TM M such that L = L(M) and: • for a string w 2 L, M halts in an accepting state • for a string w 2= L, M – either halts in a non-accepting state – or loops forever COMP 2600 — Turing Machines 7 Recursive Languages A language L is recursive if there is a TM M such that L = L(M) and M always halts, i.e. • if w 2 L, then M halts in an accepting state • if w 2= L, then M eventually halts, although it never enters an accepting state A TM of this type corresponds to an algorithm: a well defined finite sequence of steps that always finishes and produces an answer. It is a “decider” of the recursive language. If we think of a language L as a “problem”, then problem L is called decidable if it is a recursive language. COMP 2600 — Turing Machines 8 Recursive Languages and Chomsky Hierarchy All recursive languages are also recursively enumerable. All regular, context-free and context-sensitive languages are recursive. The class of recursive languages is not a member of Chomsky’s Hierarchy: this class would be properly between Type-0 and Type-1. COMP 2600 — Turing Machines 9 Reducing One Problem to Another Given two problems A and B. We say problem A reduces to problem B if we can construct a decider MA for problem A using a decider MB for problem B A ≤ B This informally means • problem A is “easier” than problem B • the decider MB of B is at least as powerful as the decider MA of A COMP 2600 — Turing Machines 10 Proving Undecidability Assume we have a problem Lhalt and we know that Lhalt is undecidable. We want to prove the undecidability of another problem L. We just need to reduce Lhalt to L. Then if L were decidable, Lhalt would necessarily be decidable too! But we know that Lhalt is undecidable. Therefore L cannot be decidable. Thus, to prove that some problem is undecidable, we assume that we have a “decider” for this problem, and show that this implies the existence of a “decider” for a known undecidable problem. COMP 2600 — Turing Machines 11 Universal Turing Machine We can construct a TM U that first reads a description of some other TM M and then simulates it. This is a universal TM. Given hhMi;wi where •h Mi is an encoding of a TM M • w is a string The universal TM U simulates M on w and accepts hhMi;wi iff M accepts w hhMi;wi 2 L(U) iff w 2 L(M) TMs can simulate other TMs (and hence any conventional computer). TMs can simulate themselves. COMP 2600 — Turing Machines 12 Turing Completeness Any machine that can simulate a universal TM is also called universal or Tur- ing Complete. Universal Language Language LU recognized by the universal TM U is called Universal Lan- guage. LU = fhhMi;wi j w 2 L(M)g LU is recursively enumerable!!! COMP 2600 — Turing Machines 13.