15-312 Recitation the Last: Review
2002-12-04
Joshua Dunfield (joshuad@cs)
Carnegie Mellon University
- Final content: everything from mutable storage on; should be
comfortable with preceding material as well, but will not be
explicitly tested on it. The final is open book, open notes.
- TA office hours: not scheduled, but please feel free to make
an appointment.
- Mutable storage
ref(e), e1:=e2, !e
Locations l do not appear in code, but arise when a ref(e) is evaluated.
Store typing /\ ::= . | /\, l:tau
Store M ::= . | M, l=v
Transition judgment (M, e) |-> (M', e')
- Monads
- Subtyping & Intersection Types:
contravariant rule for functions,
subset interp., coercion interp., coherence
intersection types: sigma /\ tau
- Bidirectional Typing
- Records
tau ::= ... | {rho}
rho ::= . | l:tau, rho
e ::= ... | {r} | e.l
- Objects
- Dynamic typing
- Futures
- Concurrent processes
- Program equivalence
e ~= e' : tau iff neither terminates or e |->* v, e' |->* v', v ~- v' : tau
v ~- v' : int
v ~- v' : bool
v ~- v' : tau1 -> tau2
if for all v1 ~- v1' : tau1, it is the case that v v1 ~= v' v1' : tau2.
Note that functions are not, by themselves, observable.
Program equivalence is only meaningful _at a particular type_.
(Example from lecture notes.)
Example of program equivalence with lists:
First extend the definition of value equivalence:
v ~- v' : tau list if either v = v' = nil
or: v = h::t, v' = h'::t' and h ~- h', t ~- t'
Let map be defined as
fun map (f) is \l. case l of nil => nil | h::t => f(h) :: map f t
Show: map (\x.x) ~= map (\x.x+0) : int list -> int list.
Proof: By structural induction on v and v'.
(I can type it up if there's demand.)
- Pi-calculus
Suggested reading: lecture notes and recitation notes.
- Concurrent ML
- This week's lectures: closures, garbage collection
- Anything else on the schedule I forgot.