a universal computer a universal computer
play

A Universal Computer A Universal Computer memory. A Turing machine - PDF document

One-Slide Summary The Turing machine is a fundamental model of computation. It models input, output, processing and A Universal Computer A Universal Computer memory. A Turing machine has a finite state machine controller as well as an


  1. One-Slide Summary • The Turing machine is a fundamental model of computation. It models input, output, processing and A Universal Computer A Universal Computer memory. A Turing machine has a finite state machine controller as well as an infinite tape . At each step it reads the current tape symbol, writes a new tape symbol, moves the tape head left or right one square, and moves to a new state in the finite state machine controller. Turing machines are universal : they are just as powerful as Scheme, Python, C, or Java. • The lambda calculus is also a universal, fundamental model of computation. You can view it as “the essence of Scheme”. #2 Thursday December 6 • Presentations in OLS 009 at 5pm – Extra credit for attending. – I will provide pizza and soda. – Rough head-count? • Lecture on December 6 th – Officially: Reading Day – Optional Class, you Vote • Quantum Computing? • Romance Novels? • Aspect-Oriented Programming? • Free-form Question and Answer? Why car? #3 Finite State Machine Turing’s Explanation • There are lots of things we can’t “We have said that the computable numbers are compute with only a finite number of those whose decimals are states calculable by finite • Solutions: means. ... For the – Infinite State Machine present I shall only say that the justification lies •Hard to describe and draw in the fact that the – Add an infinite tape to the Finite State human memory is Machine necessarily limited.” •We'll do this instead. #5 #6

  2. FSM + Infinite Tape Turing Machine Hardware • Start: • Infinite (“as much as you want”) Paper – FSM in Start State Tape – Input on Infinite Tape – can read from and write to – Pointer (= read/write head) to start of input – but only finite time ... • Step (4 sub-steps each time): – Read one input symbol from tape • Finite Brain (set of rules) – Write symbol on tape, and move L or R one square – modeling “Computers” (People) – Follow transition rule from current state • Finish: – Transition to halt state #7 #8 Turing Machine Matching Parentheses ... ... # 1 0 1 1 0 1 1 1 0 1 1 0 1 1 1 # • Find the leftmost ) – If you don’t find one, the parentheses match, write a 1 at the tape head and halt. Input: # • Replace it with an X Start Input: 1 Write: # Write: 0 • Look left for the first ( Move:  Move:  1 2 – If you find it, replace it with an X (they matched) Input: 0 Input: 1 – If you don’t find it, the parentheses didn’t Write: 0 Input: 0 Write: 1 3 Move:  match – end write a 0 at the tape head and Write: # Move:  Why is this machine Move:  halt not complete? #9 #10 Matching Parentheses Matching Parentheses (, (, R (, (, R X, X, L X, X, L ), X, L ), X, L X, X, R X, X, R 1: 1: 2: look 2: look look look Start Start for ( for ( for ) for ) ( , X, R ( , X, R #, 0, # #, 0, # #, 1, # #, 1, # HALT HALT Will this report the correct result for (()? #11 #12

  3. Matching Parentheses Turing Machine Infinite Tape (, (, R X, X, L z z z z z z z z z z z z z z z z z z z z z ), X, L X, X, R TuringMachine ::= < Alphabet , Tape , FSM > Alphabet ::= { Symbol* } 1 2: look  ), #, R ), X, L ( , X, R Tape ::= < LeftSide , Current , RightSide > for (  (, #, L Start 2: 1 look OneSquare ::= Symbol | # for ( Start Current ::= OneSquare (, X, R #, #, L LeftSide ::= [ Square* ] HAL T #, 0, - #, 1, - RightSide ::= [ Square* ] #, 1, # #, 0, # Finite State Machine #, 1, # Everything to left of LeftSide is # . 3: look Everything to right of RightSide is # . X, X, L for ( HALT (, 0, # How well does this model your computer? #13 #14 Liberal Arts Trivia: Politics Turing Machine: FSM + Infinite Tape • Start: • This military alliance, established by the – FSM in Start State North Atlantic Treaty in 1949, provides for a – Input on Infinite Tape system of collective defense whereby its – Tape head at start of input member states agree to help each other in • Step (4 sub-steps): response to an attack by an external party. – Read current input symbol from tape An infamous initial goal was “to keep the – Follow transition rule from current state on input • Write symbol on tape Russians out, the Americans in, and the • Move L or R one square Germans down.” The combined military • Update FSM state spending of its members accounts for over • Finish: Transition to halt state 70% of the world's total defense spending. #15 #16 f ( w ) A function has: Liberal Arts Trivia: Chemistry • Diacetylmorphine was first synthesized in 1874. It was later commercialized by (the company w  Domain D D that would become) Bayer in a failed effort to produce codeine. From 1898 to 1910 it was marketed as a non-addictive morphine substitute and cough suppressant, and as a cure for morphine addiction. It was quickly discovered  that it rapidly metabolized into morphine, and, f ( w ) S S Result Region as such, was essentially just a quicker form of morphine. Give today's name for this drug, which made field subjects feel heroic. #17 #18

  4. A function may have many parameters: Integer Domain: Unary: 11111 Example: 101 Binary: Addition function   f ( x , y ) x y Decimal: 5 x , y are integers We prefer Unary representation: Easier to manipulate #19 #20 Definition: Example f A function is computable if   f ( x , y ) x y is computable The function there is a Turing Machine such that: M x , y are integers    f ( w )  w Turing Machine: q q final state f 0 x 0 y Input string: unary Initial Configuration Final configuration xy 0 Output string: unary w  Domain D #21 #22   x y f ( x , y ) x y Start Turing machine for function     1 1 1 0 1 1 q 0 1  1 , R 1  1  1 , R 1 , L x  y Finish 0     1  1 , R , L 0 , L q q q q 2 0 1 3   1  1 1 0 1    , R q q final state f 4 #23 #24

  5. Time 0 Time 1 Execution Example: Time 0     1 1 0 1 1 1 1 0 1 1 x y  x 11 (2)   1 0 1 1 1 q q 0 0 q 0  1  y 11 1 , R (2) 1  1  1 , R 1 , L Final Result x  0     1  y 1 , R , L 0 , L q q q q 2 0 1 3   1 1 0 1 1    , R q q 4 4 #25 #26 Time 2 Time 3 Time 4 Time 5         1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 q q q q 0 1 1 1 1  1  1 , R 1  1  1 , R 1  1  1 , R 1 , L 1 , R 1 , L 0     1  0     1  , L , L 1 , R 0 , L 1 , R 0 , L q q q q q q q q 2 2 0 1 3 0 1 3       , R , R q q 4 4 #27 #28 Time 6 Time 7 Time 8 Time 9         1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 q q q q 3 2 3 3 1  1  1 , R 1 , R 1  1  1  1  1 , R 1 , L 1 , R 1 , L 0     0     1  1  1 , R , L 0 , L 1 , R , L 0 , L q q q q q q q q 2 2 0 1 3 0 1 3       , R , R q q 4 4 #29 #30

  6. Time 10 Time 11 Time 12       1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 q q q HALT & accept 3 3 4 1  1  1 , R 1 , R 1  1  1  1  1 , R 1 , L 1 , R 1 , L 0     1  0     1  1 , R , L 0 , L 1 , R , L 0 , L q q q q q q q q 2 2 0 1 3 0 1 3       , R , R q q 4 4 #31 #32 Liberal Arts Trivia: American Lit Liberal Arts Trivia: Chemistry • This early-20th-century American author • This highly flammable compound is formed by invited and wrote about cosmic horror, the nitrating cellulose through exposure to nitric idea that life is incomprehensible to human acid. It can be used as a propellant or low- minds and that the universe is fundamentally order explosive. French chemist Paul Vieille alien. Thus, those who genuinely reason invited the first practical smokeless powder gamble with insanity. He was little read for firearms and artillery ammunition from during life but is now regarded with Edgar this; is has also been used as a film base for Allen Poe as one of the most influential horror medical X-rays. It is commonly produced in writers of the 20 th century. introductory chemistry classes by treating cotton balls with nitric acid. #33 #34 Turing Machine Liberal Arts Trivia: Taoism z z z z z z z z z z z z z z z z z z z z • Name the group of legendary, undying xian from Chinese TuringMachine ::= < Alphabet , Tape , FSM > mythology. Each member's Alphabet ::= { Symbol* } ), X, L  ), #, R Tape ::= < LeftSide , Current , RightSide > power can be transferred to a  (, #, L 2: 1 look OneSquare ::= Symbol | # for ( Start tool that can give life or Current ::= OneSquare (, X, R LeftSide ::= [ Square* ] destroy evil. They are revered HAL T #, 0, - #, 1, - RightSide ::= [ Square* ] by Taoists, and include Royal Finite State Machine Uncle Cao , Iron Crutch Li , Everything to left of LeftSide is # . Everything to right of RightSide is # . Elder Zhang Guo , and Lu Tung- Pin . Many of them were said to practice neidan , or internal alchemy. #35 #36

Recommend


More recommend