The translation that breaks on the second step

Imagine two patterned landscapes. One contains states and lawful routes. The other contains different states and different routes. A translation thread joins each source state to a target state. That is the part people usually draw. The decisive question is whether the threads also carry every route, and every route made by joining routes, without changing what the route does.

Two patterned worlds joined by preserving threads
Two landscapes with corresponding objects and routes connected by translation threads The source world on the left and target world on the right each contain three nodes and curved routes. Object threads connect corresponding nodes. A highlighted composite route is preserved in the target, while a dotted alternative shows a translation that would fail. source pattern target pattern A B C F(A) F(B) F(C) pointwise match, wrong route
Decision: inspect the route structure, not only the object threads. The solid teal arc is the translated composite. The coral dotted arc reaches familiar endpoints through a different target morphism. Illustrative conceptual field.Alt text: Two curved landscapes contain three nodes each. Threads map nodes across landscapes, and a highlighted composite path shows that route preservation is the decisive constraint.

Objects are not the system

A category packages three kinds of information: objects, morphisms between objects and a rule for composing compatible morphisms. It also contains an identity morphism for every object. The identity is not decorative. It represents staying at the same object without adding a genuine transition. A category can describe sets and functions, vector spaces and linear maps, states and authorised actions, data schemas, orders, programs or many other structures. The common feature is composability.

The route is part of the result

Suppose two delivery systems both move a sealed package from a pharmacy to a patient. One route passes through identity verification and a temperature-controlled handover. The other drops the package at an unattended desk. Endpoint-only testing records the same parcel, destination and arrival time. Yet the routes preserve different obligations. If the source system treats verified custody as part of delivery, a translation that keeps only the endpoint has not preserved the process.

Categories make this distinction explicit because they can contain several morphisms with the same source and target. A direct release, an authorised release and a release followed by compensation may all end at Released, while remaining different arrows. The category also records when two longer paths are declared equal. In a governed workflow, the equation publish = release ∘ review says more than “both arrive at Released”. It says which route constitutes the governed operation.

This is the hidden mechanism behind many failed translations. A field map carries nouns. A state map carries snapshots. A functor must also carry operational equations: which sequences are legitimate, which sequences count as the same action, and which apparent no-ops really leave the system unchanged. Without those equations, a translator can preserve visible objects while replacing the source’s causal organisation.

Worked example 1 · The three-state workflow

Let W contain the objects Draft, Reviewed and Released. It has a morphism review: Draft → Reviewed, a morphism release: Reviewed → Released, and their composite publish = release ∘ review: Draft → Released. Each state also has an identity morphism.

Let E describe target execution. It has a governed path log_review followed by authorised_release, whose composite is governed_publish. It also has a parallel arrow bypass_publish with the same source and target. A mapping that sends review and release correctly but sends publish to bypass_publish is not a functor. The target endpoints agree, yet F(release ∘ review) ≠ F(release) ∘ F(review).

The second-step intervention reveals the broken translation
A source workflow maps to a target workflow with a composition failure The source has review followed by release and a direct composite publish. The target maps the individual actions to logged review and authorised release, whose composition is governed publish. The candidate mapping sends the direct composite to bypass publish, producing unequal paths. source category W target category E Draft Reviewed Released eDraft eReviewed eRel. review release publish = release ∘ review log release governed_publish candidate F(publish) = bypass_publish Intervention Compare translating the composite with composing the translations. bypass_publish ≠ authorised_release ∘ log_review
The failure is causal, not cosmetic. The intervention holds endpoints fixed and changes only the route. A mapping that passes object checks can still violate the source’s governing equation. Illustrative counterfactual diagram.

The two laws of a functor

A functor F: C → D assigns each object X of C an object F(X) of D, and each morphism f: X → Y a morphism F(f): F(X) → F(Y). The assignments must preserve two operations. Standard texts give the same definition because these laws are the mechanism, not a preferred interpretation.[2][3][10]

F(idX) = idF(X)    and    F(g ∘ f) = F(g) ∘ F(f)

The first law says that translating “stay here” must yield “stay at the translated object”. The second says that translating a composite route must yield the same target route as translating its parts and composing them. Functoriality turns local assignments into a global consistency obligation. Once generators and path equations are specified, many target choices are forced.

Thought experiment 1 · The identity trap

Change only the meaning of “do nothing”

Suppose an old workflow’s identity action leaves a record untouched. The migration maps it to “open and re-save”. No business field changes, so ordinary tests call this a no-op. Yet the target updates the modification timestamp and emits an event. Repeating the translated identity changes audit state and can trigger downstream work.

What should the translator do? If the target operation has an observable effect, it is not the target identity in the category that includes audit events. The candidate mapping can be rescued only by changing the target boundary so timestamps and events are deliberately ignored, or by mapping the source identity to a genuine no-op. The choice of category decides which effects count, so it must be declared.

Object matches grow slowly; composition obligations do not
Chart comparing object checks with composition checks in ordered workflow categories For a total order category on n states, object checks equal n while non-trivial composition triples equal n choose 3. Bars show composition checks increasing from 1 at three states to 56 at eight states. 0102030405060 3 states45678 1410203556 object checks: n composition triples: C(n,3) Illustrative family: total-order category on n workflow states
In this specific family, object assignments require n checks while non-trivial composition triples require C(n,3). The chart does not claim that every category has this growth rate. It shows why example-based matching becomes weak evidence as compositional structure expands. Illustrative calculation.

Test generators and equations, not screenshots

The chart creates an apparent problem. If every new object creates many more composite paths, must an auditor enumerate them all? Usually not. A finite category or schema can often be presented by a smaller set of generating objects, generating morphisms and path equations. Longer routes are built from those generators. If the presentation is complete, a mapping that preserves generator types, identities and the defining equations determines a functor on every derived composite.

For the workflow, review and release are generators. The equation identifying their composite with publish is a relation. The audit therefore checks the mapped generators and asks whether the target composite equals the mapped publish. It does not need a separate hand-written test for every syntactic spelling of the same route. This is the practical compression supplied by category theory.

The assumption matters. If the source presentation omits an effect, such as a receipt, timeout or revocation, the proof covers only the impoverished category. A complete pass can then coexist with an operational failure. The strongest functoriality result is always relative to the declared generators, equations and boundary. A good audit therefore treats missing structure as a first-class uncertainty, not as a harmless documentation gap.

The argument in one pass
Chart · flow
flowchart TD
  A["The translation that breaks on<br/>the second step"] --> B["The law that makes a map travel"]
  B --> C["Changing translations without<br/>hidden patches"]
  C --> D["A coherence audit for real<br/>translations"]
  D -. "re-test" .-> A
  classDef first fill:#0a1424,stroke:#B96D00,stroke-width:2px,color:#e6f3ff
  classDef step fill:#0a1424,stroke:#3f7da0,stroke-width:1px,color:#e6f3ff
  class A first
  class B,C,D step
A structural route through Functors and natural transformations: from The translation that breaks on the… to Move approval from endpoints to…. Reading use: follow the relation, then return to the surrounding argument for evidence and limits.

The law that makes a map travel

The word “preserve” can sound as though a functor copies everything. It does not. A functor may rename objects, compress several objects into one, forget information or embed a structure inside a richer one. What it cannot do is contradict the composition and identity laws of the source. This is why functors are useful translations rather than rigid replicas.

Preservation is selective, not photographic

Take the familiar forgetful functor from groups to sets. It sends each group to its underlying set and each group homomorphism to its underlying function. The group operation is no longer visible as an object in the target category, so information has been forgotten. Yet identity homomorphisms remain identity functions, and a composite of homomorphisms becomes the same composite of underlying functions. The translation is lawful precisely because the structure it claims to carry still composes correctly.

Other functors add or compress structure. The free-vector-space construction sends a set to the vector space of formal linear combinations of its elements, and sends a function to the induced linear map. A quotient-like workflow map may merge several internal states into one public status. An embedding may place a small category inside a richer one. None of these operations is judged by visual similarity. Each is judged by what happens to identities and composites.

This gives “preservation” a disciplined meaning. It never means that every property transfers. It means that specified operations and equations transfer. A forgetful functor may preserve composition while discarding algebraic operations from view. A compression functor may preserve order while losing distinctions. An embedding may preserve all declared arrows while the target contains many additional ones. Before asking whether a functor is good, ask which structure it was designed to preserve and which loss the decision can tolerate.

A minimal numerical intuition: order becomes monotonicity

Take a set of clearance levels 0 ≤ 1 ≤ 2 ≤ 3. Treat each level as an object and include one morphism x → y whenever x ≤ y. This turns the order into a category. A functor from this category to another ordered set is exactly a monotone map: whenever x ≤ y, we must have F(x) ≤ F(y).[4]

Worked example 2 · A monotone translator

Map source levels 0,1,2,3 to target risk tiers 0,1,1,3. The map collapses levels 1 and 2, but it never reverses order. Therefore it is a functor between the two poset categories. Map them instead to 0,2,1,3, and the source arrow 1 → 2 would require a target arrow 2 → 1. None exists. The mapping fails before we discuss names or semantics.

A functor may compress a trajectory, but it may not reverse it
Two staircase orders connected by a monotone and non-monotone map The upper diagram maps four increasing source levels to target levels 0, 1, 1 and 3 without reversal. The lower coral path maps 1 to 2 and 2 to 1, breaking monotonicity. source clearancetarget risk tier 01230123 valid: 0, 1, 1, 3 preserves order invalid alternative reverses 1 ≤ 2
A poset category makes the preservation condition visible with almost no notation. Compression is allowed. Reversal is not. Worked mathematical example.

A lawful map may still be too lossy

The monotone map 0,1,2,3 ↦ 0,1,1,3 passes the functor laws, but it merges two source levels. Whether that matters depends on the claim. If the target is a public display that intentionally groups both levels as “medium”, the compression may be correct. If the target grants authority and level 2 carries a permission unavailable at level 1, the same functor is decision-destroying.

Category theory has stronger tests for stronger claims. A functor is faithful when it does not merge distinct parallel morphisms inside any source hom-set. It is full when every target morphism between mapped objects comes from a source morphism. It is essentially surjective when every relevant target object is isomorphic to some mapped source object. These conditions do not replace semantic judgement, but they expose different forms of loss.

A functor need not be full, faithful or essentially surjective to be useful. The mistake is to pass the two functor laws and then speak as though equivalence had been proved. In the workflow case, a mapping can preserve every declared path while omitting target-only emergency controls. In the opposite direction, it can add target actions that have no source meaning. Functoriality proves consistency of translation, not completeness of coverage.

Covariance, contravariance and what direction means

A covariant functor preserves arrow direction. A contravariant construction reverses it and is usually written as a covariant functor from the opposite category Cop. Linear duality is the classic case. A linear map f: V → W induces f*: W* → V* by precomposition, so arrows reverse. Applying duality twice restores the original direction and produces a covariant double-dual functor.

Thought experiment 2 · The basis lottery

Keep every vector space, change only the chosen basis

Every finite-dimensional vector space V has the same dimension as its dual V*, so an isomorphism can be built after choosing a basis. Run the construction again with another basis. The resulting isomorphism usually changes. Object by object, “V is isomorphic to V*” is true. As a family across all vector spaces and linear maps, the chosen translations do not cohere.

Now map v ∈ V to the element of V** that evaluates each functional φ at v: ηV(v)(φ) = φ(v). No basis is chosen. For every linear map, the associated square commutes. In finite dimension, each component is an isomorphism. This contrast helped motivate the original theory of natural transformations.[1]

Pointwise isomorphism is weaker than a basis-free family
Comparison of basis-dependent V to V star maps and the natural V to double dual map The upper route from a vector space to its dual changes when the basis changes. The lower route maps a vector into its evaluation functional in the double dual and commutes with linear maps. basis-dependent choice V choose basis b V* choose b′, obtain a different component natural double-dual family V ηV(v)φ ↦ φ(v) V** same rule for every V, compatible with every linear map
Equal dimension supplies an isomorphism after a choice. Naturality asks whether the components arise by one rule that respects every relevant morphism. The evaluation map into the double dual passes that test. Historical mathematical example after Eilenberg and Mac Lane.
Mechanism

The preserved object is not a visual pattern but a calculus of paths. Identities protect what counts as no change. Composition protects the meaning of “do this, then that”. Direction protects variance. If these rules survive translation, results proved by path equations can travel. If they fail, local correspondences cannot support global inference.

Changing translations without hidden patches

Suppose we have two functors F, G: C → D. They translate the same source category into the same target category, perhaps using an old and new representation, a sandbox and live implementation, or two mathematical constructions. Comparing F(X) with G(X) separately for every object is still not enough. The comparisons themselves must respect the source morphisms.

The square you should be able to walk both ways

A natural transformation η: F ⇒ G assigns to each source object X a target morphism ηX: F(X) → G(X). For every source morphism f: X → Y, two target routes must agree. We can apply F(f) and then change representation with ηY. Or we can change representation first with ηX and then apply G(f). Naturality requires the same result.[3]

G(f) ∘ ηX = ηY ∘ F(f)
Naturality is path independence across a change of translation
A commuting naturality square The square has F of X and F of Y on the top, G of X and G of Y on the bottom. Horizontal arrows are F of f and G of f, vertical arrows are components eta X and eta Y. Both paths from F of X to G of Y are marked equal. F(X)F(Y)G(X)G(Y) F(f) G(f) ηX ηY same composite change then act = act then change
Naturality forbids object-specific patching. A component is acceptable only as part of a family whose square commutes for every source morphism. Canonical naturality diagram, redrawn.

Uniformity does not mean identical components

The components ηX need not be the same function. Their domains and codomains usually differ, so literal sameness may be impossible. Naturality demands a different kind of uniformity: every component must participate in one rule that is compatible with the source’s morphisms. The rule may adapt to the object, but it may not introduce an unexplained exception that changes what a source operation means.

Think of changing measurement units. A temperature-reading functor may represent each sensor stream in Celsius, while another represents it in Fahrenheit. The component at every stream converts values by the appropriate affine rule. Filtering before conversion agrees with conversion before filtering when the filter is defined only by sample position. A threshold test at 30°C, however, must become the corresponding threshold at 86°F. Reusing the numeral 30 in both representations makes one square fail. The converter still maps every individual reading, but it does not coherently translate the operation.

This is why naturality is stronger than a catalogue of successful examples. It asks whether the change of representation commutes with all declared ways of using the representation. When that holds, a theorem or invariant expressed through those morphisms can be moved across the change. When it fails, the component family may still be useful, but it is a patched migration rather than a natural transformation.

A database example where the square has operational meaning

Category-theoretic database models treat a schema as a category, an instance as a functor into Set, and a morphism between instances as a natural transformation.[5][6] Consider a schema with objects Person and Team, plus a morphism worksIn: Person → Team. An instance assigns a set of person rows, a set of team rows and a foreign-key function from people to teams.

Worked example 3 · Row translation without broken foreign keys

Instance I contains person P17 assigned to team T3. Instance J uses new identifiers person-882 and team-blue. A candidate transformation has components αPerson(P17)=person-882 and αTeam(T3)=team-blue.

The naturality condition says that translating P17 and then following worksIn in J must produce the same team as following worksIn in I and then translating that team. If the new person row points to team-red, the object-level mappings still exist but the transformation is not natural.

A natural transformation preserves the foreign-key square
The components translate rows in each table. Naturality ensures that relational structure travels with the rows. A row-by-row conversion that changes the foreign-key result is not a coherent instance transformation. Synthetic database instance after the functorial data model.
Thought experiment 4 · The hundred-point patch

Add one operation after every object test passes

A migration team compares an old representation F(X) and a new representation G(X) for one hundred object types. For each type, an engineer writes a converter ηX. Every sample converts correctly. The team concludes that the new representation is a coherent replacement.

Now add one source morphism merge: X × X → X, representing the operation that combines two records. In the old representation, duplicates are removed before priorities are calculated. In the new representation, priorities are calculated first and duplicates are then removed. Converting two inputs and merging them produces a different priority from merging first and converting the result. No object mapping changed. Only one route was exposed.

The failure tells us exactly what the first hundred tests could not. The converters were a pointwise patch set, not a natural family for the enlarged source category. The team has three honest options: change the converter, change the new merge operation, or narrow the claim to a category that excludes merge. Adding more endpoint examples cannot repair the square.

Natural isomorphism and irreversible change

If every component ηX is an isomorphism, the transformation is a natural isomorphism. This is stronger than having unrelated objectwise isomorphisms. Each component is reversible, and the entire family commutes with the source structure. Natural isomorphism is often the right meaning of “the same construction up to coherent renaming”. It still does not mean that the source and target categories themselves are equivalent; it compares two functors with the same source and target.

Thought experiment 3 · Promote before or after acting

Move one operation across the sandbox boundary

Let S translate an authorised workflow into sandbox execution and L translate it into live execution. For each workflow state X, let ηX: S(X) → L(X) promote a sandbox state to its live counterpart. Choose one action, such as review.

Route A promotes the draft, then performs live review. Route B performs sandbox review, then promotes the reviewed state. If both routes produce the same authoritative state and receipts, the square commutes for review. Now replace review with “send notification”. Sandbox execution records a simulated effect while live execution sends a real message. Promotion cannot make those outcomes identical. Naturality fails, revealing that notification must be excluded from the promotable category, represented with richer effect receipts, or handled by a compensation-aware structure.

Strongest boundary

A commuting diagram can be perfectly correct and still model the wrong thing. A constant functor sends every source object to one target object and every morphism to its identity. It preserves identities and composition automatically, while erasing every distinction. Natural transformations between trivial functors may also be easy. Functoriality establishes coherence relative to declared categories. It does not establish informativeness, empirical truth, semantic adequacy or equivalence.

How the claim changes under pressure
Chart · state
stateDiagram-v2
  [*] --> Claim
  state "Objects are not the system" as Claim
  state "The route is part of the result" as Test
  state "The two laws of a functor" as Revision
  Claim --> Test: expose mechanism
  Test --> Decision: evidence survives
  Test --> Revision: rival survives
  Revision --> Claim: narrow or rebuild
  Decision --> [*]
The revision loop begins with Objects are not the system and keeps counterexamples inside the reasoning path. Reading use: follow the relation, then return to the surrounding argument for evidence and limits.

A coherence audit for real translations

The practical mistake is to begin with a list of paired labels. A disciplined audit begins by stating what can happen in each domain. The proposed contribution here is a minimum coherence certificate: a compact record that separates object matching, functorial preservation, natural comparison and stronger equivalence claims.

Deriving the certificate from the failure modes

The opening migration failed because the source path equation was omitted. The identity thought experiment failed because the target boundary ignored audit effects. The basis lottery failed because each component depended on a local choice. The sandbox case failed because an irreversible effect crossed a boundary that could not preserve it. These are not four unrelated errors. Each removes a different obligation from the mapping.

Minimum coherence certificate

Record the source and target categories, including the system boundary. List the object map and the morphism map on generators. Test every declared identity and generating path equation. If two functors are being compared, list every component and test a generating set of naturality squares. Then run a collapse test: identify distinctions, equations or observables that the mapping erases. Finally, state the strongest claim the evidence permits.

Six entries make the certificate auditable

  1. Boundary. Name what counts as an object, an effect and an observation in each category. State what has been intentionally excluded. A timestamp ignored by one boundary may be a decisive morphism in another.
  2. Typing. For every generating arrow f: X → Y, verify that its image really has type F(X) → F(Y). Many attractive comparisons fail here because a state is paired with a process, or an internal proposal is paired with an authorised action.
  3. Identity. Identify the genuine no-op at every mapped object. Check readbacks, audit events and side effects, not only business fields.
  4. Composition. List the source path equations that carry meaning. Compare translating each composite with composing the translated generators. Record the first unequal path as a counterexample.
  5. Naturality. When comparing two functors, provide the component at every generating object and test the square for every generating morphism. State whether the components are reversible.
  6. Loss and claim. Search for collapsed arrows, missing target operations and erased observables. End with the weakest accurate claim class and an explicit prohibition on stronger language.

The order is deliberate. Naturality is meaningless before both candidate functors are typed and functorial. Equivalence is premature before loss has been examined. A certificate can stop at any failed gate. That stopping point is useful evidence because it tells a designer whether to repair the model, narrow the boundary or lower the claim.

Worked example 4 · From authorised intent to verified effect

Consider a source category G with objects Intent, Authorised, Executed and Verified. Its generating arrows are approve, act and readback. The composite governed_outcome = readback ∘ act ∘ approve represents the full governed route. Identity arrows preserve each state without creating a new authority or effect.

A target category K contains a model proposal, a capability grant issued by a deterministic authority kernel, a typed tool call, an effect receipt and a verified outcome. A candidate functor maps approve to policy evaluation plus capability issuance, act to the typed call, and readback to independent outcome verification. The mapped governed composite must equal that complete target chain.

Now change one thing. Let a high-confidence model proposal call the tool directly, while a separate reporting process later fabricates the same final status and receipt fields. Endpoint tests can still show “Verified”. The functor test fails because the image of governed_outcome is not the composite of the mapped generators. Authority was bypassed even though the final record resembles the authorised route.

This example shows why the certificate is useful beyond mathematics. It separates intent, proposal, authority, typed action, evidence and verified outcome. When two routes end at the same status but differ in authority or receipts, the path difference is the control failure.

A production-shaped naturality test across an authority boundary
Sandbox and live workflow translators with promotion components and receipts An authorised workflow category feeds sandbox and live execution functors. Vertical promotion maps connect corresponding states. Review commutes when state and receipts agree. Notification is marked as non-commuting because simulated and real effects differ. Authorised workflow category W objects: Draft, Reviewed, Released · morphisms: review, release, governed composite · identities Sandbox functor SLive functor L sDraftsReviewedsRel.lDraftlReviewedlRel. reviewreleasereviewrelease simulated review receiptauthoritative review receipt ηDraft: promote ηReviewed review square: state + receipt can commute notification square: simulated effect ≠ sent message authority and effect boundary
Promotion is natural only for operations whose sandbox and live semantics can be made path-independent. Irreversible effects expose the break and should be represented outside the promotable subcategory or with explicit transaction semantics. Practitioner synthesis; synthetic configured system.

Read a failed square as a diagnosis

A failed coherence test should not be reduced to one red score. Different failures call for different repairs. A boundary failure means the categories omit an effect needed by the decision. Enlarge or redefine the model. A typing failure means the proposed arrow does not connect the mapped source and target objects. Repair the object map or abandon the comparison.

An identity failure means the translated no-op creates an observable change. Find a genuine identity or declare the effect outside the boundary. A composition failure means at least one source equation changes meaning after translation. Repair the morphism map or lower the claim below functoriality. A naturality failure means two functors may each be valid while the proposed change between them contains a local exception. Repair the component family or restrict the operations over which coherence is claimed.

Finally, a collapse failure can occur even when every diagram commutes. The mapping may erase distinctions essential to the decision, as a constant functor does. This is not a violation of category theory. It is evidence that functoriality was necessary but insufficient for the intended use. The certificate keeps that distinction visible instead of forcing all defects into one similarity score.

Claim classes rather than one inflated verdict

The certificate should end with a claim class. A lexical analogy pairs terms. A typed correspondence specifies objects and candidate relations. A functorial translation passes identity and composition tests. A natural comparison coherently relates two functors. An equivalence candidate adds stronger conditions such as full and faithful behaviour and sufficient coverage of the target. Each class licenses different language.

The coherence claim matrix
Claim classMinimum evidencePermitted statementAutomatic prohibition
Lexical analogyNamed resemblance and break point“This suggests a comparison.”No structural preservation claim
Typed correspondenceObjects, morphism candidates, source and target boundaries“These roles are mapped explicitly.”No functor claim before laws are tested
Functorial translationIdentity and composition checks on generators and path equations“This translation preserves the declared compositional structure.”No equivalence or semantic identity claim
Natural comparisonTwo functors, typed components and commuting naturality squares“The change between translations is coherent across the declared operations.”No claim that components are reversible unless shown
Equivalence candidateFunctoriality plus non-collapse, coverage and inverse-style evidence“The categories may encode the same structure up to coherent isomorphism.”No ontological or empirical identity without separate evidence
Use the weakest accurate claim class. Passing a lower row’s obligations does not silently grant the claims of the next row. The matrix is a decision instrument, not a similarity score. Practitioner synthesis.

The executable functor notebook

The browser lab below audits two synthetic constructions. The first checks whether a workflow mapping preserves identity and composition. The second checks whether a family of representation converters is a natural transformation between two finite-set-valued functors. Choose a deliberate defect to see which law breaks.

Start with the governed mapping and coherent components. The expected result is two passes. Then map the workflow composite to the bypass action. Object and identity checks still pass, but composition fails. Restore the workflow and swap the release-decision component. Both functors remain valid, yet the decide and end-to-end squares fail. The interventions change one obligation at a time, so the resulting counterexample identifies the mechanism rather than merely lowering a score.

Executable lab

Commuting-path auditor

All data are synthetic. The lab tests declared equations, not semantic truth. It runs entirely in this page.

Functor
Run the audit.
Naturality
Run the audit.
Permits
No conclusion yet.
Cannot establish
Semantic adequacy, empirical equivalence, consciousness, or production safety beyond the declared finite tests.

What a positive and negative result mean

A positive functor result permits the narrow statement that the candidate mapping preserves the identities and composition equations encoded in the synthetic source. A positive naturality result permits the statement that the selected component family commutes with every tested source morphism. A negative result names a concrete counterexample path. It does not show that no better functor or natural transformation exists. It shows that this candidate, under this boundary, fails.

The finite-set implementation compares functions extensionally by evaluating every element in each synthetic domain. This works because the domains are small and complete. For large or infinite structures, an auditor needs symbolic reasoning, property-based tests, proofs on generators, or a combination of these. Sampling can find a counterexample but cannot by itself prove a universal equation.

The lab cannot discover missing objects, hidden effects or a poorly chosen category. It also cannot promote functoriality into equivalence. Those are modelling and evidence questions outside the checker. Automation can verify declared coherence; it cannot declare that the declaration captured the world.

Runnable Python version with positive and negative cases
Python 3.11+ · finite-set functor and naturality checker
from __future__ import annotations

from dataclasses import dataclass
from typing import Callable, Dict, Hashable, Iterable, Mapping, Tuple

Value = Hashable
ObjectName = str
ArrowName = str


@dataclass(frozen=True)
class Arrow:
    name: ArrowName
    source: ObjectName
    target: ObjectName


@dataclass(frozen=True)
class FiniteCategory:
    objects: frozenset[ObjectName]
    arrows: Mapping[ArrowName, Arrow]
    identities: Mapping[ObjectName, ArrowName]
    # (second, first) maps to second ∘ first
    composition: Mapping[Tuple[ArrowName, ArrowName], ArrowName]


@dataclass(frozen=True)
class FinSetFunctor:
    object_sets: Mapping[ObjectName, frozenset[Value]]
    arrow_functions: Mapping[ArrowName, Callable[[Value], Value]]


def equal_on(domain: Iterable[Value], left: Callable[[Value], Value],
             right: Callable[[Value], Value]) -> bool:
    return all(left(x) == right(x) for x in domain)


def validate_functor(category: FiniteCategory,
                     functor: FinSetFunctor) -> list[str]:
    errors: list[str] = []

    for obj in category.objects:
        if obj not in functor.object_sets:
            errors.append(f"missing object image: {obj}")

    for name, arrow in category.arrows.items():
        if name not in functor.arrow_functions:
            errors.append(f"missing arrow image: {name}")
            continue
        fn = functor.arrow_functions[name]
        source_set = functor.object_sets[arrow.source]
        target_set = functor.object_sets[arrow.target]
        for value in source_set:
            if fn(value) not in target_set:
                errors.append(f"{name} is not typed at {value!r}")

    for obj, identity_name in category.identities.items():
        identity_fn = functor.arrow_functions[identity_name]
        if not equal_on(functor.object_sets[obj], identity_fn, lambda x: x):
            errors.append(f"identity law fails at {obj}")

    for (second_name, first_name), composite_name in category.composition.items():
        first = category.arrows[first_name]
        second_fn = functor.arrow_functions[second_name]
        first_fn = functor.arrow_functions[first_name]
        composite_fn = functor.arrow_functions[composite_name]
        composed = lambda x, a=first_fn, b=second_fn: b(a(x))
        if not equal_on(functor.object_sets[first.source], composite_fn, composed):
            errors.append(
                f"composition fails: {composite_name} != "
                f"{second_name} ∘ {first_name}"
            )
    return errors


def validate_naturality(
    category: FiniteCategory,
    old: FinSetFunctor,
    new: FinSetFunctor,
    components: Mapping[ObjectName, Callable[[Value], Value]],
) -> list[str]:
    errors: list[str] = []
    for arrow in category.arrows.values():
        eta_source = components[arrow.source]
        eta_target = components[arrow.target]
        old_fn = old.arrow_functions[arrow.name]
        new_fn = new.arrow_functions[arrow.name]
        change_then_act = lambda x, e=eta_source, g=new_fn: g(e(x))
        act_then_change = lambda x, f=old_fn, e=eta_target: e(f(x))
        if not equal_on(old.object_sets[arrow.source],
                        change_then_act, act_then_change):
            errors.append(f"naturality fails for {arrow.name}")
    return errors


# Source category: Raw --normalise--> Flag --decide--> Decision
objects = frozenset({"Raw", "Flag", "Decision"})
arrows = {
    "id_Raw": Arrow("id_Raw", "Raw", "Raw"),
    "id_Flag": Arrow("id_Flag", "Flag", "Flag"),
    "id_Decision": Arrow("id_Decision", "Decision", "Decision"),
    "normalise": Arrow("normalise", "Raw", "Flag"),
    "decide": Arrow("decide", "Flag", "Decision"),
    "end_to_end": Arrow("end_to_end", "Raw", "Decision"),
}
C = FiniteCategory(
    objects=objects,
    arrows=arrows,
    identities={
        "Raw": "id_Raw", "Flag": "id_Flag", "Decision": "id_Decision"
    },
    composition={("decide", "normalise"): "end_to_end"},
)

old = FinSetFunctor(
    object_sets={
        "Raw": frozenset({-2, 0, 3}),
        "Flag": frozenset({0, 1}),
        "Decision": frozenset({"hold", "release"}),
    },
    arrow_functions={
        "id_Raw": lambda x: x,
        "id_Flag": lambda x: x,
        "id_Decision": lambda x: x,
        "normalise": lambda x: 1 if x > 0 else 0,
        "decide": lambda bit: "release" if bit == 1 else "hold",
        "end_to_end": lambda x: "release" if x > 0 else "hold",
    },
)

new = FinSetFunctor(
    object_sets={
        "Raw": frozenset({"n:-2", "n:0", "n:3"}),
        "Flag": frozenset({"false", "true"}),
        "Decision": frozenset({0, 1}),
    },
    arrow_functions={
        "id_Raw": lambda x: x,
        "id_Flag": lambda x: x,
        "id_Decision": lambda x: x,
        "normalise": lambda text: "true" if int(text[2:]) > 0 else "false",
        "decide": lambda flag: 1 if flag == "true" else 0,
        "end_to_end": lambda text: 1 if int(text[2:]) > 0 else 0,
    },
)

coherent_eta = {
    "Raw": lambda x: f"n:{x}",
    "Flag": lambda bit: "true" if bit == 1 else "false",
    "Decision": lambda d: 1 if d == "release" else 0,
}

broken_eta = {
    **coherent_eta,
    "Decision": lambda d: 0 if d == "release" else 1,
}

print("old functor:", validate_functor(C, old) or "PASS")
print("new functor:", validate_functor(C, new) or "PASS")
print("coherent eta:", validate_naturality(C, old, new, coherent_eta) or "PASS")
print("broken eta:", validate_naturality(C, old, new, broken_eta) or "PASS")

Save as coherence_audit.py and run python coherence_audit.py. The expected final line reports failures for decide and end_to_end. The code treats functions extensionally over finite synthetic domains, so it is a test harness, not a general theorem prover.

Where current applications stand

Functorial data migration is an established formal research programme: schemas can be represented as categories, instances as set-valued functors and data-preserving maps as natural transformations. Published work derives migration operations and demonstrates applied scenarios.[5][6] In machine learning, “Backprop as Functor” shows that, under stated assumptions about the learning setup, gradient descent and backpropagation define a monoidal functor from parameterised functions to learners.[7]

Broader categorical accounts of deep-learning architectures remain an active research direction rather than a settled universal description. Recent work argues that categorical algebra can bridge architectural constraints and implementations, while surveys document several distinct categorical programmes.[8][9] The relevant lesson is methodological: a paper earns the word “functor” by specifying its categories and proving preservation, not by using compositional vocabulary.

The same discipline applies to comparisons among machine architectures, biological processes and philosophical accounts. Naming a transformer block, a cognitive function and a phenomenological structure as corresponding objects does not produce a functor. The comparison must specify allowable transformations in each domain, show how they compose, and identify the target equation for every source equation. A successful formal bridge would preserve a bounded structure. It would not, without separate evidence, establish shared substrate, shared semantics or shared experience.

Open research hypothesis

Mapping failures in cross-domain AI comparisons will concentrate in naturality squares more often than in object assignments. The hypothesis is strengthened if preregistered comparisons repeatedly find plausible object and arrow maps that fail when one changes representation, scale, basis or intervention order. It is weakened if well-specified comparisons usually fail earlier, before a functor can be formed. A rival explanation is that researchers simply choose overly rich source categories. The smallest useful study is a corpus of twenty published analogy claims, each reconstructed with explicit generators and one counterfactual square.

The evidence conversation
Chart · sequence
sequenceDiagram
  participant Q as Question
  participant M as Mechanism
  participant E as Evidence
  participant D as Decision
  Q->>M: The translation that breaks on the second step
  M->>E: Objects are not the system
  E-->>M: compare rival explanations
  E->>D: Move approval from endpoints to preserved paths
  D-->>Q: revise scope or act
Question, mechanism, evidence and decision exchange the burdens developed in Functors and natural transformations. Reading use: follow the relation, then return to the surrounding argument for evidence and limits.

Move approval from endpoints to preserved paths

When someone says that one architecture, theory, schema or workflow “maps onto” another, do not ask first whether the paired concepts sound similar. Ask for the source category, the target category and the arrows that matter. Then ask which identities and composites must be preserved. If two translations are being compared, ask for the components and the squares that must commute.

The practical decision is to move approval from endpoint resemblance to path preservation. A migration that maps all fields but breaks a composite should not ship. A conceptual comparison that pairs terms but cannot specify morphisms should remain an analogy. A representation change that works object by object but fails a naturality square should be treated as an ad hoc family. A functor that collapses distinctions should not be advertised as equivalence.

For engineering review, require one counterfactual route test before accepting a migration: hold source and target endpoints fixed, then vary the order or decomposition of operations. For research review, require the categories and preservation proof before allowing formal language. For governance review, place authority and effect receipts inside the category whenever they change what counts as the same action. These changes are small enough to add to an architecture decision record, but strong enough to expose failures that screenshots and paired examples cannot see.

Decision rule

Approve the strongest claim whose commuting obligations have actually been tested. When a square fails, narrow the category, repair the translation or lower the claim. Do not average the failure away.

Functors and natural transformations do not make every translation possible. They make the cost of a serious translation visible. That is their value. They replace the comforting question “can I pair these things?” with the harder and more useful question: does every relevant way of acting survive the crossing?

Glossary

Category
Objects, morphisms, identities and an associative composition rule.
Functor
A mapping between categories that preserves identities and composition.
Natural transformation
A morphism between functors, given by components that satisfy a naturality square for every source morphism.
Natural isomorphism
A natural transformation whose every component is an isomorphism.
Commuting diagram
A diagram in which all directed paths with the same start and finish represent equal composites.
Faithful functor
A functor that does not identify distinct morphisms within any source hom-set.
Opposite category
The category obtained by reversing every morphism while keeping objects.

References

  1. Eilenberg, Samuel, and Saunders Mac Lane. “General Theory of Natural Equivalences.” Transactions of the American Mathematical Society 58, no. 2 (1945): 231-294. DOI. Primary historical source introducing categories, functors and natural transformations, including the double-dual motivation.
  2. Mac Lane, Saunders. Categories for the Working Mathematician, 2nd ed. Springer, 1998. DOI. Authoritative standard reference.
  3. Riehl, Emily. Category Theory in Context. Dover, 2016. Author-hosted book page. Authoritative modern exposition of functors, natural transformations and diagram chasing.
  4. Fong, Brendan, and David I. Spivak. An Invitation to Applied Category Theory: Seven Sketches in Compositionality. Cambridge University Press, 2019. Open preprint. Applied treatment used for the order and database examples.
  5. Spivak, David I. “Functorial Data Migration.” Information and Computation 217 (2012): 31-51. DOI; open preprint. Primary research source on schemas as categories, instances as functors and migration functors.
  6. Wisnesky, Ryan, David I. Spivak, Patrick Schultz, and Eswaran Subrahmanian. “Functorial Data Migration: From Theory to Practice.” 2015. Open preprint. Applied manufacturing-data scenario; evidence of implementation work, not a claim that all migrations are naturally expressible.
  7. Fong, Brendan, David I. Spivak, and Rémy Tuyéras. “Backprop as Functor: A Compositional Perspective on Supervised Learning.” LICS 2019. DOI; open preprint. Primary formal result under explicit assumptions about the learner construction.
  8. Gavranović, Bruno, Paul Lessard, Andrew Dudzik, Tamara von Glehn, João G. M. Araújo, and Petar Veličković. “Position: Categorical Deep Learning is an Algebraic Theory of All Architectures.” ICML 2024. Open paper. Contested position paper proposing a broad categorical programme.
  9. Shiebler, Dan, Bruno Gavranović, and Paul Wilson. “Category Theory in Machine Learning.” 2021. Open survey. Survey of distinct categorical approaches in machine learning.
  10. Leinster, Tom. Basic Category Theory. Cambridge University Press, 2014. Open author manuscript. Concise authoritative textbook for foundational definitions and examples.