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

Notes: Monday 14 April 2003

Exam 2
Exam 2 will be handed out Friday, and due Wednesday, 23 April. It will cover everything in the course through the end of today's lecture, but will focus on material that was not covered on Exam 1. Exam 2 is open book; you will be permitted to use DrScheme if you want, but the questions will be designed to discourage you from doing that.

You should not be surprised if the exam contains questions about measuring work using O, Θ and &Omega); complexity classes P, NP and NP-Complete; computability; models of computation; Turing Machines; Lambda Calculus; universal languages; state and mutation; programming with objects and inheritance; metalinguistic abstraction; and variations on Scheme. There may also be a question or two that expect you to define recursive procedures and use procedures as parameters and results.

Instead of a review session for Exam 2, I will have office hours this week Wednesday, after class - 3:45; Thursday 10am-10:45am; Thursday 4-5pm. You will also have an opportunity to ask questions in class Friday before receiving Exam 2.


How do we prove a model of computation is equivalent to a Turing Machine?

Lambda Calculus

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

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 ]

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

Making "Primitives" out of nothing but Glue

T ≡ λ xy . x)
F ≡ λ xy . y
if ≡ λ pca . pca

cons ≡ λ xy .z . zxy)
car ≡ λ p . p T
cdr ≡ λ p . p F

null ≡ λ p . T
null? ≡ λ x . (x λ y . λ z . F)

succ ≡ λ x . cons F x

1succ 0cons F null
2succ 1cons F (cons F null)


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.

If you find the meaning of life from class unsatisfying, try Eliezer S. Yudkowsky's Frequently Asked Questions about the Meaning of Life.

My account of truth is realistic, and follows the epistemological dualism of common sense. Suppose I say to you 'The thing exists' -- is that true or not? How can you tell? Not till my statement has developed its meaning farther is it determined as being true, false, or irrelevant to reality altogether. But if now you ask 'what thing?' and I reply 'a desk'; if you ask 'where?' and I point to a place; if you ask 'does it exist materially, or only in imagination?' and I say 'materially'; if moreover I say 'I mean that desk,' and then grasp and shake a desk which you see just as I have described it, you are willing to call my statement true. But you and I are commutable here; we can exchange places; and, as you go bail for my desk, so I can go bail for yours.
William James' explanation of The Meaning of Truth in 1911.
We'll stick with the T ≡ λ xy . x) version.

CS 200

CS 200: Computer Science
Department of Computer Science
University of Virginia
Using these Materials