CS6382 Theory of Computation

Slides:



Advertisements
Similar presentations
Part VI NP-Hardness. Lecture 23 Whats NP? Hard Problems.
Advertisements

Deterministic Turing Machines
CS2303-THEORY OF COMPUTATION
Lecture 3 Universal TM. Code of a DTM Consider a one-tape DTM M = (Q, Σ, Γ, δ, s). It can be encoded as follows: First, encode each state, each direction,
Lecture 16 Deterministic Turing Machine (DTM) Finite Control tape head.
Variants of Turing machines
Lecture 6 Nondeterministic Finite Automata (NFA)
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
Lecture 5 Turing Machines
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
Costas Busch - LSU1 Non-Deterministic Finite Automata.
Chapter 9 Turing Machine (TMs).
Lecture 3 Graph Representation for Regular Expressions
Lecture 18 Various TMs. Allow the head not move Theorem. If the head is allowed to stay at the cell in each move, then every function computed by the.
1 Turing Machines. 2 A Turing Machine Tape Read-Write head Control Unit.
Formal Language Finite set of alphabets Σ: e.g., {0, 1}, {a, b, c}, { ‘{‘, ‘}’ } Language L is a subset of strings on Σ, e.g., {00, 110, 01} a finite language,
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
Ding-Zhu Du Office: ECSS 3-611, M 3:15-4:30 Lecture: ECSS 2.311, MW 12:30-1:45.
Complexity theory and combinatorial optimization Class #2 – 17 th of March …. where we deal with decision problems, finite automata, Turing machines pink.
Introduction to CS Theory Lecture 15 –Turing Machines Piotr Faliszewski
Lecture Pushdown Automata. stack stack head finite control tape head tape.
Lecture 21 Reducibility. Many-one reducibility For two sets A c Σ* and B c Γ*, A ≤ m B if there exists a Turing-computable function f: Σ* → Γ* such that.
1 Turing Machines - Chap 8 Turing Machines Recursive and Recursively Enumerable Languages.
1 Introduction to Turing Machines
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2007.
Umans Complexity Theory Lectures Lecture 1b: Turing Machines & Halting Problem.
Turing Machines CS 130 Theory of Computation HMU Textbook: Chap 8.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY * Read chapter 4 of the book for next time * Lecture9x.ppt.
CS6800 Advance Theory of Computation Spring 2016 Nasser Alsaedi
Chapters 11 and 12 Decision Problems and Undecidability.
Finite Automata.
Design and Analysis of Approximation Algorithms
Theory of Computation Pushdown Automata pda Lecture #10.
Part VI NP-Hardness.
Busch Complexity Lectures: Turing Machines
COSC 3340: Introduction to Theory of Computation
Busch Complexity Lectures: Reductions
Reductions Costas Busch - LSU.
Turing Machines.
CS21 Decidability and Tractability
Pumping Lemma Revisited
CS154, Lecture 7: Turing Machines.
COSC 3340: Introduction to Theory of Computation
Turing Machines 2nd 2017 Lecture 9.
CSE 105 theory of computation
Turing Machines Acceptors; Enumerators
Chapter 9 TURING MACHINES.
CS154, Lecture 10: Rice’s Theorem, Oracle Machines
Hierarchy of languages
Turing Machines (TM) Deterministic Turing Machine (DTM)
Non-Deterministic Finite Automata
Decidable Languages Costas Busch - LSU.
8. Introduction to Turing Machines
Finite Automata Reading: Chapter 2.
4b Lexical analysis Finite Automata
CS21 Decidability and Tractability
CS21 Decidability and Tractability
Proposed in Turing’s 1936 paper
COSC 3340: Introduction to Theory of Computation
CS154, Lecture 12: Time Complexity
Recall last lecture and Nondeterministic TMs
Decidability and Tractability
CSCI 2670 Introduction to Theory of Computing
Instructor: Aaron Roth
CSE 105 theory of computation
Teori Bahasa dan Automata Lecture 10: Push Down Automata
Variants of Turing machines
CSE 105 theory of computation
Presentation transcript:

CS6382 Theory of Computation Ding-Zhu Du Office: ECSS 3-611, Thuesday 4:00-5:00 Lecture: ECSN 2.112, TuTh 1:00-2:15

Text Books Ding-Zhu Du and Ker-I Ko, Theory of Computational Complexity (2nd ed), John-Wiley, 2 014. (Main) Ding-Zhu Du and Ker-I Ko, Problem Solving in Automata, Languages and Complexity, John-Wiley, 2001. (Reference) Ding-Zhu Du and ???, Theory of Computation (potential).

Theory of Deterministic Computation Part I Theory of Deterministic Computation

Models (Machine, Circuits) Natural Problem

Complexity classes are defined based on Machine or Circuits) How to prove a Natural Problem in the class?

Reductions are defined based on Machine. How to establish reductions between Natural Problems?

Data-Driving Algorithm Reduction Oracle = database

Lecture 1-1 Deterministic Turing Machine (DTM) Finite Control tape head

p h B e a l a The tape has the left end but infinite to the right. It is divided into cells. Each cell contains a symbol in an alphabet Γ. There exists a special symbol B which represents the empty cell.

a The head scans at a cell on the tape and can read, erase, and write a symbol on the cell. In each move, the head can move to the right cell or to the left cell (or stay in the same cell).

The finite control has finitely many states which form a set Q The finite control has finitely many states which form a set Q. For each move, the state is changed according to the evaluation of a transition function δ : Q x Γ → Q x Γ x {R, L}.

b a q p δ(q, a) = (p, b, L) means that if the head reads symbol a and the finite control is in the state q, then the next state should be p, the symbol a should be changed to b, and the head moves one cell to the left.

a b q p δ(q, a) = (p, b, R) means that if the head reads symbol a and the finite control is in the state q, then the next state should be p, the symbol a should be changed to b, and the head moves one cell to the right.

s There are some special states: an initial state s and an final states h. Initially, the DTM is in state s and the head scans the leftmost cell. The tape holds an input string.

Otherwise, the input string is rejected. x h When the DTM is in the final state, the DTM stops. An input string x is accepted by the DTM if the DTM reaches the final state h. Otherwise, the input string is rejected.

The DTM can be represented by M = (Q, Σ, Γ, δ, s) where Σ is the alphabet of input symbols. The set of all strings accepted by a DTM M is denoted by L(M). We also say that the language L(M) is accepted by M.

The transition diagram of a DTM is an alternative way to represent the DTM. For M = (Q, Σ, Γ, δ, s), the transition diagram of M is a symbol-labeled digraph G=(V, E) satisfying the following: V = Q (s = , h = ) E = { p q | δ(p, a) = (q, b, D)}. a/b,D

1/1,R 0/0,R; 1/1,R 0/0,R 0/0,R B/B,R s p q h 1/1,R M=(Q, Σ, Γ, δ, s) where Q = {s, p, q, h}, Σ = {0, 1}, Г = {0, 1, B}. δ 0 1 B s (p, 0, R) (s, 1, R) - p (q, 0, R) (s, 1, R) - q (q, 0, R) (q, 1, R) (h, B, R) L(M) = (0+1)*00(0+1)*.

Theorem. Every regular set can be accepted by a DTM. Proof. Every regular set can be accepted a deterministic finite automata (DFA). Every DFA can be simulated by a DTM.

Review on Regular Set Regular sets on an alphabet Σ is defined recursively as follows (1) The empty set Φ is a regular set. (2) For every symbol a in Σ, {a} is a regular set. (3) If A and B are regular sets, then A ∩ B, A U B, and A* are all regular sets.

Review on DFA tape a b c d e f head finite control

The tape is divided into cells The tape is divided into cells. Each cell contains a symbol in an alphabet Σ. The head scans at a cell on the tape and can read symbol from the cell. It can also move from left to right, one cell per move.

The finite control has finitely many states which form a set Q The finite control has finitely many states which form a set Q. For each move, the state is changed according to the evaluation of a function δ: Q x Σ → Q. If the head reads symbol a and the finite control is in the state q, then the next state is p = δ(q, a).

There are some special states: an initial state s and some final states which form a set F. The DFA can be represented by M = (Q, Σ, δ, s, F).

Initially, the DFA is in the initial state and the head scans the leftmost cell. The tape holds an input string x. When the head moves off the tape, the DFA stops. An input string is accepted by the DFA if the DFA stops in a final state. Otherwise, the input string is rejected.

Simulate DFA by DTM Given a DFA M = (Q, Σ, δ, s, F), we can construct a DTM M’ = (Q’, Г, Σ, δ’, s) to simulate M as follows: Q’ = Q U {h}, Γ = Σ U {B}, If δ(q, a) = p, then δ’(q, a) = (p, a, R). δ’(q, B) = (h, B, R) for q in F.

L(M) = (0+1)*00(0+1)*. 1/1,R 0/0,R; 1/1,R 0/0,R 0/0,R B/B,R s p q h 0, 1 s p q 1 L(M) = (0+1)*00(0+1)*.

Turing acceptable languages Regular languages

Why DTM can accept more languages than DFA? Because The head can move in two directions. (No!) The head can erase. (No!) The head can write and move in two directions. (Yes!)

Examples of DTM

├ ├

(s, 0110B) ├ (q0, B110B) ├ (q1, B010B) ├ (q0, B011B) ├ (h, B0110B)

Remark

Turing-acceptable ├

R {ww | w ε (0+1)*} is Turing-acceptable. (s, B0110B)├ (q, B0110B)├ (q0, B011BB) ├* (q0, B011B) ├ (p0, B011B)├ (ok, BB11B) ├* (ok, B11B) ├ (q, B11B) ├ (q1, B1BB) ├ (q1, B1B) ├ (p1, B1B) ├ (ok, BBB) ├ (q, BBB) ├ (h, BBB) ?? Could we do (ok, BBB) ├ (h, BBB) ?

L= {ww | w in (0+1)*} R

Turing-Computable Functions A total function f: Σ* → Σ* is Turing-computable if there exists a DTM M such that for every x in Σ*, (s, BxB) ├* (h, Bf(x)B). A partial f: Ω → Σ* is Turing-computable if there exists a DTM M such that L(M)=Ω and for every x in Ω,

The following function f is Turing-computable: f(x) = w, if x = ww ; ↑, otherwise (s, B0110B)├ (q, B0110B)├ (q0, B011BB) ├* (q0, B011B) ├ (p0, B011B)├ (ok, B0’11B) ├* (ok, B0’11B) ├ (q, B0’11B) ├ (q1, B0’1BB) ├ (q1, B0’1B) ├ (p1, B0’1B) ├ (ok, B0’1’B) ├ (q, B0’1’B) ├ (r, B0’1B) ├* (r, B01B) ├ (o, B01B) ├* (o, B01B)├ (k, B01BB) ├ (h, B01B) R

f(x) = w if x = ww ; ↑, otherwise

Turing-decidable 1, if x ε A 0, otherwise A language A is Turing-decidable if its characteristic function is Turing-computable. χ (x) = { 1, if x ε A A 0, otherwise

{ ww | w ε (0+1)*} is Turing-decidable. (s, B0110B)├ (q, B0110B)├ (q0, B011BB) ├* (q0, B011B) ├ (p0, B011B)├ (ok, B$11B) ├* (ok, B$11B) ├ (q, B$11B) ├ (q1, B$1BB) ├ (q1, B$1B) ├ (p1, B$1B) ├ (ok, B$$B) ├ (q, B$$B) ├ (r, B$BB) ├* (r, BBB) ├ (o, BBB) ├* (h, B1B) R

Theorem A language A is Turing-acceptable iff there exists a total Turing-computable function f such that A = { f(x) | x ε (0+1)*}. If we look at each natural number as a 0-1 string, then f can be also a total Turing-computable function defined on N, the set of all natural numbers, that is, A = { f(1), f(2), f(3), …} Therefore, “Turing-acceptable” is also called “recursively enumerable” (r.e.).

Theorem A language A is Turing-decidable iff A and its complement Ā are Turing-acceptable. Proof. Suppose L(M) = A and L(M’) = Ā. Construct M* to simulate M and M’ simultaneously

Turing-decidable (recursive) Turing-acceptable (r.e.) regular

Various TMs

Allow the head not move Theorem. If the head is allowed to stay at the cell in each move, then every function computed by the DTM is still Turing-computable. Proof. Consider DTM M=(Q,Σ,Γ,δ,s) where δ: Q x Γ → Q x Γ x {R, L, H} and H means that the head stays at the current cell. We construct M’=(Q U Q’, Σ, Γ, δ’,s) as follows:

Q’ = {q’ | q ε Q} For q ε Q, δ’(q, a) = (p, b, R) if δ(q, a) = (p, b, R) δ’(q, a) = (p, b, L) if δ(q, a) = (p, b, L) δ’(q, a) = (p’, b, R) if δ(q, a) = (p, b, H) For p’ ε Q’, δ’(p’, a) = (p, a, L). M and M’ compute the same function.

Corollary. A language is accepted by a DTM, which allows the head not to move, iff it is Turing-acceptable. Why this is a corollary? Because every language accepted by a DTM is the definition domain of a function computable by a DTM of the same type. Corollary. A language is decided by a DTM, which allows the head not to move, iff it is Turing-decidable.

Two-way DTM

Theorem. Every function computed by a two-way DTM is Turing-computable. $

Consider a two-way DTM M=(Q, Σ, Γ, δ,s) Consider a two-way DTM M=(Q, Σ, Γ, δ,s). Construct a DTM M’ = (Q U Q’,Σ’,Γ’,δ’,s) to simulate M as follows: Q’={q’ | q ε Q} Γ’ ={(a, b) | a, b ε Γ } U { $ } Σ’ ={(a, B) | a ε Σ} For q ε Q, δ’(q, $) = (q’,$,R) δ’(q, (a, c)) = (p,(b,c),D) if δ(q,a)=(p,b,D) For q’ ε Q’, δ’(q’, $) = (q, $, R) δ’(q’,(a,c)) = (p’,(a,b),D’) if δ(q,c)=(p,b,D) where D’=L if D=R, R if D=L, H if D=H.

For q’ ε Q’, δ’(q’, $) = (q, $, R) δ’(q’,(a,c)) = (p’,(a,b),R) if δ(q,c)=(p,b,L) δ’(q’,(a,c)) = (p’,(a,b),L) if δ(q,c)=(p,b,R) δ’(q’,(a,c)) = (p’,(a,b),H) if δ(q,c)=(p,b,H)

Multi-tape DTM Input tape (read only) Storage tapes Output tape (possibly, write only)

Theorem. A function can be computed by a multitape DTM iff it isTuring-computable. Proof. X head b tape X head c tape X head q

tape a X head b tape X head c tape X head a b q c

tape a X head b tape X head c tape X head d e p h

tape d X head b tape X head c tape X head e p h

tape d X head e tape X head h tape X head p

To simulate a move of the multitape DTM, the one-tape DTM needs two trips: Trip 1: read all symbols at heads. Trip 2: erase and write at cells scaned by heads. Questions: How many moves does one-tape DTM needs to simulate t moves of a multitape DTM? How many states does one-tape DTM needs to simulate a multitape DTM?

Church-Turing Thesis Any reasonably computable function is a Turing-computable function.

Theorem. A language A is Turing-decidable iff both A and its complement A are Turing-acceptable. Proof. The forward direction is easy. For the backward direction, suppose one-tape DTMs M and M’ accept A and A respectively. Construct 4-tape DTM M* as follows: Use a storage tape to simulate M and another storage tape to simulate M’. M* halts iff M or M’ halts. If M halts, then M* outputs 1. If M’ halts, then M* outputs 0.