Partial combinatory algebras #
A partial combinatory algebra (pca) is a set A with a partial binary application, written
a ⬝ b, and two elements k and s such that, for all a, b and c,
k ⬝ a ⬝ b = a, s ⬝ a ⬝ b is defined, and s ⬝ a ⬝ b ⬝ c ≃ (a ⬝ c) ⬝ (b ⬝ c), where ≃ is
Kleene equality: one side is defined exactly when the other is, and then they are equal.
Application associates to the left, and an application is defined only when its two arguments are.
Pcas are the models of realizability: Kleene's first model on the natural numbers (indices of
partial recursive functions) and his second model on Baire space are the standard examples.
Application is a function A → A → Part A, and Kleene equality is equality in Part A. The
application of two partial values, ap app x y, is defined when x and y are and app is
defined at their values.
The main property is combinatory completeness: every term built from variables, constants and
application can be abstracted over its last variable. PartialCombinatoryAlgebra.abs is the
bracket abstraction, and PartialCombinatoryAlgebra.dom_eval_abs and
PartialCombinatoryAlgebra.ap_eval_abs say that the abstraction always denotes, and that applying
it to a evaluates the term with a in place of the last variable.
Main definitions #
Cslib.PartialCombinatoryAlgebra: a carrier's partial application with combinatorsk,s.Cslib.PartialCombinatoryAlgebra.ap: application of partial values.Cslib.PartialCombinatoryAlgebra.i: the identity combinator, the value ofs ⬝ k ⬝ k.Cslib.PartialCombinatoryAlgebra.Term,Cslib.PartialCombinatoryAlgebra.eval: terms with variables inFin nand constants in the carrier, and their partial values.Cslib.PartialCombinatoryAlgebra.abs: bracket abstraction of the last variable.Cslib.PartialCombinatoryAlgebra.sub: the sub-pca on a subset containingkandsand closed under application.
Main results #
Cslib.PartialCombinatoryAlgebra.app_i:i ⬝ a = a.Cslib.PartialCombinatoryAlgebra.dom_eval_abs,Cslib.PartialCombinatoryAlgebra.ap_eval_abs: combinatory completeness.
Implementation notes #
A pca is a structure on its carrier rather than a class, because realizability uses many pcas
on one carrier: Kleene's first model relative to each oracle lives on ℕ, and sub-pcas share the
application of the ambient pca. The axioms follow the definition in [vO08], Chapter 1,
§1.1, which (unlike some sources) does not require k ≠ s.
Cslib.SKI.Polynomial.toSKI in cslib is bracket abstraction for the closed SKI calculus. It
cannot be used here: a pca's terms have constants from the carrier, and its abstraction theorem
is a Kleene equality, in which definedness of either side gives definedness of the other, rather
than a reduction.
References #
- J. van Oosten, Realizability: An Introduction to its Categorical Side, Chapter 1, §1.1 (the definition of a pca, and combinatory completeness; the numbers of the definition and theorem are to be checked).
k ⬝ a is defined.
i ⬝ a = a.
Terms over the carrier A with variables in Fin n: variables, constants and application.
The partial value of a term when the variables take the values ρ.
Bracket abstraction of the last variable xₙ of a term: xₙ becomes i, another variable
or a constant t becomes k ⬝ t, and an application t ⬝ u becomes s ⬝ ⟨xₙ⟩t ⬝ ⟨xₙ⟩u.
Combinatory completeness: applying the bracket abstraction ⟨xₙ⟩t of a term to a is
Kleene equal to evaluating t with a for its last variable ([vO08], §1.1).
Sub-pcas #
The sub-pca of P on the elements satisfying S, when S contains k and s and is closed
under application. Its application is that of P (map_val_sub_app).
Application in a sub-pca is application in the ambient pca.