ICS 241 - PowerPoint PPT Presentation

About This Presentation
Title:

ICS 241

Description:

Section 11.5: Turing Machines. Background of Turing machines. Invented in 1935 by Alan Turing ... Different from the 'Turing test': a computer is 'thinking' if ... – PowerPoint PPT presentation

Number of Views:42
Avg rating:3.0/5.0
Slides: 15
Provided by: williama3
Learn more at: http://www2.hawaii.edu
Category:
Tags: ics | alan | turing

less

Transcript and Presenter's Notes

Title: ICS 241


1
ICS 241
  • Discrete Mathematics II
  • William Albritton, Information and Computer
    Sciences Department at University of Hawaii at
    Manoa
  • For use with Kenneth H. Rosens Discrete
    Mathematics Its Applications (5th Edition)

2
Section 11.5 Turing Machines
  • Background of Turing machines
  • Invented in 1935 by Alan Turing
  • Solution to the decision problem of Hilbert
    (German mathematician)
  • Is there a general method that can be applied to
    any assertion to determine whether the assertion
    is true?
  • A model that roughly describes the capability of
    todays computers
  • Different from the Turing test a computer is
    thinking if it cannot be distinguished from a
    person

3
Definition
  • A Turing machine T (S, I, f, s0 )
  • S a finite set of n states (s0, s1, s2, sn)
  • I an alphabet (0, 1, and blank symbol B)
  • f a partial function from S I to S I R,
    L
  • A partial function may be undefined for some
    inputs (such as the division function for 0)
  • R, L move to the right (or left) one cell
  • s0 the starting state

4
Definition (in plain English)
  • A Turing machine T consists of two parts
  • A long tape that is infinite in both directions
  • The tape is divided into cells, which contains a
    zero (0), one (1), or the blank symbol (B)
  • A control unit that
  • Is in a particular state
  • Reads the contents of one cell from the tape
  • Changes to a new state, based on this input
  • Writes a 0, 1, or B to the same cell
  • Moves one cell to the left or right
  • Repeats steps 1-5, until it halts

5
Defining a Turing Machine
  • Define T with a 5-tuple set (s, x, s', x', d)
  • s current state
  • x current tape symbol
  • s' next state
  • x' next tape symbol
  • d R to move right, or L to move left
  • At beginning of operation, Turing machine is
  • Starting at initial state s0
  • Positioned over the leftmost nonblank symbol on
    tape

6
Example T That Flips Bits
  • Turing machine T defined by the three 5-tuples
  • (s0, 0, s0, 1, R)
  • (s0, 1, s0, 0, R)
  • (s0, B, s1, B, R)
  • s1 is designated final state
  • Will take these steps to create the final tape
  • BBBs00110BBB
  • BBB1s0110BBB
  • BBB10s010BBB
  • BBB100s00BBB
  • BBB1001s0BBB
  • BBB1001Bs1BB (halt)

7
Example T That Recognize Sets
  • Turing machine that will recognize
    (01)(01)1(01)
  • A bit string of at least length 3 that begins
    with two bits of any combination of 0s and 1s,
    then a 1, ending with any length and any
    combination of 0s and 1s
  • (s0, 0, s1, 0, R), (s1, 0, s2, 0, R), (s2, 0, s3,
    0, R),
  • (s0, 1, s1, 1, R), (s1, 1, s2, 1, R), (s2, 1, s4,
    1, R),
  • (s0, B, s3, B, R), (s1, B, s3, B, R), (s2, B, s3,
    B, R)
  • Valid string will halt in designated final state
    s4
  • Otherwise will halt in nonfinal state s3

8
Example T That Recognize Sets
  • Steps for valid string
  • BBBs00110111BBB
  • BBB0s1110111BBB
  • BBB01s210111BBB
  • BBB011s40111BBB (halt)
  • Steps for invalid string
  • BBBs0010011BBB
  • BBB0s110011BBB
  • BBB01s20011BBB
  • BBB010s3011BBB (halt)

9
Class Exercise
  • Exercise 1.c. (p. 782)
  • Each pair of students should use only one sheet
    of paper while solving the class exercises

10
Computing Functions
  • Give string x as input, and halt with string y on
    the tape
  • T(x) y
  • Domain of T set of strings for which T halts
  • if T does not halt, T(x) is undefined
  • x, y nonnegative integers (N, natural numbers)
  • Use unary representations of integers 0 a
    single 1, 1 two 1s, 2 three 1s,
  • i.e., n n 1 ones
  • For example, numeral 5 111111 (six ones)

11
Representing Integers
  • Input x and output y nonnegative integers
  • Use unary representations of integers 0 a
    single 1, 1 two 1s, 2 three 1s,
  • i.e., n n 1 ones
  • For example, numeral 5 111111 (six ones)
  • Separate integers with asterisks ()
  • For example, T(0, 1, 4) is represented
    byBBB11111111BBB

12
Example T That Computes Functions
  • Function that adds two integers
  • T(n1, n2) n1 n2
  • Input n1, n2 n1 1 ones, followed by an
    asterisk (), followed by n2 1 ones
  • Output n1 n2 n1 n2 1 ones
  • Erase the leftmost two 1s, halt if n1 1,
    replace with 1, then halt
  • (s0, 1, s1, B, R), (s1, 1, s2, B, R), (s2, 1, s2,
    1, R)
  • (s1, , s3, B, R), (s2,
    , s3, 1, R)

13
Example T That Computes Functions
  • Steps to add 2 4 6
  • BBBs011111111BBB
  • BBBBs11111111BBB
  • BBBBBs2111111BBB
  • BBBBB1s211111BBB
  • BBBBB11s311111BBB (halt)

14
Class Exercise
  • Exercise 17. (p. 782)
  • Each pair of students should use only one sheet
    of paper while solving the class exercises
Write a Comment
User Comments (0)
About PowerShow.com