Kleene's first model #
Kleene's first model K₁ is the partial combinatory algebra on ℕ in which e ⬝ n is the value
of the e-th partial recursive function at n: with Mathlib's numbering of codes,
e ⬝ n = (ofNat Nat.Partrec.Code e).eval n.
Its combinators come from two facts about the numbering. The s-m-n theorem gives indices that
specialize the first of two paired arguments, and specialization is itself computable. The
universal function (e, n) ↦ eₙ is partial recursive. PartialCombinatoryAlgebra.ofSmn builds a
pca from these two facts for any numbering of partial functions on ℕ, so that relativized
versions of K₁ reuse the construction. In it, k specializes the first projection, so
k ⬝ a is an index of b ↦ a; and s ⬝ a ⬝ b is an index of c ↦ (a ⬝ c) ⬝ (b ⬝ c), obtained
by specializing a universal program twice.
Main definitions #
Cslib.PartialCombinatoryAlgebra.ofSmn: the pca onℕgiven by a numbering with a computable s-m-n operation and a universal index.Cslib.PartialCombinatoryAlgebra.kleeneOne: Kleene's first modelK₁.
Main results #
Cslib.PartialCombinatoryAlgebra.kleeneOne_app: application inK₁is evaluation of codes.
References #
- J. van Oosten, Realizability: An Introduction to its Categorical Side,
Chapter 1 (Kleene's first model
K₁; the section number is to be checked). - S. C. Kleene, Introduction to Metamathematics, §65 (the s-m-n theorem).
The pca on ℕ given by a numbering φ of partial functions with a computable s-m-n operation
and a universal index:
curry e mis an index ofn ↦ φ e ⟨m, n⟩;lift eis an index ofm ↦ curry e m;fstis an index of the first projection⟨a, b⟩ ↦ a;uis an index of⟨⟨a, b⟩, c⟩ ↦ (φ a c) ⬝ (φ b c), applying the value ofaatcto that ofbatc.
Its combinators are k = lift fst and s = lift (lift u).
Kleene's first model K₁: the pca on ℕ in which e ⬝ n is the value of the e-th
partial recursive function, in Mathlib's numbering of Nat.Partrec.Code, at n.
Application in K₁ is evaluation of the code with the given index.