Try
A two-stage lookup can lose inputs. Imagine a local catalog that translates numbered requests into category codes, followed by a second catalog that translates supported categories into display labels. A missing entry means undefined: it is not a label called “missing,” zero, or a failed request counted as an ordinary output.
Let the source A contain 0, 1 and 2. The first lookup f sends both 0 and 1 to u and sends 2 to v. The second lookup g has just one entry: v goes to z. Before reading further, write the inputs for which the entire lookup finishes. Does finishing on fewer inputs repair the collision between 0 and 1?
| Input x | First value f(x) | Is g defined there? | Composite value |
|---|
| 0 | u | No | Undefined |
| 1 | u | No | Undefined |
| 2 | v | Yes | z |
The complete composite has only the entry 2↦z. It is injective on its singleton domain: there are no two distinct eligible inputs with the same output. But f still has the collision f(0)=f(1). The second lookup has concealed it, not separated it. Writing “undefined” in the table is explanatory notation, not an extra output shared by 0 and 1.
Predict
Now add a new input 3, let f(3)=w, and add g(w)=q with q different from z. Predict the new composite domain and whether the conclusion changes. It has entries 2↦z and 3↦q. Thus the same phenomenon occurs with two distinct surviving inputs; it is not an artifact of a singleton domain.
Change something else: define g(u)=z. All four inputs now survive, and 0 and 1 still collide after composition. In fact 2 also reaches z. No deterministic function applied to equal intermediate values can make them different. The crucial question is whether the intermediate value is eligible for the next stage.
Keep these three statements separate: f is defined on all of its named source; f has no collisions on its defined inputs; f reaches every element of its named codomain. They are called totality, injectivity and surjectivity, respectively. None is a synonym for either of the others.
Experiment
Make a paper table with source inputs a, b, c, d, e and first-stage entries a↦red, b↦red, c↦blue, d↦green; leave e undefined. Give the second stage blue↦square and green↦circle. Record every surviving input and output. Then change only green’s output to square. Identify which claim fails after that change and which domains remain unchanged.
Compare the complete table and the changed case
Initially the composite has domain consisting of c and d, with different outputs square and circle, so it is injective. The first map is not injective because a and b share red. After changing green’s output, c and d share square and the composite is no longer injective. Its domain is still c and d. An output change can alter injectivity without changing eligibility. The input e never reaches the second lookup at all.
Next allow the second lookup to accept red. Can any chosen output restore injectivity of the composite on all four defined first-stage inputs? No: a and b must receive the same output. This is a small investigation of the general proof below, not a proof for every possible pair of maps.
Understand
We use an explicit convention. A partial map f:A⇀B has an actual domain dom(f) contained in A and assigns one value f(x) in B to each x in dom(f). It is total on A exactly when dom(f)=A. Its image f(dom(f)) consists of its actual outputs. It is injective when equality f(x)=f(y) for x,y in dom(f) forces x=y, and it is onto B when f(dom(f))=B. An empty-domain map is injective; it is onto its codomain only when that codomain is empty.
For g:B⇀C, the composite has domain
dom(g∘f) = the set of x in dom(f) for which f(x) belongs to dom(g).
Both directions matter. If the composite is defined, f must first produce a value and that value must be eligible for g. Conversely those two conditions permit the two successive evaluations, producing g(f(x)). Do not evaluate f(x) outside dom(f) merely to test the second condition. Two partial maps with the same named source and codomain are equal only if their actual domains and values agree.
Suppose g∘f is injective. For x,y in its domain, f(x)=f(y) gives g(f(x))=g(f(y)), so x=y. This proves injectivity of f restricted to the composite domain. It proves injectivity on all of dom(f) if we additionally know f(dom(f)) is contained in dom(g), equivalently dom(g∘f)=dom(f). Under that coverage hypothesis every possible collision of f can be passed through g. Injectivity of g is not needed for this implication. Coverage is a sufficient hypothesis; a particular f might already be injective without it.
Surjectivity uses a different argument. If g∘f is onto C, then each c in C has an input x producing it; the intermediate value f(x) witnesses that g is onto C. If f is onto B and g is onto C, choose a preimage y in dom(g) of c, then a preimage x in dom(f) of y. That x belongs to the composite domain, proving the composite onto. These proofs require neither partial map to be total.
For another familiar implication, assume g is injective and the composite is onto C. For y in dom(g), choose x with g(f(x))=g(y). Injectivity gives f(x)=y. We have proved that f reaches dom(g), not necessarily every element of B. Requiring g to be total on B repairs the stronger conclusion that f is onto B. For example, with B consisting of u and v, g defined only at u, and f reaching only u, the composite can be onto a singleton C while f misses v.
Apply
Consider the real partial map F(x)=1/x and the total map G(x)=x−2. Determine both domains before simplifying. G∘F is defined for every real x except 0 and has value 1/x−2. F∘G is defined for every real x except 2 and has value 1/(x−2). The excluded input is determined by the intermediate value, not by the printed name of the outer function alone.
For a domain-only surprise, let J(x)=x²/x on the real numbers where the quotient exists. Cancellation gives J(x)=x for x≠0. It does not turn J into the total identity: its graph lacks the pair 0↦0. Adding that pair creates an extension. Write a sentence explaining why a table and an algebraic formula require the same domain bookkeeping.
Check the explanation and an inverse boundary
Cancellation proves equality of values on an existing domain, not the existence of a previously undefined value. Similarly, an injective partial lookup can be reversed on its image: the two composites fix the original actual domain and its image. They need not fix every element of the named ambient source and codomain, because some of those inputs remain undefined. Calling a map an inverse therefore requires specifying the sets on which the identity claims hold.
Continue
In the practice tasks, supply domains beside every composite, and separate examples from general proofs. One task asks for associativity: the two groupings must have the same domain before their nested output formulas can establish equality. Another asks you to repair a surjectivity implication by stating exactly which map must be total.
Before accepting any composition argument, ask: Which inputs were quantified over? Are both intermediate values defined? Does “onto” refer to the image, the next map’s actual domain, or its named codomain? These questions expose the hidden assumption rather than discarding the useful total-function theorem.