Could someone please explain the process of finding the lambda-terme without free variables of the following types ? I have some idea on how I should solve this but I'm not really sure it's the right way.
a) p->(q->q)
b) (p->q)->((q->r)->(p->r))
c) (p->(q->(q->r)))->(p->(q->r))
a)
p -> (q -> q)
We need something to take a
p
,and produce a
q -> q
, so we repeat, taking a q, and the only thing we can do is then return that qwe can add parens for emphasis:
b) (p -> q) -> ((q -> r) -> (p -> r))
We repeat. Our term starts by taking a function from
p
toq
:It must return a function of type
((q -> r) -> (p -> r))
, so we start by returning something taking a function fromq
tor
And we now need it to produce an
r
given ap
. There are only so many ways to piece together the available pieces:Again, with parenthesis for emphasis:
c)
(p -> (q -> (q -> r))) -> (p -> (q -> r))
Hmm, my naming convention falls a little short on this one ;)
First, our term takes a
(p -> (q -> (q -> r)))
:Next, we must produce a term of type
(p -> (q -> r))
, so we let it take ap
, and next take aq
:Producing an
r
now just involves piecing together what we haveHoped that helped with your homework ;)