Practice: Mappings That Preserve Structure

Error diagnosis · Classification

A submitted verification reads: "I checked F ( g ∘ f ) = F ( g ) ∘ F ( f ) on three composable pairs and it held each time, and F ( id A ) = id F ( A ) for the object A . So F is a functor."

The category has five objects and eleven composable pairs.

What is wrong?

2 hints available, least help first.

Hint 1: Retrieval cue

Read each law's statement. What does it quantify over?

Hint 2: Concept cue

Count what was checked against what exists: pairs, and objects.

Direct application · Explanation

A structure has three objects A , B , C and six arrows: the three identities, f : A → B , g : B → C , and g f : A → C , with g ∘ f = g f and identities acting as identities.

(a) How many composable triples ( a , b , c ) , meaning both b ∘ c and a ∘ b are defined, must be checked to verify associativity?

(b) Explain why checking a subset of them, however large, does not establish associativity.

Write your answer, then compare it with the worked solution.

2 hints available, least help first.

Hint 1: Retrieval cue

A triple is composable when the endpoints meet twice: target of c is source of b , target of b is source of a .

Hint 2: Concept cue

Ask what a passing sample would license you to conclude about a triple you did not check.

Compare with the worked solution

Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.

(a) Fifteen.

A triple ( a , b , c ) is composable when the target of c is the source of b , and the target of b is the source of a . Enumerating over the six arrows under that condition gives 15 composable triples, and associativity a ∘ ( b ∘ c ) = ( a ∘ b ) ∘ c holds in all fifteen, so the structure is a category.

Most of the fifteen involve at least one identity and are immediate once the identity laws hold. The triples worth attention are those built from f and g , where the composite g f is actually consulted.

(b) Why a subset settles nothing.

Associativity is universally quantified: it claims the equation holds for every composable triple. A single failing triple refutes the claim outright, so the negative case is decided by one counterexample.

The positive case has no such shortcut. Triples that pass constrain only themselves. Nothing about the axioms lets agreement on one triple propagate to another. A sample that passes therefore leaves the claim exactly where it started: undecided, because the unchecked triples are precisely where a counterexample would hide.

This is why a verification should report the count. "Associativity holds" is an assertion; "associativity holds, checked on all 15 composable triples" is a verification, because a reader can confirm the enumeration was complete.

A complete answer does each of these:

  • verifies category laws

Direct application · Explanation

In the category C of the worked example, let D have objects X , Y and arrows id X , id Y , h : X → Y . Define F by: A , B ↦ X ; C ↦ Y ; id A , id B , f ↦ id X ; id C ↦ id Y ; g , g f ↦ h .

(a) Verify the identity law at every object.

(b) Verify the composition law, showing the pair ( g , f ) explicitly and saying which pairs remain.

(c) F sends two distinct objects to one object, and sends the non-identity arrow f to an identity. Explain why F is nonetheless a functor.

Write your answer, then compare it with the worked solution.

2 hints available, least help first.

Hint 1: Retrieval cue

The only composable pair of non-identity arrows in C is ( g , f ) .

Hint 2: Concept cue

For (c), list what the definition of a functor actually demands, then check whether injectivity appears on the list.

Compare with the worked solution

Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.

(a) Identity law.

F ( id A ) = id X , and id F ( A ) = id X since F ( A ) = X ✓.

F ( id B ) = id X , and id F ( B ) = id X since F ( B ) = X ✓.

F ( id C ) = id Y , and id F ( C ) = id Y since F ( C ) = Y ✓.

All three objects check.

(b) Composition law.

The pair that carries content is ( g , f ) , the only pair of non-identity arrows that composes:

F ( g ∘ f ) = F ( g f ) = h , F ( g ) ∘ F ( f ) = h ∘ id X = h .

Equal ✓.

The remaining composable pairs each involve an identity, ( id B , f ) , ( f , id A ) , ( id C , g ) , ( g , id B ) , ( id C , g f ) , ( g f , id A ) , and the three identity-with-itself pairs. Every one of these is satisfied automatically once part (a) holds, since both sides reduce to the image of the non-identity arrow. They should be listed, and they contribute no information.

Both laws hold, so F is a functor.

(c) Why collapsing is permitted.

The definition requires exactly two things: that identities go to identities, and that the image of a composite equals the composite of the images. Nothing requires F to be injective on objects or on arrows, and nothing requires a non-identity arrow to have a non-identity image.

The distinction the laws draw is between losing information and being inconsistent. F loses information: knowing F ( f ) = id X does not let you recover f , and knowing an object maps to X does not say whether it was A or B . That is permitted, and the constant functor, every object to one object, every arrow to its identity, is the extreme case, still a functor.

What is forbidden is assigning g f something that contradicts the assignments to f and g . F never does: whatever it discards, it discards consistently, so the two routes to an image of a composite always agree.

This is why satisfying the laws is a floor rather than a merit. A functor can be entirely uninformative and still be a functor; what it cannot be is self-contradicting.

A complete answer does each of these:

  • checks functor laws

Method selection · Explanation

A colleague proposes a mapping G from C to D : A ↦ X ; B , C ↦ Y ; f ↦ h ; g ↦ id Y ; g f ↦ id Y . They argue it is a functor because every object has an image and every arrow lands on an arrow with the correct source and target.

(a) Name the check that settles the question, and carry it out.

(b) Each of your colleague's claims is true. Explain why they nevertheless do not establish the conclusion, and say what they do establish.

Write your answer, then compare it with the worked solution.

2 hints available, least help first.

Hint 1: Retrieval cue

Endpoints matching is one condition; preserving composition is another.

Hint 2: Concept cue

Count how many assignments each check examines at once.

Compare with the worked solution

Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.

(a) The composition law on the pair ( g , f ) .

G ( g ∘ f ) = G ( g f ) = id Y , G ( g ) ∘ G ( f ) = id Y ∘ h = h .

Since id Y ≠ h , they are distinct arrows of D , the law fails, and G is not a functor. This is the pair to choose because it is the only composable pair of non-identity arrows. Pairs involving an identity are satisfied automatically once the identity law holds, so checking those first would consume effort and return nothing. (b) What the colleague's evidence establishes. Their claims are correct as stated. Every object does have an image, and every arrow does land correctly: f : A → B maps to h : X → Y with G ( A ) = X and G ( B ) = Y ; g : B → C maps to id Y : Y → Y with G ( B ) = G ( C ) = Y ; g f : A → C maps to id Y , which, note, requires G ( A ) = X and G ( C ) = Y , and id Y runs Y → Y , so this last assignment is in fact already ill-typed. Taking their claim at face value for the arrows where it does hold, the point stands. What these checks establish is the typing condition: that images of arrows have endpoints consistent with the object map. That condition is necessary, and its role is enabling rather than deciding. It is what makes the composite G ( g ) ∘ G ( f ) a defined arrow, so that the composition law can be stated at all. A mapping failing it is not a candidate; a mapping passing it is a candidate whose status is still open. Why their checks cannot decide: the object map and the endpoint condition each examine one assignment at a time. The composition law is a constraint relating three assignments jointly, what G does to f , to g , and to g f . An inconsistency among three choices is invisible to any check that looks at them individually, which is exactly the situation here: each of G ( f ) , G ( g ) , G ( g f ) is individually unobjectionable, and the trouble is only in their relationship. This is the general shape of the error. The conditions that are easy to verify are not the ones that decide, and a mapping can pass everything inspection offers while failing the one law that carries the meaning.

A complete answer does each of these:

  • locates law failure

Interpretation · Evaluation

Let P send every object of C to X and every arrow to id X ; let Q send every object to Y and every arrow to id Y . Take α o = h : X → Y at each object. Checking α B ∘ P ( n ) = Q ( n ) ∘ α A at all six arrows of C gives h = h every time, so α is natural.

A reader concludes that this verification is good evidence that naturality is an easy condition to satisfy.

(a) Assess that conclusion, showing what both routes reduce to and why.

(b) State what a verification would need in order to be evidence about how demanding the condition is, and give an example that meets the requirement.

Write your answer, then compare it with the worked solution.

2 hints available, least help first.

Hint 1: Retrieval cue

Write out P ( n ) and Q ( n ) without assuming which arrow n is.

Hint 2: Strategy cue

Ask whether any choice of α could have made the check fail.

Compare with the worked solution

Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.

(a) The conclusion is unsupported.

Because P and Q are constant functors, P ( n ) = id X and Q ( n ) = id Y for every arrow n , whatever n happens to be. So the two routes are

α B ∘ P ( n ) = h ∘ id X = h , Q ( n ) ∘ α A = id Y ∘ h = h ,

and they agree for a reason that has nothing to do with which arrow was chosen. The arrow n does not appear in either result.

The check was also insensitive to α : replacing h by any other arrow X → Y would give agreement just the same, since both sides would reduce to that arrow. No assignment could have failed.

A check whose outcome is fixed in advance confirms that the procedure was carried out correctly, both routes evaluated, results compared, and carries no information about the condition being checked. The example is degenerate, and reporting it as evidence about naturality's difficulty mistakes the exercise for the result.

(b) What would make it evidence.

The verification needs functors that act differently on arrows, so the two routes could in principle diverge. Then agreement is a fact about the particular transformation rather than a consequence of the shape of the example.

A case that meets this: take the list functor, where map f genuinely depends on f . The transformation reverse satisfies

map f ∘ reverse = reverse ∘ map f ,

and it holds because reversing rearranges positions without examining elements.

That this is a real constraint is shown by sort, which has the same type and fails: sort inspects elements, so mapping before sorting can produce a different order than sorting before mapping, as soon as f does not preserve the ordering. Two transformations of identical shape, one natural and one not, which is what a non-degenerate check looks like.

The general point. When reporting a verification, ask whether the check could have come out the other way. If not, say so: an unfailable check is worth recording as a confirmation of method, and is not evidence about the thing checked.

A complete answer does each of these:

  • verifies naturality
  • reads structure preservation

Prediction · Explanation

A library defines a container type whose map operation reverses the container while mapping. The code type-checks, and the test suite, which exercises map only on single-element containers, passes.

Predict the outcome of each of the following on a three-element container [ a , b , c ] , giving the reason in each case:

(a) Evaluating map id.

(b) An optimiser rewriting map g . map f to map (g . f).

(c) State why the test suite did not catch the defect, and what a test would have to do to catch it.

Write your answer, then compare it with the worked solution.

2 hints available, least help first.

Hint 1: Retrieval cue

Count the reversals on each side of the rewrite.

Hint 2: Concept cue

Ask which law the optimiser's rewrite is a restatement of.

Compare with the worked solution

Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.

(a) map id returns [ c , b , a ] .

The identity law requires map id = id, so map id applied to [ a , b , c ] should give [ a , b , c ] . This implementation reverses, producing [ c , b , a ] . The law fails, and it fails on the simplest possible input. No clever function is needed to expose it, only a container with more than one element.

(b) The rewrite changes the result.

Before the rewrite, map f then map g: the first reverses to [ f ( c ) , f ( b ) , f ( a ) ] , the second reverses again, giving

[ g ( f ( a ) ) , g ( f ( b ) ) , g ( f ( c ) ) ] .

Two reversals cancel, so the original order is restored.

After the rewrite, map (g . f) is a single map and reverses once:

[ g ( f ( c ) ) , g ( f ( b ) ) , g ( f ( a ) ) ] .

The two results are reverses of one another, so they differ whenever the container has more than one distinct element.

The optimisation is valid only because the composition law is assumed: map g. map f = map (g. f) is precisely that law. With the law broken, the rewrite is unsound, and the program's output depends on whether the optimiser fired, which may vary with build flags, inlining decisions, or compiler version. That is the reason such bugs are hard to trace: the source code is unchanged, and the behaviour depends on a transformation nobody wrote.

(c) Why the tests missed it, and what would catch it.

Reversing a single-element container is the identity on it, so every law the suite could check is satisfied vacuously by the only inputs it supplies. The tests are not weak in coverage of lines, map runs every time, but in coverage of the property: they exercise the one input shape on which a reversing map is indistinguishable from a correct one.

A test that catches it checks the laws as laws: map id xs == xs and map g (map f xs) == map (g . f) xs, over containers with at least two distinct elements, ideally property-based over randomly generated containers and functions. The law is the specification, and testing anything narrower than the law tests something other than what the optimiser relies on.

A complete answer does each of these:

  • checks functor laws

Error diagnosis · Evaluation

A submitted verification reads:

" G is a functor. Its object map sends A to X and both B and C to Y , which is well defined. Every arrow has the right source and target: f ↦ h : X → Y matches G ( A ) = X , G ( B ) = Y ; and g ↦ id Y : Y → Y matches G ( B ) = G ( C ) = Y . The identity law holds at all three objects. I checked the composition law on the pairs ( id B , f ) and ( g , id B ) and both agreed, so all the laws hold."

The conclusion is wrong.

(a) Identify the defect in the verification. The flaw in how it was conducted, not merely the fact that G fails.

(b) State what the writer would have found had the verification been complete.

(c) Say what the two checks they did perform contributed.

Write your answer, then compare it with the worked solution.

2 hints available, least help first.

Hint 1: Retrieval cue

List every composable pair in C , then mark the ones the writer checked.

Hint 2: Concept cue

Ask, of each pair they checked, whether it could have failed.

Compare with the worked solution

Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.

(a) The defect: incomplete quantification.

The composition law is a claim about every composable pair. The writer checked two, and stopped. The pair carrying the content, ( g , f ) , the only pair of non-identity arrows that composes, was never examined.

The flaw is in the scope of the check, not in any individual claim. Every sentence in the submission is true, which is what makes the error instructive: a verification can consist entirely of correct statements and still establish nothing, if what it quantified over was not what the law quantifies over.

(b) What a complete verification finds.

G ( g ∘ f ) = G ( g f ) = id Y , G ( g ) ∘ G ( f ) = id Y ∘ h = h .

Since id Y ≠ h , the composition law fails and G is not a functor. One pair decides it.

(c) What the two performed checks contributed: nothing.

Both ( id B , f ) and ( g , id B ) involve an identity arrow. Once the identity law holds, which the writer had already established, such pairs are satisfied automatically: both sides reduce to the image of the single non-identity arrow. So these checks could not have failed, and their agreement was guaranteed before they were run.

This compounds the error rather than mitigating it. The writer performed two checks, obtained two confirmations, and reasonably felt the verification was progressing, but the confirmations were empty, and the feeling of progress came from work that carried no information. Worse, selecting the easy pairs is a natural thing to do, which is why the error recurs.

The lesson for conducting a verification. Identify in advance which checks could come out either way, and do those. Report the full list of what was checked, so a reader can see whether the informative cases were among them. A verification that names its scope can be audited; one that reports only its conclusion cannot.

A complete answer does each of these:

  • locates law failure

Construction · Evaluation · Explanation

You are asked to build a mapping H : C → D that satisfies the typing condition and the identity law but fails the composition law, where D has objects X , Y and arrows id X , id Y , h : X → Y .

(a) Attempt the construction. Work out how much freedom you have: for each arrow of C , how many images are available once the object map is fixed and the typing condition is imposed?

(b) Report what you find. If the construction succeeds, exhibit the failing pair and evaluate both sides; if it cannot succeed, state that and prove it.

(c) Say which single assignment would have to change to repair a broken mapping in general, and why the other two do not.

Write your answer, then compare it with the worked solution.

3 hints available, least help first.

Hint 1: Retrieval cue

How many arrows does D have from X to Y ? From Y to X ?

Hint 2: Concept cue

Both sides of the composition law live in the same hom-set. What follows if that hom-set has at most one element?

Hint 3: Strategy cue

If no assignment can fail, the task is to prove that rather than to keep searching.

Compare with the worked solution

Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.

(a) How much freedom the typing condition leaves. Fix an object map. For an arrow n : P → Q of C , the typing condition requires H ( n ) : H ( P ) → H ( Q ) , so the available images are exactly the arrows of D from H ( P ) to H ( Q ) . Counting those in D : | from → to | arrows available |
|---|---|
| X → X | 1 (namely id X ) |
| Y → Y | 1 (namely id Y ) |
| X → Y | 1 (namely h ) |
| Y → X | 0 | Every hom-set of D has at most one arrow. So once the object map is chosen, the typing condition does not merely constrain each image. It determines it, whenever an image exists at all. (b) The construction cannot succeed, and here is why. Suppose H satisfies the typing condition, and let ( g , f ) be any composable pair, f : A → B and g : B → C . Then: - H ( g ∘ f ) is an arrow H ( A ) → H ( C ) , by the typing condition applied to g ∘ f ;
- H ( g ) ∘ H ( f ) is a composite H ( A ) → H ( B ) → H ( C ) , hence also an arrow H ( A ) → H ( C ) . Both sides therefore lie in the same hom-set of D , and every hom-set of D has at most one element. Two arrows in a set of size at most one are equal. So

H ( g ∘ f ) = H ( g ) ∘ H ( f )

necessarily, for every composable pair, for every typed H whatever. The composition law cannot fail in this D . ∎ The requested construction is impossible, and the impossibility is the answer. Note what it depends on: not on C , and not on the object map chosen, but only on D being thin, having at most one arrow between any two objects. Any thin category as codomain forces every typed mapping that respects identities to be a functor. (This is the same fact met in the order-theory setting: a partial order is a thin category, which is why a monotone map between two orders is automatically a functor and needs no separate composition check.) What a failing example requires. A codomain with two distinct parallel arrows. Take D ′ with objects X , Y and two arrows h 1 , h 2 : X → Y alongside the identities. Setting H ( A ) = X , H ( B ) = X , H ( C ) = Y , H ( f ) = id X , H ( g ) = h 1 , H ( g f ) = h 2 satisfies the typing condition and the identity law, and gives

H ( g ∘ f ) = h 2 ≠ h 1 = h 1 ∘ id X = H ( g ) ∘ H ( f ) .

A genuine failure, and it needed the extra arrow. (c) Which assignment must change. The image of the composite, H ( g f ) . The assignments to f and to g jointly determine what H ( g f ) is required to be, namely H ( g ) ∘ H ( f ) , which is fully computed from them. H ( g f ) is the only one of the three free to disagree with the others, so it is the only one whose value the law constrains given the rest. That said, "must change" describes the logic, not the diagnosis. A failure is an inconsistency among three choices, and repairing it means deciding which choice was the mistake. The composite may be right and one of the parts wrong. What the law tells you is that they cannot all three stand; which to revise is a question about what the mapping was meant to do.

A complete answer does each of these:

  • locates law failure
  • reads structure preservation

Transfer · Evaluation · Explanation

A team maintains two representations of a data schema and a translation T between them. They claim T is "structure-preserving" because every table in the source has an image in the target and every foreign key maps to a foreign key with matching endpoints. They rely on this claim when applying migrations: they assume that applying migration m 1 , then m 2 , gives the same result as applying the composite migration m 2 ∘ m 1 .

Write a verification report covering:

(a) Which categorical structure their setup corresponds to, and what the laws say in their terms.

(b) What their stated evidence does and does not establish.

(c) The check that would settle the claim, including what it must quantify over.

(d) What observable failure to expect in production if the claim is false, and why it would resist diagnosis.

(e) The team also maintains a routine normalise that rewrites a schema state into a canonical form, defined for both representations. They claim T commutes with it, that normalising then translating equals translating then normalising. Say what categorical condition that claim is, state the equation it must satisfy and what it quantifies over, and explain how to tell a genuine verification of it from one that could not have failed.

Write your answer, then compare it with the worked solution.

2 hints available, least help first.

Hint 1: Retrieval cue

What are the objects, and what are the arrows? Migrations compose, that is the clue.

Hint 2: Concept cue

Restate their migration assumption as an equation, then compare it with the two functor laws.

Compare with the worked solution

Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.

(a) The structure. Each schema representation is a category: objects are schema states, arrows are migrations, composition is applying migrations in sequence, and the identity arrow at a schema state is the null migration. Composition is associative because applying migrations in sequence is, and the null migration is a genuine identity, so the axioms hold. The translation T is a candidate functor between these two categories. In the team's terms: - The identity law says T sends the null migration to the null migration, translating "do nothing" yields "do nothing".
- The composition law says T ( m 2 ∘ m 1 ) = T ( m 2 ) ∘ T ( m 1 ) , translating a combined migration gives the same result as translating the parts and applying them in sequence. Their working assumption is the composition law. It is not an incidental convenience they happen to rely on; it is the substantive requirement, stated in their own vocabulary. (b) What the evidence establishes. Every table having an image is the object map. Foreign keys mapping to foreign keys with matching endpoints is the typing condition. Together these establish that T is a well-formed candidate: the composite T ( m 2 ) ∘ T ( m 1 ) is a defined migration, so the law can be stated. They establish nothing about whether it holds. This is exactly the failure mode of the mapping G in the worked example: a sound object map, correct endpoints on every arrow, and still not a functor, because G ( g ∘ f ) = id Y while G ( g ) ∘ G ( f ) = h . The team's checks are of precisely the kind that cannot detect that discrepancy. Each examines one assignment at a time, while the composition law constrains three jointly. (c) The check. For every composable pair ( m 1 , m 2 ) , compute T ( m 2 ∘ m 1 ) and T ( m 2 ) ∘ T ( m 1 ) and compare the resulting target schema states. Separately, check T ( null ) = null at every schema state. The quantification is the point: composable pairs, not a sample. One failing pair refutes the claim; a passing sample leaves it undecided, because nothing propagates agreement from a checked pair to an unchecked one. Two practical qualifications. Pairs in which one migration is the null migration are satisfied automatically once the identity law holds and should not be counted as evidence. They are the analogue of the identity pairs that made the flawed verification in the diagnosis exercise look productive. And if the pairs are too numerous to enumerate, the claim must be established by an argument over how T is constructed, not by testing; the report should say which was done, since "we tested it" and "we proved it" support different confidences. (d) The production failure. If the law fails, a sequence of migrations and the corresponding combined migration produce different target schemas. Concretely: a database migrated incrementally ends in a different state from one migrated in a single step; or replaying the migration history from scratch disagrees with the schema currently deployed; or two environments that applied the same migrations in different groupings diverge. It resists diagnosis for four reasons. Each individual migration passes every check the team performs, so no migration looks suspect. The divergence appears only on paths that combine migrations in a particular way, and the triggering grouping may be one no test exercises. Nothing raises an error at the time. The inconsistency is silent, surfacing later as data that does not match the schema anyone believes is deployed. And the natural response, re-examining the migrations individually, looks in the only place the defect is guaranteed not to be. (e) The normalise claim is naturality. Let F be the identity functor on the source category and let T be the translation, both taking schema states to schema states and migrations to migrations. normalise supplies, for each schema state S , an arrow ν S . The rewrite of S into canonical form. A family of arrows indexed by objects, one per object, relating two functors: that is a natural transformation, and the commuting claim is its naturality condition. The equation. For every migration m : S 1 → S 2 ,

ν S 2 ∘ T ( m ) = T ( m ) ∘ ν S 1 ,

reading: translate then normalise equals normalise then translate. (Stated for whichever pair of functors the team actually means; the shape is the same.) What it quantifies over: migrations, not schema states. This is the part teams get wrong, because normalise is defined per schema state, so it is natural to check it per schema state. The condition is indexed by arrows. A family can behave correctly at every schema state taken alone and still fail the square for some migration, that is precisely the situation the condition exists to detect, and checking only the states would miss it. Telling a real verification from an empty one. Ask whether the check could have failed. If T or the surrounding functors act trivially on migrations, mapping every migration to a null migration, say, then both routes collapse to ν alone, the migration m drops out of both sides, and the squares commute whatever normalise does. Agreement then reports the shape of the example, not a property of normalise. The same happens if the team tests only on schema states where normalisation is already a no-op: ν = id makes both routes T ( m ) identically. A genuine check uses migrations that normalise actually interacts with, ones that touch the structures canonicalisation rewrites, so the order could matter. The diagnostic question is whether some migration in the test set would have exposed a difference had one existed. If none would, the verification has confirmed the procedure and established nothing about the claim, and the report should say so rather than recording a pass. Their assumption is load-bearing: it licenses the inference that two deployment paths agree, and real deployments rest on it. A claim that something is structure-preserving is worth exactly as much as the check behind it, and the checks they performed are the ones that cannot fail on a mapping of this kind.

A complete answer does each of these:

  • verifies category laws
  • checks functor laws

Construction · Direct application · Explanation

Let C have objects A , B , C and non-identity arrows f : A → B , g : B → C , g f : A → C . Let D have objects X , Y and non-identity arrow h : X → Y .

A colleague proposes G : on objects A ↦ X , B , C ↦ Y ; on arrows f ↦ h , g ↦ id Y , g f ↦ id Y .

(a) Check whether every arrow lands with matching source and target.

(b) Name the law G breaks and exhibit the specific composite that witnesses it.

(c) Distinguish a law failure from an assignment whose arrows have the wrong endpoints, and say why the second is not a law failure at all.

(d) Suppose α is proposed as a natural transformation from G to some H . State what has to be checked, and over what.

Write your answer, then compare it with the worked solution.

3 hints available, least help first.

Hint 1: Retrieval cue

Check where each image arrow starts and ends before testing any law.

Hint 2: Concept cue

The composition law concerns composable pairs. This category has exactly one.

Hint 3: Strategy cue

In (d), count what naturality quantifies over: objects, or arrows?

Compare with the worked solution

Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.

(a) The typing condition. Each arrow's image must run between the images of its endpoints.

arrowimagerequiredholds
f : A → B h : X → Y X → Y yes
g : B → C id Y : Y → Y Y → Y yes
g f : A → C id Y : Y → Y X → Y no

The third fails: id Y runs Y → Y while G ( A ) = X , so the image of g f does not start where it must. The claim that every arrow has the right endpoints is false, and as written this is not yet a candidate functor.

Isolate the law. Send g f ↦ h instead, which does run X → Y . Now the typing condition holds everywhere and the laws can be tested.

(b) The law that breaks. With the repair, the one composable pair gives G ( g ∘ f ) = h against G ( g ) ∘ G ( f ) = id Y ∘ h = h : these agree, so that assignment is a functor.

Return to the proposal as stated, with g f ↦ id Y :

G ( g ∘ f ) = id Y against G ( g ) ∘ G ( f ) = id Y ∘ h = h .

id Y ≠ h , so the composition law fails, and the witnessing composite is g ∘ f . Naming the law without exhibiting the composite leaves the claim unchecked: the pair ( g , f ) is what a reader verifies.

(c) A law failure against a typing failure. Different defects, different repairs. Typing is a well-formedness requirement: an arrow sent where its endpoints do not permit means no functor was proposed and there is nothing to test. A law failure means a well-formed assignment does not preserve structure: every arrow lands legally and composition still is not respected. The first is caught by reading endpoints, the second only by composing.

(d) Naturality. A natural transformation α : G ⇒ H is a family α o : G ( o ) → H ( o ) , one arrow per object, such that for every arrow u : o → o ′

H ( u ) ∘ α o = α o ′ ∘ G ( u ) .

So the check is one equation per arrow, not per object: a square for each of f , g , g f and each identity, with both paths evaluated and compared. Arguing from the diagram's shape checks nothing, because a diagram is drawn the same way whether or not it commutes.

A complete answer does each of these:

  • locates law failure
  • verifies naturality
  • reads structure preservation
Practice data

Your practice record is stored in this browser only. Clearing it removes every answer and every scheduled review, and cannot be undone.

Results update as you type. Use the up and down arrow keys to move between results, Enter to open one, and Escape to close.

Type to search.

Settings

Appearance

Interface density

Your record

Your progress is stored in this browser and nowhere else: an identifier, the answers you have given, the mastery states and review schedule derived from them, and the lesson you last opened. Clearing it makes you a new learner on this device. It cannot be undone, and it will not affect your appearance or density settings.

Focus timer

Focus--minutes remaining

Phase

Kept in this browser only, and used to label the session in your own history.

Today

Nothing recorded yet. Finish a focus session and it will appear here.

Settings

Focus sessions between long breaks.

Sessions you are aiming for in a day.

Notifications

Your history

Sessions are stored in this browser and nowhere else. They are not evidence and never reach your mastery record.