200 likes | 213 Views
Computability and Complexity. 5-1. Classifying Problems. Computability and Complexity Andrei Bulatov. Computability and Complexity. 5-2. Problems and Languages. We have seen that every decision problem has an associated language L (, e ) (via a suitable encoding e ).
E N D
Computability and Complexity 5-1 Classifying Problems Computability and Complexity Andrei Bulatov
Computability and Complexity 5-2 Problems and Languages We have seen that every decision problem has an associated languageL(,e) (via a suitable encoding e) Hence, to classify decision problems we will develop methods to classify languages
Computability and Complexity Definition A language L is decidableª if there exists a TM T, with 2 final states and , such that • If x L then T(x) halts in state • If x L then T(x) halts in state ªalso known as recursive 5-3 Decidable Languages T is said to decide the language L — it gives a yes or no answer for each possible string from *
Computability and Complexity 5-4 Examples The following languages are decidable: • * • • {x| |x| = 20} • {x | xis prime} • {x | x encodes a graph G, and a Hamilton circuit of G} • {x | xis a valid encoding of a TM}
Computability and Complexity 5-5 Examples All languages accepted by finite automata, or generated by context-free grammars are decidable All Languages Decidable Languages Context-free Languages Regular Languages (for finite automata see Discrete Mathematics course or Sipser) (for context-free grammars see Compilers course or Sipser)
Computability and Complexity Definition A language L is acceptableª if there exists a TM T, with 2 final states and , such that • If x L then T(x) halts in state • If x L then T(x) halts in state or infinite ªalso known as Turing-acceptable or Turing-recognizable 5-6 Acceptable Languages T is said to accept the language L — it gives a yes answer for each string in L, in all other cases it gives a no answer or fails to halt
Computability and Complexity 5-7 Acceptable vs. Decidable • If a language is decidable, then it is acceptable. • If a language, L, is acceptable, and its complement is also • acceptable, the it is decidable. • (Proof: run the two acceptor machines alternately until one halts) So, to show that there are languages that are not decidable, we must find a language that is not acceptable …
Computability and Complexity Halting Instance: A Turing Machine T and an input string x. Question: Does T(x) halt? Once we choose an encoding for Turing machines, the corresponding language is: • is acceptable • is not decidable 5-8 The Halting Problem • use a universal TM U to simulate T on x and modify it so that • that if it halts then it moves to “Accept” state - see next slide
Computability and Complexity • Assume, for contradiction, that there is a TM that decides • Construct a new T from so that for input x, T simulates • but • if accepts “x;x” then T goes into an infinite loop, • if rejects “x;x” then T accepts x. 5-9
Computability and Complexity I N P U T 5-10 R? A? T
Computability and Complexity ; I N P U T I N P U T I N P U T A? R? 5-11 R? A? T
Computability and Complexity • if T(T) halts this implies that rejects “T;T”, • implying that T(T) does not halt! - if T(T) does not halt this implies that accepts “T;T”, implying that T(T) halts! • Hence cannot exist, so is undecidable. 5-12 • Consider the computation T(T)
Computability and Complexity • The language is not acceptable. The Halting problem cannot be solved by any algorithm! This result was first announced in Turing’s 1936 paper 5-13 Consequences • There is no Turing machine that can give correct answers to the • Halting problem on all inputs. • Hence, by Turing’s Thesis:
Computability and Complexity 5-14 Reducibility A major tool in analysing and classifying problems is the idea of “reducing one problem to another” Informally, a problem is reducible to a problem if we can somehow use methods that solve in order to solve
Computability and Complexity Definition A language A is many-one reducible (or m-reducible, or mapping reducible) to a language B if there exists a total and computable function f such that for all • We denote this by writing 5-15 Many-One Reducibility • We can use a machine that decides B (plus a machine that reduces A) • So, in a sense, A is “no harder than” B
Computability and Complexity • If and is decidable, then so is • (Just build a machine that computes f(x) and then behaves like • the machine that decides ) • is reflexive and transitive • If is any language (apart from and *) and is • decidable, then 5-16 Properties of Many-One Reducibility The first property can be used when trying to prove that a language is decidable (or undecidable). The last property implies that many-one reducibility is too weak to distinguish between decidable languages — they are pretty much All reducible to each other!
Computability and Complexity ACCEPTANCE Instance: A Turing Machine (acceptor) T and an input string x. Question: Does T accept x? The corresponding language is: Theorem is undecidable. 5-17 Other Undecidable Problems Proof see next slide
Computability and Complexity We show that For every input “T;x” of , we do: • Add to T two new states and (to guarantee that they • are not in T already we may need to rename the states of T) • Change the transition function by adding transition from every • final state to Therefore, the function which maps “T;x” to “T’;x” is computable and provides a mapping reduction from to 5-18 • Denote the obtained machine T’ Note that T’ accepts x if and only if T halts on x
Computability and Complexity Regularity Ambiguous Grammars Instance: A Turing Machine T. Question: Can T be simulated by a finite automaton? Instance: A context-free grammar G. Question: Is G ambiguous? 5-19
Computability and Complexity Diophantine Equations Instance: A multivariate polynomial equation such as Question: Does this equation have an integer-valued solution? See “Hilbert’s Tenth Problem is Unsolvable” M.Davis, American Mathematical Monthly 80 (1973) pp.233-269 5-20