The Simply Typed Lambda Calculus Explained | Introduction & Basics

Added:

The Untyped Lambda Calculus and the Turing-Completeness Trade-off

While the Simply Typed Lambda Calculus (STLC) guarantees program termination (strong normalization) and type safety, it does so at the cost of computational expressiveness. STLC is not Turing-complete; it cannot express general recursion, meaning that self-referential functions and general fixed-point combinators (like the Y combinator) cannot be defined within the system without external extensions. In contrast, the Untyped Lambda Calculus serves as the primary alternative. By omitting types entirely, it achieves full Turing-completeness, enabling the representation of any computable algorithm. This highlights a fundamental philosophical trade-off in computer science: the safety, predictability, and mathematical tractability of static type systems versus the unrestricted expressiveness and computational power of untyped systems.

The Untyped Lambda Calculus, including basic syntax (variables, abstraction, and application) and operational semantics.
The mechanics of reduction and evaluation, specifically beta-reduction, alpha-conversion, and finding normal forms.
Basic mathematical logic and formal notation, particularly the use of inference rules, premises, and sequents (e.g., turnstile notation).
Fundamental concepts of static typing in programming, such as compile-time vs. run-time errors and data types.
The Curry-Howard Isomorphism, which connects structural proof theory to type systems by mapping propositions to types and proofs to programs.
Key safety properties of the Simply Typed Lambda Calculus, specifically Type Safety (proved via Progress and Preservation) and Strong Normalization.
Type Inference Algorithms, such as the Hindley-Milner algorithm, which automatically deduce types without explicit user annotations.
Advanced type systems further up the Lambda Cube, such as System F (parametric polymorphism) and Dependent Types (e.g., Calculus of Constructions).
11.1K views234likes18:41@TheUBerlinOriginal Release: 2021-11-18

The simply typed lambda calculus introduces types to address the shortcomings of untyped lambda calculus, where functions lack specificity about their inputs and outputs. Types are constructed from type variables (α, β, γ) and arrow types (σ → τ), representing functions from type σ to type τ. The system distinguishes between pre-typed terms (syntactically valid but potentially untypable) and legal terms (properly typeable). Type checking is performed through derivation using three inference rules: the variable rule (if x:σ is in context Γ, then Γ ⊢ x:σ), the application rule (if Γ ⊢ m:σ→τ and Γ ⊢ n:σ, then Γ ⊢ m n:τ), and the abstraction rule (if Γ,x:σ ⊢ m:τ, then Γ ⊢ λx:σ.m:σ→τ). These rules enable systematic validation of whether terms are truly typeable, ensuring that functions receive appropriate inputs and produce expected outputs.