Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Type Mismatch: Bool is not Nat<br />
Arith> if 0 then true else false<br />
Type Mismatch: Nat is not Bool<br />
is is good, we’ve made a whole class of illegal programs unrepresentable. Lets do more of this!<br />
Simply Typed Lambda Calculus<br />
e simply typed lambda calculus ( STLC ) of Church and Curry is an extension of the lambda calculus<br />
that annotates each lambda binder with a type term. e STLC is explictly typed, all types are present<br />
directly on the binders and to determine the type of any variable in scope we only need to traverse to its<br />
enclosing scope.<br />
e := x<br />
e 1 e 2<br />
λx : τ.e<br />
e simplest STLC language is these three terms, however we will add numeric and boolean literal terms<br />
so that we can write meaningful examples.<br />
e := x<br />
e 1 e 2<br />
λx : τ.e<br />
n<br />
true<br />
false<br />
if e then e else e<br />
We can consider a very simple type system for our language that will consist of Int and Bool types and<br />
function types.<br />
τ := Int<br />
Bool<br />
τ → τ<br />
Type Checker<br />
e typing rules are quite simple, and again we get the nice property that there is a one-to-one mapping<br />
between each syntax term and a typing rule.<br />
62