CS 541 Lecture -*- Outline -*- * Rewrite systems universal machine, where machine details are less obvious ** Plotkin's Terminal transition systems (TTS) called labeled transition systems if the transitions labeled *** parts of a TTS --------------------- (Gamma, =>, T) Gamma: a set of configurations (e.g., g) => a binary relation on Gamma T subset of terminal configurations, must be such that if g in T, then there is no g' such that g => g' =>* transitive closure of => --------------------- *** use in semantics ------------------ I: Programs -> Gamma the input function O: T -> Answers the output function ------------------ ** Example: the lambda calculus -------------- Programs = LambdaTerms I = identity function on LambdaTerms Gamma = LambdaTerms T = Lambda Terms in normal form Answers = LambdaTerms/cnv(alpha) (alpha cnv equiv. classes) O = canonical map from LambdaTerms to equivalence class ------------- *** axioms for transitions (=>): ------------------- (\I.M)N => [N/I]M [beta-reduction] \I.MI => M, where I not free in M [eta-reduction] ------------------- *** inference rules: ------------------- M => M' _____________ [reduce-body] \I.M => \I.M' M => M' _____________ [app-operator] M N => M' N N => N' _____________ [app-operand] M N => M N' M => M' _____________ [parens] (M) => (M') ------------------- The configurations are usually more complex. ** Use in Semantics *** Meaning function, M --------------- M[[P]] = a iff there is a g in T such that I(P) =>* g and O(g)=a. ---------------- -partial in general -if => is deterministic, then M is well-defined (a function) however, not necessary that => be deterministic (as above) only has to be Church-Rosser (confluent) ** variations try some proofs in the above system, then change to call by value add syntax for naming add mu syntax (mu I . E) => [(mu I . E)/I]E with the FL semantics (which is little step) show a big step (evaluation semantics) variation ** Nondeterminism operator AMB that introduces nondeterminism AMB x y => x [Amb-1] AMB x y => y [Amb-2] destroys confluence (and referential transparency), but allows for models of parallelism Do different kinds of choice (angelic, demonic) ** full abstraction for reasoning about program, want semantics that has no unnecessary details... for example, in operational semantics of FL it's not clear that (rec F (proc n (if (= n 0) 0 (F (- n 1))))) and (rec G (proc n 0)) are the same function.