140 likes | 155 Views
This lecture delves into Turing Machines, Church-Turing Thesis, and various models of computation, showcasing the power and limitations of algorithms. Discover the essence of recursive languages and decision problems.
E N D
Introduction to CS Theory Lecture 15 – Turing Machines Piotr Faliszewski pf@cs.rit.edu
Models of computation Finite automata Pushdown automata Restrictions FA Finite memory Left-to-right access to input PDA Infinite memory… … but accessible only in a stack form Left-to-right access to input Unrestricted model of computation? Turing machine Our Models of Computation So Far δ, q 0 0 1 1 0 0 0 …
Church-Turing Thesis A language can be solved by an algorithm if and only if it can be accepted by a Turing machine that terminates on every output. How to validate Church-Turing Thesis? Many models of algorithms Unrestricted grammars Lambda calculus RAM machines … all equivalent to Turing machines Can Church-Turgin thesis be proven? Church-Turing Thesis Turing machines were, at the time, the most convincing model
Turing machine M is a quintuple M = (Q, Σ, Γ, q0, δ) where: Q – finite set of states, assumed not to contain the two halting states, ha and hr. Σ is the input alphabet and Γ is the tape alphabet. ΣΓ. Γ does not contain the special blank symbol Δ q0 – the initial state δ – the transition function δ: Q (Γ {Δ}) (Q {ha, hr}) (Γ {Δ}) {R, L, S} δ is a total funciton (i.e., your machine should not get stuck in a non-halting state without knowing what to do) Definition
δ(q, X) = (p, Y, D) means: If the machine is in state q, scanning symbol X, then: Change state to p Replace symbol X with symbol Y Move the tape according to the direction D (L – left, R – right, S – stay) Questions What happens if the machine “falls off” the left side of the tape? Do we really need the “S” move? Example Strings of length 2n Turing machine for the palindromes language Transition of a TM
Configuration of a Turing machine Contents of the tape Position of the head Current state Notation (q, xay) means that Machine in state q The head is at the last symbol of the string xa The head is followed by string y, followed by an infinte number of blank symbols Initial configuration (q0, Δx) x – machines’s input string Given a Turing machine T, we define relation (q,xay) (p,zbw) If the latter can be obtained in one step from the former Configurations
Definition. Let M = (Q, Σ, Γ, q0, δ) and let x Σ* x is accepted by M if (q0, Δx) * (ha, yaz) for some y,a, z A string can be rejected if: M ends up in state hr, or M runs forever on x Notation L(M) – language accepted by a Turing machine M If a language is accepted by a Turing machine then we say that it is recursively enumerable The set of all languages accetped by Turing machines is called RE If a language is accepted by a Turing machine that halts on all inputs then we say that it is recursive Languages Accepted by TMs
Examples • Give a Turing machine for the following language • { aibici | i ≥ 0 }
Computing a Function on a TM • Definition • Let M = (Q, Σ, Γ, q0, δ) be a TM • Let f: Σ* Γ* be a total function • We say that M computes f if for each x in Σ* it holds that (q0, Δx) * (ha,Δf(x)) • Example • Give a TM that computes f(1n) = 12n
We can add extra features to a Turing machine 2-way infinite tape More than one tape Random access to the memory Nondeterminisms 2-dimensional tape Example: Try to simulate these features (or prove that simulation is possible) Power of Turing Machines None of the extra features strengthens the model!
Decision problem Name Input the mathematical entities about whose properties we ask Question A well-defined yes/no question Language A set of strings Languages encode decision problems Example Name: Connectivity Input: Graph G, vertices s and t Question: Are vertices s and t connected in G Languages and Decision Problems
Our two fundamental questions What decision problems can and cannot be solved? What decision problem can and cannot be solved efficiently We focus on languages Chomsky Hierarchy Models of computation Regular languages / finite automata Context-free languages / push-down automata Turing machines Languages and Decision Problems
Hierarchy of Languages All languages Recursive languages Finite languages Context-freelanguages
Can everything be solved on a computer? Recursive languages Recursively enumerable languages do they really exist? Two proofs… Counting… And an example of a language Undecidable Languages