Lecture 23 Programming with Pictures Programming Wet Stuff

  • Slides: 44
Download presentation
Lecture 23: Programming with Pictures & Programming Wet Stuff “Toon. Talk is a video

Lecture 23: Programming with Pictures & Programming Wet Stuff “Toon. Talk is a video game for making video games. ” David Kahn, age 10. “It's an animated world that lets kids make, run, debug, and trade programs. ” Ken Kahn, David's dad CS 655: Programming Languages David Evans University of Virginia CS 655 http: //www. cs. virginia. edu/~evans Computer Science

Menu • Rotunda Presentations • Non-text based Programming • Amorphous Computing 9/15/2020 University of

Menu • Rotunda Presentations • Non-text based Programming • Amorphous Computing 9/15/2020 University of Virginia CS 655 2

Course Evaluations • You should have received email • Fill out the official evaluation

Course Evaluations • You should have received email • Fill out the official evaluation at: http: //www. people. virginia. edu/~ad 4 n/seas_evals/ • Must fill in before May 5 • Once you do, send me email to get the real evaluation – Specific questions like the midterm evaluation – Fill out after the final (this is an important part of the course to evaluate, no matter what SEAS thinks!) 9/15/2020 University of Virginia CS 655 3

Rotunda Presentations • Monday, 6: 30 pm • Laptop projector, screen, laptop with Power.

Rotunda Presentations • Monday, 6: 30 pm • Laptop projector, screen, laptop with Power. Point – If you need something else, let me know • Not all group members need talk • Aim for about 15 minutes (no more than 20) • Invite guests (but number limited) 9/15/2020 University of Virginia CS 655 4

Giving a Good Rotunda Talk • Pretend its a research conference talk – Your

Giving a Good Rotunda Talk • Pretend its a research conference talk – Your audience knows about the field, but not your specific area – Your goal is to make them want to learn more about your work • A good talk tells a story – Not a collection of slides 9/15/2020 University of Virginia CS 655 5

Beginning • Motivate your work – Convey why the problem you are solving is

Beginning • Motivate your work – Convey why the problem you are solving is interesting, important and exciting • It helps when you think so yourself, but act if you don’t – Place your work in context: how is it different from what others have done • Can do this at end instead • Teaser for your results – why should we listen to the rest of the talk? – Don’t need a full outline, but let audience know enough so they want to listen to the rest 9/15/2020 University of Virginia CS 655 6

Middle • Explain your solution – Don’t be comprehensive – convey the big picture

Middle • Explain your solution – Don’t be comprehensive – convey the big picture – Use pictures, metaphors, examples, etc. to explain what you did • Convey one technical nugget – Show one neat technical thing that came out of your work. Could be: • A surprising example • A design idea • A formalism 9/15/2020 University of Virginia CS 655 7

Last Third • Evaluation – Explain how you evaluated your work – Present your

Last Third • Evaluation – Explain how you evaluated your work – Present your results • Conclude – Summarize your conclusions with one key point 9/15/2020 University of Virginia CS 655 8

Some Specific Advice • Average 2 minutes per slide – Simple slides: big text,

Some Specific Advice • Average 2 minutes per slide – Simple slides: big text, use pictures, less words than this slide • Figure out what the most important 1 or 2 sentences in your talk are and memorize them • Practice – I will listen to any group that wants to practice their talk Sunday night; email your preferred time 6 pmmidnight. 9/15/2020 University of Virginia CS 655 9

Giving good talks is one of the most important ingredients of a research career.

Giving good talks is one of the most important ingredients of a research career. Take advantage of all opportunities you can to practice! 9/15/2020 University of Virginia CS 655 10

Programming • Everything we have seen so far looks identical to my Grandma: –

Programming • Everything we have seen so far looks identical to my Grandma: – Geeky engineer sits at a keyboard – Types a bunch of cryptic instructions giving step-bystep way of solving a problem 9/15/2020 University of Virginia CS 655 11

Declarative Programming • Prolog (Programmation en Logique) [Colmerauer and Roussel, 1972] – Designed for

Declarative Programming • Prolog (Programmation en Logique) [Colmerauer and Roussel, 1972] – Designed for natural language processing – Used in AI community • Program is a database of facts and inference rules, executes by proving or disproving conjectures • Separates logic from control: – Logic – requirements of a satisfactory answer specified by programmer – Control – how to get it (mostly hidden in interpreted) 9/15/2020 University of Virginia CS 655 12

PROLOG example: facts parent. Of (chelsea, bill) parent. Of (chelsea, hillary) parent. Of (bill,

PROLOG example: facts parent. Of (chelsea, bill) parent. Of (chelsea, hillary) parent. Of (bill, roger) parent. Of (bill, virginia) female (chelsea) These may look like female (hillary) function calls, but they are female (virginia) just axioms. male (bill) male (roger) occupation. Of (chelsea, student) occupation. Of (roger, used_car_salesman) 9/15/2020 University of Virginia CS 655 13

Interactive Session ? - parent. Of (chelsea, bill) Yes ? - parent. Of (chelsea,

Interactive Session ? - parent. Of (chelsea, bill) Yes ? - parent. Of (chelsea, roger) No ? - parent. Of (chelsea, X) X = bill; X = hillary; 9/15/2020 University of Virginia CS 655 14

Defining Rules • We can define a predicate in terms of other predicates: mother.

Defining Rules • We can define a predicate in terms of other predicates: mother. Of (X, M) : parent. Of (X, M), female (M) • Read: “M is the mother. Of X if M is the parent. Of X and M is female. ” ? - mother. Of (chelsea, Z) Z = hillary; 9/15/2020 University of Virginia CS 655 15

Combining Predicates grand. Mother. Of (X, G) : parent. Of (X, M), mother. Of

Combining Predicates grand. Mother. Of (X, G) : parent. Of (X, M), mother. Of (M, G) ancestor. Of (X, A) : - parent. Of (X, A) ancestor. Of (X, A) : parent. Of (X, P), ancestor. Of (P, A) 9/15/2020 University of Virginia CS 655 16

Evaluation • Uses unification algorithm like in type inference: guess all possibilities exhaustively ?

Evaluation • Uses unification algorithm like in type inference: guess all possibilities exhaustively ? - ancestor. Of (chelsea, X) X = bill; PROLOG specifies rules X = hillary; tried in order. X = roger; X = virginia; 9/15/2020 University of Virginia CS 655 17

PROLOG Factorial factorial (0, 1) factorial (N, F) : N > 0, factorial (D,

PROLOG Factorial factorial (0, 1) factorial (N, F) : N > 0, factorial (D, R), D is N - 1, F is N * R. ? - factorial (5, F) F = 120; ? - factorial (N, 27) no 9/15/2020 University of Virginia CS 655 18

Programming by Example • Sometimes called “Programming by Demonstration” • Programmer demonstrates task, system

Programming by Example • Sometimes called “Programming by Demonstration” • Programmer demonstrates task, system records • Widely used instance: – Word/Excel/Power. Point Macros 9/15/2020 University of Virginia CS 655 19

Stagecast Creator • Started as Kid. Sim Project, Apple • Before-After Rules: – Guard:

Stagecast Creator • Started as Kid. Sim Project, Apple • Before-After Rules: – Guard: predicate to match before invoking rule – Action: sequence of primitive operations Demo at end of class (time permitting) 9/15/2020 University of Virginia CS 655 20

Toon. Talk • Provide a video-game metaphor syntax to a regular programming language •

Toon. Talk • Provide a video-game metaphor syntax to a regular programming language • Variables = Boxes • Passing Parameters = Birds 9/15/2020 University of Virginia CS 655 21

Toon. Talk Metaphors • Comparison = Scale • Robots act like guarded commands –

Toon. Talk Metaphors • Comparison = Scale • Robots act like guarded commands – Thought bubble is predicate – Sequence of actions after matching Demo at end of class (time permitting) 9/15/2020 University of Virginia CS 655 22

Visual Programming A favorite subject for Ph. D dissertations in software engineering is graphical,

Visual Programming A favorite subject for Ph. D dissertations in software engineering is graphical, or visual, programming - the application of computer graphics to software design. . Nothing even convincing, much less exciting, has yet emerged from such efforts. I am persuaded that nothing will. Fred Brooks, 1987 9/15/2020 University of Virginia CS 655 23

Amorphous Computing Cement 10 GFlop 9/15/2020 University of Virginia CS 655 24

Amorphous Computing Cement 10 GFlop 9/15/2020 University of Virginia CS 655 24

Premise • Will soon be cheap to make lots of computational stuff so long

Premise • Will soon be cheap to make lots of computational stuff so long as: – It doesn’t all have to work correctly – Arrangements and interconnects are mushy • Examples: – Construct logic circuits using biological cells – Nanotechnology • How to you program it? – Get acceptable answers with high probability – Look to biology for inspiration and metaphors • Human genome: 3 Billion base pairs = 750 MB 9/15/2020 University of Virginia CS 655 25

Model • Computing elements sprinkled on a surface or in a volume • Each

Model • Computing elements sprinkled on a surface or in a volume • Each can talk to a few nearby neighbors, but not reliably • Each has modest computing power and a modest amount of memory • The particles are not synchonized, nor are they regularly arranged. 9/15/2020 University of Virginia CS 655 26

Slide adapted from Abelson/Knight/Sussman talk Why is this interesting? • • Physically feasible at

Slide adapted from Abelson/Knight/Sussman talk Why is this interesting? • • Physically feasible at any scale Forces robustness of design Potentially extremely inexpensive Provides the possibility of bulk computation – smart paints – smart gels – concrete by the Megaflops 9/15/2020 University of Virginia CS 655 27

Slide adapted from Abelson/Knight/Sussman talk Amorphous Computing Medium An amorphous medium has independent computational

Slide adapted from Abelson/Knight/Sussman talk Amorphous Computing Medium An amorphous medium has independent computational particles, all identically programmed. Each particle is represented by a spot in the picture, and different states are shown by different colors. 9/15/2020 University of Virginia CS 655 28

Biological Programming • Growing-Point Language [Coore 99] • Two primitive datatypes: – Materials –

Biological Programming • Growing-Point Language [Coore 99] • Two primitive datatypes: – Materials – colored stuff that can be left in amorphous medium – Pheromones – chemicals that attract or repel other growing points, spread out diffusely when secreted • Growing points may split, die, merge 9/15/2020 University of Virginia CS 655 29

Growing Point Program (define-growing-point (A-to-B-segment) (material A-material) What is deposited as it grows (tropism

Growing Point Program (define-growing-point (A-to-B-segment) (material A-material) What is deposited as it grows (tropism (ortho+ B-pheromone)) Grows towards increasing quantities of B-pheromone. (actions (when ((sensing? B-material) Stop when touching B-material. (terminate)) (default (propagate))))) 9/15/2020 University of Virginia CS 655 30

Growing Point Program (define-growing-point (B-point) (material B-material) What is deposited as it grows No

Growing Point Program (define-growing-point (B-point) (material B-material) What is deposited as it grows No tropism – it is stationary. (for-each-step (secrete 10 B-pheromone))) Distribute B-pheromone to neighbors, radiates approximately symmetrically, decreasing over 10 units. 9/15/2020 University of Virginia CS 655 31

Slide adapted from Abelson/Knight/Sussman talk Start with Vdd, Vss, and a Poly Contact 9/15/2020

Slide adapted from Abelson/Knight/Sussman talk Start with Vdd, Vss, and a Poly Contact 9/15/2020 University of Virginia CS 655 32

Slide adapted from Abelson/Knight/Sussman talk The poly contact sprouts a growing point that bifurcates

Slide adapted from Abelson/Knight/Sussman talk The poly contact sprouts a growing point that bifurcates and then grows toward the pheromones secreted by Vdd and Vss. 9/15/2020 University of Virginia CS 655 33

Slide adapted from Abelson/Knight/Sussman talk When the growing poly gets close to Vdd and

Slide adapted from Abelson/Knight/Sussman talk When the growing poly gets close to Vdd and Vss it is stopped by a short-range inhibition 9/15/2020 University of Virginia CS 655 34

Slide adapted from Abelson/Knight/Sussman talk The poly growing points die off, but first they

Slide adapted from Abelson/Knight/Sussman talk The poly growing points die off, but first they sprout P and N transistor diffusion growing points, which grow toward Vdd and Vss, where they drop contacts. 9/15/2020 University of Virginia CS 655 35

Slide adapted from Abelson/Knight/Sussman talk The diffusions also grow toward each other. When they

Slide adapted from Abelson/Knight/Sussman talk The diffusions also grow toward each other. When they hit they form a new poly contact and poly growing point. 9/15/2020 University of Virginia CS 655 36

Slide adapted from Abelson/Knight/Sussman talk The process then repeats, growing the next inverter. 9/15/2020

Slide adapted from Abelson/Knight/Sussman talk The process then repeats, growing the next inverter. 9/15/2020 University of Virginia CS 655 37

Slide adapted from Abelson/Knight/Sussman talk This process repeats to make an arbitrarily long chain

Slide adapted from Abelson/Knight/Sussman talk This process repeats to make an arbitrarily long chain of ugly, but topologically correct inverters. This demonstrates totally local control of precision topology. 9/15/2020 University of Virginia CS 655 38

Slide adapted from Abelson/Knight/Sussman talk (define-growing-point ((poly from-input-contact) Q-id) (material poly) (tropism constant Vdd-long

Slide adapted from Abelson/Knight/Sussman talk (define-growing-point ((poly from-input-contact) Q-id) (material poly) (tropism constant Vdd-long Vss-long) (initialize lifetime 5) (secrete (poly-short inhibitor) Q-id) (when (= lifetime 0) (start-growing-point (poly up) Q-id) (start-growing-point (poly down) Q-id) (terminate))) 9/15/2020 University of Virginia CS 655 39

Amorphous Computing Summary • If you have enough randomly-distributed amorphous stuff, can use GPL

Amorphous Computing Summary • If you have enough randomly-distributed amorphous stuff, can use GPL to produce any topology • We can build arbitrary logic out of biological stuff (DNA, RNA) – Once you can make an inverter, can program anything 9/15/2020 University of Virginia CS 655 40

Which of PROLOG, Toon. Talk, Creator, GPLs are Programming Languages? 9/15/2020 University of Virginia

Which of PROLOG, Toon. Talk, Creator, GPLs are Programming Languages? 9/15/2020 University of Virginia CS 655 41

What is a language? (Lecture 1) Nerdy Linguist’s Definition of Language: A description of

What is a language? (Lecture 1) Nerdy Linguist’s Definition of Language: 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. Liberal Definition of Programming Language: A language (according to the nerdy linguist’s definition) intended to be read and written by humans and processed by machines. 9/15/2020 University of Virginia CS 655 42

From Lecture 2: • Bruce Mac. Lellan’s definition: A language that is intended for

From Lecture 2: • Bruce Mac. Lellan’s definition: A language that is intended for the expression of computer programs and that is capable of expressing any computer program. • Ravi Sethi’s definition: Notations used for specifying, organizing, and reasoning about computations. 9/15/2020 University of Virginia CS 655 43

Charge • Tomorrow, 11: 59 pm – Project Reports due • Monday night: Rotunda

Charge • Tomorrow, 11: 59 pm – Project Reports due • Monday night: Rotunda Presentations • Next time: Jeopardy (in your project teams) 9/15/2020 University of Virginia CS 655 44