Lecture 16 Deterministic Turing Machine (DTM) - PowerPoint PPT Presentation

1 / 39
About This Presentation
Title:

Lecture 16 Deterministic Turing Machine (DTM)

Description:

Lecture 16 Deterministic Turing Machine (DTM) tape head Finite Control – PowerPoint PPT presentation

Number of Views:118
Avg rating:3.0/5.0
Slides: 40
Provided by: Ding54
Category:

less

Transcript and Presenter's Notes

Title: Lecture 16 Deterministic Turing Machine (DTM)


1
Lecture 16Deterministic Turing Machine (DTM)
2
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.

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

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

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

6

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.

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

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

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

10
  • 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
11
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).

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

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

14
Review on DFA
tape
a
b
c
d
e
f
head
finite control
15
  • 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.

16
  • 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).

17
  • 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).

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

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

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

21
Turing acceptable languages
Regular languages
22
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 erase, write and move in two
    directions. (Yes!)
  • What would happen if the head can read, erase and
    write, but move in one direction?

23
Lecture 17Examples of DTM
24


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

27
Remark
28
Turing-acceptable

29
  • 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
30
R
  • L ww w in (01)

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

32
  • 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
33
R
  • f(x) w if x ww ?, otherwise

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

1, if x e A
0, otherwise
A
35
  • 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
36
(No Transcript)
37
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.).

38
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

39
Turing-decidable (recursive)
Turing-acceptable (r.e.)
regular
Write a Comment
User Comments (0)
About PowerShow.com