Abstraction function Created 2026-10-13 Updated 2026-10-14
An abstraction function maps a valid concrete representation to its abstract value. Write and . Different storage states can denote the same abstract value. Correct implementation requires both preservation of the representation invariant and agreement with the specified operation after applying the abstraction function; preserving a length bound alone would not prove first-in, first-out behavior.
The representation invariant answers "is this storage state allowed?" The abstraction function answers "which value does it represent?" Thus is a truth value, whereas is a value of the abstract data type. Treating as a partial function on all storage states, or as a function defined on only, expresses the same restriction. The abstraction function may forget storage details, and need not be executable code: its purpose is to connect an implementation to its formal specification.[ref]
This distinction makes functional correctness manageable one operation at a time. The unreduced rational representation below separates valid storage from mathematical meaning; correct operations through an abstraction function then checks whether an implementation performs the promised addition. For an example with hidden mutable storage and failure cases, the bounded queue with encapsulation supplies a different abstraction function, reading an occupied prefix of an array as a sequence.
Binary search tree Created 2026-10-13 Updated 2026-10-14
A binary search tree stores key-value entries in a binary tree, with distinct keys drawn from a total order. At every vertex, all keys in its left subtree must be smaller than its own key, and all keys in its right subtree must be larger. Thus the entries represent a partial function from keys to values: a key has at most one associated value and may be absent. [ref]
Lookup starts at the root of a tree. Compare the target with the current key: equality returns its value, a smaller target continues into the left subtree, and a larger target continues into the right subtree. Reaching an empty subtree reports absence. The ordering rule justifies discarding the other subtree at every step; this is the algorithm correctness argument for lookup. It applies to the entire subtree, even if that subtree contains many vertices. [ref]
In the seven-key example, search for . At , the comparison selects the right subtree; at , selects the left subtree; at , equality ends the search. The visited keys are , three key comparisons. The right-child chain stores exactly the same keys and satisfies the same binary search tree rule, but lookup of visits , five comparisons. Searching for absent key visits in the first binary search tree and all seven keys in the chain before reaching an empty right subtree.
Figure 1.
Lookup of key in two binary search trees containing the same seven keys
. Orange highlights visited keys and edges; green marks the match. The balanced shape has height of a binary tree and requires three visits, while the chain has height of a binary tree and requires five visits for this target. Details.
For a nonempty binary search tree of height of a binary tree , lookup inspects at most vertices. Under constant-cost key comparisons and child-reference access, its time complexity is in Big O notation, usually written for . With entries, , giving worst-case lookup. If the shape is kept balanced so that , lookup takes for . The empty and one-entry cases take constant work. The worst-case linear bound also appears in Sedgewick and Wayne's ordinary, unbalanced implementation. [ref]
In a shape with every level full, there are vertices, a geometric series. This explains how a small height of a binary tree can accommodate many entries. The binary search tree ordering rule alone does not guarantee this shape or logarithmic time complexity. Breadth-first search also gains no logarithmic key-lookup guarantee merely from having a binary tree: in the displayed balanced example, its left-to-right level order is , so it inspects six keys before finding , and an absent target requires all seven. Directed lookup uses the total order to choose one branch.
The ordering requirement includes every ancestor on the graph path from the root of a tree. Consider the smaller binary tree with root key , left child , right child , and right child under . Key must satisfy both , from its immediate parent in a rooted tree, and , from its position in the root's left subtree. Replacing by preserves all immediate parent-child comparisons, including , but violates . Lookup for would incorrectly go from to and then to an empty left subtree, overlooking the stored key.
Figure 2.
The binary search tree ordering rule constrains an entire subtree
. The valid example has . The invalid example passes immediate parent-child comparisons, but key lies in the left subtree of key and violates its inherited upper bound. Details.
An inorder traversal visits a left subtree, then its own vertex, then a right subtree. On the valid small example its output is ; on the invalid example it is , exposing the descent from to . Both seven-key binary search trees yield . The theorem is that an inorder traversal of a finite binary search tree with distinct keys lists every key once in strictly increasing total order. For a short proof outline, use mathematical induction on the number of vertices: each smaller subtree produces its own sorted list, and the full ordering rule places every left key before the current key and every right key after it. Concatenating these three parts preserves strict order. Sedgewick and Wayne's keys method uses this left-current-right order. [ref]
This combination is useful and attractive: one data structure supports directed lookup and ordered enumeration. An inorder traversal costs time complexity for entries, since it visits every vertex; balance accelerates lookup but cannot eliminate the work of outputting all keys.
// Destination: computer-science.bigb
The category has sets as objects and partial functions as morphisms. Composition is defined where both successive functions are defined. The nowhere-defined map is a zero morphism, and the empty set is its sole actual zero object. Adjoining a tagged basepoint turns a partial function into a total basepoint-preserving function, giving an equivalence of categories with the category of pointed sets.
The union of a chain of partial-function graphs is a partial function: two values at the same input occur together in a larger chain member and therefore agree. Any closure or algebraic identity involving finitely many inputs passes to the union if it holds in every chain member, because one member contains all those inputs.
Over a model of Generalized continuum hypothesis, add Cohen reals with finite binary partial functions. The Delta-system lemma proves the countable chain condition for forcing. The generic reals give the continuum lower bound , while nice forcing names for subsets of number at most in the ground model. Cardinal preservation then gives .
Composition of partial functions Created 2026-10-05 Updated 2026-11-05
For partial functions and , their function composition is defined precisely on
For example, composing with , as real partial functions, gives only on .
More generally, strict composition of partial functions makes defined only if every is defined and is defined on the resulting tuple. An argument discarded by the outer function must still be defined: the expression with the everywhere-zero constant function remains undefined at zero. A representation in a programming language using lazy evaluation therefore needs an explicit check of the intermediate definedness conditions.
Domain of a partial function Created 2026-10-03 Updated 2026-11-05
For a partial function , its domain of a partial function is the subset
Its restriction to is an ordinary function . Outside , function evaluation has no assigned value.
For instance, the real square root as a partial function on the real line has . Both and lie in the surrounding source, but only at zero is there an output; the value zero and absence of a value are different situations.
The finite-condition Lévy collapse consists of finite partial functions with and , ordered by reverse inclusion. The generic union gives a surjection for every infinite . If is regular and uncountable, the Delta-system lemma at a regular uncountable cardinal proves the -chain condition, so the extension makes .
For an infinite ground-model cardinal number , use finite partial functions from to , ordered by reverse inclusion. The union of a generic filter is a surjection . The order has size , hence the -chain condition, and preserves cardinals at least .
Finite Lévy collapse to omega-one Created 2026-10-06 Updated 2026-11-05
With an uncountable regular cardinal, finite partial functions on assigning a value below the first coordinate collapse every ground ordinal below to countable size. The Delta-system lemma gives the chain condition for forcing; the possible-values lemma for chain-condition forcing then preserves the regularity of . Therefore becomes the extension . Strong inaccessibility is enough but is not needed for this identification.
Function Created 2026-09-24 Updated 2026-11-05
A function assigns exactly one output in the specified codomain to each input in its domain of a function . Its rule may be a formula, a finite table, or another unambiguous assignment. The outputs actually reached form its image of a function . A codomain states where outputs are allowed; the image of a function records where they actually land. Oscar Levin's introduction makes this distinction explicit. [ref].
For example, , , has the entire real line as its domain of a function and codomain, but its image of a function is . Both and give the output : several inputs sharing an output is permitted. Assigning two distinct outputs to one input is not permitted. A partial function can be undefined at some elements of a larger specified source set; an ordinary function on must be defined at every element of .
Three properties describe how a function uses its target. An injective function never sends distinct inputs to the same output. A surjective function reaches every member of its specified codomain. A bijection does both, pairing each source element with exactly one target element. These are different requirements, as finite arrow diagrams show.
Figure 1.
Injective, surjective and bijective functions have different output patterns
. Every source element has exactly one outgoing arrow. Left: an injective function from three elements to four leaves one target unused. Middle: a surjective function from four elements to three reaches every target but merges two inputs. Right: a bijection pairs three source elements with three targets, allowing every arrow to be reversed uniquely. Details.
The chosen codomain matters even when the formula does not change. The function from to is not surjective, whereas the same rule from to is surjective. Both fail injectivity. Further restricting the domain of a function to makes it a bijection onto , with square root as its inverse function.
Functions make transformations composable: if and , their function composition is . Identifying each intermediate codomain prevents attempting to feed an output into a rule that is not defined there. When a transformation is a bijection, an inverse function recovers the original input without ambiguity. This is useful whenever information must be transported or a calculation reversed.
For a partial function with , its th iterated function is defined only when each intermediate application is defined. Put , , and use the displayed recursion for the domain of a function. Simplifying an algebraic expression for does not restore points excluded by an intermediate application. For example, has on ; the simplified expression has a larger natural domain of a function.
Kleene's recursion theorem Created 2026-10-14 Updated 2026-11-05
Fix an effective numbering of the partial computable functions with a universal partial computable function and the parameter compilation supplied by the S-m-n theorem. For every total computable function , there is a program index such that
Here means equality as partial functions, including the inputs on which computation diverges. The conclusion concerns a program's behavior, not equality of program indices: has no numerical fixed point, but still has this semantic fixed point.[ref]
For a proof, the S-m-n theorem gives a total computable function compiling into a program that, on input , first computes and then runs the program with that resulting index on . Thus
where both sides diverge if the inner computation does. Choose an index for the total computable function . Setting gives
The theorem makes rigorous a program's ability to use a description of itself. For example, let compile a program that ignores its input and prints . Its semantic fixed point is a program that prints its own index. This does not require a program to read its source file.
Partial function Created 2026-10-03 Updated 2026-11-05
A partial function from a set to a set assigns at most one function output in to each function input in . It can be treated as an ordinary function on a specified subset , its domain of a partial function. The surrounding source set can contain points at which no value is defined.
For example, real division by the argument gives the partial function on with . Being undefined at zero is different from assigning a default value there. A partial function with is defined at every allowed input.
Partial unary operation Created 2026-10-06 Updated 2026-11-05
A partial unary operation on a set is a partial function with specified domain of a function and values in . For example, is a partial unary operation on the real numbers with .
A function preserving partial unary operations and must send each into and satisfy . It need not reflect definedness: a point outside can still map into . Preservation therefore requires both a domain of a partial function condition and a value equality.
Zorn's lemma states that a nonempty partially ordered set in which every chain has an upper bound contains a maximal element. Here a chain means a subset totally ordered by the inherited order; it need not have a greatest member.
View every partial function as its graph, a subset of . The family is a set by axiom of separation from the power set of this product. Let be a chain and put . If two members of the union assign values to the same input, the chain property makes one graph contain the other, so those values agree. Thus is a partial function.
If and , choose a chain member containing in its domain. Its rational-scalar closure gives . If , choose two chain members containing them; the larger one contains both, and therefore contains with value . Hence satisfies the required additive identity and domain closure. Consequently
and it is an upper bound for the chain. For the empty chain its union is the empty function, which satisfies the defining logical implications vacuously, so this case is covered too.
A complete lattice has every join, hence every directed and finite join. Conversely, if a partially ordered set is directed-complete and has finite joins including the empty join, then for any subset the set of joins of its finite subsets is nonempty and directed. Its least upper bound is . Including the empty join supplies a bottom element and handles .
For a directed set of partial functions from to , their union is a function: any two functions have a common extension, so they agree wherever their domains overlap. This union is exactly their least upper bound in the extension order, proving directed completeness.
Write for the intersection of all sets containing and closed under and directed joins. Then means . Reflexivity is immediate, and transitivity follows because any closed set containing must contain and then every with . The upper set is closed: is inflationary, and a directed join of elements above is above . Thus implies , proving antisymmetry.
If , then , so . Moreover by monotonicity, and by inflationarity. This proves that is directed. Define . Pointwise monotonicity of every implies monotonicity of . Since and is closed under directed joins, ; hence .
The original map belongs to by the definition of closedness, so and by the definition of the join. Inflationarity gives the reverse inequality. Finally, if and , the lower set is closed by monotonicity of and the join property. Thus every is at most , and so is . This proves the least fixed point from a directed family of maps: is the least fixed point above .
Work over a ground model of ZFC+Generalized continuum hypothesis and let . Force with finite binary partial functions on , with extensions stronger. The Delta-system lemma thins any uncountable family of finite domains to an uncountable family with one common root. Only finitely many binary assignments on that root occur, so two conditions agree there and their union is a common extension. Hence the forcing has the countable chain condition for forcing and preserves cardinals and cofinalities.
The generic union yields distinct reals. Totality at each coordinate is dense, and for two different coordinates it is dense to assign different values at some unused natural-number position. Thus the extension satisfies .
A nice forcing name for a subset of uses one countable forcing antichain at each ordinal below . Since the forcing has size , there are at most such forcing names. Ground Generalized continuum hypothesis gives ; for instance apply the Hausdorff formula at and the Generalized continuum hypothesis arithmetic below it. Therefore in the extension. Combining the bounds gives
The ordinal and cardinal is the same in both models by the chain in a partial order condition. The forcing theorem formalizes this construction as the requested relative-consistency implication. A countable transitive ground model is a convenient presentation, not an additional consequence silently derived from mere consistency. This is the Cohen forcing two-level continuum plateau.
Rice theorem: every nontrivial extensional property of programs computing partial computable functions has an undecidable index set. More precisely, take an acceptable effective enumeration of the unary partial computable functions. If contains some but not all of these functions, then
“Extensional” means that equality of partial functions, including their domains, preserves membership; no syntactic restriction on program codes is being considered.
We use two standard facts, stated explicitly. The diagonal halting set is undecidable. For the associated acceptable enumerations of -ary partial computable functions, with , the S-m-n theorem says that for every there is a total computable function such that
where means equality of defined values and equality of undefinedness. Thus fixed parameters in a program can be compiled into its index effectively.
Let be the nowhere-defined partial computable function. Choose a partial computable function whose membership in is opposite to that of ; this is possible by nontriviality. For each , construct the program
This is a uniform partial computation. Take an index for the binary partial computable function . The S-m-n theorem gives the total computable function with . Crucially,
Even when itself is undefined, the equality of partial functions remains correct. If , this gives a many-one reduction of to ; if , it gives a many-one reduction of to the complement of . A decision procedure for would therefore decide in either case, a contradiction.
The equivalent language formulation says that every nontrivial property of computably enumerable languages depending only on the recognized language has an undecidable index set. Apply the function formulation to the property of a partial computable function that its domain has the specified language property: every computably enumerable language occurs as such a domain.
An equivalence of categories consists of functors and together with invertible natural transformations and . A strict isomorphism of categories instead requires a functor with an inverse whose composites are literally identity functors.
First suppose belongs to an equivalence of categories. The isomorphisms give essential surjectivity. If , apply and conjugate by to obtain , so is a faithful functor. Similarly is a faithful functor. Writing , any has a preimage
Indeed naturality of gives , and faithfulness of gives . Thus is a full and faithful functor.
Conversely, assume is a full and faithful functor and has essential surjectivity. Using the axiom of choice, for each choose an object and an isomorphism . Define on a morphism by the unique lift
The full and faithful functor property makes preserve identities and composition, and makes a natural transformation. For , lift uniquely to . Lifting its inverse shows that is invertible. The naturality of and faithfulness of imply the naturality of . This proves
For large categories, this choice argument is understood in a fixed universe, or with the corresponding class-choice convention; ordinary set-sized axiom of choice suffices for small categories.
For the category of partial functions, let , with a tagged new element as basepoint. Send a partial function to the basepoint-preserving total function
Undefined composition is sent to the basepoint, so this is a functor . Restriction away from the basepoint recovers each partial function uniquely; hence it is a full and faithful functor. Every pointed set is isomorphic to , so there is an equivalence of categories. This particular equivalence can also be constructed explicitly, without choice, by deleting and adjoining the basepoint.
These actual categories are equivalent but not isomorphic. In the empty set is the only zero object: if is nonempty, its identity differs from its nowhere-defined endomorphism, so it cannot be initial or terminal. In every singleton pointed set is a zero object, and distinct singleton underlying sets give distinct objects. An isomorphism of categories is a bijection on objects preserving zero objects; it cannot take one such object onto several. This uses the categories of all actual sets, as in the paper, rather than chosen skeletal categories of representatives.
A skeletal category has no distinct isomorphic objects. If an equivalence joins two skeletal categories, essential surjectivity becomes surjectivity on objects. If , lift the identity of that object and its inverse using full and faithful to obtain , so . Thus is bijective on objects and on every hom-set. Its inverse on objects and morphisms is a strictly inverse functor, proving that it is an isomorphism of categories.
Under the axiom of choice, choose one object from each isomorphism class of a small category. The full subcategory on those objects is a skeleton of a category, and its inclusion is a full and faithful functor with essential surjectivity, hence an equivalence of categories.
For the converse, form the small category which is a groupoid with objects for , and exactly one morphism when , with no morphisms when . Suppose it is equivalent to a skeletal category , with quasi-inverse functors and . For each , the objects for are isomorphic, hence all equal to a uniquely determined . The isomorphism ensures that for some . The rule is a choice function. In particular, no representative in had to be chosen to define , since it is unique. Consequently