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]
Reading 13: Abstraction Functions & Rep Invariants. Rep Invariant and Abstraction Function: representation space, abstract space, partial AF and boolean RI
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.
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]
https://raw.githubusercontent.com/kevin-wayne/algs4/master/src/main/java/edu/princeton/cs/algs4/BST.java. Sedgewick and Wayne, Algorithms: BST implementation, complexity contract and get method
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.
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]https://raw.githubusercontent.com/kevin-wayne/algs4/master/src/main/java/edu/princeton/cs/algs4/BST.java. Sedgewick and Wayne, Algorithms: BST keys method and inherited-bound isBST check
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
Category of partial functions 2026-10-05
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.
Cohen forcing two-level continuum plateau 2026-10-06
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-10-06
Composition of partial functions is strict: is defined only if every is defined and is defined on the resulting tuple. An argument discarded by the outer function still has to be defined. A representation in a non-strict programming language therefore needs an explicit sequencing guard.
Finite-condition Lévy collapse 2026-10-03
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 .
Finite-function collapse to countable size 2026-10-05
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 2026-10-06
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 in a partial order condition; 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-10-14
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]
https://discrete.openmathbooks.org/preview/sec_intro-functions.html. Levin, Discrete Mathematics: An Open Introduction, Functions
.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.
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.
Partial unary operation 2026-10-06
A partial unary operation on a set is a partial function with specified domain and values in . A map preserving such operations must send each point of the source domain into the target domain and preserve its assigned value. It need not reflect whether the operation is defined.
Past exam of the mathematics course of the University of Cambridge 2007 ii Paper 1 16G Solution Created 2026-09-24 Updated 2026-10-14
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 .
Past exam of the mathematics course of the University of Cambridge 2014 iii Paper 19 5 iii Solution Created 2026-10-03 Updated 2026-10-06
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 givesThe 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.
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 120 3 Solution Created 2026-10-03 Updated 2026-10-06
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 thatwhere 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 programThis 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.
Past exam of the mathematics course of the University of Cambridge 2017 iii Paper 119 1 Solution Created 2026-10-03 Updated 2026-10-05
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 preimageIndeed 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 liftThe 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 provesFor 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 functionUndefined 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
Past exam of the mathematics course of the University of Cambridge 2017 iii Paper 121 4 ii Solution Created 2026-10-03 Updated 2026-10-05
The two-argument version of Fn forcing consists of finite partial functions:Thus a stronger condition specifies more values. The empty partial function is the greatest condition. Two conditions are compatible forcing conditions exactly when they agree on their common domain; if they do, their set union is a common strengthening. This is in the three-argument convention for Fn forcing. If or is empty, only the empty condition exists. For infinite and at least two elements in , assigning two different values at a fresh coordinate proves that this is an atomless forcing order.
Past exam of the mathematics course of the University of Cambridge 2018 iii Paper 121 2 iv Solution Created 2026-10-03 Updated 2026-10-05
We give a relative-consistency argument using a finite-function collapse to countable size. The assumed consistency implies that ZFC is consistent. Passing to the constructible universe gives consistency of , which also satisfies the Generalized continuum hypothesis. Work in this ground theory, let , and force with finite partial functions , ordered by reverse inclusion.
The union of a generic filter is a total surjection : prescribing a new domain coordinate is dense, and putting any specified into the range is dense. Hence becomes countable. Set forcing preserves ordinals, and absoluteness of constructible levels implies that the extension has the same constructible universe as the ground model. Its is therefore still the old , so it satisfies the stated countability of constructible omega-one condition.
We must also verify GCH after the collapse. The order has ground-model size , hence the -chain condition. By cardinal preservation by chain-condition forcing, all old cardinals at least survive. Every old ordinal below has size at most and becomes countable, so the old is exactly the new .
A name for a subset of a fixed ground-model ordinal can be chosen as a set of pairs with and a condition: use an antichain deciding membership at each coordinate. Thus the number of such names in the ground model is at most . For subsets of this is by ground-model GCH. In the extension it gives , and Cantor theorem gives the reverse lower bound. For every old cardinal the bound isin the ground model. Both and remain cardinals, so again the upper bound and Cantor theorem give the extension's equality . These are all its uncountable cardinals. This proves GCH preservation by a finite-function collapse in the required case.
The forcing relative-consistency theorem now yieldsThe construction in fact only needs consistency of ZFC. This argument uses the formal inner-model and forcing consistency theorems; it does not infer the existence of a countable transitive model merely from consistency.


