Prerequisites. Direct starred prerequisites: Chapter 169. No later core chapter depends on this route.
Let 𝐴 be a set of tags and 𝐵 :𝐴 →𝐒𝐞𝐭 a family, and let 𝑆:=∑𝑎:𝐴𝐵(𝑎) be the set of tagged values. A client wants an accessor focusing on the tag. The read is the first projection 𝑆 →𝐴. The write is not a function 𝑆 ×𝐴 →𝑆: replacing the tag 𝑎 by 𝑎′ leaves a payload of type 𝐵(𝑎) where one of type 𝐵(𝑎′) is required, and no total function repairs that when 𝐵(𝑎) and 𝐵(𝑎′) are different sets.
The obstruction is not a missing equation. It is that the type of the residual part of the structure depends on the value being replaced, so the backward direction of the accessor cannot be typed in the category where the forward direction lives. Chapter 169 took both directions in one category C acted on by one monoidal category; here the two directions must be taken in categories that vary with the index.
The concrete dependent lens
Let 𝐴 be a set, 𝐵,𝐵′ :𝐴 →𝐒𝐞𝐭 families, and put 𝑆:=∑𝑎:𝐴𝐵(𝑎) and 𝑆′:=∑𝑎:𝐴𝐵′(𝑎). A dependent lens from (𝑆,𝑆′) to (𝐴,𝐴) consists of 𝗀𝖾𝗍:𝑆→𝐴,𝗉𝗎𝗍:∏𝑠:𝑆∏𝑎′:𝐴𝐵′(𝑎′), so that 𝗉𝗎𝗍 takes a tagged value and a new tag and returns a payload lying in the fibre over the new tag.
Referenced from 5 locations
The clumsiness of definition 170.1 is the point: the type of the result of 𝗉𝗎𝗍 mentions its own argument. Written as a diagram, the data are two maps over a fixed base, and the base is where the index lives.
Let C:=𝐒𝐞𝐭 and let C/𝐴 be the slice category. Writing 𝑋:=(𝑆 →𝐴) and 𝑋′:=(𝑆′ →𝐴) for the two projections as objects of C/𝐴, a dependent lens in the sense of definition 170.1 is exactly a pair 𝑙:𝑋→𝜋∗𝐴𝑌in C/𝐴,𝑟:𝜋∗𝐴𝑌′→𝑋′in C/𝐴, where 𝑌 =𝑌′ =(id𝐴 :𝐴 →𝐴) and 𝜋∗𝐴 is pullback along the identity, that is the identity functor.
Referenced from 4 locations
Proof of Proposition 170.2 — Dependent lenses as maps over a base
Proof. An object of C/𝐴 over 𝐴 is a family; 𝑋 is the family 𝐵 and 𝑋′ is 𝐵′. A map 𝑋 →𝑌 in C/𝐴 with 𝑌 the terminal object of the slice is unique, so 𝑙 carries no information beyond the existence of 𝗀𝖾𝗍, which is the structure map of 𝑋. A map 𝑌′ →𝑋′ in C/𝐴 is a section of 𝑋′, that is a choice of element of 𝐵′(𝑎) for each 𝑎, and that is exactly the second component of 𝗉𝗎𝗍 once the first argument has been discarded. ◻
Proposition 170.2 is degenerate because the base was fixed. A useful accessor changes it: the forward direction should be allowed to move from a base 𝐴 to a base 𝐵, and the backward direction should return along the same move. That is a morphism of bicategories, and the next section makes it the definition.
Dependent optics
Let B be a bicategory. A B-indexed category is a pseudofunctor L :Bop →𝐂𝐚𝐭. We write L𝐴 for L(𝐴) and 𝑓∗ for L(𝑓) when 𝑓 is a 1-morphism, and L(𝑚) for the natural transformation assigned to a 2-morphism 𝑚. We write 𝜃𝐴 :IdL𝐴 ⇒(id𝐴)∗ and 𝜃𝑓,𝑔 :𝑓∗ ∘𝑔∗ ⇒(𝑔 ∘𝑓)∗ for the coherence isomorphisms. Two indexed categories are used throughout, L for the forward direction and R for the backward one; the functor assigned by R to 𝑓 is written 𝑓∗′.
Referenced from 2 locations
The category OpticL,R has as objects the triples (𝑋,𝑋′)𝐴 with 𝐴 an object of B, 𝑋 an object of L𝐴 and 𝑋′ an object of R𝐴. Its hom-sets are OpticL,R((𝑋,𝑋′)𝐴,(𝑌,𝑌′)𝐵):=∫𝑓∈B(𝐴,𝐵)L𝐴(𝑋,𝑓∗𝑌)×R𝐴(𝑓∗′𝑌′,𝑋′). By proposition 169.11 an element is a pair (𝑙,𝑟) with 𝑙 :𝑋 →𝑓∗𝑌 and 𝑟 :𝑓∗′𝑌′ →𝑋′, quotiented by the relation generated by (L(𝑚)𝑌∘𝑙, 𝑟) ∼ (𝑙, 𝑟∘R(𝑚)𝑌′) for 2-morphisms 𝑚 :𝑓 ⇒𝑔 with 𝑙 :𝑋 →𝑓∗𝑌 and 𝑟 :𝑔∗′𝑌′ →𝑋′. We write ⟨𝑙 ∣𝑟⟩ and call 𝑓 its representative.
Referenced from 12 locations
Id(𝑋,𝑋′)𝐴:=⟨(𝜃𝐴)𝑋 ∣ (𝜃′−1𝐴)𝑋′⟩, ⟨𝑙2∣𝑟2⟩∘⟨𝑙1∣𝑟1⟩:=⟨(𝜃𝑓,𝑔)𝑍∘𝑓∗(𝑙2)∘𝑙1 ∣ 𝑟1∘𝑓∗′(𝑟2)∘(𝜃′−1𝑓,𝑔)𝑍′⟩, for ⟨𝑙1 ∣𝑟1⟩ with representative 𝑓 :𝐴 →𝐵 and ⟨𝑙2 ∣𝑟2⟩ with representative 𝑔 :𝐵 →𝐶.
Referenced from 10 locations
Definition 170.5 is well defined and satisfies the unit and associativity laws.
Referenced from 7 locations
Proof of Theorem 170.6 — Optic_ L, R is a category
Proof. Proof idea. The composite is written with an explicit representative 𝑔 ∘𝑓; well-definedness is extranaturality of the formula in 𝑓 and 𝑔, and each law is the corresponding coherence law of a pseudofunctor, transported across (170.1).
Well-definedness. Replace the representative of the second optic by one related through 𝑚 :𝑔 ⇒𝑔1. Both 𝑓∗ and 𝑓∗′ are functors, so the composite changes by 𝑓∗(L(𝑚)) on the left and 𝑓∗′(R(𝑚)) on the right, and pseudofunctoriality identifies those with L(𝑓 ∗𝑚) and R(𝑓 ∗𝑚) for the whiskered 2-morphism 𝑓 ∗𝑚; then (170.1) at 𝑓 ∗𝑚 identifies the two composites. Replacing the representative of the first optic is the same argument with the whiskering on the other side.
Unit law. Let ⟨𝑙 ∣𝑟⟩ have representative 𝑓. Then ⟨𝑙∣𝑟⟩∘Id(𝑋,𝑋′)𝐴𝑑𝑒𝑓𝑖𝑛𝑖𝑡𝑖𝑜𝑛170.5=⟨(𝜃id𝐴,𝑓)𝑌∘(id𝐴)∗(𝑙)∘(𝜃𝐴)𝑋∣⋯⟩𝜃𝐴𝑛𝑎𝑡𝑢𝑟𝑎𝑙=⟨(𝜃id𝐴,𝑓)𝑌∘(𝜃𝐴)𝑓∗𝑌∘𝑙∣⋯⟩𝑢𝑛𝑖𝑡𝑐𝑜ℎ𝑒𝑟𝑒𝑛𝑐𝑒=⟨𝑙∣𝑟⟩, the last step because the composite (𝜃id𝐴,𝑓)𝑌 ∘(𝜃𝐴)𝑓∗𝑌 is the identity by the left unit coherence law of the pseudofunctor L, and dually on the right; the omitted backward components are the mirror calculation with 𝜃′. The other unit law uses the right unit coherence.
Associativity. Choose representatives 𝑓,𝑔,ℎ of three optics simultaneously, which is legitimate because the coend over B(𝐴,𝐵) ×B(𝐵,𝐶) ×B(𝐶,𝐷) may be computed one factor at a time. Both bracketings produce the pair whose forward component is (𝜃𝑓,ℎ∘𝑔)𝑊∘𝑓∗((𝜃𝑔,ℎ)𝑊∘𝑔∗(𝑙3)∘𝑙2)∘𝑙1, and the associativity coherence of L identifies the two ways of reassociating the 𝜃’s; the backward components are the same calculation for R, and (170.1) at the resulting isomorphism of representatives identifies the two classes. ◻
Two constructions recovered
Let CL and CR be categories acted on by a monoidal category M, and let BM be the bicategory with one object ∗ and BM( ∗, ∗) =M. The two actions correspond to BM-indexed categories L,R, and mixed optics for the two actions are exactly the morphisms of OpticL,R with B:=BopM.
Referenced from 7 locations
Proof of Proposition 170.7 — Mixed optics are the one-object case
Proof. An action M →[C,C] is the same as a pseudofunctor out of the delooping, by definition 169.13: the unit and associativity data of the action are the coherence isomorphisms 𝜃∗ and 𝜃𝑓,𝑔. With one object, B(𝐴,𝐵) =M for the unique pair, so the coend of definition 170.4 is the coend of definition 169.16 with C split into the two categories, which is the definition of a mixed optic recalled in example 169.35. The composition formulas agree because 𝜃𝑓,𝑔 is the associativity datum of the action. ◻
Let B be a 1-category, let R be a B-indexed category, and let ∙ be the terminal B-indexed category. Then Optic∙,R is the category obtained from R by the Grothendieck construction on its pointwise opposite.
Referenced from 7 locations
Proof of Proposition 170.8 — Functor lenses are the trivial-forward case
Proof. An object of Optic∙,R is a triple (𝑋,𝑋′)𝐴 with 𝑋 the unique object of ∙𝐴, hence a pair (𝐴,𝑋′) with 𝑋′ ∈R𝐴: the objects of the Grothendieck construction. A 1-category has only identity 2-morphisms, so (170.1) is the identity relation and the coend of definition 170.4 is a coproduct: ∫𝑓∈B(𝐴,𝐵)R𝐴(𝑓∗′𝑌′,𝑋′) ≅ ∐𝑓∈B(𝐴,𝐵)R𝐴(𝑓∗′𝑌′,𝑋′), which is the hom-set of the Grothendieck construction on the pointwise opposite: a morphism is a map 𝑓 of the base together with a map 𝑓∗′𝑌′ →𝑋′ in the fibre. Composition of definition 170.5 reduces to the composition there, since the forward components are identities and the 𝜃’s are the coherence data of the fibration. ◻
Dependent lenses computed
Let C be a finitely complete category and SpanC its bicategory of spans: objects those of C, 1-morphisms 𝐴 →𝐵 the spans 𝐴 ←𝑀 →𝐵, composition by pullback, and 2-morphisms the maps of spans. Let C/ − :SpanopC →𝐂𝐚𝐭 send 𝐴 to the slice C/𝐴 and a span to the composite of pullback along its left leg with pushforward along its right leg. Set DLensC:=OpticC/−, C/−. Its objects are cospans 𝑋 →𝐴 ←𝑋′.
Referenced from 3 locations
For objects (𝑋,𝑋′)𝐴 and (𝑌,𝑌′)𝐵 of DLensC, DLensC((𝑋,𝑋′)𝐴,(𝑌,𝑌′)𝐵) ≅ ∏𝑋→𝑌C/𝐴(𝑋×𝐵𝑌′, 𝑋′), the product ranging over the maps 𝑋 →𝑌 over 𝐴 ×𝐵.
Referenced from 8 locations
Proof of Theorem 170.11 — The hom-set of dependent lenses
Proof. Unfold definition 170.4 for this indexed category: ∫𝑀∈C/(𝐴×𝐵)C/𝐴(𝑋, 𝑀×𝐵𝑌)×C/𝐴(𝑀×𝐵𝑌′, 𝑋′)≅∫𝑀(∏𝑋→𝑌C/(𝐴×𝐵)(𝑋,𝑀))×C/𝐴(𝑀×𝐵𝑌′,𝑋′)≅∏𝑋→𝑌∫𝑀C/(𝐴×𝐵)(𝑋,𝑀)×C/𝐴(𝑀×𝐵𝑌′,𝑋′)≅∏𝑋→𝑌C/𝐴(𝑋×𝐵𝑌′, 𝑋′), The first step is the universal property of the pullback; the second uses that coends commute with products; the third is lemma 169.12. In detail, the first splits a map into 𝑀 ×𝐵𝑌 over 𝐴 into its component into 𝑀 over 𝐴 ×𝐵 and its component into 𝑌 over 𝐵, the latter being the index of the product. The last step is Yoneda reduction in 𝑀, which substitutes 𝑋 for 𝑀. ◻
Take C:=𝐒𝐞𝐭, 𝐴 the set of tags, 𝑋:=(𝑆 →𝐴) the family 𝐵, 𝑋′:=(𝑆′ →𝐴) the family 𝐵′, and let the target be (𝑌,𝑌′){∗} with 𝑌 =𝑌′ =𝐴 regarded as a set over the point. A span 𝐴 ←𝑀 →{ ∗} is a set 𝑀 over 𝐴, and theorem 170.11 gives DLens𝐒𝐞𝐭((𝑋,𝑋′)𝐴,(𝐴,𝐴){∗}) ≅ ∏𝗀𝖾𝗍:𝑆→𝐴 ∏𝑎∈𝐴 (𝐵(𝑎)×𝐴→𝐵′(𝑎)) after unfolding the slices: the forward component is the read 𝗀𝖾𝗍, and the backward component assigns, to each tag 𝑎, each payload in 𝐵(𝑎) and each new tag, an element of 𝐵′(𝑎). The type of the result now mentions the old index 𝑎 rather than the new one, which is what makes it a function; the change of index is recorded by the base of the cospan, not by the fibre.
Referenced from 4 locations
If C is lextensive, the inclusion C →SpanC preserves coproducts.
Referenced from 4 locations
Proof of Lemma 170.13 — Coproducts in the span bicategory
Proof. Let 𝐴 =∐𝑖𝐴𝑖. For every 𝐵, SpanC(𝐴,𝐵)𝑑𝑒𝑓.=C/(𝐴×𝐵)𝑙𝑒𝑥𝑡𝑒𝑛𝑠𝑖𝑣𝑒=C/(∐𝑖𝐴𝑖×𝐵)𝑙𝑒𝑥𝑡𝑒𝑛𝑠𝑖𝑣𝑒=∏𝑖C/(𝐴𝑖×𝐵)𝑑𝑒𝑓.=∏𝑖SpanC(𝐴𝑖,𝐵), so 𝐴 has the universal property of the coproduct in SpanC. ◻
Let B have finite coproducts and let L and R send finite coproducts in B to finite products in 𝐂𝐚𝐭. Then OpticL,R has finite coproducts. In particular DLensC has finite coproducts when C is lextensive.
Referenced from 8 locations
Proof of Proposition 170.14 — Coproducts of dependent optics
Proof. Let (𝑋𝑖,𝑋′𝑖)𝐴𝑖 be a finite family. Put 𝐴:=∐𝑖𝐴𝑖. By hypothesis L𝐴 ≅∏𝑖L𝐴𝑖 and likewise for R, so the families (𝑋𝑖) and (𝑋′𝑖) assemble into single objects 𝑋 of L𝐴 and 𝑋′ of R𝐴. A morphism (𝑋,𝑋′)𝐴 →(𝑌,𝑌′)𝐵 is, by definition 170.4 and the hypothesis, a family of morphisms (𝑋𝑖,𝑋′𝑖)𝐴𝑖 →(𝑌,𝑌′)𝐵, since B(𝐴,𝐵) ≅∏𝑖B(𝐴𝑖,𝐵) and the coend of a product over a product of indices is the product of the coends. That is the universal property of the coproduct.
For the particular case, lemma 170.13 gives coproducts in SpanC, and C/ − turns them into products because C/∐𝑖𝐴𝑖 ≅∏𝑖C/𝐴𝑖 in a lextensive category. ◻
Proposition 170.14 is the concrete payoff of the indexing. The category of ordinary lenses of chapter 169 does not have coproducts: a lens into a coproduct would need a single residual serving both summands, and the two summands have different ones. Allowing the base to vary supplies the missing object.
Tambara representations and the profunctor encoding
Let D be a category. A D-valued Tambara representation consists of
a functor 𝑃𝐴 :Lop𝐴 ×R𝐴 →D for each object 𝐴 of B;
a natural transformation 𝜁𝑓 :𝑃𝐵( −, =) ⇒𝑃𝐴(𝑓∗ −, 𝑓∗′ =) for each 1-morphism 𝑓 :𝐴 →𝐵, extranatural in 𝑓,
subject to 𝑃𝐴(𝜃𝐴,𝜃′−1𝐴)∘𝜁id𝐴=Id𝑃𝐴,𝑃𝐴(𝜃𝑓,𝑔,𝜃′−1𝑓,𝑔)∘𝜁𝑔∘𝑓=(𝜁𝑓)𝑔∗(−),𝑔∗′(=)∘𝜁𝑔. A morphism (𝑃,𝜁) →(𝑄,𝜉) is a family of natural transformations 𝜂𝐴 :𝑃𝐴 ⇒𝑄𝐴 with 𝜂𝐴𝑓∗(−),𝑓∗′(=) ∘𝜁𝑓 =𝜉𝑓 ∘𝜂𝐵. Write TambD for the resulting category.
Referenced from 7 locations
For each object 𝐴 define 𝜄𝐴 :L𝐴 ×(R𝐴)op →OpticL,R by 𝜄𝐴(𝑋,𝑋′):=(𝑋,𝑋′)𝐴 on objects, and on a morphism (𝑙,𝑟) :(𝑋0,𝑋′0) →(𝑋1,𝑋′1) by the optic with representative id𝐴 whose two components are 𝑙 and 𝑟 transported along 𝜃𝐴 and 𝜃′𝐴. The family 𝜄op is a Opticop-valued Tambara representation, with 𝜁𝑓 the map sending a morphism to its composite with the optic ⟨𝜃 ∣𝜃′−1⟩ of representative 𝑓.
Referenced from 2 locations
For every category D, precomposition with 𝜄op is an isomorphism of categories (−)∘𝜄op:[OpticopL,R, D] ⟶ TambD.
Referenced from 7 locations
Proof of Theorem 170.17 — Classification of contravariant functors
Proof. Proof idea. Extranaturality of 𝜁𝑓 in 𝑓 is exactly the condition needed to descend a family of maps along the coend of definition 170.4, and the two coherence equations of definition 170.15 are exactly preservation of identity and composition for the descended functor.
From a representation to a functor. Given (𝑃,𝜁), define ̃𝑃 on objects by ̃𝑃((𝑋,𝑋′)𝐴):=𝑃𝐴(𝑋,𝑋′). On morphisms, consider L𝐴(𝑋,𝑓∗𝑌)×R𝐴(𝑓∗′𝑌′,𝑋′)⟶D(𝑃𝐵(𝑌,𝑌′), 𝑃𝐴(𝑋,𝑋′)),(𝑙,𝑟)↦𝑃𝐴(𝑙,𝑟)∘(𝜁𝑓)𝑌,𝑌′. This is extranatural in 𝑓 by the hypothesis on 𝜁, so by proposition 169.11 it descends to the coend, giving ̃𝑃 on hom-sets. The first equation of definition 170.15 makes ̃𝑃 preserve identities and the second makes it preserve composition, by comparison with definition 170.5.
The two constructions are inverse. On objects, (̃𝑃 ∘𝜄op)𝐴(𝑋,𝑋′) =̃𝑃((𝑋,𝑋′)𝐴) =𝑃𝐴(𝑋,𝑋′). On morphisms, 𝜄𝐴(𝑙,𝑟) has representative id𝐴, so applying ̃𝑃 to it gives 𝑃𝐴(𝑙,𝑟) ∘𝜁id𝐴, which is 𝑃𝐴(𝑙,𝑟) by the first equation of definition 170.15. Conversely, a functor 𝐹 out of Opticop is determined by its values on the optics 𝜄𝐴(𝑙,𝑟) and on the optics ⟨𝜃 ∣𝜃′−1⟩ of each representative, because every optic factors as one of the latter followed by one of the former; that factorization is the composition formula of definition 170.5 with 𝑙2 and 𝑟2 the coherence maps. ◻
For objects (𝑋,𝑋′)𝐴 and (𝑌,𝑌′)𝐵, OpticL,R((𝑋,𝑋′)𝐴,(𝑌,𝑌′)𝐵) ≅ ∫𝑃∈Tamb𝐒𝐞𝐭𝐒𝐞𝐭(𝑃𝐵(𝑌,𝑌′), 𝑃𝐴(𝑋,𝑋′)).
Referenced from 7 locations
Proof of Corollary 170.18 — Profunctor encoding of dependent optics
Proof. By theorem 170.17 at D:=𝐒𝐞𝐭, the category Tamb𝐒𝐞𝐭 is isomorphic to the category of presheaves on OpticL,R. For any category E and objects 𝑆,𝑇, the Yoneda lemma gives E(𝑆,𝑇)𝑌𝑜𝑛𝑒𝑑𝑎=E(−,𝑇)(𝑆)𝑌𝑜𝑛𝑒𝑑𝑎=∫𝐹∈̂E𝐒𝐞𝐭(𝐹(𝑇), 𝐹(𝑆)), the second step because ̂E(E( −,𝑇),𝐹) ≅𝐹(𝑇). Apply this with E:=OpticL,R, 𝑆:=(𝑋,𝑋′)𝐴 and 𝑇:=(𝑌,𝑌′)𝐵, and transport along the isomorphism of theorem 170.17. ◻
Corollary 170.18 is the dependent counterpart of theorem 169.24: an optic is a family of maps natural in the representation, with no residual mentioned. The two statements are not instances of one another; proposition 170.7 makes the earlier one the one-object case of the earlier definition, and theorem 170.17 is proved for a general bicategory.
Boundary
Proved here. The concrete dependent lens and its reading over a base (definition 170.1, proposition 170.2); the category of dependent optics (definition 170.4, definition 170.5, theorem 170.6); the two comparisons (proposition 170.7, proposition 170.8); the hom-set of dependent lenses and the accessor of the opening (definition 170.10, theorem 170.11, example 170.12); coproducts (lemma 170.13, proposition 170.14); and the Tambara classification with its profunctor corollary (definition 170.15, theorem 170.17, corollary 170.18).
Exported interface. Exactly the statements listed above, at the hypotheses displayed with them: B a bicategory, L and R pseudofunctors into 𝐂𝐚𝐭, and for theorem 170.11, proposition 170.14 the further hypotheses that C be finitely complete and, for coproducts, lextensive. No later development may strengthen the interface by appeal to an implementation or to a comparison.
Comparisons only. Two neighbouring uses of bidirectional structure appear in the literature and are not theorems of this chapter. The first is borrowing safety: an accessor that yields a temporary view of a field, valid for a bounded region, is not an optic of definition 170.4, because the forward and backward directions there carry no lifetime and the composition of definition 170.5 imposes no ordering on their use. The second is mutable-value independence: a semantics in which a value’s identity is independent of the store is not established by corollary 170.18, which classifies functors out of the optic category and says nothing about a store. Both are comparisons, and neither is used as a premise anywhere above.
The bicategory of dependent optics. Definition 170.4 quotients over 2-morphisms, so the representative of a composite is determined only up to that quotient. A construction retaining the representative would be a bicategory of dependent optics rather than a category, and theorem 170.6 is not a statement about one.
Suggested first pass.
Problems exercise 170.1, exercise 170.2, and exercise 170.4 form the suggested first pass. None of these problems is a prerequisite for a later chapter.
★★☆ Carry out by hand the calculation that exposes the obstruction of the opening.
Take 𝐴:=𝟐, 𝐵(𝗍𝗍):=𝟏, 𝐵(𝖿𝖿):=𝟐, and 𝑆:=∑𝑎:𝐴𝐵(𝑎). List the elements of 𝑆.
Show that no function 𝗉𝗎𝗍 :𝑆 ×𝐴 →𝑆 satisfies put-get together with the requirement that the second component of the result lie in 𝐵 of the new tag, by displaying the pair at which the two demands conflict.
Compute the hom-set of theorem 170.11 for this instance and exhibit its elements explicitly.
State which component of the result records the change of index, and why it is not a component of an optic in the sense of definition 169.16.
Referenced from 5 locations
★★★ Theorem 170.6 is the smallest invariant used by theorem 170.17: without it there is no category to classify functors out of.
Write the associativity verification in full, displaying every use of the pseudofunctor coherence and every use of (170.1).
Show that the quotient (170.1) cannot be dropped, by exhibiting two representatives of one accessor whose composites with a third have non-isomorphic representatives.
State what fails in proposition 170.8 if B is allowed nontrivial 2-morphisms, and identify the step of its proof that uses their absence.
Referenced from 3 locations
★★☆ Proposition 170.14 needs both hypotheses.
Exhibit a bicategory with finite coproducts and an indexed category not sending them to products, and show that the conclusion fails.
Show directly that the category of ordinary lenses over 𝐒𝐞𝐭 has no coproduct of the two one-element objects, by displaying the two candidate residuals.
Explain, in one sentence, which datum of definition 170.4 supplies the missing object.
Referenced from 2 locations
★★★ Practical project.dependent-optic-checker First stage. Implement, in Agda, the concrete representation of dependent lenses given by theorem 170.11 over 𝐒𝐞𝐭, with finite base sets and finite fibres.
Calculus to implement. A finite category C of finite sets and functions; slices C/𝐴 as pairs of a finite set and a function into 𝐴; spans 𝐴 ←𝑀 →𝐵; pullback along a leg and pushforward along the other; and dependent lenses in the form of the right-hand side of theorem 170.11, that is a family indexed by maps 𝑋 →𝑌 over 𝐴 ×𝐵 of maps 𝑋 ×𝐵𝑌′ →𝑋′ over 𝐴.
Invariant. Every constructed lens must be checked to commute over the base: the two triangles of example 170.12 must commute pointwise, and the program must report the offending element when they do not.
Concrete result. For a named cospan and a named lens, an accept or reject verdict together with, on rejection, the element at which commutation fails.
Acceptance test. On the instance of exercise 170.1 with 𝐴 =𝟐, 𝐵(𝗍𝗍) =𝟏 and 𝐵(𝖿𝖿) =𝟐, the program must accept the lens whose backward component keeps the payload when the tag is unchanged and returns the designated element of the new fibre otherwise, and must print its four components. It must reject the attempted ordinary lens of exercise 170.1(2), naming the pair at which the fibre types disagree.
Referenced from 5 locations
★★★ Practical project.dependent-optic-checker Second stage. Continue exercise 170.4. Add composition and the two comparisons.
Calculus to implement. The composition of definition 170.5 specialised to spans, computed by pullback; the identity of definition 170.5; the embedding of ordinary optics of proposition 170.7 for a one-object base; and the embedding of functor lenses of proposition 170.8 for a discrete base.
Invariant. Composition must be computed on representatives and the result must be checked to be independent of the representatives chosen, by comparing the two composites obtained from two representatives related by a map of spans; the program must report the pair of representatives when they disagree. This is the executable form of theorem 170.6, well-definedness clause.
Concrete result. For three composable lenses, the two bracketings of their composite together with a verdict that they agree; and, for an ordinary optic and a functor lens, their images under the two embeddings with a verdict that composition is preserved.
Acceptance test. The two bracketings of a three-fold composite over the base 𝟐 must agree componentwise. An ordinary lens on 𝟐 ×𝟐 embedded by proposition 170.7 must compose to the image of the ordinary composite. A functor lens over the discrete base {0,1,2} embedded by proposition 170.8 must have the hom-set computed as a coproduct, and the program must print its cardinality, which must equal the sum over base maps of the fibre hom-set sizes.
Referenced from 4 locations
★★★ Practical project.dependent-optic-checker Third stage. Continue exercise 170.5. Add the profunctor encoding and coproducts.
Calculus to implement. Finite Tambara representations in the sense of definition 170.15, given by a finite family of finite profunctors with their structure maps; the two directions of corollary 170.18 at those finite representations; and the coproduct of proposition 170.14 for a finite lextensive base.
Invariant. The two directions of the encoding must be mutually inverse on every constructed lens, and the program must check that round trip; and the coproduct injections must be checked to satisfy the universal property against every finite competitor it can enumerate.
Concrete result. A report giving, for each named lens, its profunctor form as a table of maps indexed by the enumerated representations, the result of the round trip, and the coproduct verdict.
Acceptance test. The round trip must succeed for the lens of exercise 170.4 and for the composite of exercise 170.5. The coproduct of the two objects (𝟏,𝟏){0} and (𝟏,𝟏){1} must be computed and its universal property verified against all finite competitors over bases of size at most three. The program must exhibit, as a counterexample, a base that is not lextensive together with two objects whose coproduct fails, and must print the failing cocone. Produce three mutations that still typecheck — drop the extranaturality check on 𝜁, compose without pulling back along the left leg, and identify two representatives related by a non-invertible map of spans — and confirm that each makes a named case fail. State explicitly that the program checks theorem 170.6, corollary 170.18, proposition 170.14 at finitely many finite instances and proves none of them.
Referenced from 2 locations