Other Agda modules in this section (28)
- Equivalences
- Everything
- IdentificationCalculus.CoordinateComparisons
- 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.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.
# Assembling pairing comparisons A comparison between successive substitutions is determined by its two coordinate comparisons. We retain both routes explicitly and normalize each to a paired coordinate comparison followed by the common substitution base. This calculation uses only the specified pairing functoriality laws. ```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.ProductCalculus.PairingInterface as Interface module SCT.VolumeI.Chapter01.Section03.ProductCalculus.PairingAssembly {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) (O : Interface.PairingOperations V T P S) (F : Interface.PairingFunctoriality V T P S O) where open Vocabulary V open Operations V open Products.ProductData P open Coherence.CompositionStructure S open Coherence.Composition V T P S open Specialization V T P PL S hiding (pair-cong; pair-pre) open Specialization.Units V T P PL S VC open Specialization.Whiskering V T P PL S W open Interface.PairingOperations O open Interface.PairingFunctoriality F combine-pair : {X A B : CAT} {aβ aβ aβ : MAP X A} {bβ bβ bβ : MAP X B} {source : MAP X (A Γ B)} (Ξ± : aβ =β aβ) (Ξ² : bβ =β bβ) (Ξ³ : aβ =β aβ) (Ξ΄ : bβ =β bβ) (base : source =β (pair aβ bβ)) β (pair-cong Ξ± Ξ² β (pair-cong Ξ³ Ξ΄ β base)) =β (pair-cong (Ξ± β Ξ³) (Ξ² β Ξ΄) β base) combine-pair Ξ± Ξ² Ξ³ Ξ΄ base = isoComp-cong ((pair-cong-comp Ξ± Ξ³ Ξ² Ξ΄) β»ΒΉ) (idIso base) β (isoComp-assoc-at (pair-cong Ξ± Ξ²) (pair-cong Ξ³ Ξ΄) base) β»ΒΉ module PairingAssembly {Q R X A B : CAT} (b : MAP X A) (c : MAP X B) (r : MAP R X) (t : MAP Q R) (s : MAP Q X) (Ξ΄ : (r β t) =β s) {bβ : MAP R A} {cβ : MAP R B} {bβ bβ : MAP Q A} {cβ cβ : MAP Q B} (u : (b β r) =β bβ) (v : (c β r) =β cβ) (w : (bβ β t) =β bβ) (z : (cβ β t) =β cβ) (a : (b β s) =β bβ) (d : (c β s) =β cβ) (Ξ· : bβ =β bβ) (ΞΈ : cβ =β cβ) where base : ((pair b c β r) β t) =β (pair ((b β r) β t) ((c β r) β t)) base = pair-pre (b β r) (c β r) t β (pair-pre b c r β· t) shortFirst : ((b β r) β t) =β bβ shortFirst = a β ((b β Ξ΄) β comp-assoc t r b) shortSecond : ((c β r) β t) =β cβ shortSecond = d β ((c β Ξ΄) β comp-assoc t r c) longFirst : ((b β r) β t) =β bβ longFirst = Ξ· β (w β (u β· t)) longSecond : ((c β r) β t) =β cβ longSecond = ΞΈ β (z β (v β· t)) short : ((pair b c β r) β t) =β (pair bβ cβ) short = (pair-cong a d β pair-pre b c s) β ((pair b c β Ξ΄) β comp-assoc t r (pair b c)) long : ((pair b c β r) β t) =β (pair bβ cβ) long = pair-cong Ξ· ΞΈ β ((pair-cong w z β pair-pre bβ cβ t) β ((pair-cong u v β pair-pre b c r) β· t)) short-normalization : short =β (pair-cong shortFirst shortSecond β base) short-normalization = let paired = pair-cong a d changed = pair-cong (b β Ξ΄) (c β Ξ΄) A = comp-assoc t r (pair b c) pairedA = pair-cong (comp-assoc t r b) (comp-assoc t r c) substitute = isoComp-assoc-at changed (pair-pre b c (r β t)) A β (isoComp-cong ((pair-pre-natural-substitution b c Ξ΄) β»ΒΉ) (idIso A) β (isoComp-assoc-at (pair-pre b c s) (pair b c β Ξ΄) A) β»ΒΉ) iterate = isoComp-cong (idIso changed) (pair-pre-iterated b c r t) combineInner = combine-pair (b β Ξ΄) (c β Ξ΄) (comp-assoc t r b) (comp-assoc t r c) base in combine-pair a d ((b β Ξ΄) β comp-assoc t r b) ((c β Ξ΄) β comp-assoc t r c) base β (isoComp-cong (idIso paired) (combineInner β (iterate β substitute)) β isoComp-assoc-at paired (pair-pre b c s) ((pair b c β Ξ΄) β A)) intermediate-normalization : ((pair-cong w z β pair-pre bβ cβ t) β ((pair-cong u v β pair-pre b c r) β· t)) =β (pair-cong (w β (u β· t)) (z β (v β· t)) β base) intermediate-normalization = let outer = pair-cong w z before = pair-pre b c r β· t middle = pair-pre bβ cβ t input = pair-cong u v β· t output = pair-cong (u β· t) (v β· t) exchange = isoComp-assoc-at output (pair-pre (b β r) (c β r) t) before β (isoComp-cong ((pair-pre-natural-inputs u v t) β»ΒΉ) (idIso before) β (isoComp-assoc-at middle input before) β»ΒΉ) in combine-pair w z (u β· t) (v β· t) base β (isoComp-cong (idIso outer) exchange β (isoComp-assoc-at outer middle (input β before) β isoComp-cong (idIso (outer β middle)) (preWhisker-isoComp-at (pair-cong u v) (pair-pre b c r) t))) long-normalization : long =β (pair-cong longFirst longSecond β base) long-normalization = combine-pair Ξ· ΞΈ (w β (u β· t)) (z β (v β· t)) base β isoComp-cong (idIso (pair-cong Ξ· ΞΈ)) intermediate-normalization assemble : shortFirst =β longFirst β shortSecond =β longSecond β short =β long assemble first second = long-normalization β»ΒΉ β (isoComp-cong (pair-cong-Isoβ first second) (idIso base) β short-normalization) ``` Changing the two coordinate frames gives a square for the paired comparison. Normalize the given substitution comparison and both boundary routes, then apply the two supplied coordinate squares. ```agda module FramedPairing {Q R A B : CAT} (s : MAP Q R) {aβ aβ : MAP R A} {bβ bβ : MAP R B} {aβ aβ aβ : MAP Q A} {bβ bβ bβ : MAP Q B} (u : aβ =β aβ) (v : bβ =β bβ) (uβ² : aβ =β aβ) (vβ² : bβ =β bβ) (Ξ· : aβ =β aβ) (ΞΈ : bβ =β bβ) (e : (aβ β s) =β aβ) (d : (bβ β s) =β bβ) (first : (aβ β s) =β aβ) (second : (bβ β s) =β bβ) (ΞΊ : (pair aβ bβ β s) =β (pair aβ bβ)) (normalization : ΞΊ =β (pair-cong e d β pair-pre aβ bβ s)) where before = pair-cong u v after = pair-cong uβ² vβ² finish = pair-cong Ξ· ΞΈ changed = pair-cong first second β pair-pre aβ bβ s comparison-square : (Ξ· β (uβ² β e)) =β (first β (u β· s)) β (ΞΈ β (vβ² β d)) =β (second β (v β· s)) β ((finish β after) β ΞΊ) =β (changed β (before β· s)) comparison-square firstNormalize secondNormalize = let base = pair-pre aβ bβ s normalizeLeft = combine-pair Ξ· ΞΈ (uβ² β e) (vβ² β d) base β (isoComp-cong (idIso finish) (combine-pair uβ² vβ² e d base) β (isoComp-assoc-at finish after (pair-cong e d β base) β isoComp-cong (idIso (finish β after)) normalization)) normalizeRight = combine-pair first second (u β· s) (v β· s) base β (isoComp-cong (idIso (pair-cong first second)) ((pair-pre-natural-inputs u v s) β»ΒΉ) β isoComp-assoc-at (pair-cong first second) (pair-pre aβ bβ s) (before β· s)) in normalizeRight β»ΒΉ β (isoComp-cong (pair-cong-Isoβ firstNormalize secondNormalize) (idIso base) β normalizeLeft) ```