
































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Professor: Pierce; Class: SOFTWARE FOUNDATIONS; Subject: Computer & Information Science; University: University of Pennsylvania; Term: Fall 2004;
Typology: Study notes
1 / 72
This page cannot be seen from the preview
Don't miss anything!

































































CIS 500, 6 October
1
Today’s lecture will not be covered by the midterm.
Next Monday, review class.
Old exams and review questions on webpage.
No recitation sections next week.
New office hours next week, watch newsgroup for details.
CIS 500, 6 October
2
Where we’ve been:
Inductive definitions
abstract syntax
inference rules
Proofs by structural induction
Operational semantics
The lambda-calculus
Typing rules and type soundness
Where we’re going:
“Simple types” for the lambda-calculus
references, exceptions, etc.)Formalizing more features of real-world languages (records, datatypes,
Subtyping
Objects
CIS 500, 6 October
3-a
CIS 500, 6 October
4
types
Bool
type of booleans
types of functions
CIS 500, 6 October
6
true
Bool
T-True
false
Bool
T-False
t 1
Bool
if t
1
then t
2
else t
3
T-If
CIS 500, 6 October
7
true
Bool
T-True
false
Bool
T-False
t 1
Bool
if t
1
then t
2
else t
3
T-If
x:T
T-Var
CIS 500, 6 October
7-b
true
Bool
T-True
false
Bool
T-False
t 1
Bool
t 2 : T Γ t 3 : Tif t
1
then t
2
else t
3
T-If
x:T
T-Var
CIS 500, 6 October
7-c
true
Bool
T-True
false
Bool
T-False
t 1
Bool
t 2 : T Γ t 3 : Tif t
1
then t
2
else t
3
T-If
x:T
T-Var
x:T
λ x:T
1 .t
T-Abs
11
12
11
12
T-App
CIS 500, 6 October
7-e
What derivations justify the following typing statements?
λ x:Bool.x) true
Bool
f:Bool
Bool
f (if false then true else false)
Bool
f:Bool
Bool
λ x:Bool. f (if x then false else x)
Bool
Bool
CIS 500, 6 October
8
→
soundness As before, the fundamental property of the type system we have just defined is
with respect to the operational semantics.
Progress:
A closed, well-typed term is not stuck
If
t
, then either
t
is a value or else
t
− →
t (^) ′
for some
t (^) ′ .
Preservation:
Types are preserved by one-step evaluation
If
t
and
t
− →
t (^) ′ , then
t (^) ′
CIS 500, 6 October
9-a
Same steps as before...
CIS 500, 6 October
10
true
Bool
T-True
false
Bool
T-False
t 1
Bool
t 2 : T Γ t 3 : Tif t
1
then t
2
else t
3
T-If
x:T
T-Var
x:T
λ x:T
1 .t
T-Abs
11
12
11
12
T-App
CIS 500, 6 October
11
Lemma:
If
true
, then
Bool
If
false
, then
Bool
If
if t
1
then t
2
else t
3
, then
t 1
Bool
and
t 2 , (^) t
3
CIS 500, 6 October
12