Lecture 8: The Meaning of Life, Searching for Truth and The Stuff Primitives are Made Of (and a smattering of Quantum Physics) David Evans

Slides:



Advertisements
Similar presentations
Types and Programming Languages Lecture 7 Simon Gay Department of Computing Science University of Glasgow 2006/07.
Advertisements

Primitive Recursive Functions (Chapter 3)
1 Programming Languages (CS 550) Lecture Summary Functional Programming and Operational Semantics for Scheme Jeremy R. Johnson.
Functional Programming. Pure Functional Programming Computation is largely performed by applying functions to values. The value of an expression depends.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 3: Rules of Evaluation.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 39: Lambda Calculus.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 40: Computing with Glue and Photons.
School of Computing and Mathematics, University of Huddersfield CAS810: WEEK 3 LECTURE: LAMBDA CALCULUS PRACTICAL/TUTORIAL: (i) Do exercises given out.
Lisp. Versions of LISP Lisp is an old language with many variants –LISP is an acronym for List Processing language Lisp is alive and well today Most modern.
David Evans CS200: Computer Science University of Virginia Computer Science Class 31: Universal Turing Machines.
Cs1120 Fall 2009 David Evans Lecture 19: Stateful Evaluation.
Lecture 20: λ Calculus λ Calculus & Computability Yan Huang Dept. of Comp. Sci. University of Virginia.
David Evans Class 13: Quicksort, Problems and Procedures CS150: Computer Science University of Virginia Computer Science.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 2: Orders of Growth
CSE S. Tanimoto Lambda Calculus 1 Lambda Calculus What is the simplest functional language that is still Turing complete? Where do functional languages.
Exponents An exponent is the number of times the base is multiplied by itself. Example 27 can also be written as 3 This means 3 X 3 X 3.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 18: Think Globally, Mutate Locally.
David Evans CS200: Computer Science University of Virginia Computer Science Class 38: Fixed Points and Biological Computing.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 3: Rules of Evaluation.
David Evans CS200: Computer Science University of Virginia Computer Science Class 17: Mutation M. C. Escher, Day and Night.
Class 37: Secret of Life CS200: Computer Science
1 The Evaluator. 2 Compiler vs. Interpreter Command Processing Unit The Computer Program in Low Level Machine Language Program in High Level Language.
© Kenneth C. Louden, Chapter 11 - Functional Programming, Part III: Theory Programming Languages: Principles and Practice, 2nd Ed. Kenneth C. Louden.
CSE 230 The -Calculus. Background Developed in 1930’s by Alonzo Church Studied in logic and computer science Test bed for procedural and functional PLs.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 3: Levels of Abstraction
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 19: Environments.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 5: Recursing on Lists.
Dr. Philip Cannata 1 Simple Lisp John McCarthy Alonzo Church David Hilbert, Jules Richard, G. G. Berry, Georg Cantor, Bertrand Russell, Kurt Gödel, Alan.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 18: Mutation M. C. Escher, Day and.
Cs1120 Fall 2009 David Evans Lecture 18: Changing State Sounds of Colossus:
David Evans Class 15: P vs. NP (Smiley Puzzles and Curing Cancer) CS150: Computer Science University of Virginia Computer.
David Evans CS200: Computer Science University of Virginia Computer Science Class 32: The Meaning of Truth.
Lecture 3: Rules of Evaluation CS150: Computer Science
ITM © Port, KazmanVariables - 1 ITM 352 Data types, Variables Class #4.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 4: Programming with Data.
David Evans CS200: Computer Science University of Virginia Computer Science Class 32: The Meaning of Truth.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 22: Objectifying Objects.
David Evans CS150: Computer Science University of Virginia Computer Science Class 32: Computability in Theory and Practice.
Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. L03-1 September 14, 2006http:// -calculus: A Basis for.
The material in this lecture should be review. If you have not seen it before, you should be able to learn it quickly – and on your own. So we are going.
(Thunking about Thunks)
CS 550 Programming Languages Jeremy Johnson
Lecture 17: Environments CS200: Computer Science
Lecture 6: Lambda Calculus
Lecture 4: Evaluation Rules Recursion CS200: Computer Science
Class 22: Inheritance CS150: Computer Science University of Virginia
Lecture 7: List Recursion CS200: Computer Science
More on Lambda Calculus
CS 611: Lecture 9 More Lambda Calculus: Recursion, Scope, and Substitution September 17, 1999 Cornell University Computer Science Department Andrew Myers.
September 4, 1997 Programming Languages (CS 550) Lecture 6 Summary Operational Semantics of Scheme using Substitution Jeremy R. Johnson TexPoint fonts.
Lambda Calculus Revisited
Closures and Streams cs784(Prasad) L11Clos
Class 19: Think Globally, Mutate Locally CS150: Computer Science
Functional Programming
Class 36: The Meaning of Truth CS200: Computer Science
Lecture 13: Cost of Sorts CS150: Computer Science
Lecture 24: Metalinguistics CS200: Computer Science
Class 37: Making Lists, Numbers and Recursion from Glue Alone
Lecture 27: In Praise of Idleness CS200: Computer Science
Lecture 26: The Metacircular Evaluator Eval Apply
Class 33: Making Recursion M.C. Escher, Ascending and Descending
Announcements Quiz 5 HW6 due October 23
Class 31: Universal Turing Machines CS200: Computer Science
Lecture 10: Fixed Points ad Infinitum M.C. Escher, Moebius Ants
This Lecture Substitution model
Class 33: Learning to Count CS200: Computer Science
CSE S. Tanimoto Lambda Calculus
Lecture 14: Mocking Mockingbirds
Lecture 15: Crazy Eddie and the Fixed Points Background
Presentation transcript:

Lecture 8: The Meaning of Life, Searching for Truth and The Stuff Primitives are Made Of (and a smattering of Quantum Physics) David Evans CS655: Programming Languages University of Virginia Computer Science

13 Feb 2001CS 655: Lecture 82 Menu An Important Scientific Discovery! (with major implications for Programming Languages) Pictorial Calculi Searching for the Truth Token Rewards Manifest is online only today

13 Feb 2001CS 655: Lecture 83 Scientific Discovery Announced over Weekend Human genome is about half as big as previously thought – only about 30,000 genes! Genetic code for 2 humans differs in only 2.1 million genetic letters (4 million bits = 0.5 MB)

13 Feb 2001CS 655: Lecture 84 How big is.5 MB? 1/3 of a floppy disk <1% of Windows 2000 Lecture Slides 1, 2 and 3

13 Feb 2001CS 655: Lecture 85 Nature vs. C++ Microsoft Windows 2000: 50M lines of C++ code ~ 5GB of data Difference between Windows 2000 and Linux: essentially, all 50M lines ~ 5GB. Nature: Human: 30,000 genes (~3.1B base pairs ~ 1.5GB) Difference between me and Michael Jordan = 0.5MB

13 Feb 2001CS 655: Lecture 86 Nature vs. C++ The differences between any two people are at least 1000x more interesting than the differences between Linux and Windows 2000 Hence, nature’s programming language is: 5GB/.5MB * 1000 = ~10M times more expressive than C++ or ~100,000 times more expressive than Scheme

13 Feb 2001CS 655: Lecture 87 Is DNA Really a Programming Language?

13 Feb 2001CS 655: Lecture 88 Nerdy Linguist’s Definition A description of pairs (S, M), where S stands for sound, or any kind of surface forms, and M stands for meaning. A theory of language must specify the properties of S and M, and how they are related.

13 Feb 2001CS 655: Lecture 89 Programming Language (Definition from Lecture 1) A description of pairs (S, M), where S stands for sound, or any kind of surface forms, and M stands for meaning intended to be read and written by humans and processed by machines.

13 Feb 2001CS 655: Lecture 810 Stuff Programming Languages are Made Of Primitives Means of Combination Means of Abstraction My best guess: sequence that encodes a protein ?? Morphogenesis? Not well understood (by anyone). DNA itself – separate proteins from their encoding Genes – group DNA by function (sort of) Chromosomes – package Genes together Organisms – packages for reproducing Genes This is where most of the 100Kx improvement over Scheme comes from!?!

13 Feb 2001CS 655: Lecture 811 Biology is (becoming) a subfield of Computer Science Biological mechanisms are mostly understood (proteomics still has a way to go) What is not understood is how those are combined to create meaning Alex Hartemink (faculty candidate in Computational Biology), Monday 3:30

13 Feb 2001CS 655: Lecture 812 Pictorial Calculi Keenan’s paper Any important pictorial calculi?

13 Feb 2001CS 655: Lecture 813

13 Feb 2001CS 655: Lecture 814 Feynman Diagrams Pictorial calculi for understanding quantum electrodynamics Simple notations: electron photon Rules for combining and manipulating that calculate electromagnetic interactions

13 Feb 2001CS 655: Lecture 815 Richard Feynman ( ) Nobel Prize in Physics, 1965 (for work stemming from Feynman Diagrams) Leader in quantum computing (PS2) Leader in nanotechnology Co-taught computing course using (pre- publication) Wizard book Every aspiring scientist should read “Surely You’re Joking, Mr. Feynman” and “What Do You Care What Other People Think”

13 Feb 2001CS 655: Lecture 816 Lambda Calculus Summary so Far Rules for substitution Rules for reduction (only  -reduction does real work: substitution) Normal form (no more reductions possible) On faith: if you do outermost  -reduction first, you find the normal form if there is one

13 Feb 2001CS 655: Lecture 817 Lambda Calculus Intuition Lambda expression corresponds to a computation Normal form is that value of that computation But...can we do useful computations without primitives?

13 Feb 2001CS 655: Lecture 818 In search of the truth? What does true mean? True is something that when used as the first operand of if, makes the value of the if the value of its second operand: if T M N  M

13 Feb 2001CS 655: Lecture 819 Don’t search for T, search for if T  xy. x F  xy. y if  pca. pca

13 Feb 2001CS 655: Lecture 820 Finding the Truth T  xy. x F  xy. y if  pca. pca if T M N (( pca. pca) ( xy. x)) M N   ( ca. ( x.( y. x)) ca)) M N     ( x.( y. x)) M N   ( y. M )) N   M Prakash’s proof messed this up (p. 5)! Is the if necessary?

13 Feb 2001CS 655: Lecture 821 and and or? and  xy. if x y F or  xy. if x T y

13 Feb 2001CS 655: Lecture 822 What is three-ness? 3 trois III

13 Feb 2001CS 655: Lecture 823 Meaning of Numbers “Three-ness” is something who’s successor is “four-ness” “Three-ness” is something who’s predecessor is “two-ness” “Zero” is special. It has a successor “one-ness”, but no predecessor.

13 Feb 2001CS 655: Lecture 824 Meaning of Numbers pred (succ N)  N succ (pred N)  N succ (pred (succ N))  succ N... zero? Zero  T zero? (succ Zero)  F zero? (pred (succ Zero))  T...

13 Feb 2001CS 655: Lecture 825 Is this enough? Can we define add with pred, succ, zero? and Zero? add  xy.if (zero? x) y (add (pred x) (succ y))

13 Feb 2001CS 655: Lecture 826 Can we define lambda expressions that behave like Zero, zero?, pred and succ ? Hint: what if we had cons and cdr?

13 Feb 2001CS 655: Lecture 827 Numbers are Lists... zero? x = null? x pred x = cdr x succ x = cons F x

13 Feb 2001CS 655: Lecture 828 Cons and car cons  xy.( z.z xy) car  p.p T car cons M N = p.p T ( xy.( z.z xy)) M N   T ( xy.( z.z xy)) M N   T ( z.z M N)   M

13 Feb 2001CS 655: Lecture 829 Cdr too! cons  xy.( z.z xy) car  p.p T cdr  p.p F cdr cons M N = p.p F ( xy.( z.z xy)) M N   F ( xy.( z.z xy)) M N   F ( z.z M N)   N

13 Feb 2001CS 655: Lecture 830 Null and null? Null = p.p null? = x.x T null? Null   ( x.x T ) p.p   p.p T   T

13 Feb 2001CS 655: Lecture 831 null? (cons Null Null)   ( x.x T ) ( xy.( z.z xy) p.p p.p)   ( x.x T ) ( z.z p.p p.p)   ( z.z p.p p.p) T   (T p.p p.p)  xy. x p.p p.p  p.p  T (but is it equivalent to F ?) Figure it out, or what I did wrong for a token reward...

13 Feb 2001CS 655: Lecture 832 Counting 0  I 1  cons F 0 2  cons F 1 3  cons F 2... succ  x.cons F x pred  x.cdr x

13 Feb 2001CS 655: Lecture 833 Arithmetic Zero?  x.x T Zero? 0 = ( x.x T) I = T Zero? 1 = ( x.x T) [F, I] = F succ  x.[F, x] pred  x.x F pred 1 = ( x.x F) [F, I] = [F, I]F = I = 0 pred 0 = ( x.x F) I = IF = F

13 Feb 2001CS 655: Lecture 834 Factorial mult  xy. if (zero? x) 0 (add y (mult (pred x) y)) fact  x. if (zero? x) 1 (mult x (fact (pred x))) Recursive definitions should make you uncomfortable. Need for definitions should also bother you.

13 Feb 2001CS 655: Lecture 835 Summary All you need is application and abstraction and you can compute anything This is just one way of representing numbers, booleans, etc. – many others are possible Integers, booleans, if, while, +, *, =, <, subtyping, multiple inheritance, etc. are for wimps! Real programmers only use.

13 Feb 2001CS 655: Lecture 836 Token Rewards Haiyong – repeatuntil problem in PS1 solution Chris – problem with Prakash’s proof (p. 5).