L8 Flashcards
Explain Landin’s knot
203
What is the problem associated with introducing state for the theory?
203-205
Every type is inhabited
Interaction between state + functions = recursive definitions
STLC is consistent but lost this when we added state
Explain how to overcome the theoretical problem associated with state
206
Describe the types, pure terms, impure terms, values, stores, contexts, store typings for the monadic language
207
Refs and T.
Get three new constructs for references.
Locations and wrapped impure code are both values.
Stores: loc -> value
Context: var -> type
Store Typing: loc -> type
Give rules for pure term typing in monadic language
208
A location that stores a value of type X has type ref X.
Give rules for effectful term typing in monadic language
209
let x=e;t – the e needs to be of type T X (i.e. wrapped)
return e implies that e is of (pure) type X — it isn’t effectful (conservative approximation)
Give rules for pure op sem of monadic language
210
What is the store typing relation? What is a configuration and configuration typing? Store and config typing for monadic language
213
- well typed store = given the asserted store typing, Sigma, is every location containing a well typed value consistent with what the store typing says for that location? (need two sigmas because one acts as an accumulator that is checked before everything has been added).
- ConfigOK=is store well typed and term well-typed (wrt impure typing relation, in empty var->type context?
- StoreCons also ensures that all expressions in store are closed.
- ConfigOK uses the effectful typing to check the term rather than the pure typing. A config’s term is essentially an impure rather than pure expression (for generality – as pure computations can’t depend on impure ones).
• Pure Term Weakening:
214
New var can go anywhere in the context list
• Pure Term Exchange:
214
• Pure Term Substitution:
214
• Effectful Term Weakening:
215
Remember to always use the effectful term type judgement for effectful terms
Effectful weakening is about the effectful type relation not the store typing
• Effectful Term Exchange:
215
• Effectful Term Substitution:
215
A pure term gets substituted into an effectful term
Proof ordering for monadic language
216
Two mutually recursive judgements – need to prove each meta theory using mutual induction