


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



1.0 Initial Release.
Your answers to the following questions are to be hand-written neatly or printed on one or more sheets of paper, each with your name in the upper right corner. The homework is to be turned in in class at the start of class. Alternately, you may hand it to Prof. Elsa Gunter in person before the deadline.
The purpose of this HW is to test your understanding of:
Another purpose of HW3 is to provide you with experience answering non-programming written questions of the kind you may experience on the final.
λy.λz.λf.λx.y(xzf )x −→α λa.λz.λf.λx.a(xzf )x.
Because α-conversion implies α-equivalence, we have
λy.λz.λf.λx.y(xzf )x α ∼λa.λz.λf.λx.a(xzf )x.
By α-conversion λx.a(xzf )x α −→λy.a(yzf )y,
and thus λx.a(xzf )x α ∼λy.a(yzf )y.
By three appplications of congruence for abstractions, we have
λf.λx.a(xzf )x α ∼λf.λy.a(yzf )y
and hence λz.λf.λx.a(xzf )x α ∼λz.λf.λy.a(yzf )y
and λa.λz.λf.λx.a(xzf )x α ∼λa.λz.λf.λy.a(yzf )y.
By transitivity, we then have
λy.λz.λf.λx.y(xzf )x ∼αλa.λz.λf.λy.a(yzf )y.
By α-conversion, λa.λz.λf.λy.a(yzf )y −→α λx.λz.λf.λy.x(yzf )y,
and thus λa.λz.λf.λy.a(yzf )y α ∼λx.λz.λf.λy.x(yzf )y,
and thus by transitivity λy.λz.λf.λx.y(xzf )x α ∼λx.λz.λf.λy.x(yzf )y.
By α-conversion, λz.λf.λy.x(yzf )y α −→λa.λf.λy.x(yaf )y,
and thus λz.λf.λy.x(yzf )y α ∼λa.λf.λy.x(yaf )y.
By α-conversion, λf.λy.x(yaf )y α −→λz.λy.x(yaz)y.
and thus λf.λy.x(yaf )y α ∼λz.λy.x(yaz)y.
By congruence of abstraction, λa.λf.λy.x(yaf )y ∼αλa.λz.λy.x(yaz)y.
By α-conversion, λa.λz.λy.x(yaz)y −→α λf.λz.λy.x(yf z)y,
and thus λa.λz.λy.x(az)y ∼αλf.λz.λy.x(yf z)y.
By transitivity, we have λz.λf.λy.x(yzf )y α ∼λf.λz.λy.x(yf z)y.
Once again by congruence of abstraction, we have
λx.λz.λf.λy.x(yzf )y α ∼λx.λf.λz.λy.x(yf z)y.
And finally, once more by tranisitivitym we have
λy.λz.λf.λx.y(xzf )x α ∼λx.λf.λz.λy.x(yf z)y,
as was to be shown.
type ’a option = None | Some of ’a
let case x a f = match x with None -> a | Some y -> f y
Solution: None → λx 1 .λx 2 .x 1 Some → λy.λx 1 .λx 2 .yx 2 case → λx.λa.λf.(λx 1 .λx 2 .λe.ex 1 x 2 )af x β −→λx.λa.λf.(λx 2 .λe.eax 2 )f x β −→λx.λa.λf.(λe.eaf )x β −→λx.λa.λf.xaf