The lambda calculus has the following expressions:
e ::= Expressions x Variables (λx.e) Functions e e Function application
From this base, we can define a number of additional constructs, such as Booleans and conditional statements:
let true = (λx.(λy.x)) false = (λx.(λy.y)) if = (λcond.(λthen.(λelse.cond then else)))
Showing your work, show the evaluation of the following program:
if false false true
.
Maybe if(false (then false ( else true then true)))
?
But that would just mean exactly what it means. if false then false else true then true
.
I don't know how to approach it.
Having the definitions
true = (λx.(λy.x))
false = (λx.(λy.y))
if = (λcond.(λthen.(λelse.cond then else)))
defined, means that
true x y = x
false x y = y
if cond then else = cond then else
Thus, e.g.,
if true true false
-- if cond then else = cond then else
= true true false
-- true x y = x
= true
There's no more definitions to apply here, so we have our result.
Now you can try working out your example.