University of Virginia, Department of Computer Science
CS200: Computer Science, Spring 2002

Notes: 17 April 2002

Schedule
Optional Readings
Guy L. Steele, Growing a Language, OOPSLA 1998 Keynote. Guy Steele was a co-designer of Scheme, and one of the leading proponents of Java (and a co-author of the Java Language Specificaion). The second page shows a machine that is equivalent to a Turing Machine. If you are bothered by the sexist language in this paper, read Douglas Hofstadter's A Person Paper on Purity in Language (attached to Steele's paper). If you weren't bothered by the sexist language in this paper, you should especially read Douglas Hofstadter's A Person Paper on Purity in Language. Read the Post Scriptum on this essay before you find it offensive.

Unlike most authors, Guy Steele had a good excuse for using sexist language because of the unusual writing constraint he imposed (which will be made clear if you read the paper). You, on the other hand, have no such excuse. I will be intolerant of sexist language in your project reports.

Lambda Calculus — you don't need to read these, but if you want more information on Lambda Calculus, here are some good sources:

Lambda Calculus
What is a calculus?




What properties make Scheme too complex to be a good model of computation?





Lambda Calculus is a set of rules for manipulating symbols. They can be given meanings that map well to computation.

Lambda Calculus Term Grammar

term ::= variable
term ::= term term
term ::= ( term )
term ::= λ variable . term

Rules

Alpha Reduction: (renaming variables)
λ y . Mα λ v . M [y |→ v]) where v does not occur in M.
We can can change the name of a lambda variable, but replacing all occurances of the variable in the body term with a new name that does not appear in the body term.

Beta Reduction: (substitution)

x . M) Nβ M [ x |→ N ]
Identity

Two lambda calculus terms are (syntactically) identical (≡) only if one of these is true:

xy if x and y are same name
M1 M2N1 N2N2 if M1N1 and M2N2
(M)(N) if MN
λ x. M ≡ λ y . N if xy and MN.
How can we know those are all the rules we need to determine if any two lambda calculus terms are equivalent?










Substitution

  1. For term ::= variable:
    • y [x |→ N] = N where xy
    • y [x |→ N] = y where xy
  2. For term ::= term term:
    • M1 M2 [x |→ N] = M1 [x |→ N] M2 [x |→ N]
  3. For term ::= ( term ):
    • (M) [x |→ N] ::= (M [x |→ N])
  4. For λ variable . term (we need a lot of complicated rules in case variable names are reused, otherwise it would be easy)
    • x . M) [x |→ N] = λ x . M
    • y . M) [x |→ N] = λy . (M [x |→ N]) where xy and y does not appear free in N and x appears free in M.
    • y . M) [x |→ N] = λy . M where xy and x does not appear free in M.
    • y . M) [x |→ N] = λy . (M [x |→ N]) where xy and y does not appear free in N or x does not appear free in M.
    • y . M) [x |→ N] = λz . (M [y |→ z) [x |→ N] where x &neq; y, zx and zy and z does not appear in M or N, x does occur free in M and y does occur free in N.
Uninteresting Reduction Rules

MM
PMPN if MN
MPNP if MN
λ x . M ⇒ λ x . N ⇒ if MN
M ⇒ P if MN and N ⇒ P

Example

λ f . ((λ x . f (xx)) (λ x . f (xx)))








CS 655 University of Virginia
Department of Computer Science
CS 200: Computer Science
David Evans
evans@cs.virginia.edu
Using these Materials