1 / 36

The Meaning of Life and the Stuff Primitives are Made Of

Explore the meaning of life, the search for truth, and the fundamental components of programming languages. Discover the fascinating world of quantum physics and the implications for programming languages.

hagar
Télécharger la présentation

The Meaning of Life and the Stuff Primitives are Made Of

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 8: The Meaning of Life, Searching for Truth and The Stuff Primitives are Made Of (and a smattering of Quantum Physics) CS655: Programming Languages University of Virginia Computer Science David Evans http://www.cs.virginia.edu/~evans

  2. Menu • An Important Scientific Discovery! (with major implications for Programming Languages) • Pictorial Calculi • Searching for the Truth • Token Rewards • Manifest is online only today CS 655: Lecture 8

  3. 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) CS 655: Lecture 8

  4. How big is .5 MB? • 1/3 of a floppy disk • <1% of Windows 2000 • Lecture Slides 1, 2 and 3 CS 655: Lecture 8

  5. 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 CS 655: Lecture 8

  6. 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 CS 655: Lecture 8

  7. Is DNA Really a Programming Language? CS 655: Lecture 8

  8. 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. CS 655: Lecture 8

  9. 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. CS 655: Lecture 8

  10. 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). This is where most of the 100Kx improvement over Scheme comes from!?! DNA itself – separate proteins from their encoding Genes – group DNA by function (sort of) Chromosomes – package Genes together Organisms – packages for reproducing Genes CS 655: Lecture 8

  11. 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 CS 655: Lecture 8

  12. Pictorial Calculi • Keenan’s paper • Any important pictorial calculi? CS 655: Lecture 8

  13. CS 655: Lecture 8

  14. Feynman Diagrams • Pictorial calculi for understanding quantum electrodynamics • Simple notations: electron photon • Rules for combining and manipulating that calculate electromagnetic interactions CS 655: Lecture 8

  15. Richard Feynman (1918-1988) • 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” CS 655: Lecture 8

  16. Lambda CalculusSummary 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 CS 655: Lecture 8

  17. 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? CS 655: Lecture 8

  18. In search of thetruth? • 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: ifTMN M CS 655: Lecture 8

  19. Don’t search for T, search for if T  xy. x F  xy. y if pca . pca CS 655: Lecture 8

  20. 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 Is the if necessary? Prakash’s proof messed this up (p. 5)! CS 655: Lecture 8

  21. and and or? and xy. ifxyF or xy. ifxTy CS 655: Lecture 8

  22. What is three-ness? 3 trois III CS 655: Lecture 8

  23. 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. CS 655: Lecture 8

  24. Meaning of Numbers pred (succN)  N succ (predN)  N succ (pred (succN))  succN ... zero? Zero  T zero? (succ Zero)  F zero? (pred (succ Zero))  T ... CS 655: Lecture 8

  25. Is this enough? • Can we define add with pred, succ, zero? and Zero? add  xy.if (zero? x) y (add (pred x)(succ y)) CS 655: Lecture 8

  26. Can we define lambda expressions that behave likeZero, zero?, pred and succ? Hint: what if we had cons and cdr? CS 655: Lecture 8

  27. Numbers are Lists... zero? x = null? x pred x = cdr x succ x = cons F x CS 655: Lecture 8

  28. Cons and car cons xy.(z.z xy) car p.p T car cons MN = p.p T (xy.(z.z xy)) MN   T (xy.(z.z xy)) MN  T (z.z M N)  M CS 655: Lecture 8

  29. Cdr too! cons xy.(z.z xy) car p.p T cdr p.p F cdr cons MN = p.p F (xy.(z.z xy)) MN   F (xy.(z.z xy)) MN  F (z.z M N)  N CS 655: Lecture 8

  30. Null and null? Null = p.p null? = x.x T null? Null   (x.x T) p.p   p.pT   T CS 655: Lecture 8

  31. null? (cons NullNull)   (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... CS 655: Lecture 8

  32. Counting 0 I 1 cons F 0 2 cons F 1 3 cons F 2 ... succ  x.consFx pred  x.cdrx CS 655: Lecture 8

  33. 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 CS 655: Lecture 8

  34. Factorial mult  xy.if (zero?x) 0 (addy (mult (predx) y)) fact x. if (zero?x) 1 (multx (fact (predx))) Recursive definitions should make you uncomfortable. Need for definitions should also bother you. CS 655: Lecture 8

  35. 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 . CS 655: Lecture 8

  36. Token RewardsHaiyong – repeatuntil problem in PS1 solutionChris – problem with Prakash’s proof (p. 5). CS 655: Lecture 8

More Related