CS6382 Theory of Computation - PowerPoint PPT Presentation

1 / 55
About This Presentation
Title:

CS6382 Theory of Computation

Description:

A language is decided by a DTM, which allows the head not to move, iff it is Turing-decidable. ... A language A is Turing-decidable iff both A and its ... – PowerPoint PPT presentation

Number of Views:33
Avg rating:3.0/5.0
Slides: 56
Provided by: ding8
Category:

less

Transcript and Presenter's Notes

Title: CS6382 Theory of Computation


1
CS6382 Theory of Computation
  • Ding-Zhu Du
  • Office ECSS 3-611, M 315-430
  • Lecture ECSS 2.311, MW 1230-145

2
Text Books
  • Ding-Zhu Du and Ker-I Ko, Theory of Computational
    Complexity, John-Wiley, 2 000. (Main)
  • Ding-Zhu Du and Ker-I Ko, Problem Solving in
    Automata, Languages and Complexity, John-Wiley,
    2001. (Reference)

3
Part I
  • Theory of Deterministic Computation

4
Lecture 1Deterministic Turing Machine (DTM)
5
e
p
h
B
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 G. There exists
    a special symbol B which represents the empty
    cell.

6
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).

7
  • 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
  • d Q x G ? Q x G x R, L.

8
b
a
q
p
  • d(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.

9

a
b
p
q
  • d(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.

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

11
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.

12
  • The DTM can be represented by
  • M (Q, S, G, d, s)
  • where S 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.

13
  • The transition diagram of a DTM is an
    alternative way to represent the DTM.
  • For M (Q, S, G, d, s), the transition diagram
    of M is a symbol-labeled digraph G(V, E)
    satisfying the following
  • V Q (s , h )
  • E p q d(p, a) (q, b, D).

a/b,D
14
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, G, d, s) where Q s, p, q, h,
  • S 0, 1, ? 0, 1, B.
  • d 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) (01)00(01).

15
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.

16
Review on Regular Set
  • Regular sets on an alphabet S is defined
    recursively as follows
  • (1) The empty set F is a regular set.
  • (2) For every symbol a in S, a is a
  • regular set.
  • (3) If A and B are regular sets, then
  • A n B, A U B, and A are all regular
  • sets.

17
Review on DFA
tape
a
b
c
d
e
f
head
finite control
18
  • The tape is divided into cells. Each cell
    contains a symbol in an alphabet S.
  • 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.

19
  • 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
    d Q x S ? Q. If the head reads symbol a and the
    finite control is in the state q, then the next
    state is p d(q, a).

20
  • 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, d, s, F).

21
  • 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.

22
Simulate DFA by DTM
  • Given a DFA M (Q, S, d, s, F), we can construct
    a DTM M (Q, ?, S, d, s) to simulate M as
    follows
  • Q Q U h, G S U B,
  • If d(q, a) p, then d(q, a) (p, a, R).
    d(q, B) (h, B, R) for q in F.

23
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
1
0, 1
0
0
s
p
q
1
  • L(M) (01)00(01).

24
Turing acceptable languages
Regular languages
25
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!)

26
Examples of DTM
27


28
(No Transcript)
29
  • (s, 0110B)
  • (q0, B110B)
  • (q1, B010B)
  • (q1, B010B)
  • (q0, B011B)
  • (h, B0110B)

30
Remark
31
Turing-acceptable

32
  • ww w e (01) 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) ?

R
33
R
  • L ww w in (01)

34
Turing-Computable Functions
  • A total function f S ? S is Turing-computable
    if there exists a DTM M such that for every x in
    S,
  • (s, BxB) (h, Bf(x)B).
  • A partial f O ? S is Turing-computable if
    there exists a DTM M such that L(M)O and for
    every x in O,
  • (s, BxB) (h, Bf(x)B).

35
  • 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, B011B)
  • (ok, B011B) (q, B011B) (q1, B01BB)
  • (q1, B01B) (p1, B01B) (ok, B01B)
  • (q, B01B) (r, B01B) (r, B01B)
  • (o, B01B) (o, B01B) (k, B01BB)
  • (h, B01B)

R
36
R
  • f(x) w if x ww ?, otherwise

37
Turing-decidable
  • A language A is Turing-decidable if its
    characteristic function is Turing-computable.
  • ? (x)

1, if x e A
0, otherwise
A
38
  • ww w e (01) is Turing-decidable.
  • (s, B0110B) (q, B0110B) (q0, B011BB)
  • (q0, B011B) (p0, B011B) (ok, B11B)
  • (ok, B11B) (q, B11B) (q1, B1BB)
  • (q1, B1B) (p1, B1B) (ok, BB)
  • (q, BB) (r, BBB) (r, BBB)
  • (o, BBB) (h, B1B)

R
39
(No Transcript)
40
Theorem
  • A language A is Turing-acceptable iff there
    exists a total Turing-computable function f such
    that A f(x) x e (01).
  • 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.).

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

42
Turing-decidable (recursive)
Turing-acceptable (r.e.)
regular
43
Various TMs
44
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,G,d,s) where
  • d Q x G ? Q x G x R, L, H and H means
  • that the head stays at the current cell. We
    construct M(Q U Q, S, G, d,s) as follows

45
  • Q q q e Q
  • For q e Q,
  • d(q, a) (p, b, R) if d(q, a) (p, b, R)
  • d(q, a) (p, b, L) if d(q, a) (p, b, L)
  • d(q, a) (p, b, R) if d(q, a) (p, b, H)
  • For p e Q,
  • d(p, a) (p, a, L).
  • M and M compute the same function.

46
  • 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.

47
Two-way DTM
48
  • Theorem. Every function computed by a two-way DTM
    is Turing-computable.


49
  • Consider a two-way DTM M(Q, S, G, d,s).
    Construct a DTM M (Q U Q,S,G,d,s) to
    simulate M as follows
  • Qq q e Q
  • G (a, b) a, b e G U (B, )
  • S (a, B) a e S
  • For q e Q,
  • d(q, ) (q,,R)
  • d(q, (a, c)) (p,(b,c),D) if d(q,a)(p,b,D)

50
  • For q e Q,
  • d(q, ) (q, , R)
  • d(q,(c,a)) (p,(c,b),R) if d(q,a)(p,b,L)
  • d(q,(c,a)) (p,(c,b),L) if d(q,a)(p,b,R)
  • d(q,(c,a)) (p,(c,b),H) if d(q,a)(p,b,H)

51
Multi-tape DTM
Input tape (read only)
Storage tapes
Output tape
(possibly, write only)
52
  • Theorem. A function can be computed by a
    multitape DTM iff it isTuring-computable.
  • Proof.

tape
X
head
tape
X
head
tape
X
head
53
  • 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?

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

55
  • 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.
Write a Comment
User Comments (0)
About PowerShow.com