19_universality

# 19_universality - Fundamental Questions Duality...

This preview shows pages 1–4. Sign up to view the full content.

1 Introduction to Computer Science Sedgewick and Wayne Copyright © 2007 http://www.cs.Princeton.EDU/IntroCS Duality, Universality, and Computability 2 Fundamental Questions Q. What is a general-purpose computer? Q. Are there limits on the power of digital computers? Q. Are there limits on the power of machines we can build? Pioneering work in the 1930s. Hilbert, Gödel, Turing, Church, von Neumann. Automata, languages, computability, universality, complexity, logic. David Hilbert Kurt Gödel Alan Turing Alonzo Church John von Neumann Introduction to Computer Science Sedgewick and Wayne Copyright © 2007 http://www.cs.Princeton.EDU/IntroCS 7.5 Turing Machines Alan Turing (1912-1954) 4 Turing Machine Desiderata. Simple model of computation that is "as powerful" as conventional computers. Intuition. Simulate how humans calculate. Ex. Addition. 0 0 0 0 0 0 0 1 0 0 0 0 2 3 4 5 0 0 + 3 0 0 0 0 1 4 1 5 0 0 0 0 0 0 0 6 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 5 Turing Machine: Tape Tape. Stores input, output, and intermediate results. One arbitrarily long strip, divided into cells. Finite alphabet of symbols. Tape head. Points to one cell of tape. Reads a symbol from active cell. Writes a symbol to active cell. Moves left or right one cell at a time. tape head tape tape head tape # 1 1 0 0 + 1 0 1 1 # tape 6 L 0 L 1 1 : 0 R 2 L 3 # : # + : + R 4 H 5 0 : 1 # : 1 1 : 0 0 : 1 + : # # : # 1 : # Turing Machine: States State. What machine remembers. State transition diagram. Complete description of what machine will do. if in state 3 and tape head is 0 : write a 1 go to state 2 move tape head right # 1 1 0 0 + 1 0 1 1 # tape (before) 7 State. What machine remembers. State transition diagram. Complete description of what machine will do. L 0 L 1 1 : 0 R 2 L 3 # : # + : + R 4 H 5 0 : 1 # : 1 1 : 0 0 : 1 + : # # : # 1 : # Turing Machine: States # 1 1 + 1 0 1 1 # tape (after) 1 0 R if in state 3 and tape head is 0 : write a 1 go to state 2 move tape head right 8 Binary Adder # 1 0 1 0 + 1 1 1 1 # L L 1 : 0 R L # : # + : + R H 0 : 1 # : 1 find right end of y add one to x subtract one from y find plus sign 1 : 0 0 : 1 x y + : # # : # halt clean up 1 : #
3 9 Turing Machine: Initialization and Termination Initialization. Set input on some portion of tape; set tape head. Termination. Stop if enter yes , no , or halt state. infinite loop possible tape head # 1 0 1 0 + 1 1 1 1 # tape 10 Duality 11 Duality of Program and Data Data. Sequence of symbols (interpreted one way). Program. Sequence of symbols (interpreted another way). Program and data are interchangeable. Ex 1. A compiler is a program that takes a program in one language as input and outputs a program in another language. Java machine language 12 Duality of Program and Data Data. Sequence of symbols (interpreted one way). Program. Sequence of symbols (interpreted another way).

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern