Computer Science 101 A Survey of Computer Science - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Computer Science 101 A Survey of Computer Science

Description:

... Science 101. A Survey of Computer Science ... With more time, we could do much more impressive things. So far, we have used a new machine for each problem. ... – PowerPoint PPT presentation

Number of Views:36
Avg rating:3.0/5.0
Slides: 18
Provided by: tomwh
Category:

less

Transcript and Presenter's Notes

Title: Computer Science 101 A Survey of Computer Science


1
Computer Science 101A Survey of Computer Science
  • Church-Turing Thesis

2
Where we are
  • We have looked at the definition of Turing
    machines simple models of computing agents.
  • We have seen a series of examples showing that we
    can do numerical algorithms, rearranging, etc.
  • We have seen how we can piece together machines
    for simple problems to solve more complex
    problems.
  • With more time, we could do much more impressive
    things.
  • So far, we have used a new machine for each
    problem. Now we look at the notion of a
    programmable Turing machine.

3
Encoding a Turing Machine
  • To encode symbols of the alphabet Use 1 for
    b Use 11 for second symbol Use 111 for third
    symbol, etc.
  • To encode states Use 1 for first state Use
    11 for second state, etc.
  • To encode directions Use 1 for L Use 11 for R

4
Encoding a Turing Machine (cont.)
  • To encode instructions Encode the components of
    the instructions and separate by 0s.
  • Example Suppose alphabet is b,0,1 so b is
    encoded as 1, 0 as 11, 1 as 111.Then the
    instruction (3,1,0,2,L) would be encoded as
    111011101101101.
  • To encode a Turing machine Encode the
    instructions and separate by 0s.

5
Encoded TM
  • Here is the code (serial number) for a Turing
    Machine with alphabet b,1 1011011010101010110
    1101or Turing Machine number 5985645

6
Universal Turing Machine
  • A Universal Turing Machine, U
  • U is a Turing Machine
  • U takes as input
  • The encoding of another TM, M, (this is the
    program) and
  • Some string S of input symbols for M
  • U produces as output
  • Whatever output M would have produced if it had
    been given input S

7
Universal Turing Machine (cont.)
  • So a universal Turing machine is programmable in
    that you can program it with the encoding of
    another machine and it will simulate that machine
    (program).
  • The details of how U works are beyond the scope,
    but basically
  • It keeps sections of its tape
  • For the current state of M
  • A copy of what Ms tape would look like
  • It scans to see what state M would be in, what it
    would be reading. Then it finds an instruction
    that matches. It then carries out the actions
    that M would do.

8
Church Turing Thesis
  • Church-Turing Thesis If there is an algorithm to
    do a symbol manipulation task, then there is a
    Turing machine to do that task.
  • Or, contrapositively If such a task can not be
    done with a Turing machine, then there is no
    algorithm to do the task.

9
Church Turing Thesis (cont.)
  • The Church-Turing Thesis is not a theorem to be
    proven, but an accepted theoretical definition of
    a computation or algorithm.
  • Why is Church-Turing Thesis accepted?
  • Every algorithm presented was shown to be
    solvable by TM
  • Other very different attempts (by very smart
    people) to define computability were shown to be
    equivalent to TMs

10
Proof by Contradiction
  • Proof by contradiction is an important proof
    technique used by mathematicians and logicians.
  • To prove statement P true
  • Make the assumption that P is false
  • Show that this leads to a logical contradiction
  • Conclude that the assumption must be false i.e.,
    that P must be true.

11
The Halting Problem
  • The problem Find TM (algorithm), H, that takes
    as input
  • Encoding, M of a TM (program), M, and
  • Input for M (input for the program), S
  • and outputs
  • 1 if M will eventually halt on input S
  • 0 if M will not halt on input S
  • Note such an algorithm would let us know whether
    or not it is safe to execute the program on the
    given input.

12
Halting Problem (cont.)
  • Suppose we have TM, H, as proposed

M b S
H
Halts with 1 on tape if M halts with input S
Halts with 0 on tape if Mnever halts with input S
13
Halting Problem (cont.)
  • Modify H by adding instructions to cause it to
    loop forever once it reaches the halt with 1
    configuration.

14
Halting Problem (cont.)
  • Modify K by having it first make copy of its
    input and then simulate K

15
Halting Problem (cont.)
  • Now suppose we give Q its own encoding for input

16
Halting Problem (cont.)
  • So
  • Q never halts on input Q if Q halts on input Q
  • Q halts on input Q if Q never halts on input Q
  • This is a contradiction
  • Suppose we have TM, H, as proposed
  • Conclusion No such H exists Halting problem is
    unsolvable by algorithm

17
Unsolvable Problems
  • Problems for which no algorithm can exist (1000s
    known)
  • Decide whether Java program will terminate on
    given input.
  • Decide whether two Java programs will always give
    the same output.
  • Decide whether a given polynomial has roots that
    are whole numbers.
  • Decide whether a given TM will halt if given a
    blank tape
Write a Comment
User Comments (0)
About PowerShow.com