Partial combinatory algebra

In theoretical computer science and mathematical logic, specifically in realizability, a partial combinatory algebra (pca) is an algebraic structure which abstracts a model of computation. The definition of pcas uses an idea from combinatory logic. The realizability topos over a pca is a model of higher-order intuitionistic logic where informally every function is computable in the model of computation specified by the pca.

Definition

edit

A partial applicative structure is simply a set   equipped with a partial binary operation   called application. In the context of realizability, this operation is usually denoted by simple juxtaposition, i.e.,  . It is usually not associative; by convention, the notation   associates to the left as  , matching the standard convention in λ-calculus.[1]: 1 

The terms (or expressions) over a partial applicative structure   are defined inductively:[1]: 2 [2]: 27 

  • A constant   is an expression,
  • A variable, from some fixed, countably infinite set of variables, is an expression,
  • If   and   are expressions, then   is an expression.

(In other words, they form the free magma over the disjoint union   where   is the set of variables.)

A term is closed when it contains no variables. A closed term may be evaluated in the natural way: a constant   evaluates to itself, and if the terms   and   respectively evaluate to   and  , then   evaluates to  , if this is defined. Note that the evaluation is a partial operation, since not all applications are defined. We write   to simultaneously express that the term   evaluates to a defined value and denote this value (this matches standard notation for values of partial functions). We also write   when both closed terms   and   either do not evaluate to a defined value, or evaluate to the same value.

A substitution operation is also defined in the natural way: if   is a term,   is a variable and   is another term,   denotes the term   with all occurrences of   replaced by  .

The partial applicative structure A is said to be combinatory complete or functionally complete if, for every term   (that is, a term   whose variables are among  ), there exists an element   such that:[2]: 27 [1]: 3 

  •   for all  ,
  •   for all  .

A partial combinatory algebra (pca) is a combinatory complete partial applicative structure. A total combinatory algebra (tca) is a pca whose application operation is total.

Informally, the combinatory completeness condition requires an analogue of the abstraction operation from lambda calculus to exist inside the pca.

Characterization by combinators

edit

In the same way as there is a translation from λ-terms to terms of the SKI combinator calculus by eliminating λ-abstractions using combinators, pcas can be characterized by the existence of elements which satisfy equations analogous to the S and K combinators. Note, however, that some care must be taken in the statement and proof since application is not always defined in a pca.

Theorem:[2]: 28 [1]: 3  A partial applicative structure   is combinatory complete if and only if there exist two elements   such that:

  •   for all  ,
  •   for all  ,
  •   for all  .

For the proof, in the forward direction, if   is combinatory complete, it suffices to apply the definition of combinatory completeness to the terms   and   to obtain   and   with the required properties.

It is the converse that involves abstraction elimination. Assume we have   and   as stated. Given a variable   and a term  , we define a term   whose variables are those of   minus  , which plays a role similar to   in λ-calculus. The definition is by induction on   as follows:[1]: 3 [2]: 28 

  •   for a constant  ,
  •   where  ,
  •   if   is a variable different from  ,
  •  .

Beware that the analogy between   and   is not perfect. For example, the terms   and   are not generally equivalent in a reasonable sense, e.g., taking a variable   different from   and   constants, we have  , which cannot be considered equivalent to   because the latter always evaluates to   if   is replaced by a constant  , while the former may not as   may be undefined.[1]: 4–5 

However, if   is a constant  , then   is indeed equivalent to   in the sense that substituting all variables for some constants in these two terms gives the same result (per  ).[1]: 4 

Moreover, substituting variables by constants in   always evaluates to a defined result, even if this would not be the case by substituting variables in  . For example, if   are two constants, the term   (abstracting a variable which does not appear) is equal to  . By the assumptions on   and  , this is well-defined, even though   may not be well-defined.[1]: 4 

These remarks imply that for all term  , the value   is well-defined and satisfies the two requirements of combinatory completeness.[1]: 4 

Examples

edit

First Kleene algebra

edit

The first Kleene algebra   consists of the set   with application  , where   denotes the  -th partial recursive function in a standard Gödel numbering.[1]: 15 [2]: 29 

This pca can also be relativized to an oracle  : we define a pca   with carrier   by setting  , where   is the  -th partial recursive function with oracle  .[1]: 15 [2]: 30 

Untyped λ-calculus

edit

We can form a pca (in fact a tca) by quotienting the set of closed (untyped) λ-terms by β-equivalence and taking the application to be the one inherited from λ-calculus.[1]: 23 [2]: 30 

Reflexive domains

edit

Second Kleene algebra

edit

References

edit
  1. ^ a b c d e f g h i j k l Jaap van Oosten (2008). Realizability: an introduction to its categorical side. Elsevier Science. p. 328. ISBN 9780444515841.
  2. ^ a b c d e f g Andrej Bauer (2025-02-21). "Notes on realizability" (PDF). GitHub. Retrieved 2025-02-21.