Documentation

CslibFrontier.Languages.CombinatoryLogic.KleeneSecondModel

Kleene's second model #

Kleene's second model K₂ is the partial combinatory algebra on Baire space ℕ → ℕ in which an element a acts on x as a code for a continuous partial function. Here a is read as an oracle program with a parameter: its first entry a 0 is the index of an oracle code, and its tail a' = n ↦ a (n + 1) is a parameter oracle. The program runs relative to the join a' ⊕ x of the parameter with the input, and a ⬝ x is the function n ↦ Φ_{a 0}^{a' ⊕ x}(n), defined when every entry is (Cslib.PartialCombinatoryAlgebra.kleeneTwoEval).

Main definitions #

Main results #

Implementation notes #

The sources define K₂ through neighbourhood functions: a codes a continuous partial functional by listing, for each finite sequence, either a value or "look further". Here a codes the functional instead by an oracle program and its parameter, so that application reuses the oracle code evaluator, the universal code, the join and the clocked oracle programs of Foundations/Computability, and the pca laws are proved through codes rather than by manipulating neighbourhood functions. For total maps the two presentations represent the same functionals, the continuous ones (continuous_iff_exists_kleeneTwo_app; the neighbourhood-function side is the standard argument and is not formalized). The two models are not claimed to be isomorphic as pcas here.

Application is defined pointwise: a ⬝ x is defined when the program of a converges on x at every entry. It is the partial map Nat.RecursiveIn.Code.evalStream of the code a 0 relative to the tail of a. The combinators are fixed elements kleeneTwoCode c (fun _ => 0) for codes c chosen once, so they are computable, and K₂^rec is a sub-pca with the same k and s.

References #

The partial function that a computes on x in Kleene's second model: the oracle code with index a 0, run relative to the join of the tail n ↦ a (n + 1) with x.

The element of K₂ running the oracle code c with the parameter p: its first entry is the index of c, and its tail is p.

Codes for the combinators #

Kleene's second model K₂: the pca on Baire space in which a ⬝ x is the function n ↦ Φ_{a 0}^{a' ⊕ x}(n) computed by the oracle code with index a 0 relative to the join of the tail a' of a with x, defined when every entry is.

a ⬝ x has value y in K₂ exactly when the program of a computes y from x.

a ⬝ x is defined in K₂ exactly when the program of a converges on x at every entry.

The interpreter of K₂. One oracle code computes a ⬝ x entry by entry, relative to the join a ⊕ x of the element with its argument.

Each entry of a ⬝ x is a clocked oracle program over the interface of two oracles, run with the tail of a and with x: the compiled program of the code of a, with its queries to the join answered by splitHandler.

Continuous functions #

theorem Cslib.PartialCombinatoryAlgebra.continuous_iff_exists_kleeneTwo_app {F : (ℕ → ℕ) → ℕ → ℕ} :
Continuous F ↔ ∃ (a : ℕ → ℕ), ∀ (x : ℕ → ℕ), kleeneTwo.app a x = Part.some (F x)

The total maps represented in K₂ are the continuous ones. A total map F on Baire space is continuous exactly when some element a of K₂ has a ⬝ x = F x for every x.

The computable sub-pca #

The element running a code with a computable parameter is computable.

Application in K₂ preserves computability.

The computable sub-pca K₂^rec of Kleene's second model: the computable elements of Baire space, with the application of K₂.

@[simp]

Application in K₂^rec is application in K₂.