HeadlinesBriefing HeadlinesBriefing.com

Constructing a Quine from Kleene's Second Recursion Theorem

Hacker News •
×

This article explores the practical construction of a Quine—a program that outputs its own source code—using Kleene's Second Recursion Theorem. The author formalizes the proof in the untyped lambda calculus, motivated by a preprint that details this approach. The classical computability perspective states the theorem using an effective numbering of partial recursive functions $\{\varphi_i\}_{i \in \mathbb{N}}$, where a function $\psi$ yields an index $e$ such that $\psi(e,\bar{x}) \simeq \varphi_e(\bar{x})$. A Quine emerges when $\psi$ is the identity function.

The author critiques traditional models of computation for relying on tedious natural-number encodings that obscure structure. Instead, the untyped lambda calculus is adopted as a proof-theoretic model that preserves syntactic structure. A typed presentation of the recursion theorem is first considered to draw connections to other results, with types treated as "moral types" in the untyped setting. The construction is then carried out explicitly in the untyped lambda calculus, demonstrating how self-referential programs arise naturally from the theorem's fixed-point structure.

The formalization process revealed insights into the theorem's mechanics, challenging the view of formal verification as mere transcription. The piece concludes by assembling the lambda calculus components into a working Quine, illustrating the theorem's constructive power.

Source: Hacker News · Summarized by HeadlinesBriefing