Extraordinary Ordinals
This article meticulously details different lambda calculus encodings for natural numbers, categorized by their linearity properties. It systematically presents historical and novel numeral systems from pioneers like Church and Wadsworth, illustrating each with hand-drawn diagrams. Hacker News readers appreciate this deep dive into foundational computer science, exploring the elegant and sometimes surprising ways numbers can be represented computationally.
The Lowdown
The article "Extraordinary Ordinals" by Marvin Borner delves into the fascinating world of lambda calculus numeral systems, specifically exploring various encodings for natural numbers, or ordinals. It organizes these systems into three primary categories: Linear, Affine, and Non-Linear, demonstrating how each can be used for arithmetic. The author emphasizes the visual representation of these complex concepts through meticulously hand-drawn diagrams.
- Core Concept: The article systematically presents different ways to encode natural numbers (ordinals) using lambda calculus expressions.
- Categorization: Encodings are grouped into three classes: Linear, Affine, and Non-Linear, based on how variables are handled, with an explanation of application, abstraction, and beta-reduction in the linear context.
- Linear Encodings: Discusses the Mackie (2019) and Parigot (1989) systems, providing mathematical definitions for the number zero (⟨0⟩) and the successor function (⟨S(n)⟩), alongside illustrative diagrams for 0 and 3.
- Affine Encodings: Explores the Scott (1963) and the author's Bruijn encodings, characterized by unbound variables being 'left hanging.' Each system includes definitions and diagrams for 0 and 3.
- Non-Linear Encodings: Covers the Church (1932), Mogensen (2001), and Wadsworth (1980) systems, where variables can be bound multiple times, requiring explicit duplication. Definitions and diagrams for 0 and 3 are detailed, with Mogensen's system also demonstrating binary representations.
- Arithmetic Capability: A key feature highlighted is that all presented encoding methods are inherently capable of performing arithmetic operations.
- Visual Aids: All complex lambda calculus expressions and reductions are accompanied by unique, hand-drawn diagrams in LaTeX+TikZ, significantly aiding comprehension of the abstract concepts.
Overall, the article serves as a comprehensive, visually rich catalog of lambda calculus numeral systems, offering a detailed look at the theoretical underpinnings of number representation in functional programming.