We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Set Recursive Function Language

From Esolang
Jump to navigation Jump to search

Set Recursive Function Language (SRFL) is a programming language which generalizes the idea of general recursive functions in arithmetic to general recursive functions on sets (in some background set universe). We will construct a language where we can, 'magically', give a (set) collection of sets as input, and get a single set as output. For more information on primitive recursive set functions, see (Rathjen 1992) [1].

General Recursive Functions

We define the general recursive functions here, denoted grf, recursively (heh) as follows:

0() = 0 is grf. This is our constant function which gives the empty set.

ω() = ω is grf. This is our constant function which gives the von neumann ordinal ω.

ρni(x1, ..., xn) = xi is grf. These are called projection functions.

j(x,y) = x∪{y} is grf. This is the adjunction function, which is commonly used in weak set theories, see (Montagna & Mancini 1994) [2].

x\y = x\y is grf. This is the set complementation function.

P(x) = 2x is grf. This is the powerset function.

|x| = cardinality of x, is grf. This is the cardinality function.

For any grf functions f(x1, ..., xn), g1(x1, ..., xm), ..., , gn(x1, ..., xm), we have that the composition, f(g1(x1, ..., xm), ..., , gn(x1, ..., xm)), is grf.

For any grf function f(y, x1, ..., xn), ∪y∈zf(y, x1, ..., xn) is grf. This is the union operation.

Given a grf function g(y, x1, ..., xn), we can define a grf function f(z, x1, ..., xn) = g(f(z, x1, ..., xn), ∪y∈zf(y, x1, ..., xn), z, x1, ..., xn). This is our recursive definition principle. Note that if this self-referential definition does not give a unique value, then the function is partial and does not return a value.

No other functions are grf.

Deriving Basic Functions

We get primitive recursion fairly quickly, f(z, x1, ..., xn) = h(∪y∈zf(y,x1, ..., xn), z, x1, ..., xn), by applying recursion and union.

{x} = 0 ∪ {x} = j(0, x).

{x,y} = (0 ∪ {x}) ∪ {y} = j(j(0, x), y). We can iterate this as many times as we want to get arbitrary pairs.

s(x) = x ∪ {x} = j(x,x). This is the successor function.

x ∪ y = ∪z∈{x,y}(z).

x ∩ y = x \ (x \ y).

B(a, b) = ∪c∈b({c} ∩ {a}) which is equal to {a} if a∈b, and is equal to 0 otherwise. We use this to construct the characteristic function for elementhood:

Ca∈b(a,b) = ∪c∈B(a,b)({0}) which is equal to 1 = {0} is a∈b, and is equal to 0 otherwise.

(todo: continue constructing more functions)

Bounded Separation and Replacement

Note on Turing Completeness

This language is turing complete since the general recursive functions on ω are a 'subset' of these functions.

More Complicated Set Functions

References

  1. ↑ M. Rathjen, "A Proof-Theoretic Characterization of the Primitive Recursive Set Functions," The Journal of Symbolic Logic, vol. 57, no. 3, September 1992, doi:10.2307/2275441.
  2. ↑ F. Montagna and A. Mancini, "A Minimal Predicative Set Theory," Notre Dame Journal of Formal Logic, vol. 35, no. 2, 1994, doi: 10.1305/ndjfl/1094061860.