Chapter%206%20Basic%20Computability%20??????????????????? - PowerPoint PPT Presentation

About This Presentation
Title:

Chapter%206%20Basic%20Computability%20???????????????????

Description:

Chapter 6 Basic Computability K. H. Rosen, Discrete Mathematics and Its Applications, 5th Edition, McGraw-Hill. – PowerPoint PPT presentation

Number of Views:173
Avg rating:3.0/5.0
Slides: 98
Provided by: acth
Category:

less

Transcript and Presenter's Notes

Title: Chapter%206%20Basic%20Computability%20???????????????????


1
Chapter 6Basic Computability???????????????????
  • K. H. Rosen, Discrete Mathematics and Its
    Applications, 5th Edition, McGraw-Hill.
  • A. V. Aho and J. D. Ullman, Foundations of
    Computer Science, C Edition, W.H. Freeman.
  • J. Martin, Introduction to Languages and the
    Theory of Computation, 3rd Edition, McGraw-Hill.
  • M. Sweat, CS4710 CS for Bioinformatics, College
    of Computing, Georgia Tech. USA.

1/2552 204111
2
Outline
  • Finite State Machines (?????????????????)
  • Turing Machines (?????????????)

3
Finite State Machines
  • Topics
  • State Machines and Automata
  • Graph Representing State Machines

4
6.1 State Machines and Automata
  • ???????????????????? (Pattern) ???????????????????
    ??
  • ???? ?????????????? ? ?????????? a,e,i,o,u
    ???????????????????????????? 5 ???????????????
  • abstemious
  • facetious
  • sacrilegious
  • ??????????????????????????????????????????????????
    ????????????????? (State) ??????????????????????
    ???????????????????

5
main procedure print testWord(abstemious,
10) end main procedure testWord(word, n)
i 0 if (findChar(word, a, i, n)
/state 1/ if (findChar(word,e, i,
n) /state 2/ if (findChar(word,i,
i, n) /state 3/ if
(findChar(word,o, i, n) /state 4/
if (findChar(word,u, i, n) /state 5/
return true return false end
procedure procedure findChar(word, ch, i,
n) while (i lt n and wordi ! ch) i
i1 end while if (in) return
false else i return true
end if end procedure
6
6.1 State Machines and Automata
  • ????????????????????????????? Directed
    Graph?????????
  • ????? node ??? ???????????????
  • arc ?????????????????????????????????????????
    (Transitions) ????????????????????????????????
    label ??????? ????
  • ??????????????? 0 ???? 1 ????????????? a
  • ? (Lambda) ??? ?????????????????????? A-Z, a-z
  • ??????? ?-a ??? ???????????????????????? a

?-a
?-e
?-i
?-o
?-u
start
a
e
i
o
u
0
1
2
3
4
5
7
6.1 State Machines and Automata
  • ?????????????? node ??????? ????????? pattern
    ???????????? ???????? accepting state
    ???????????????????
  • ???? node ??????????? start state
    ?????????????????????????????
  • ??????????????? Finite Automaton ???? Automaton

?-a
?-e
?-i
?-o
?-u
start
a
e
i
o
u
0
1
2
3
4
5
8
6.1 State Machines and Automata
  • ??????????? Automaton
  • Automaton ????????????????????? ???? input
    sequence
  • ????????????????? Start State ????????????????????
    ????? input sequence
  • ?????????????????? (input) ??????????????
    Transition ???????????
  • ?????????????????????????? ?????? State ????
  • ??????????????????????? ??????????? State ?????
  • ??????????? Automaton ???????????????????
    ??????????????????????? ? ???????????? input
    sequence
  • ????????????????????? Automaton ??????? Accepting
    State

9
6.1 State Machines and Automata
  • ??????????? 1 ???????? String ???????????????????
    ???? 0 ??? 1 ???????? ?????? ????? Automaton
    ???????????? Pattern ??
    (????????????? Automaton ??????? Accepting State)

1
0
(?)
0
start
1
String ?? ? ????????????? 0
10
6.1 State Machines and Automata
0
(?)
1
c
0
start
0
a
b
1
1
0
d
1
String ?? ? ????????????? 00 ???? 01
11
6.1 State Machines and Automata
(?)
0
1
1
start
1
a
b
c
0
0
String ?? ? ????????????? 11
12
6.1 State Machines and Automata
(?)
odd even
0
1
0
1
even even
odd odd
1
0
1
0
even odd
String ?? ? ????? 0 ???????????? ????? 1
????????????
13
6.2 Definition of a Finite Automaton
  • A finite automaton, or finite-state machine
    (abbreviated FA) is a 5-tuple (Q,?,q0, A,?),
    where
  • Q is a finite set (whose elements we will
    think of as state)
  • ? is a finite alphabet of input symbols
  • q0 ? Q (the initial state)
  • A ? Q (the set of accepting states)
  • ? is a function from Qx? to Q (the transition
    function).
  • For any element q of Q and any symbol a ? ?, we
    interpret ?(q, a) as the state to which the FA
    moves, if it is in state q and receives the input
    a.

? - sigma, ? - delta
14
6.3 Finite-State Machines with Output
  • ??????????????????????????????? 20 ??? ???
    ??????????????? 5, 10
    ???
  • ?????????????????????? 20 ??? ????????????????????
    ??????????
  • ????????????????????????? 20 ???
    ??????????????????????????
    ?????????????????????????????????????????????

    ????????????????????????????????????????
  • ??????????????????????????????????????????????????
    ????????????? ????????????????????????????????
    ????????????? combination
    ????????????????????????????????

15
State Table ??????????????????????????????? State Table ??????????????????????????????? State Table ???????????????????????????????
Next State Output
Input Input
State 5 10 O R 5 10 O R
S0
S1
S2
S3
S4
S0 ??????????????????????????????????????????? Si
????????????? ? ????? FA ????????? Input
??????????????? 5, 10, ???????-O,
???????-R Output ??????????????? 5, 10,
?????????????-OJ, ?????????????????-AJ n ???
nothing ?????????????
16
6.3 Finite-State Machines with Output
s0
State Diagram
17
Exercise
  • ?????? State Diagram ??? State Table ???

State Table State Table State Table
f G
Input Input
State 0 1 0 1
S0 S1 S0 1 0
S1 S3 S0 1 1
S2 S1 S2 0 1
S3 S2 S1 0 0
18
Exercise
  • ?????? State Table ??? State Diagram ???

State Table State Table State Table
f G
Input Input
State 0 1 0 1
S0 S1 S3 1 0
S1 S1 S2 1 1
S2 S3 S4 0 0
S3 S1 S0 0 0
S4 S3 S4 0 0
19
6.3 Exercise
  • ????????? Automaton ???????????????? String 0 ???
    1
  • ????????????????????????????????????????? 1
    ???????????????????? (Accepting State ????? 1
    ??????????)
  • ????????????? string ?????? ?????? 1
    ?????????????? 2 ????????????????? ???? 11
    ????????? 111 ?????????
  • ????????? Automaton ??????????????????? String ??
    ? (A-Z ??? a-z)
  • ???????????????????????????? (Accepting State)
    ???????????????????????????? end

20
6.3 Exercise
  • ????????? FA ?????????????????????????????????????
    ????????????????????????? 1, 2, 5, ??? 10 ???
    ???????????????????????? 8 ???
    ?????????????????????????? ??????????????????????
    ?????????? ???????????????????????????????????????
    ???????????????????

21
6.3 Exercise
  • ????????? FA ?????????????????????????????
    ????????????????????????? 1, 2, 5, ??? 10 ???
    ?????????????????????????? 6 ???
    ??????????????????????????????????????
    ??????????????????????????????????????????????????
    ? ????????????????????????????????????????????????
    ????????????????????????????????????????????

22
Turing Machines
23
Turing Machines
Alan Turing 1912-1954
24
6.4 Turing Machines
  • ??????????? Finite-State Automata ???
  • ???????????????????? (state) ????????
  • ??????????????????? FA ???????????????????????????
    ???????????????????????????
  • ???? if (a10 gt b10) then ... ??????????????
  • ?????.?. 1936 Alan Turing ??????? Abstract
    Machine ??????????????? Turing Machine (TM)
  • ??????????????????????????????????????????????
  • ??????????????????????????????????????????????????
    ????????

25
6.4 Turing Machines
  • TM ???????????????????????????????????????????????
    ?????????????? ???????? ?????? (Tape head)
  • ???????????????????? ?????????????????????????????
    ??
  • ?????????????????? ? ??????????????????
  • ??????????????? TM ???????? state ?? state
    ????????? ??????????? State ???????????????
    (Unique)

Tape
Symbol
Tape head
26
6.4 Example 1
Time 0
......
......
Time 1
......
......
1. Reads
2. Writes
3. Moves Left
27
Time 1
......
......
Time 2
......
......
1. Reads
2. Writes
3. Moves Right
28
6.4 Turing Machines
  • TM ??????? output ????? ???????? Accepting state
  • ?????? State ?????? ?? State ??????? 2 ????
    ??????
  • Initial State ???? state ????????
  • Halt State ???????????????

29
6.4 Turing Machines
  • Halt State ????????
  • final (ha)
  • ???????????????????????????????? accept
  • halting (hr)
  • ???????????????????????????????? reject
  • ???????????????????? accept ???? reject ??? input
    string ????????????????????????
    state ?????????? ????????????????????????????????
    ??
  • hr ????????????????????????????????????? (crash)
    ?????????? ???? ?????????????????????? ???????

30
6.4 Turing Machines
  • ??????????? TM ???????????????????????????????????
    ??????????????? ?????????????????????
  • ??????????????????????
  • ?????????????????????????????? (??????????????????
    ??)
  • ?????????????????????????
  • ?????????????????????????? ??????? ??????????????
  • ????????? state ?????
  • ??????????????????????????????????????????????????
    ?????????????????? ?????????????????? state
    ???????????????????????????????????????????

31
6.4 ??????????? 2
  • TM ???????????????????????

32
6.4 ??????????? 2
33
6.4 ??????????? 2
34
6.4.1 5-Tuple Definition
  • A Turing machine (TM) is a 5-tuple
    T(Q,?,?,q0,?), where
  • Q is a finite set of states, assume not to
    contain ha or hr, the two halting states (the
    same symbols will be use for the halt states of
    every TM)
  • ? and ? are finite sets, the input and tape
    alphabets, respectively, with ? ? ? ? is assumed
    not to contain ?, the blank symbol
  • q0, the initial state, is an element of Q
  • ? Q x (???) ? (Q ? ha, hr)x (???)xR,L,S
    is a partial function (that is,
    possibly undefined at certain points).

? - sigma, ? - gamma, ? - delta
35
6.4.1 5-Tuple Definition
  • For elements q?Q, r?Q ? ha, hr, X,Y????, and
    D?R,L,S, we interpret the formula
  • ?(q, X) (r, Y, D)
  • when T is in state q and the symbol on the
    current tape square is X,
  • the machine replaces X by Y on that square,
  • changes to state r, and
  • either moves the tape head one square right,
    moves it one square left (if the tape head is not
    already on the leftmost square), or leaves it
    stationary, depending on whether D is R, L, or S,
    respectively.
  • When r is either ha or hr, we say that T is
    halts.
  • Once it has halted, it cannot move further, since
    ? is not defined at any pair (ha, X) or (hr,X).

36
6.4.1 5-Tuple Definition
  • We permit the machine to crash by entering the
    reject state in case it tries to move the tape
    head off the left end of the tape.
  • This is the way for the machine to halt that is
    not reflected by the transition function ?.
  • If the tape head is currently on the leftmost
    square, the current state and tape symbol are q
    and a, respectively, and ?(q, a) (r, b, L),
  • we will say that the machine leaves the tape head
    where it is, replaces the a by b, and enters the
    state hr instead of r.

37
6.4.2 Transition Function
  • ???????? TM ?????? state ?? ? (s)
    ???????????????????????????????????????? x
    ??????? Partial Function (f) ??? (s,x)
  • f(s,x) (s,x,d)
  • ???????????
  • ??????????? state s
  • ?????????????? x ?????????????????????????? x
  • ??????????????????????????????? d (???? L ??? R
    ?????????????? S)
  • ???????????? (s, x, s, x, d)
  • ??? f ???????????????? (s,x) ??????? TM halt

38
6.4.2 Transition Function
  • ???????? ?????????????????? TM T ?????????????
    Transition Function ????????
  • (s0,0,s0,0,R), (s0,1,s1,1,R), (s0,B,s3,B,R)
  • (s1,0,s0,0,R), (s1,1,s2,0,L), (s1,B,s3,B,R)
  • (s2,1,s3,0,R)
  • state input next state write
    direction
  • s0 0 s0 0 R
  • s0 1 s1 1 R
  • s0 B s3 B R
  • s1 0 s0 0 R
  • s1 1 s2 0 L
  • s1 B s3 B R
  • s2 1 s3 0 R

39
6.4.2 Transition Function
(s0,0,s0,0,R), (s0,1,s1,1,R), (s0,B,s3,B,R) (s1,0,
s0,0,R), (s1,1,s2,0,L), (s1,B,s3,B,R) (s2,1,s3,0,R
)
(s0,0,s0,0,R)
  • ??? Initial State (s0)
  • ??????????????????????????????????????????????????
    ?????????????????? Blank (B)

40
6.4.2 Transition Function
(s0,0,s0,0,R), (s0,1,s1,1,R), (s0,B,s3,B,R) (s1,0,
s0,0,R), (s1,1,s2,0,L), (s1,B,s3,B,R) (s2,1,s3,0,R
)
(s0,0,s0,0,R)
(s0,1,s1,1,R)
B
B
0
1
0
1
1
0
B
B
  • ...

41
6.4.2 Transition Function
(s0,0,s0,0,R), (s0,1,s1,1,R), (s0,B,s3,B,R) (s1,0,
s0,0,R), (s1,1,s2,0,L), (s1,B,s3,B,R) (s2,1,s3,0,R
)
(s0,1,s1,1,R)
(s1,0,s0,0,R)
B
B
0
1
0
1
1
0
B
B
  • ...

42
6.4.2 Transition Function
(s0,0,s0,0,R), (s0,1,s1,1,R), (s0,B,s3,B,R) (s1,0,
s0,0,R), (s1,1,s2,0,L), (s1,B,s3,B,R) (s2,1,s3,0,R
)
(s0,1,s1,1,R)
(s1,0,s0,0,R)
B
B
0
1
0
1
1
0
B
B
  • ...

43
6.4.2 Transition Function
(s0,0,s0,0,R), (s0,1,s1,1,R), (s0,B,s3,B,R) (s1,0,
s0,0,R), (s1,1,s2,0,L), (s1,B,s3,B,R) (s2,1,s3,0,R
)
(s0,1,s1,1,R)
(s1,1,s2,0,L)
B
B
0
1
0
1
1
0
B
B
  • ...

44
6.4.2 Transition Function
(s0,0,s0,0,R), (s0,1,s1,1,R), (s0,B,s3,B,R) (s1,0,
s0,0,R), (s1,1,s2,0,L), (s1,B,s3,B,R) (s2,1,s3,0,R
)
(s1,1,s2,0,L)
(s2,1,s3,0,R)
B
B
0
1
0
1
0
0
B
B
  • ...

45
6.4.2 Transition Function
(s0,0,s0,0,R), (s0,1,s1,1,R), (s0,B,s3,B,R) (s1,0,
s0,0,R), (s1,1,s2,0,L), (s1,B,s3,B,R) (s2,1,s3,0,R
)
B
B
0
1
0
0
0
0
B
B
  • There is no transition function for state s3,
    thus the machine halts.

46
6.4.2 Exercise
  • Let T be the Turing machine defined by the
    five-tuples (s0,0,s1,1,R), (s0,1,s1,0,R),
    (s1,0,s2,1,L), (s1,1,s1,0,R), (s1,B,s2,0,L). For
    each of these initial tapes, determine the final
    tape when T halts, assuming that T begins in
    initial position.

B
B
0
0
1
1
B
B
a)
B
B
1
0
1
B
B
B
b)
B
B
1
1
B
0
1
B
c)
B
B
B
B
B
B
B
B
d)
47
6.4.2 Exercise
  • Let T be the Turing machine defined by the
    five-tuples (s0,0,s1,0,R), (s0,1,s1,0,L),
    (s0,B,s1,1,R), (s1,0,s2,1,R), (s1,1,s1,1,R),
    (s1,B,s2,0,R), (s2,B,s3,0,R). For each of these
    initial tapes, determine the final tape when T
    halts, assuming that T begins in initial
    position.

B
B
0
1
0
1
B
B
a)
B
B
1
1
1
B
B
B
b)
B
B
0
0
B
0
0
B
c)
B
B
B
B
B
B
B
B
d)
48
6.4.2 Exercise
  1. What does the Turing machine described by the
    five-tuples (s0,0,s0,0,R), (s0,1,s1,0,R),
    (s0,B,s2,B,R), (s1,0,s1,0,R), (s1,1,s0,1,R), and
    (s1,B,s2,B,R) do when given a bit string as
    input?
  2. What does the Turing machine described by the
    five-tuples (s0,0,s1,B,R), (s0,1,s1,1,R),
    (s1,0,s1,0,R), (s1,1,s2,1,R), (s2,0,s1,0,R),
    (s2,1,s3,0,L), (s3,0,s4,0,R), and (s3,1,s4,0,R)
    do when given a bit string as input?

49
6.4.2 Solution
  • Click Next for 3 and 4 solutions

50
6.4.2 Solution
  • What does the Turing machine described by the
    five-tuples (s0,0,s0,0,R), (s0,1,s1,0,R),
    (s0,B,s2,B,R), (s1,0,s1,0,R), (s1,1,s0,1,R), and
    (s1,B,s2,B,R) do when given a bit string as
    input?
  • ????????? 1 ??????????

51
6.4.2 Solution
  • What does the Turing machine described by the
    five-tuples (s0,0,s1,B,R), (s0,1,s1,1,R),
    (s1,0,s1,0,R), (s1,1,s2,1,R), (s2,0,s1,0,R),
    (s2,1,s3,0,L), (s3,0,s4,0,R), and (s3,1,s4,0,R)
    do when given a bit string as input?
  • ?????? 0 ?????? string ????????????? Blank
  • ?????? 11 ??????? string ????????????? 00
    ??????????????

52
Quiz
53
6.4.3 Transition Diagram
54
6.4.3 Transition Diagram
55
6.4.3 Transition Diagram
  • (s0,0,s0,0,R), (s0,1,s1,0,R), (s0,B,s2,B,R),
    (s1,0,s1,0,R), (s1,1,s0,1,R), (s1,B,s2,B,R)

56
6.4.3 Transition Diagram
Turing Machines are deterministic
S2
a?b,R
S1
S3
b?d,L
57
Partial Transition Function
6.4.3 Transition Diagram
......
......
B
B
B
B
B
Example
S1
S2
S1
S3
58
6.4.3 Transition Diagram
The machine halts if there are no possible
transitions to follow
......
......
B
B
B
B
B
Example
S1
S2
S1
S3
59
6.4.3 Transition Diagram
S0
S1
  • Final states have no outgoing transitions
  • In a final state the machine halts

60
6.4.3 Transition Diagram
Accept Input
Reject Input
61
6.4.3 Transition Diagram
Example A Turing machine that accepts language a
a ? a,R
S0
62
6.4.3 Transition Diagram
a ? a,R
B ? B,L
S0
S1
B
B
B
B
S0
Halt Accept
63
6.4.3 Transition Diagram
a ? a,R
B ? B,L
S0
S1
B
B
B
B
b
S0
No possible transition HaltReject
64
6.4.3 Transition Diagram
Example Infinite loop on a TM
B ? B,L
S0
S1
65
6.4.3 Transition Diagram
B ? B,L
S0
S1
66
6.4.3 Transition Diagram
  • For infinite loop case
  • The final state cannot be reached
  • The machine never halts
  • The input is not accepted

67
6.4.3 Transition Diagram
Example Turing machine for the language anbn
s4
B?B,L
s0
s1
s2
s3
68
6.4.3 Transition Diagram
Test input tape
B
B
s0
69
6.4.4 TM Construction
  • Find a TM that recognizes the set of bit strings
    that have a 1 as their second bit, that is, the
    regular set (0?1)1(0 ? 1)
  • TM ??????????????????????????? 0 ???? 1
    ????????????????????? 1 ?????????????????? 0 ????
    1 ??????????? ?????? 0 ????????
  • ???????? TM ??????????????????????????????????????
    ????? Blank
  • ???????? State S0
  • ????????????????????????????? 0 ???? 1 ?????
    ?????
  • (s0,0,s1,0,R) ??? (s0,1,s1,1,R)

70
6.4.4 TM Construction
  • Ex. TM ?????? (0?1)1(0 ? 1)
  • ???????????????????????????????? 2 ??????? 1
    ?????????????? ?????
  • (s1,0,s2,0,R) ??? (s1,1,s3,1,R)
  • ????????? ?????????????? s2 ????????????? Final
    State ?????????? s3 ??????????? Final State
  • ??????????????????????????????? B ?????????? ?
    state
  • s0 ?????? B ?????????????????? (0?1) ???????????
    (s0,B,s2,B,R)
  • s1 ?????? B ??????????????????????????????
    ???????? (s1,B,s2,B,R)
  • ?????????????????? Transition Function ?????? s2
    ??? s3 ??? ???????????????? State
    ?????????????????????????????

71
6.4.4 TM Construction
  • Ex. TM ?????? (0?1)1(0 ? 1)
  • (s0,0,s1,0,R), (s0,1,s1,1,R), (s0,B,s2,B,R),
    (s1,0,s2,0,R), (s1,1,s3,1,R), ??? (s1,B,s2,B,R)

72
6.4.4 TM Construction
  • Ex. ???????? TM ????????? 0?10100?1
  • String ?? ? ????? 010 ????????? String ????

73
6.4.4 TM Construction
  • Ex. ???????? TM ????????? 0n1n n gt 1 ???????
    1

0
0
0
1
1
1
B
B
74
6.4.4 TM Construction
  • Ex. ???????? TM ????????? 0n1n n gt 1 ???????
    2

0
0
0
1
1
1
B
B
75
6.4.4 TM Construction
  • Ex. ???????? TM ????????? 0n1n n gt 1

(s0,0,s1,M,R), (s1,0,s1,0,R), (s1,1,s1,1,R),
(s1,M,s2,M,L), (s1,B,s2,B,L), (s2,1,s3,M,L),
(s3,1,s3,1,L), (s3,0,s4,0,L), (s3,M,s5,M,R),
(s4,0,s4,0,L), (s4,M,s0,M,R)
76
6.4.4 Exercise ... from Rosen
  1. Construct a TM with type symbols 0, 1, and B that
    replaces the first 0 with a 1 and does not change
    any of the other symbols on the tape.
  2. Construct a TM with tape symbols 0, 1, and B
    that, given a bit string as input, replaces all
    0s on the tape with 1s and does not change any of
    the 1s on the tape.

77
6.4.4 Exercise
  1. Construct a TM with tape symbols 0, 1, and B
    that, given a bit string as input, replaces all
    but the leftmost 1 on the tape with 0s and does
    not change any of the other symbols on the tape.
  2. Construct a TM with tape symbols 0, 1, and B
    that, given a bit string as input, replaces the
    first two consecutive 1s on the tape with 0s and
    does not change any of the other symbols on the
    tape.

78
6.4.4 Exercise
  1. Construct a TM that recognizes the set of all bit
    strings that contain at least two 1s.
  2. Construct a TM that recognizes the set of all bit
    strings that contain an even number of 1s.
  3. Construct a TM that recognizes the set
    0n1n2n n gt 0.

79
  • End

80
TM Simulator
http//ironphoenix.org/tril/tm/
81
http//www.cs.washington.edu/building/art/SPTM/
82
(No Transcript)
83
7.x Regular Languages
  • Definition 1 Regular Languages and Regular
    Expressions over ?
  • The set of R of regular languages over ?, and the
    corresponding regular expressions, are defined as
    follows.
  • ? is an element of R, and the corresponding
    regular expression is ?.
  • ? is an element of R and the corresponding
    regular expression is ?.
  • For each a ? ?, a is an element of R, and the
    corresponding regular expression is a.

84
7.x Regular Languages
  • Definition 1 Regular Languages and Regular
    Expressions over ?
  • If L1 and L2 are any elements of R, and r1, r2
    are the corresponding regular expressions,
  • (a) L1 ? L2 is an element of R, and the
    corresponding regular expression is (r1 r2)
  • (b) L1L2 is an element of R, and the
    corresponding regular expression is (r1r2)
  • (c) L1 is an element of R, and the
    corresponding regular expression is (r1).
  • Only those languages that can be obtained by
    using statements 1-4 are regular languages over
    ?.
  • - Kleene

85
7.x Regular Languages
  • Languages Corresponding Regular Expression
  • ? ? - null string
  • 0 0
  • 001 (i.e.,001) 001
  • 0,1 (i.e.,0?1) 01
  • 0,10 (i.e.,0?10) 010
  • 1, ?001 (1 ?)001
  • 1100,1 (110)(01)
  • 110 110
  • 10,111,11010 (101111010)
  • 0,10(11 ?001, ?) (010)((11)001?)

86
7.x Regular Languages
  • (ab) ? ab
  • 1(1 ?) 1
  • 11 1
  • 01 10
  • (01) (01)

87
7.4 Turing Machines
  • ?????????????????????? Human Computer
  • A human who is solving some problem
    algorithmically using a pencil and paper.
  • ?????????????????? 3 ???
  • the only things written on the paper are symbols
    from some fixed finite set
  • each step taken by the computer depends only on
    the symbol he is currently examining and on his
    state of mind at the time
  • although his state of mind might changes as a
    result of symbols he has seen or computations he
    has made, only a finite number of distinct states
    of mind are possible.

88
7.4 Turing Machines
  • ?????????????????? Human Computer ?? 3 ???????
  • Examining an individual symbol on the paper
  • Erasing a symbol or replacing it by another
  • Transferring attention from one part of the paper
    to another.

89
7.4 Turing Machines
90
7.4 Turing Machines
  • ??????????????????????????....??????????
  • A Turing machine will have a finite alphabet of
    symbols
  • (actually two alphabets, an input alphabet and a
    possible larger alphabet for use during the
    computation)
  • and a finite set of states, corresponding to the
    possible state of mind of the human computer.

91
7.4 Turing Machines
  • Instead of a sheet of paper, Turing specified a
    linear tape, which has a left end and is
    potentially infinite to the right.
  • The tape is marked off into squares, each of
    which can hold one symbol from the alphabet
  • if a square has no symbol on it, we say that it
    contains the blank symbol.

92
7.4 Turing Machines
  • We think of the reading and writing as being done
    by a tape head, which at any time is centered on
    one square of the tape.

93
7.4 Turing Machines
94
7.4 Turing Machines
  • In this study, a single move is determined by the
    current state and the current tape symbol, and
    consists of three parts
  • Replacing the symbol in the current square by
    another, possibly different symbol
  • Moving the tape head one square to the right or
    left (except that if it is already centered on
    the leftmost square, it cannot be moved to the
    left), or leaving it where it is
  • Moving from the current state to another,
    possibly different state.

95
7.4 Turing Machines
  • ??? Turing Machine ???????????????????????????????
  • The tape serves as the input device
  • (the input is simply the string, assume to be
    finite, of nonblank symbols on the tape
    originally),
  • the memory available for use during the
    computation,
  • and the output device
  • (the output is the string of symbols left on the
    tape at the end of the computation).

96
7.4 Turing Machines
  • ????????????? Turing machine ??? Machine ???? ?
  • In Turing machine, processing a string is no
    longer restricted to a single left-to-right pass
    through the input.
  • The tape head can move in both directions and
    erase or modify any symbol it encounters.
  • The machine can
  • examine part of the input,
  • modify it,
  • take time out to execute some computations in a
    different area of the tape,
  • return to re-examine the input, repeat any of
    these actions,
  • and perhaps stop the processing before it has
    looked at all the input.

97
7.4 Turing Machines
Write a Comment
User Comments (0)
About PowerShow.com