









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: Paper; Class: PROGRAMNG LANGUAGES; Subject: COMPUTER SCIENCE; University: Iowa State University; Term: Unknown 1997;
Typology: Papers
1 / 15
This page cannot be seen from the preview
Don't miss anything!










Com S 541
!
τ
1
σ
"
τ
2
σ
σ
τ
σ
"
τ
σ
τ
σ
σ
σ
τ
σ
τ
σ
1
τ
2
σ
2
σ
σ
1
τ
σ
1
τ
σ
1
τ
σ
1
τ
σ
τ
σ
τ
"
σ
σ
"
(
τ
"
σ)
σ
τ
τ
τ "
τ
σ
"
( τ
"
τ)
Com S 541
!
!
Α
1
τ
2
σ
2
σ
Α
1
τ
Α
Β
Α
Β
"
Α
Α
"
(
Β
"
Α)
Α
"
(
Β
"
Α)
τ
σ
Β
τ
Β
"
τ
σ
τ
Com S 541
!
Even the polymorphic lambda calculus is not powerful enoughto express certain lambda terms.
!
Recall that both
Ω
and the Y combinator, which make use of
ìself applicationî:
Ω ≡
(
λ
x. x x) (
λ
x. x x)
Y
≡ λ
f. (
λ
x. f (x x)) (
λ
x. f (x x))
!
What type annotation would you assign to the expression? Aretheses terms typable at all?
Com S 541
Overview:
!
!
!
!
References:
!
!
!
Com S 541
!
1
2
!
1
"
2
!
T
Com S 541
!
with a finite domain
the set of
variables.
!
A type assertion or type judgement is a triple
,e,t)
, where
is a type
assumption,
e
is a lambda-term (either typed or untyped, depending on the
context), and
t
is a type. The domain of
is exactly the set of free variables of
e
f
v(
e)
!
A type system for the lambda-calculus:
2
2
1
1
2
2
1
1
2
1
1
2
1
t : )
e
(e
t : e - t t : e -
t
t :
e)
. t : x ( -
t : e - t : x ;
t : x - t : x ;
|
|
| |
|
|
Com S 541
!
Input:A lambda-term
0
!
Initialization:Set
0
0
0
0
0
0
!
Loop Step:If
subgoals, as specified in an action table.End of Skeleton
Com S 541
!
Case
(
Γ
,x,t
)
:
Generate the equation
t=
Γ
(
x)
.
!
Case
(
Γ
,(
λ
x.e)
,t
)
:
Let
τ
1
and
τ
2
be fresh type variables. Generate the equation
t=
τ
1
"
τ
2
and the subgoal
(
Γ
;x:
τ
1
,e,
τ
2
)
.
!
Case
(
Γ
,(
e
1
e
2
)
,t
)
:
Let
τ
1
be a fresh type variable. Then generate the subgoals
(
Γ
,e
1
,
τ
1
"
t
)
and
(
Γ
,e
2
,
τ
1
)
.
Com S 541
!
0
1
2
2
3
4
4
5
6
8
7
6
1
8
5
9
7
3
9
5
!
0
5
7
6
5
7
5
6
principal type of the term
Com S 541
1
2
1
2
fail
fail
°
1
2
3
4
1
3
2
4