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

1 / 21
About This Presentation
Title:

Computer Science 101 A Survey of Computer Science

Description:

... Alan Turing, proposed a model of a computing agent, The Turing Machine, ... There are only a finite number of states for a given Turing machine. ... – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 22
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
  • Models of Computation

2
Models
  • Captures the essence the important properties
    of the real thing.
  • Probably differs in scale from the real thing.
  • Suppresses details of the real thing.
  • Lacks the full functionality of the real thing.

3
Modeling Cycle
  • The details that are present/suppressed, etc.
    depend on the study the model is to be used for.
  • Too many details/features may make the model too
    slow, too unwieldy, too expensive, infeasible to
    work with.
  • Too few details (or the wrong details) may make
    the model inaccurate for the purposes at hand.
  • Usually, there is a cycle of designing,
    implementing, testing, and then refining.

4
Computer Models
  • Many fields of research natural and social
    sciences in particular make heavy use of
    computer models for predictions and explanations.
  • Professor Eason in Physics works with very
    complex and computationally intensive models of
    the heart.
  • Professor Conners in Geology works with complex
    models of geological faults to explain history of
    the site.
  • And many, many more such examples.

5
Properties of a Computing Agent
  • Can accept input
  • Can store information in and retrieve it from
    memory
  • Can take actions according to algorithm
    instructions, depending on current state of the
    agent and its input.
  • Can produce output

6
Historical Background
  • Around 1900 there was a very optimistic spirit
    within the mathematical community.
  • Some even believed it might be possible to have
    an algorithm that would take as input
    mathematical statements and output whether the
    statement was true or false.
  • This would put mathematicians out of business
    as far as the need for proving new theorems.

7
Historical Background
  • In 1931, Austrian logician, Kurt Godel, showed
    that any reasonably complex mathematical systems
    (enough to do number theory) would contain true
    statements that could not be proven in the
    system.
  • So, a mathematician, might devote a lifetime to
    attempting to prove a result for which no proof
    could exist.

8
Historical Background
  • In mid 1930s, mathematicians began to look
    closely at computational procedures (algorithms)
    themselves what does it mean to be computable
    by algorithm, etc. Could there be an algorithm
    that told whether a statement is provable or not
    (not whether it is true or not).
  • British mathematician, Alan Turing, proposed a
    model of a computing agent, The Turing Machine,
    which gradually gained acceptance (equivalent to
    many other proposed models).

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

10
Turing MachinesModels of Computing Agents
  • We can view a Turing Machine as consisting of
    three main units
  • A tape for holding the input and intermediate
    results
  • A state unit where the system is always in one of
    a finite number of states
  • A control unit that determines how the tape is
    processed and how the system changes state.

11
The Tape
  • The tape consists of individual cells,
    theoretically extending infinitely in either
    direction.
  • Each cell can hold one symbol from the machines
    alphabet a finite set of symbols including b
    (blank).
  • The tape holds the original input, a finite
    string of non-blank symbols.
  • At any point in time the tape will have only a
    finite number of non-blanks.
  • There is a read/write head that is pointing to a
    particular cell and is capable of reading what is
    in that cell and writing a new symbol there.

12
States of the Machine
  • The states of the machine refer roughly to the
    status of the machine in doing its task.
  • There are only a finite number of states for a
    given Turing machine. At any point the machine is
    in exactly one of these states.
  • With a computer, we could think of being in state
    of beginning the fetch phase, or having just
    loaded something into the register, etc.
  • In an algorithm, maybe we are in state of having
    just gotten the current temperature from user.

13
State Unit
1
2
8
7
3
6
4
5
14
Control (Steps) of Turing Machine
  • A Turing Machine TM operates in a step by step
    fashion think of a clock ticking and at each
    click, an action is taken.
  • The action taken at a given step depends on
  • The state the machine is in
  • The tape symbol in the cell where the tape head
    is located
  • The action consists of
  • State change (what is the next state possibly
    same state)
  • Tape action
  • New symbol is written into the cell where tape
    head is located (possibly same symbol)
  • The tape head is moved one cell to the left or
    one cell to the right.

15
TMs more details
  • Initialization TM begins
  • In State 1
  • With tape head on leftmost non-blank cell
  • Leftmost tape symbol is blank
  • There can not be two possible actions for a given
    state and tape symbol
  • The TM halts if it there is no action specified
    for its current situation
  • If a TM halts, the non-blank portion of its tape
    can be considered to be its output.
  • It could be required that a TM always halt on
    appropriate input (maybe, maybe not)

16
Anatomy of an Instruction
  • A TM instruction is given as a 5-tuple(current
    state, current symbol, next symbol, next state,
    direction)
  • For example, the instruction (2,1,0,4,L) would
    mean
  • If we are in State 2 and if tape head is reading
    a 1 then
  • Replace the 1 with a 0 Move to state
    4 Move tape head one cell to the left

17
Turing Machine Example
  • Suppose a TM has the following instructions
  • (1,1,1,2,R)
  • (1,0,0,1,R)
  • (2,1,1,1,R)
  • (2,0,0,2,R)
  • (1,b,1,3,R)
  • (2,b,0,3,R)
  • Suppose input is 101

18
Turing Machine Example
  • (1,1,1,2,R)
  • (1,0,0,1,R)
  • (2,1,1,1,R)
  • (2,0,0,2,R)
  • (1,b,1,3,R)
  • (2,b,0,3,R)
  • Suppose input is 111

19
Turing Machine Example Odd parity
20
Turing Machine Example
  • (1,1,1,2,R)
  • (1,0,0,1,R)
  • (2,1,1,1,R)
  • (2,0,0,2,R)
  • (1,b,1,3,R)
  • (2,b,0,3,R)
  • Strategy Scan from left to right keeping track
    of whether we have seen an even number of 1s or
    an odd number of 1s
  • States
  • State 1 is state where we have seen an even
    number of 1s
  • State 2 is state where we have seen an odd number
    of 1s
  • State 3 is the halt state

21
Turing Machine ExampleState Transition Diagram
  • (1,1,1,2,R)
  • (1,0,0,1,R)
  • (2,1,1,1,R)
  • (2,0,0,2,R)
  • (1,b,1,3,R)
  • (2,b,0,3,R)
Write a Comment
User Comments (0)
About PowerShow.com