I need to state the type of the term
((λx : int. (x ≤ 1)) 2)
and prove it using a proof tree. I'm fairly certain that this is taking 2 as an input for x
, then comparing 2 to 1 and returning a boolean
. This means the type of the term would be int → boolean
. I'm just not sure how to write a proof tree for it. If someone could point me towards some examples or explain how to do a similar problem that would be great.
I assume you are talking about the simply typed lambda calculus extended with the datatypes
int
andboolean
, the terms_≤_
,1
and2
, and the typing derivation rulesUsing these, and the standard STLC typing rules, the type of your term is not
int → boolean
, rather, it isboolean
as we will see below. Also, it β-reduces to2 ≤ 1
, so that should show you quite easily that it is aboolean
.But now to the meat of it: the typing derivation tree:
To save on horizontal space, let's do the rest in a new tree: