
One-Slide Summary • The Turing machine is a fundamental model of computation. It models input, output, processing and memory. A Turing machine has a finite state machine AA UniversalUniversal ComputerComputer 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 6th – 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 compute with only a finite number of computable numbers are states those whose decimals are calculable by finite • Solutions: means. ... For the – Infinite State Machine present I shall only say •Hard to describe and draw that the justification lies – Add an infinite tape to the Finite State in the fact that the Machine human memory is •We'll do this instead. necessarily limited.” #5 #6 FSM + Infinite Tape Turing Machine Hardware • Start: – FSM in Start State • Infinite (“as much as you want”) Paper – Input on Infinite Tape Tape – Pointer (= read/write head) to start of input – can read from and write to • Step (4 sub-steps each time): – but only finite 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: # Start Input: • Replace it with an X Write: # 1 Move: Write: 0 • Look left for the first ( Move: 1 2 – If you find it, replace it with an X (they Input: matched) Input: 1 0 Write: Write: 1 0 Input: 0 – If you don’t find it, the parentheses didn’t Move: Move: Write: # 3 Why is match – end write a 0 at the tape head and Move: this machine not complete? halt #9 #10 Matching Parentheses Matching Parentheses (, (, R (, (, R X, X, L X, X, L X, X, R ), X, L X, X, R ), X, L 1: 2: look 1: 2: look Start look Start look for ) for ( for ) for ( (, X, R (, X, R #, 1, # #, 0, # #, 1, # #, 0, # HALT HALT Will this report the correct result for (()? #11 #12 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 ), X, L X, X, R TuringMachine ::= < Alphabet, Tape, FSM > ), #, R 2: look ), X, L Alphabet ::= { Symbol* } (, #, L 1 (, X, R for ( 2: Tape ::= < LeftSide, Current, RightSide > Start 1 look for ( Start OneSquare ::= Symbol | # (, X, R Current ::= OneSquare #, #, L HAL T #, 0, - LeftSide ::= [ Square* ] #, 1, - RightSide ::= [ Square* ] #, 1, # #, 0, # Finite State Machine 3: look #, 1, # Everything to left of LeftSide is #. X, X, L for ( Everything to right of RightSide is #. HALT (, 0, # How well does this model your computer? #13 #14 Turing Machine: FSM + Infinite Tape Liberal Arts Trivia: Politics • Start: – FSM in Start State • This military alliance, established by the – Input on Infinite Tape North Atlantic Treaty in 1949, provides for a – Tape head at start of input system of collective defense whereby its • Step (4 sub-steps): member states agree to help each other in – Read current input symbol from tape response to an attack by an external party. – Follow transition rule from current state on input An infamous initial goal was “to keep the • Write symbol on tape Russians out, the Americans in, and the • Move L or R one square • Update FSM state Germans down.” The combined military • Finish: Transition to halt state spending of its members accounts for over 70% of the world's total defense spending. #15 #16 Liberal Arts Trivia: Chemistry A function f (w) has: • Diacetylmorphine was first synthesized in 1874. It was later commercialized by (the company that would become) Bayer in a failed effort to Domain D w D 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, S f (w) S as such, was essentially just a quicker form of Result Region morphine. Give today's name for this drug, which made field subjects feel heroic. #17 #18 Integer Domain: A function may have many parameters: Unary: 11111 Example: Binary: 101 Addition function Decimal: 5 f (x, y) x y We prefer Unary representation: x, y are integers Easier to manipulate #19 #20 Definition: Example A function f is computable if The function f (x, y) x y is computable there is a Turing Machine M such that: x, y are integers w f (w) Turing Machine: q0 q f final state Input string: x0y unary Initial Configuration Final configuration Output string: xy0 unary w D Domain #21 #22 Start x y Turing machine for function f (x, y) x y 1 1 1 0 1 1 q0 11, R 11, R 11, L x y Finish 0 1, R , L 1 0, L q0 q1 q2 q3 1 1 1 1 0 , R q f final state q4 #23 #24 Time 0 Time 1 Execution Example: Time 0 1 1 0 1 1 1 1 0 1 1 x y x 11 (2) 1 1 0 1 1 q0 q0 q0 y 11 (2) 11, R 11, R 11, L Final Result x y 0 1, R , L 1 0, L q0 q1 q2 q3 1 1 1 1 0 , R q4 q4 #25 #26 Time 2 Time 3 Time 4 Time 5 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 q0 q1 q1 q1 11, R 11, R 11, L 11, R 11, R 11, L 0 1, R , L 1 0, L 0 1, R , L 1 0, L q0 q1 q2 q3 q0 q1 q2 q3 , R , R q4 q4 #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 q2 q3 q3 q3 11, R 11, R 11, L 11, R 11, R 11, L 0 1, R , L 1 0, L 0 1, R , L 1 0, L q0 q1 q2 q3 q0 q1 q2 q3 , R , R q4 q4 #29 #30 Time 10 Time 11 Time 12 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 q q q 3 3 4 HALT & accept 11, R 11, R 11, L 11, R 11, R 11, L 0 1, R , L 1 0, L 0 1, R , L 1 0, L q0 q1 q2 q3 q0 q1 q2 q3 , R , R q4 q4 #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 20th century. introductory chemistry classes by treating cotton balls with nitric acid. #33 #34 Liberal Arts Trivia: Taoism Turing Machine 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 > ), X, L mythology. Each member's ), #, R Alphabet ::= { Symbol* } (, #, L 2: Tape ::= < LeftSide, Current, RightSide > 1 look power can be transferred to a for ( Start OneSquare ::= Symbol | # tool that can give life or (, X, R Current ::= OneSquare HAL T #, 0, - LeftSide ::= [ Square* ] #, 1, - destroy evil. They are revered 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 Describing Finite State Machines Enumerating Turing Machines TuringMachine ::= < Alphabet, Tape, FSM > FSM ::= < States, TransitionRules, InitialState, HaltingStates > • Now that we’ve decided how to describe States ::= { StateName* } Turing Machines, we can number them InitialState ::= StateName must be element of States HaltingStates ::= { StateName* } all must be elements of States • TM-5023582376 = balancing parens TransitionRules ::= { TransitionRule* } TransitionRule ::= • TM-57239683 = even number of 1s < StateName, ;; Current State Transition Rule is a procedure: • TM-3523796834721038296738259873 = Photomosaic Program OneSquare, ;; Current square Inputs: StateName, OneSquare StateName, ;; Next State Outputs: StateName, OneSquare, • TM-3672349872381692309875823987609823712347823 = Windows 7 OneSquare, ;; Write on tape Direction Direction > ;; Move tape Direction ::= L, R, # #37 #38 Enumerating Turing Machines Universal Turing Machine • Now that we’ve decided how to describe Turing Machines, we can number them P Output • TM-5023582376 = balancing parens Number Universal of TM Tape • TM-57239683 = even number of 1s Turing for running • TM-3523796834721038296738259873 = Photomosaic Program I TM-P Machine in tape I • TM-3672349872381692309875823987609823712347823 = Windows 7 Input Not the real Tape numbers – they Can we make a Universal Turing Machine? would be much also, just a number! bigger! #39 #40 Yes! • People have designed Universal Turing Machines with – 4 symbols, 7 states
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages9 Page
-
File Size-