Glue, Photons, P=NP? Glue, Photons, P=NP? One-Slide Summary • The lambda calculus is a universal, fundamental model of computation. You can view it as “the essence of Scheme”. It contains terms and rules describing variables, function abstraction, and function application. • It is possible to encode programming concepts, such as true, false, if, numbers, lists, etc., in the lambda calculus. Lambda calculus can simulate Turing machines. • Quantum computers and non-determinsitic Turing machines can try many options at once. They are not more powerful than normal Turing machines. • The Complexity Class P contains tractable problems that can be solved in polynomial time. The Complexity Class NP contains problems for which solutions can be verified in polynomial time. DNA Helix Photomosaic from cover of • Does P = NP? We don't know! $1+ million if you know. Nature , 15 Feb 2001 (made by Eric Lander) #2 Final Exam Office Hours • Vote! • Sunday 1pm – My Apologies • Option A: All students must complete the • Evan Davis Today, 5pm – 9pm , Stacks take-home final exam. The final exam will be • Vote: Yes/No worth 15-50% of your grade, as per the – Evan Davis Tomorrow, 5pm-9pm, Stacks syllabus. Individuals may still opt for the • Pick At Most One Time and one Modality: comprehensive oral exam. – Yang He, Today, 6:00-7:00pm • Option B: There will be no final exam; no – Yang He, Tomorrow, any time except Noon-4pm student may complete the final exam. – Yang He, Wednesday, any time before 5pm Individuals may still opt for the – Pick One: Office Hour or aim/gchat channel comprehensive oral exam. #3 #4 What is 42? Lambda Calculus is a Universal Computer? z z z z z z z z z z z z z z z z z z z z 42 • Read/Write Infinite Tape ), X, L Mutable Lists forty-two ¬ ), #, R ¬ (, #, L • Finite State Machine 2: 1 look for ( Start Numbers (, X, R • Processing XLII HAL T #, 0, - #, 1, - Way to make decisions (if) Finite State Machine Way to keep going cuarenta y dos #5 #6
Meaning of Numbers Meaning of Numbers • “42-ness” is something who’s successor pred (succ N ) → N is “43-ness” succ (pred N ) → N • “42-ness” is something who’s succ (pred (succ N )) → succ N predecessor is “41-ness” • “Zero” is special. It has a successor “one-ness”, but no predecessor . zero? zero → T zero? (succ zero ) → F #7 #8 Is this enough? Can we define lambda terms Can we define add with pred , succ , zero? and zero ? that behave like zero , zero? , pred and succ ? add ≡ λ xy. if ( zero? x ) y ( add ( pred x ) ( succ y )) Hint: what if we had cons , car and cdr ? #9 #10 Liberal Arts Trivia: Numbers are Lists... Religious Studies •In Sunni Islam, the Five Pillars of zero? ≡ null? Islam are five duties incumbent pred ≡ cdr on Muslims. They include the succ ≡ λ x . cons F x Profession of Faith, Formal Prayers, and Giving Alms. Name The length of the list corresponds to the number value. the remaining two pillars. #11 #12
cons and car Making Pairs cons ≡ λ x. λ y. λ z.zxy Example: cons M N = ( λ x. λ y. λ z.zxy ) M N → β ( λ y. λ z.z M y ) N (define ( make-pair x y) ( lambda (selector) ( if selector x y))) → β λ z.z MN T ≡ λ xy . x car ≡ λ p.p T (define ( car-of-pair p) (p #t)) Example: car (cons M N) ≡ car ( λ z.z MN) ≡ ( λ p.p T ) (define ( cdr-of-pair p) (p #f)) ( λ z.z MN) → β ( λ z.z MN) T → β T MN → β ( λ xy . x ) MN A pair is just an if statement that → β ( λ y . M)N chooses between the car (then) and the cdr (else). → β M #13 #14 cdr too! Null and null? cons ≡ λ xyz.zxy null ≡ λ x. T car ≡ λ p.p T null? ≡ λ x. ( x λ y. λ z. F ) cdr ≡ λ p.p F Example: Example: cdr (cons M N) null? null → λ x. ( x λ y. λ z. F ) ( λ x. T ) cdr λ z.z MN = ( λ p.p F) λ z.z MN → β ( λ x. T ) ( λ y. λ z. F ) → β ( λ z.z MN) F → β T → β FMN → β N #15 #16 Null and null? Counting null ≡ λ x. T 0 ≡ null null? ≡ λ x. ( x λ y. λ z. F ) 1 ≡ cons F 0 2 ≡ cons F 1 Example: 3 ≡ cons F 2 null? (cons M N) → λ x. ( x λ y. λ z. F ) λ z.z MN ... → β ( λ z.z MN) ( λ y. λ z. F ) succ ≡ λ x . cons F x → β ( λ y. λ z. F ) MN pred ≡ λ x . cdr x → β F #17 #18
42 = λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y Lambda Calculus is a Universal Computer λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) z z z z z z z z z z z z z z z z z z z z λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) ), X, L λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y ¬ ), #, R ¬ (, #, L 2: λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. 1 look for ( • Read/Write Infinite Tape Start ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) (, X, R Mutable Lists λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y HAL • Finite State Machine T #, 0, - #, 1, - λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. Finite State Machine Numbers to keep track of state ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) • Processing Way of making decisions (if) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) λ xy . y λ xy. ( λ z.z xy ) Way to keep going λ xy . y λ x. T #19 #20 Liberal Arts Trivia: Equivalent Computers! Biology, Chemistry • While rendered fat obtained form pigs is ... z z z z z z z term = variable known as lard, rendered beef or mutton fat | term term is known as this . It is used to make animal | ( term ) | λ variable . term feed and soap. Historically, it was used to ), X, L ¬ ), #, R ¬ (, #, L 2: can simulate make candles: it provided a cheaper 1 look for ( Start λ y . M ⇒ α λ v . ( M [ y → v ]) (, X, R alternative to wax. Before switching to where v does not occur in M . HAL T #, 0, - #, 1, - can simulate vegetable oil in 1990, McDonald's cooked Finite State Machine ( λ x . M ) N ⇒ β M [ x → N ] fries in 93% this and 7% cottonseed oil. Turing Machine Lambda Calculus #21 #22 Universal Computer What about “non-mechanical” computers? • Lambda Calculus can simulate a Turing Machine – Everything a Turing Machine can compute, Lambda Calculus can compute also • Turing Machine can simulate Lambda Calculus (we didn’t prove this) – Everything Lambda Calculus can compute, a Turing Machine can compute also • Church-Turing Thesis : this is true for any other mechanical computer also #23 #24
Quantum Physics Quantum Computing for Dummies • Feynman, 1982 • Quantum particles are in all possible states • Light behaves like both a wave and a particle at the same time • Can try lots of possible computations at • A single photon is in many states at once with the same particles once • In theory, can test all possible • Can’t observe its state without factorizations/keys/paths/etc. and get the forcing it into one state right one! • Schrödinger’s Cat – Put a live cat in a box with cyanide vial • In practice, very hard to keep states that opens depending on quantum state entangled: once disturbed, must be in just – Cat is both dead and alive at the same one possible state time until you open the box #25 #26 Quantum Computers Today Qubit • Several quantum algorithms • Regular bit: either a 0 or a 1 – Shor’s algorithm: factoring using a quantum computer • Quantum bit : 0, 1 or in between • Actual quantum computers – p% probability it is a 1 – 5-qubit computer built by IBM (2001) • A single qubit is in 2 possible states at once – Implemented Shor’s algorithm to factor: • “World’s most complex quantum computation” 15 (= 5 * 3) • If you have 7 bits, you can represent any – D-Wave 16-qubit quantum computer (2007) one of 2 7 different states • Solves Sudoku puzzles • If you have 7 qubits, you have 2 7 different • To exceed practical normal computing need > 50 qubits states (at once!) – Adding another qubit is more than twice as hard #27 #28 Two Ways of Thinking about Nondeterministic Computing Nondeterminstic Computing ... ... 1 1 1 1 1 1 1 1 # # 1 1 1 1 1 1 1 • Omniscient (all-knowing): machine always guesses right (the right guess is There can be multiple Input: 1 Input: 1 Write: 1 transitions on the same the one that eventually leads to a halting Start Write: 1 Move: → input. Nondeterministic state) Move: → TM takes all of them at once. Each gets its 1 • Omnipotent (all-powerful): machine can 2 own independent copy split in two every step, all resulting of the tape. If any path finds halting state, that machines execute on each step, if one of Input: # is the result. 3 Write: # the machines halts its tape is the output Move: → #29 #30
Recommend
More recommend