Other Agda modules in this section (28)
- Equivalences
- Everything
- IdentificationCalculus.CoordinateNaturality
- IdentificationCalculus.FamilyNaturality
- IdentificationCalculus.FramedSubstitution
- IdentificationCalculus.FunctorCoherence
- IdentificationCalculus.Inverses
- IdentificationCalculus.Parameterized
- IdentificationCalculus.Structural
- IdentificationCalculus.VerticalComposition
- ProductCalculus.BinaryFunctorCalculus
- ProductCalculus.ChosenPairing
- ProductCalculus.ChosenPairingFunctoriality
- ProductCalculus.FamilyPairing
- ProductCalculus.FamilyProductFunctor
- ProductCalculus.IteratedPairing
- ProductCalculus.NestedSymmetry
- ProductCalculus.PairingAssembly
- ProductCalculus.PairingCoherence
- ProductCalculus.PairingInterface
- ProductCalculus.PairingNaturality
- ProductCalculus.PairingUnits
- ProductCalculus.ProductFunctorCoherence
- ProductCalculus.ProductFunctorUnits
- ProductCalculus.ProductPairing
- ProductConstructions
- Retracts
- Whiskering
Complete compiler-highlighted source. Follow a symbol to its declaration.
# Pasting and composition of coordinate comparisons A coordinate square can be transported by postcomposition. Its composite comparison records the source and target associators explicitly. The following calculations compare successive transports and transport of a pasted square; the external pentagon accounts for the reassociations. ```agda {-# OPTIONS --safe --without-K #-} open import Agda.Primitive using (Level) open import SCT.VolumeI.Chapter01.Section01.Vocabulary import SCT.VolumeI.Chapter01.Section01.Terminal as Terminal import SCT.VolumeI.Chapter01.Section01.Products as Products import SCT.VolumeI.Chapter01.Section02.Coherence as Coherence import SCT.VolumeI.Chapter01.Section02.Specialization as Specialization import SCT.VolumeI.Chapter01.Section03.IdentificationCalculus.Structural as Structural import SCT.VolumeI.Chapter01.Section03.IdentificationCalculus.FunctorCoherence as FunctorCoherence import SCT.VolumeI.Chapter01.Section03.IdentificationCalculus.CoordinateNaturality as CoordinateNaturality import SCT.VolumeI.Chapter01.Section03.ProductCalculus.PairingNaturality as PairingNaturality module SCT.VolumeI.Chapter01.Section03.IdentificationCalculus.CoordinateComparisons {c m a : Level} (V : Vocabulary c m a) (T : Terminal.TerminalStructure V) (P : Products.ProductData V) (PL : Products.ProductLaws V P) (S : Coherence.CompositionStructure V T P) (VC : Coherence.VerticalCoherence V T P S) (W : Coherence.WhiskeringCoherence V T P S) (PT : Coherence.PentagonTriangleCoherence V T P S) where open PairingNaturality V T P PL S VC W using (cancel-right) open Vocabulary V open Operations V open Coherence.CompositionStructure S open Coherence.Composition V T P S open Coherence.WhiskeringCoherence W open Specialization V T P PL S open Specialization.Units V T P PL S VC open Specialization.Whiskering V T P PL S W open Structural V T P PL S W using (whisker-mixed-at; postWhisker-comp-at) open FunctorCoherence V T P PL S VC W PT using (pentagon-whiskered; cancel-right-reflect) coordinate-comparison : {R X K C D : CAT} (Ο : MAP R X) (f : MAP X C) (Ο : MAP K C) (h : MAP R K) β (Ο β h) =β (f β Ο) β (F : MAP C D) β ((F β Ο) β h) =β ((F β f) β Ο) coordinate-comparison Ο f Ο h b F = (comp-assoc Ο f F) β»ΒΉ β ((F β b) β comp-assoc h Ο F) open CoordinateNaturality V T P PL S VC W public using (paste-squares; coordinate-at) private cancel-inverse-pair : {C D : CAT} {f g gβ² : MAP C D} (q : g =β gβ²) (u : f =β g) β (q β»ΒΉ β (q β u)) =β u cancel-inverse-pair q u = isoComp-unitΛ‘-at u β (isoComp-cong (isoComp-inverseΛ‘-at q) (idIso u) β (isoComp-assoc-at (q β»ΒΉ) q u) β»ΒΉ) pentagon-left-corner : {C D : CAT} {xβ xβ xβ xβ xβ : MAP C D} (A : xβ =β xβ) (B : xβ =β xβ) (Cβ² : xβ =β xβ) (Dβ² : xβ =β xβ) (E : xβ =β xβ) β (A β B) =β (Cβ² β (Dβ² β E)) β (Dβ² β»ΒΉ β (Cβ² β»ΒΉ β A)) =β (E β B β»ΒΉ) pentagon-left-corner A B Cβ² Dβ² E pentagon = let clear : ((A β B) β B β»ΒΉ) =β A clear = isoComp-unitΚ³-at A β (isoComp-cong (idIso A) (isoComp-inverseΚ³-at B) β isoComp-assoc-at A B (B β»ΒΉ)) expandCorner : A =β (Cβ² β (Dβ² β (E β B β»ΒΉ))) expandCorner = isoComp-cong (idIso Cβ²) (isoComp-assoc-at Dβ² E (B β»ΒΉ)) β (isoComp-assoc-at Cβ² (Dβ² β E) (B β»ΒΉ) β (isoComp-cong pentagon (idIso (B β»ΒΉ)) β clear β»ΒΉ)) in cancel-inverse-pair Dβ² (E β B β»ΒΉ) β (isoComp-cong (idIso (Dβ² β»ΒΉ)) (cancel-inverse-pair Cβ² (Dβ² β (E β B β»ΒΉ))) β isoComp-cong (idIso (Dβ² β»ΒΉ)) (isoComp-cong (idIso (Cβ² β»ΒΉ)) expandCorner)) ``` Successive postcomposition is governed by three squares: the source pentagon, associator naturality, and the target pentagon. ```agda private post-inverse : {X C D : CAT} (F : MAP C D) {u v : MAP X C} (Ξ± : u =β v) β (F β Ξ± β»ΒΉ) =β ((F β Ξ±) β»ΒΉ) post-inverse F {u} Ξ± = cancel-right-reflect (F β Ξ±) ((isoComp-inverseΛ‘-at (F β Ξ±)) β»ΒΉ β (postWhisker-idIso F u β ((postWhisker F β isoComp-inverseΛ‘-at Ξ±) β (postWhisker-isoComp-at F (Ξ± β»ΒΉ) Ξ±) β»ΒΉ))) coordinate-outer-comp : {R X K C D E : CAT} (Ο : MAP R X) (s : MAP X C) (Ο : MAP K C) (h : MAP R K) (b : (Ο β h) =β (s β Ο)) (g : MAP C D) (f : MAP D E) β ((comp-assoc s g f β· Ο) β coordinate-comparison Ο s Ο h b (f β g)) =β (coordinate-comparison Ο (g β s) (g β Ο) h (coordinate-comparison Ο s Ο h b g) f β (comp-assoc Ο g f β· h)) coordinate-outer-comp Ο s Ο h b g f = let inputLeft = comp-assoc h Ο (f β g) middleLeft = (f β g) β b outputLeft = (comp-assoc Ο s (f β g)) β»ΒΉ inputRight = (f β comp-assoc h Ο g) β comp-assoc h (g β Ο) f middleRight = f β (g β b) outputRight = (comp-assoc Ο (g β s) f) β»ΒΉ β (f β (comp-assoc Ο s g) β»ΒΉ) atSource = comp-assoc Ο g f β· h afterInput = comp-assoc (Ο β h) g f beforeOutput = comp-assoc (s β Ο) g f atTarget = comp-assoc s g f β· Ο inputSquare : (inputRight β atSource) =β (afterInput β inputLeft) inputSquare = (pentagon-whiskered h Ο g f) β»ΒΉ β isoComp-assoc-at (f β comp-assoc h Ο g) (comp-assoc h (g β Ο) f) atSource middleSquare : (middleRight β afterInput) =β (beforeOutput β middleLeft) middleSquare = (postWhisker-comp-at b g f) β»ΒΉ outputSquare : (outputRight β beforeOutput) =β (atTarget β outputLeft) outputSquare = pentagon-left-corner beforeOutput (comp-assoc Ο s (f β g)) (f β comp-assoc Ο s g) (comp-assoc Ο (g β s) f) atTarget (pentagon-whiskered Ο s g f) β (isoComp-assoc-at ((comp-assoc Ο (g β s) f) β»ΒΉ) ((f β comp-assoc Ο s g) β»ΒΉ) beforeOutput β isoComp-cong (isoComp-cong (idIso ((comp-assoc Ο (g β s) f) β»ΒΉ)) (post-inverse f (comp-assoc Ο s g))) (idIso beforeOutput)) assembled : ((outputRight β (middleRight β inputRight)) β atSource) =β (atTarget β (outputLeft β (middleLeft β inputLeft))) assembled = paste-squares (middleLeft β inputLeft) (middleRight β inputRight) outputLeft outputRight atSource beforeOutput atTarget (paste-squares inputLeft inputRight middleLeft middleRight atSource afterInput beforeOutput inputSquare middleSquare) outputSquare outside = (comp-assoc Ο (g β s) f) β»ΒΉ firstImage = f β (comp-assoc Ο s g) β»ΒΉ lastImage = f β comp-assoc h Ο g finalInput = comp-assoc h (g β Ο) f mergeImages : (firstImage β (middleRight β lastImage)) =β (f β coordinate-comparison Ο s Ο h b g) mergeImages = (postWhisker-isoComp-at f ((comp-assoc Ο s g) β»ΒΉ) ((g β b) β comp-assoc h Ο g)) β»ΒΉ β isoComp-cong (idIso firstImage) ((postWhisker-isoComp-at f (g β b) (comp-assoc h Ο g)) β»ΒΉ) normalizeRight : (outputRight β (middleRight β inputRight)) =β (coordinate-comparison Ο (g β s) (g β Ο) h (coordinate-comparison Ο s Ο h b g) f) normalizeRight = isoComp-cong (idIso outside) (isoComp-cong mergeImages (idIso finalInput) β ((isoComp-assoc-at firstImage (middleRight β lastImage) finalInput) β»ΒΉ β isoComp-cong (idIso firstImage) ((isoComp-assoc-at middleRight lastImage finalInput) β»ΒΉ))) β isoComp-assoc-at outside firstImage (middleRight β (lastImage β finalInput)) in isoComp-cong normalizeRight (idIso atSource) β assembled β»ΒΉ ``` For a pasted coordinate square, compatibility of postwhiskering with composition and the mixed whiskering square give the corresponding comparison of the two image pastings. ```agda cancel-inverse-tail : {X Y : CAT} {a b c : MAP X Y} (Ξ± : b =β c) (Ξ² : b =β a) β ((Ξ± β Ξ² β»ΒΉ) β Ξ²) =β Ξ± cancel-inverse-tail Ξ± Ξ² = isoComp-unitΚ³-at Ξ± β (isoComp-cong (idIso Ξ±) (isoComp-inverseΛ‘-at Ξ²) β isoComp-assoc-at Ξ± (Ξ² β»ΒΉ) Ξ²) post-pasting : {Q R K A B : CAT} (F : MAP A B) (Ο : MAP K A) (h : MAP R K) (k : MAP Q R) {q : MAP R A} {v : MAP Q A} (b : (Ο β h) =β q) (c : (q β k) =β v) β ((F β (c β ((b β· k) β (comp-assoc k h Ο) β»ΒΉ))) β (comp-assoc (h β k) Ο F β comp-assoc k h (F β Ο))) =β ((F β c) β (comp-assoc k q F β (((F β b) β comp-assoc h Ο F) β· k))) post-pasting F Ο h k {q} b c = let A = comp-assoc k h Ο B = comp-assoc k (Ο β h) F C = comp-assoc h Ο F β· k D = comp-assoc k q F e = F β c d = F β (b β· k) p = F β (c β ((b β· k) β A β»ΒΉ)) cancellation = cancel-inverse-tail (c β (b β· k)) A β isoComp-cong ((isoComp-assoc-at c (b β· k) (A β»ΒΉ)) β»ΒΉ) (idIso A) join = postWhisker-isoComp-at F c (b β· k) β ((postWhisker F β cancellation) β (postWhisker-isoComp-at F (c β ((b β· k) β A β»ΒΉ)) A) β»ΒΉ) mixed = (whisker-mixed-at b k F) β»ΒΉ finish = isoComp-cong (idIso e) (isoComp-cong (idIso D) ((preWhisker-isoComp-at (F β b) (comp-assoc h Ο F) k) β»ΒΉ) β isoComp-assoc-at D ((F β b) β· k) C) exchange = isoComp-cong (idIso e) (isoComp-cong mixed (idIso C)) β (isoComp-cong (idIso e) ((isoComp-assoc-at d B C) β»ΒΉ) β isoComp-assoc-at e d (B β C)) in finish β (exchange β (isoComp-cong join (idIso (B β C)) β ((isoComp-assoc-at p (F β A) (B β C)) β»ΒΉ β isoComp-cong (idIso p) (pentagon-whiskered k h Ο F)))) cancel-forward : {X Y : CAT} {a b c : MAP X Y} (Ξ± : a =β b) (Ξ² : c =β b) β (Ξ± β (Ξ± β»ΒΉ β Ξ²)) =β Ξ² cancel-forward Ξ± Ξ² = isoComp-unitΛ‘-at Ξ² β (isoComp-cong (isoComp-inverseΚ³-at Ξ±) (idIso Ξ²) β (isoComp-assoc-at Ξ± (Ξ± β»ΒΉ) Ξ²) β»ΒΉ) ``` A change of substitution also transports a specified projection square. We postcompose that square, then use the pasting calculation to remove the intermediate associators. ```agda coordinate-at-change : {Q R K A B : CAT} (F : MAP A B) (Ο : MAP K A) (h : MAP R K) (t : MAP Q R) (s : MAP Q K) (Ξ΄ : (h β t) =β s) {q : MAP R A} {v : MAP Q A} (b : (Ο β h) =β q) (bβ² : (Ο β s) =β v) (c : (q β t) =β v) β (bβ² β (Ο β Ξ΄)) =β (c β ((b β· t) β (comp-assoc t h Ο) β»ΒΉ)) β (coordinate-at F Ο s bβ² β (((F β Ο) β Ξ΄) β comp-assoc t h (F β Ο))) =β ((F β c) β (comp-assoc t q F β (coordinate-at F Ο h b β· t))) coordinate-at-change F Ο h t s Ξ΄ b bβ² c square = let leftImage = F β bβ² inputA = comp-assoc s Ο F change = (F β Ο) β Ξ΄ sourceA = comp-assoc t h (F β Ο) across = F β (Ο β Ξ΄) afterA = comp-assoc (h β t) Ο F projected = c β ((b β· t) β (comp-assoc t h Ο) β»ΒΉ) projectImage = (postWhisker F β square) β (postWhisker-isoComp-at F bβ² (Ο β Ξ΄)) β»ΒΉ moveInput = isoComp-assoc-at across afterA sourceA β (isoComp-cong (postWhisker-comp-at Ξ΄ Ο F) (idIso sourceA) β (isoComp-assoc-at inputA change sourceA) β»ΒΉ) removeInner = isoComp-cong projectImage (idIso (afterA β sourceA)) β (isoComp-assoc-at leftImage across (afterA β sourceA)) β»ΒΉ in post-pasting F Ο h t b c β (removeInner β (isoComp-cong (idIso leftImage) moveInput β isoComp-assoc-at leftImage inputA (change β sourceA))) ``` Postcomposition also preserves the specified comparison for two successive substitutions. The second form permits an identification of their composite with another substitution; both forms keep the supplied square explicit. ```agda post-iterated-comparison : {Q R X A B : CAT} (F : MAP A B) (H : MAP X A) (r : MAP R X) (s : MAP Q R) {Hβ : MAP R A} {Hβ Hβ : MAP Q A} (u : (H β r) =β Hβ) (v : (Hβ β s) =β Hβ) (w : (H β (r β s)) =β Hβ) (z : Hβ =β Hβ) β (w β comp-assoc s r H) =β (z β (v β (u β· s))) β (((F β w) β comp-assoc (r β s) H F) β comp-assoc s r (F β H)) =β ((F β z) β (((F β v) β comp-assoc s Hβ F) β (((F β u) β comp-assoc r H F) β· s))) post-iterated-comparison F H r s {Hβ} u v w z p = let A = comp-assoc s r H pre = u β· s normalize = isoComp-assoc-at (z β v) pre (A β»ΒΉ) β (isoComp-cong ((isoComp-assoc-at z v pre) β»ΒΉ) (idIso (A β»ΒΉ)) β (isoComp-cong p (idIso (A β»ΒΉ)) β (cancel-right A w) β»ΒΉ)) image = ((F β u) β comp-assoc r H F) β· s targetA = comp-assoc s Hβ F finish = isoComp-cong (idIso (F β z)) ((isoComp-assoc-at (F β v) targetA image) β»ΒΉ) β (isoComp-assoc-at (F β z) (F β v) (targetA β image) β isoComp-cong (postWhisker-isoComp-at F z v) (idIso (targetA β image))) in finish β (post-pasting F H r s u (z β v) β (isoComp-cong (postWhisker F β normalize) (idIso (comp-assoc (r β s) H F β comp-assoc s r (F β H))) β isoComp-assoc-at (F β w) (comp-assoc (r β s) H F) (comp-assoc s r (F β H)))) post-change-comparison : {Q R X A B : CAT} (F : MAP A B) (H : MAP X A) (h : MAP R X) (t : MAP Q R) (s : MAP Q X) (Ξ΄ : (h β t) =β s) {Hβ : MAP R A} {Hβ Hβ : MAP Q A} (u : (H β h) =β Hβ) (v : (Hβ β t) =β Hβ) (w : (H β s) =β Hβ) (z : Hβ =β Hβ) β (w β ((H β Ξ΄) β comp-assoc t h H)) =β (z β (v β (u β· t))) β (((F β w) β comp-assoc s H F) β (((F β H) β Ξ΄) β comp-assoc t h (F β H))) =β ((F β z) β (((F β v) β comp-assoc t Hβ F) β (((F β u) β comp-assoc h H F) β· t))) post-change-comparison F H h t s Ξ΄ u v w z square = let image = F β w inputA = comp-assoc s H F change = (F β H) β Ξ΄ outsideA = comp-assoc t h (F β H) across = F β (H β Ξ΄) middleA = comp-assoc (h β t) H F normalization = (isoComp-assoc-at (F β (w β (H β Ξ΄))) middleA outsideA) β»ΒΉ β (isoComp-cong ((postWhisker-isoComp-at F w (H β Ξ΄)) β»ΒΉ) (idIso (middleA β outsideA)) β ((isoComp-assoc-at image across (middleA β outsideA)) β»ΒΉ β (isoComp-cong (idIso image) (isoComp-assoc-at across middleA outsideA) β (isoComp-cong (idIso image) (isoComp-cong (postWhisker-comp-at Ξ΄ H F) (idIso outsideA)) β (isoComp-cong (idIso image) ((isoComp-assoc-at inputA change outsideA) β»ΒΉ) β isoComp-assoc-at image inputA (change β outsideA)))))) in post-iterated-comparison F H h t u v (w β (H β Ξ΄)) z (square β isoComp-assoc-at w (H β Ξ΄) (comp-assoc t h H)) β normalization ``` Successive postcomposition of a coordinate comparison is governed by the external pentagon and naturality of the associator. ```agda coordinate-at-outer-composition : {R K X Y Z : CAT} (F : MAP Y Z) (G : MAP X Y) (Ο : MAP K X) (t : MAP R K) {p : MAP R X} (b : (Ο β t) =β p) β (comp-assoc p G F β coordinate-at (F β G) Ο t b) =β ((F β coordinate-at G Ο t b) β (comp-assoc t (G β Ο) F β (comp-assoc Ο G F β· t))) coordinate-at-outer-composition F G Ο t {p} b = let A = comp-assoc p G F B = (F β G) β b C = comp-assoc t Ο (F β G) D = F β (G β b) E = comp-assoc (Ο β t) G F I = F β comp-assoc t Ο G J = comp-assoc t (G β Ο) F K = comp-assoc Ο G F β· t in isoComp-cong ((postWhisker-isoComp-at F (G β b) (comp-assoc t Ο G)) β»ΒΉ) (idIso (J β K)) β ((isoComp-assoc-at D I (J β K)) β»ΒΉ β (isoComp-cong (idIso D) (pentagon-whiskered t Ο G F) β (isoComp-assoc-at D E C β (isoComp-cong (postWhisker-comp-at b G F) (idIso C) β (isoComp-assoc-at A B C) β»ΒΉ)))) ``` A chosen reverse comparison can be used to solve the image square for its upper side. The cancellation witness is an input: the statement therefore applies to the specified reverse comparison, without replacing it by an unspecified inverse with the same endpoints. ```agda post-change-with-inverse : {Q R X A B : CAT} (F : MAP A B) (H : MAP X A) (h : MAP R X) (t : MAP Q R) (s : MAP Q X) (Ξ΄ : (h β t) =β s) {Hβ : MAP R A} {Hβ Hβ : MAP Q A} (u : (H β h) =β Hβ) (v : (Hβ β t) =β Hβ) (w : (H β s) =β Hβ) (z : Hβ =β Hβ) (square : (w β ((H β Ξ΄) β comp-assoc t h H)) =β (z β (v β (u β· t)))) (back : (F β Hβ) =β ((F β H) β h)) (inverse : (((F β u) β comp-assoc h H F) β back) =β idIso (F β Hβ)) β ((F β z) β ((F β v) β comp-assoc t Hβ F)) =β (((F β w) β comp-assoc s H F) β (((F β H) β Ξ΄) β (comp-assoc t h (F β H) β (back β· t)))) post-change-with-inverse F H h t s Ξ΄ {Hβ} u v w z square back inverse = let A = comp-assoc t h (F β H) forward = (F β u) β comp-assoc h H F before = forward β· t backT = back β· t target = (F β z) β ((F β v) β comp-assoc t Hβ F) short = (F β w) β comp-assoc s H F step = (F β H) β Ξ΄ cancel = preWhisker-idIso (F β Hβ) t β ((preWhisker t β inverse) β (preWhisker-isoComp-at forward back t) β»ΒΉ) compare = (isoComp-assoc-at (F β z) ((F β v) β comp-assoc t Hβ F) before) β»ΒΉ β post-change-comparison F H h t s Ξ΄ u v w z square in isoComp-cong (idIso short) (isoComp-assoc-at step A backT) β (isoComp-assoc-at short (step β A) backT β (isoComp-cong (compare β»ΒΉ) (idIso backT) β ((isoComp-assoc-at target before backT) β»ΒΉ β (isoComp-cong (idIso target) (cancel β»ΒΉ) β (isoComp-unitΚ³-at target) β»ΒΉ)))) ```