The Simply Typed Lambda Calculus

Derive function types from application and abstraction rules and use self-application to expose a finite-type constraint.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. The context records types of free variables
  2. Self-application forces incompatible finite structure

The context records types of free variables

In context \(\Gamma\), if \(e\) has type \(B\) after adding assumption \(x:A\), then \(\lambda x.e\) has type \(A\to B\) in \(\Gamma\). Application combines a term of type \(A\to B\) with one of type \(A\) to get type \(B\). For example, \(\lambda x.x\) can have type \(\mathrm{Bool}\to\mathrm{Bool}\) under a Boolean choice for the parameter.

Self-application forces incompatible finite structure

To type \(x\,x\) with a single type \(T\) for \(x\), the left occurrence requires \(T=T\to B\) for some result type \(B\). No finite simple type has that shape. This is the same recursive equation rejected by the occurs check. The proof-rule view in natural deduction reads the function type as implication. Type inference solves such constraints automatically where a solution exists.[1][2]

References

  1. Benjamin C. Pierce et al., Software Foundations ↩
  2. Shriram Krishnamurthi, Programming Languages: Application and Interpretation ↩