Documentation

CslibFrontier.Languages.CombinatoryLogic.KleeneFirstModel

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 #

Main results #

References #

def Cslib.PartialCombinatoryAlgebra.ofSmn (φ : ℕ → ℕ → Part ℕ) (curry : ℕ → ℕ → ℕ) (lift : ℕ → ℕ) (fst u : ℕ) (eval_curry : ∀ (e m n : ℕ), φ (curry e m) n = φ e (Nat.pair m n)) (eval_lift : ∀ (e m : ℕ), φ (lift e) m = Part.some (curry e m)) (eval_fst : ∀ (a b : ℕ), φ fst (Nat.pair a b) = Part.some a) (eval_u : ∀ (a b c : ℕ), φ u (Nat.pair (Nat.pair a b) c) = ap φ (φ a c) (φ b c)) :

The pca on ℕ given by a numbering φ of partial functions with a computable s-m-n operation and a universal index:

  • curry e m is an index of n ↦ φ e ⟨m, n⟩;
  • lift e is an index of m ↦ curry e m;
  • fst is an index of the first projection ⟨a, b⟩ ↦ a;
  • u is an index of ⟨⟨a, b⟩, c⟩ ↦ (φ a c) ⬝ (φ b c), applying the value of a at c to that of b at c.

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.

@[simp]

Application in K₁ is evaluation of the code with the given index.