1 / 34

Models of Computation: Exploring the Essence of Computing Agents

This chapter discusses the concept of models in computation, focusing on the properties and limitations of computing agents. It introduces the Turing Machine as a historical perspective and explores its capabilities as a computing agent.

robertag
Download Presentation

Models of Computation: Exploring the Essence of Computing Agents

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 10 Models of Computation

  2. What is a model? • 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. Examples • Physical models • Model cars • Dolls • Velcro-covered balls stuck together in a certain way to represent the molecular structure. • Mathematical models • d=rxt • Weather system

  4. Models • Models • Can be used to predict behavior of existing phenomena • can provide environments for learning and practicing interactions with various phenomena. • Can be used as design tools. • But, the information gained is only as good as the model used.

  5. A Model of Computing Agent • We want to construct a model for the “computing agent” that will capture its fundamental properties and enable us to explore the capabilities and limitations of computation in the most general sense.

  6. Properties of A Computing Agent • We shall require that any computing agent • Can accept input • Can store information in and retrieve it from memory • Can take actions according to algorithm instructions, and that the choice of what action to take may depend on the present state of the computing agent as well as on the input item presently being processed • Can produce output

  7. The Turing Machine: Historical Prospective • Interest in the theoretical nature of computation far predated the advent of modern computers. • Mathematicians are interested in formalizing the nature of proof, with two goals in mind: • Guarantee the correctness of a proof • Allow for mechanical theorem proving • Leads to the study of the nature of computation procedure itself. • We will look at the model proposed by Alan Turing.

  8. The Turing Machine • A Turing machine includes a (conceptual) tape that extends infinitely in both directions. • The tape is divided into cells, each of which contains one symbol. • The symbols must come from a finite set of symbols called the alphabet. • The alphabet always contains a special symbol b (for “blank”), usually both of the symbols 0 and 1, and others. • At any point in time, only a finite number of cells contain nonblank symbols.

  9. The Turing Machine (cont’d) • Example: • The tape will be used to hold input to the Turing machine. • The Turing machine will write its output on the tape. • The tape will also serve as memory. . . b b 0 1 1 b b . . .

  10. The Turing Machine (cont’d) • The rest of the Turing machine consists of a unit that reads one cell of the tape at a time and writes a symbol in that cell. • There is a finite number k of “states” of the machine, labeled 1,2,…,k, and at any moment, the unit is in one of these states. • A Turing machine configuration: . . b b 0 1 1 b b . . . 1 (current state of the machine)

  11. The Turing Machine (cont’d) • The Turing machine is designed to carry out only one type of primitive operation. • Each time such an operation is done, three actions take place: • Write a symbol in the cell • Go into a new state • Move one cell left or right • The details of the actions depend on the current state of the machine and on the contents of the tape cell currently being read (the input).

  12. Primitive Operation (Instruction) • If you are in state Iand you are reading symbol jthen write symbol k onto the tape go into state s move in direction d

  13. Shorthand Notation for Turing Machine Instructions • Five components: • Current state • Current symbol • Next symbol • Next state • Direction of move • (current state, current symbol, next symbol, next state, direction of move)

  14. Example • (1,0,1,2,R) . . b b 0 1 1 b b . . . 1 (current state of the machine) . . b b 1 1 1 b b . . . 2 (current state of the machine)

  15. More on Turing Machine Instructions • What if we have (1,0,1,2,R) and (1,0,0,3,L) • Avoid ambiguity by requiring that a set of instructions for a Turing machine can never contain two different instructions of the form (i,j,-,-,-) and (i,j,-,-,-) • If there is no instruction that applies to the current state-current symbol for the machine, then the machine halts. • Conventions about initial configuration: • The start-up will always be state 1 • The machine will be reading the leftmost nonblank cell on the tape.

  16. Example • (1,0,1,2,R) • (1,1,1,2,R) • (2,0,1,2,R) • (2,1,0,2,R) • (2,b,b,3,L) . . b b 0 1 1 b b . . . 1

  17. Example (cont’d) . . b b 1 1 1 b b . . . 2 . . b b 1 0 1 b b . . . 2 . . b b 1 0 0 b b . . . 2 . . b b 1 0 0 b b . . . 3

  18. Turing Machine as a Computing Agent • The Turing machine can: • Read symbols on its tape. • Write symbols on its tape and, by moving around over the tape, can go back and read those symbols at a later time. • The present state and symbol determine the appropriate instruction • If the Turing machine halts, what is written on the tape at that time can be considered output.

  19. Summary • A Turing machine is a general computing machine. • It has no limit on the amount of memory.

  20. A Model of An Algorithm • An algorithm is a collection of instructions intended for a computing agent to follow. • Requirements: • Be a well-ordered collection • Consists of unambiguous and effectively computable operations • Halts in a finite amount of time • Produce a result • Does an arbitrary collection of Turing machine instructions satisfy all the requirements?

  21. Turing Machine Examples • Bit converter • (1,0,1,1,R) and (1,1,0,1,R) • A state diagram is a visual representation of a Turing machine algorithm where circles represent states, and arrows represent transitions from one state to another. • Along each transition arrow, we show three things: • The input symbol that causes the transition • The corresponding output • The direction of move

  22. A Parity Bit Machine • Odd parity bit: will be set so that the number of 1s in the whole string of bits, including the parity bit, is odd. • (1,1,1,2,R): even parity state reading 1, change state • (1,0,0,1,R):even parity state reading 0, don’t change state • (2,1,1,1,R): odd parity state reading 1, change state • (2,0,0,2,R):odd parity state reading 0, don’t change state • (1,b,1,3,R): end of string in even parity state, write 1 and go to state 3 • (2,b,0,3,R): end of string in even parity state, write 1 and go to state 3

  23. Unary Incrementing • Unary representation of numbers:Number Turing machine tape representation0 11 112 111 • Incrementing (algorithm 1): • (1,1,1,1,R): pass to the right over 1s • (1,b,1,2,R): Add a single one at the right hand side of the string . . b b 1 1 1 b b . . .

  24. Incrementing: Algorithm 2 • (1,1,1,1,L): pass to the left over 1s • (1,b,1,2,L): Add a single 1 at the left-hand end of the string • 2 steps vs. n+2 steps . . b b 1 1 1 b b . . .

  25. Unary Addition Machine • (1,1,b,2,R): erase the leftmost 1 and move right • (2,1,b,3,R): erase the second 1 and move right • (3,1,1,3,R):pass over any 1s until a blank is found • (3,b,1,4,R):write a 1 over the blank and halt.

  26. The Church-Turing Thesis • If there is an algorithm to do a symbol manipulation task, then there is a Turing machine to do that task. • If we find a symbol manipulation task that no Turing machine can perform, then there is no algorithm for this task. • Turing machines define the limits of Computability.

  27. Unsolvable Problems • Example:(1,0,1,2,R)(1,1,0,2,R)(2,0,0,2,R)(2,b,b,2,L) • …b11bbb… 2 • …b1bbb… 1

  28. The Halting Problem • Formal statement: Decide, given any collection of Turing machine instructions together with any initial tape contents, whether that Turing machine will ever halt if started on that tape. • The halting problem is unsolvable, and we will prove it by contradiction.

  29. Proof • Assume that P is a Turing machine that solves the halting problem. • On the initial for P we will have to put a description of a collection T of Turing machine instructions, as well as the initial tape content t on which those instructions run. • …T*btbbb… (T* symbolize the binary form of T)

  30. Proof (cont’d) • P will give us an answer • Yes, halts (1) • No, never halts (0) • When begun on a tape containing T* and t, • P halts with 1 on its tape exactly when T eventually halts when begun on t • P halts with 0 on its tape exactly when T never halts when begun on t • Refer to Figure 10.10

  31. Proof (cont’d) • Let’s imagine adding more instructions to P to create a new machine Q that behaves just like P except that when it reaches this sme configuration, it moves forever to the right on the tape instead of halting. (Refer to Figure 10.11) • Example: Pick some state not in P, say 52, and add two new instructions to P: • (9,1,1,52,R) • (52,b,b,52,R)

  32. Proof (cont’d) • Finally, create a new machine S which first makes a copy of what appears on its input. • After S is finished with its copying job, it uses the same instruction as machine Q. • What happens when machine S is run on a tape that contains S*, the binary representation of S? • S first makes a copy of S* and then turn the computation over to Q, which is now running on a tape containing S* and S*.

  33. Proof (cont’d) S* Input S*bS* S Never halts exactly when S eventually halts on S* Halts with 0 on tape exactly when S never halts on S* output Contradiction!

  34. Practical Unsolvable Problems • No C++ program can be written to decide whether any given C++ program always stops eventually, no matter what input. • No C++ program can be written to decide whether any two C++ programs are equivalent. • No C++ program can be written to decide whether any given C++ program on any given input will ever produce some specific output.

More Related