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).
- The oracle evaluator. One fixed code interprets every element: relative to
a ⊕ x, it computesa ⬝ xentry by entry (exists_kleeneTwo_interpreter), using the universal code for total oracles. Equivalently, each entry ofa ⬝ xis a clocked oracle program over the interface of two oracles, run witha'andx(kleeneTwoEval_eq_clocked). - Combinators.
k ⬝ ais the element running the codejoinLeftwith parametera, which returns its parameter.s ⬝ a ⬝ bis the element whose parameter isa ⊕ band whose code applies, entry by entry,a ⬝ ctob ⬝ c, through the universal code. Its code first evaluates the entries(a ⬝ c)(n)and(b ⬝ c)(n), so that it diverges somewhere whena ⬝ corb ⬝ cdoes. - Continuous functions. By the continuity theorem
Nat.RecursiveIn.Code.continuous_iff_exists_code, the total maps on Baire space represented inK₂are exactly the continuous ones (continuous_iff_exists_kleeneTwo_app). - The computable sub-pca. The computable elements are closed under application and contain the
combinators, so they form a sub-pca
K₂^rec(kleeneTwoRec).
Main definitions #
Cslib.PartialCombinatoryAlgebra.kleeneTwoEval: the partial function thatacomputes onx.Cslib.PartialCombinatoryAlgebra.kleeneTwoCode: the element running a code with a parameter.Cslib.PartialCombinatoryAlgebra.kleeneTwo: Kleene's second modelK₂.Cslib.PartialCombinatoryAlgebra.kleeneTwoRec: its sub-pcaK₂^recof computable elements.
Main results #
Cslib.PartialCombinatoryAlgebra.kleeneTwo_app_eq_some_iff: application is code evaluation.Cslib.PartialCombinatoryAlgebra.exists_kleeneTwo_interpreter: one code interpretsK₂.Cslib.PartialCombinatoryAlgebra.kleeneTwoEval_eq_clocked: application as a clocked program over two oracles.Cslib.PartialCombinatoryAlgebra.continuous_iff_exists_kleeneTwo_app: the total maps represented inK₂are the continuous ones.Cslib.PartialCombinatoryAlgebra.computable_of_mem_kleeneTwo_app: application preserves computability, which makesK₂^reca sub-pca.
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 #
- J. van Oosten, Realizability: An Introduction to its Categorical Side: background on Kleene's second model.
- J. Longley and D. Normann, Higher-Order Computability: background on Kleene's second model and its computable submodel.
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.
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 #
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₂.
Application in K₂^rec is application in K₂.