Download presentation
Presentation is loading. Please wait.
Published bySpencer Little Modified over 8 years ago
1
Lecture 8: The Meaning of Life, Searching for Truth and The Stuff Primitives are Made Of (and a smattering of Quantum Physics) David Evans http://www.cs.virginia.edu/~evans CS655: Programming Languages University of Virginia Computer Science
2
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
3
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)
4
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
5
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
6
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
7
13 Feb 2001CS 655: Lecture 87 Is DNA Really a Programming Language?
8
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.
9
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.
10
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!?!
11
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
12
13 Feb 2001CS 655: Lecture 812 Pictorial Calculi Keenan’s paper Any important pictorial calculi?
13
13 Feb 2001CS 655: Lecture 813
14
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
15
13 Feb 2001CS 655: Lecture 815 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”
16
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
17
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?
18
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
19
13 Feb 2001CS 655: Lecture 819 Don’t search for T, search for if T xy. x F xy. y if pca. pca
20
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?
21
13 Feb 2001CS 655: Lecture 821 and and or? and xy. if x y F or xy. if x T y
22
13 Feb 2001CS 655: Lecture 822 What is three-ness? 3 trois III
23
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.
24
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...
25
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))
26
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?
27
13 Feb 2001CS 655: Lecture 827 Numbers are Lists... zero? x = null? x pred x = cdr x succ x = cons F x
28
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
29
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
30
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
31
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...
32
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
33
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
34
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.
35
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.
36
13 Feb 2001CS 655: Lecture 836 Token Rewards Haiyong – repeatuntil problem in PS1 solution Chris – problem with Prakash’s proof (p. 5).
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.