Download presentation
Presentation is loading. Please wait.
Published byTrevor Lang Modified over 9 years ago
1
Introduction to CS Theory Lecture 15 –Turing Machines Piotr Faliszewski pf@cs.rit.edu
2
Our Models of Computation So Far 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 δ, q … 0 0 1 1 0 0 0
3
Church-Turing Thesis 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? Turing machines were, at the time, the most convincing model
4
Definition Turing machine M is a quintuple M = (Q, Σ, Γ, q 0, δ) where: Q – finite set of states, assumed not to contain the two halting states, h a and h r. Σ is the input alphabet and Γ is the tape alphabet. Σ Γ. Γ does not contain the special blank symbol Δ q 0 – the initial state δ – the transition function δ: Q (Γ {Δ}) (Q {h a, h r }) (Γ {Δ}) {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)
5
Transition of a TM δ(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 2 n Turing machine for the palindromes language
6
Configurations 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
7
Languages Accepted by TMs Definition. Let M = (Q, Σ, Γ, q 0, δ) and let x Σ * x is accepted by M if (q 0, Δx) * (h a, yaz) for some y,a, z A string can be rejected if: M ends up in state h r, 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
8
Examples Give a Turing machine for the following language { a i b i c i | i ≥ 0 }
9
Computing a Function on a TM Definition Let M = (Q, Σ, Γ, q 0, δ) be a TM Let f: Σ * Γ * be a total function We say that M computes f if for each x in Σ * it holds that (q 0, Δx) * (h a,Δf(x)) Example Give a TM that computes f(1 n ) = 1 2n
10
Power of Turing Machines 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) None of the extra features strengthens the model!
11
Languages and Decision Problems 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
12
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
13
Hierarchy of Languages Finite languages Context-free languages Recursive languages All languages
14
Undecidable Languages 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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.