CSE 505 Programming Languages -...
Transcript of CSE 505 Programming Languages -...
![Page 1: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/1.jpg)
CSE 505Programming Languages
Intro1
![Page 2: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/2.jpg)
Today: IntroductionAdministrivia
Motivation and Goals
Overview
Caml Crash Course
2
![Page 3: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/3.jpg)
Hello! My name is...Zach Tatlockztatlock@csCSE 546
door is open!
New faculty first ever course!)
3
![Page 4: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/4.jpg)
ResourcesWeb: http://courses.cs.washington.edu/
courses/cse505/13au/
Mailing List: [email protected]
Piazza: (your course email will be subscribed)
4
![Page 5: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/5.jpg)
Structure4-5 Individual Homeworks:
- “pen & paper” (TeX) proofs- implementations in OCaml- challenge problems optional
Midterm & Final
Useful, Optional ReferencePierce’s Types and Programming Languages
5
![Page 6: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/6.jpg)
6
![Page 7: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/7.jpg)
Academic IntegrityDo. Not. Cheat.
Erodes the very foundation of academia.Absolutely not worth the risk.
Roughly: Discuss problem and sketch ideas together.Write your own solutions, note discussion partners.
When in doubt, ask!
7
![Page 8: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/8.jpg)
Today: IntroductionAdministrivia
Motivation and Goals
Overview
Caml Crash Course
8
![Page 9: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/9.jpg)
Today: IntroductionAdministrivia
Motivation and Goals
Overview
Caml Crash Course
9
![Page 10: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/10.jpg)
10
![Page 11: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/11.jpg)
11
![Page 12: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/12.jpg)
SOFTWAREIS
GREAT!!!
12
![Page 13: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/13.jpg)
The magic of myth and legend has been realized in our time. One simply types the correct incantation on a keyboard, and a display screen comes to life, showing things that never were nor could be.
Fred Brooks
13
![Page 14: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/14.jpg)
http://cs.brown.edu/events/talks/notkin.html
14
![Page 15: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/15.jpg)
SOFTWAREIS GREAT!!!
... but (often) still poorly understood!
15
![Page 16: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/16.jpg)
wat
https://www.destroyallsoftware.com/talks/wat
16
![Page 17: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/17.jpg)
Room For ImprovementDevelopment
quickly produce high quality code in teams
Maintenancecomprehend, extend, fix bugs, tune
Reliabilityavionics, medicine, finance, nuclear power
Require reasoning!17
![Page 18: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/18.jpg)
What do these do?
printf("%d", printf("%d", printf("%d", printf("%s", "husky"))));
a=0?(3>2?23:(2>5?(7<6?34:48):64)):1;printf("%d",a);
Realistic?
18
![Page 19: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/19.jpg)
Safe to optimize / refactor?class A { int f() { return 0; } }class B { int g(A x) { try { return x.f(); } finally { foo(); } }}
class A { int f() { return 0; } }class B { int g(A x) { return 0; }}
)19
![Page 20: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/20.jpg)
... nope.A could be extendedx could be nulls could have “side effects”
Safe to optimize / refactor?
How can we handle general case?How can we be sure it’s right?How do we automate?
20
![Page 21: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/21.jpg)
Goal
Develop tools to rigorously study what programs mean.
semantics
equivalence, termination, determinism, ...
21
![Page 22: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/22.jpg)
... [rigorous proofs about programs] are an absolute scientific ideal, like purity of materials in chemistry or accuracy of measurement in mechanics. The value of purity and accuracy (just like correctness) are often not appreciated until after the scientist has built the tools that make them achievable.
Sir C.A.R. Hoare
our goal is noble!
22
![Page 23: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/23.jpg)
Benefits
Writing a PL-ish thing is inevitableextensible systems, rich data structures, optimizer
Build skill with “Theory B” formalismsall research needs precision, expressiveness, clarity
Become better programmerstravel to understand where you’re from
23
![Page 24: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/24.jpg)
Today: IntroductionAdministrivia
Motivation and Goals
Overview
Caml Crash Course
24
![Page 25: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/25.jpg)
Today: IntroductionAdministrivia
Motivation and Goals
Overview
Caml Crash Course
25
![Page 26: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/26.jpg)
Which PL to Study?Well... which is the best?Aren’t they all the same?
Depends.Yes and no.
Challenges?
26
![Page 27: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/27.jpg)
Approach
Define small, tractable languagesTuring complete, but not for “real” programming
Extend with increasingly rich featuresextend reasoning techniques in parallel
Sketch application to “real” PLsimplement programs to connect theory with code
10 weeks is short!
27
![Page 28: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/28.jpg)
Subgoals
Develop tools for studying program behaviorinductive defns, structural induction, inference rules
Investigate core PL conceptstypes, functions, scope, mutation, iteration
28
![Page 29: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/29.jpg)
Today: IntroductionAdministrivia
Motivation and Goals
Overview
Caml Crash Course
29
![Page 30: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546](https://reader033.fdocuments.net/reader033/viewer/2022050119/5f4ffe32e412720141486a89/html5/thumbnails/30.jpg)
Today: IntroductionAdministrivia
Motivation and Goals
Overview
Caml Crash Course
30