Other Agda modules in this section (28)

Complete compiler-highlighted source. Follow a symbol to its declaration.

Corresponding book passages
# Pairing and iterated precomposition

The comparison concerns the already chosen `pair-pre`, with the primitive
external associator retained on both the product and its two components.

The argument is now parameterized by the chosen pairing comparisons and
all their projection laws. The adapter retains the original choices. The main
proof still compares the two explicit pastings by projecting them; it never
opens the construction of a pairing comparison through the product inverse.

```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.Section02.Isomorphisms as Isomorphisms
import SCT.VolumeI.Chapter01.Section03.ProductCalculus.PairingCoherence as PairingCoherence
import SCT.VolumeI.Chapter01.Section03.Whiskering as WhiskeringEquivalences
import SCT.VolumeI.Chapter01.Section03.ProductCalculus.PairingNaturality as PairingNaturality

import SCT.VolumeI.Chapter01.Section03.ProductCalculus.PairingInterface as Interface
import SCT.VolumeI.Chapter01.Section03.ProductCalculus.ChosenPairing as ChosenPairing
import SCT.VolumeI.Chapter01.Section03.IdentificationCalculus.FunctorCoherence as FunctorCoherence


module SCT.VolumeI.Chapter01.Section03.ProductCalculus.IteratedPairing
  {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 Vocabulary V
open Operations V
open Products.ProductData P
open Coherence.CompositionStructure S
open Coherence.Composition V T P S
open Coherence.WhiskeringCoherence W
open Coherence.PentagonTriangleCoherence PT
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 PairingCoherence V T P PL S VC W using (equiv-reflect)
open WhiskeringEquivalences V T P PL S VC W using
  (leftMultiply; rightMultiply; leftMultiply-isEquiv; rightMultiply-isEquiv;
   left-evaluate; right-evaluate)
open Isomorphisms V T P PL S VC W using (reassociateFour; cancel-inverse)
open PairingNaturality V T P PL S VC W using
  (move-square; project-composite; pre-square-projection)

open FunctorCoherence V T P PL S VC W PT public using
  (hcomp-idOuter; hcomp-idInner; pentagon-whiskered; leftMultiply-at; rightMultiply-at; cancel-left; cancel-right; pre-assoc-at; mixed-at; pre-inverse-at; inverse-tail; solve-pentagon; transport-pre; transport-pre-assoc)

module Calculation
  (O : Interface.PairingOperations V T P S)
  (L : Interface.PairingLaws V T P S O) where

  open Interface.PairingOperations O
  open Interface.PairingLaws L

  module Boundaries {Q R X C D : CAT}
    (f : MAP X C) (g : MAP X D) (Οƒ : MAP R X) (Ο„ : MAP Q R) where

    source : MAP Q (C Γ— D)
    source = (pair f g ∘ Οƒ) ∘ Ο„

    target : MAP Q (C Γ— D)
    target = pair (f ∘ (Οƒ ∘ Ο„)) (g ∘ (Οƒ ∘ Ο„))

    together : source =₁ target
    together = pair-pre f g (Οƒ ∘ Ο„) βˆ™ comp-assoc Ο„ Οƒ (pair f g)

    successively : source =₁ target
    successively = pair-cong (comp-assoc Ο„ Οƒ f) (comp-assoc Ο„ Οƒ g) βˆ™
      (pair-pre (f ∘ Οƒ) (g ∘ Οƒ) Ο„ βˆ™ (pair-pre f g Οƒ β–· Ο„))

    project-successively : {Z : CAT} (Ο€ : MAP (C Γ— D) Z) (z : MAP X Z)
      (bβ‚€ : (Ο€ ∘ pair f g) =₁ z)
      (b₁ : (Ο€ ∘ pair (f ∘ Οƒ) (g ∘ Οƒ)) =₁ (z ∘ Οƒ))
      (bβ‚‚ : (Ο€ ∘ pair ((f ∘ Οƒ) ∘ Ο„) ((g ∘ Οƒ) ∘ Ο„)) =₁ ((z ∘ Οƒ) ∘ Ο„))
      (b₃ : (Ο€ ∘ target) =₁ (z ∘ (Οƒ ∘ Ο„)))
      β†’ (b₁ βˆ™ (Ο€ ◁ pair-pre f g Οƒ)) =β‚‚ (transport-pre Ο€ (pair f g) bβ‚€ Οƒ)
      β†’ (bβ‚‚ βˆ™ (Ο€ ◁ pair-pre (f ∘ Οƒ) (g ∘ Οƒ) Ο„)) =β‚‚
          (transport-pre Ο€ (pair (f ∘ Οƒ) (g ∘ Οƒ)) b₁ Ο„)
      β†’ (b₃ βˆ™ (Ο€ ◁ pair-cong (comp-assoc Ο„ Οƒ f) (comp-assoc Ο„ Οƒ g))) =β‚‚
          (comp-assoc Ο„ Οƒ z βˆ™ bβ‚‚)
      β†’ (b₃ βˆ™ (Ο€ ◁ successively)) =β‚‚
          (transport-pre Ο€ (pair f g) bβ‚€ (Οƒ ∘ Ο„) βˆ™ (Ο€ ◁ comp-assoc Ο„ Οƒ (pair f g)))
    project-successively Ο€ z bβ‚€ b₁ bβ‚‚ b₃ first second last =
      let before = pair-pre f g Οƒ
          after = pair-pre (f ∘ Οƒ) (g ∘ Οƒ) Ο„
          top = pair-cong (comp-assoc Ο„ Οƒ f) (comp-assoc Ο„ Οƒ g)
          inner = after βˆ™ (before β–· Ο„)
          transported = transport-pre Ο€ (pair f g) bβ‚€ Οƒ
          moved = pre-square-projection Ο€ before (idIso (z ∘ Οƒ))
            transported b₁ Ο„ ((isoComp-unitΛ‘-at transported) ⁻¹ βˆ™ first)
          remove-id = isoComp-unitΛ‘-at (transport-pre Ο€ (pair f g ∘ Οƒ) transported Ο„) βˆ™
            isoComp-cong (preWhisker-idIso (z ∘ Οƒ) Ο„) (idIso _)
          inner-normal = remove-id βˆ™
            (moved βˆ™
              (isoComp-cong second (idIso (Ο€ ◁ (before β–· Ο„))) βˆ™
                project-composite Ο€ after (before β–· Ο„) bβ‚‚))
          outer-normal = isoComp-cong (idIso (comp-assoc Ο„ Οƒ z)) inner-normal βˆ™
            (isoComp-assoc-at (comp-assoc Ο„ Οƒ z) bβ‚‚ (Ο€ ◁ inner) βˆ™
              (isoComp-cong last (idIso (Ο€ ◁ inner)) βˆ™
                project-composite Ο€ top inner b₃))
      in transport-pre-assoc Ο€ (pair f g) z bβ‚€ Οƒ Ο„ βˆ™
        ((isoComp-assoc-at (comp-assoc Ο„ Οƒ z) (transported β–· Ο„)
          ((comp-assoc Ο„ (pair f g ∘ Οƒ) Ο€) ⁻¹)) ⁻¹ βˆ™ outer-normal)

    project-together : {Z : CAT} (Ο€ : MAP (C Γ— D) Z) (z : MAP X Z)
      (bβ‚€ : (Ο€ ∘ pair f g) =₁ z)
      (b₃ : (Ο€ ∘ target) =₁ (z ∘ (Οƒ ∘ Ο„)))
      β†’ (b₃ βˆ™ (Ο€ ◁ pair-pre f g (Οƒ ∘ Ο„))) =β‚‚
          (transport-pre Ο€ (pair f g) bβ‚€ (Οƒ ∘ Ο„))
      β†’ (b₃ βˆ™ (Ο€ ◁ together)) =β‚‚
          (transport-pre Ο€ (pair f g) bβ‚€ (Οƒ ∘ Ο„) βˆ™ (Ο€ ◁ comp-assoc Ο„ Οƒ (pair f g)))
    project-together Ο€ z bβ‚€ b₃ triangle =
      isoComp-cong triangle (idIso _) βˆ™
        project-composite Ο€ (pair-pre f g (Οƒ ∘ Ο„)) (comp-assoc Ο„ Οƒ (pair f g)) b₃

    compatibility : together =β‚‚ successively
    compatibility = pair-iso-extensionality
      (cancel-left (pair-β₁ (f ∘ (Οƒ ∘ Ο„)) (g ∘ (Οƒ ∘ Ο„)))
        ((project-successively pr₁ f
          (pair-β₁ f g)
          (pair-β₁ (f ∘ Οƒ) (g ∘ Οƒ))
          (pair-β₁ ((f ∘ Οƒ) ∘ Ο„) ((g ∘ Οƒ) ∘ Ο„))
          (pair-β₁ (f ∘ (Οƒ ∘ Ο„)) (g ∘ (Οƒ ∘ Ο„)))
          (pair-pre-triangle₁ f g Οƒ)
          (pair-pre-triangle₁ (f ∘ Οƒ) (g ∘ Οƒ) Ο„)
          (pair-cong-triangle₁ (comp-assoc Ο„ Οƒ f) (comp-assoc Ο„ Οƒ g))) ⁻¹ βˆ™
         project-together pr₁ f (pair-β₁ f g)
          (pair-β₁ (f ∘ (Οƒ ∘ Ο„)) (g ∘ (Οƒ ∘ Ο„)))
          (pair-pre-triangle₁ f g (Οƒ ∘ Ο„))))
      (cancel-left (pair-Ξ²β‚‚ (f ∘ (Οƒ ∘ Ο„)) (g ∘ (Οƒ ∘ Ο„)))
        ((project-successively prβ‚‚ g
          (pair-Ξ²β‚‚ f g)
          (pair-Ξ²β‚‚ (f ∘ Οƒ) (g ∘ Οƒ))
          (pair-Ξ²β‚‚ ((f ∘ Οƒ) ∘ Ο„) ((g ∘ Οƒ) ∘ Ο„))
          (pair-Ξ²β‚‚ (f ∘ (Οƒ ∘ Ο„)) (g ∘ (Οƒ ∘ Ο„)))
          (pair-pre-triangleβ‚‚ f g Οƒ)
          (pair-pre-triangleβ‚‚ (f ∘ Οƒ) (g ∘ Οƒ) Ο„)
          (pair-cong-triangleβ‚‚ (comp-assoc Ο„ Οƒ f) (comp-assoc Ο„ Οƒ g))) ⁻¹ βˆ™
         project-together prβ‚‚ g (pair-Ξ²β‚‚ f g)
          (pair-Ξ²β‚‚ (f ∘ (Οƒ ∘ Ο„)) (g ∘ (Οƒ ∘ Ο„)))
          (pair-pre-triangleβ‚‚ f g (Οƒ ∘ Ο„))))

  pair-pre-iterated : {Q R X C D : CAT}
    (f : MAP X C) (g : MAP X D) (Οƒ : MAP R X) (Ο„ : MAP Q R)
    β†’ (Boundaries.together f g Οƒ Ο„) =β‚‚ (Boundaries.successively f g Οƒ Ο„)
  pair-pre-iterated = Boundaries.compatibility
```


The same argument applies to the specified pairing comparisons. The following
boundary diagram and theorem retain the concrete notation of the construction.

```agda
private
  module Chosen = ChosenPairing V T P PL S VC W using (operations; laws)
  module Realized = Calculation Chosen.operations Chosen.laws
open Specialization V T P PL S using (pair-cong; pair-pre)

module Boundaries {Q R X C D : CAT}
  (f : MAP X C) (g : MAP X D) (Οƒ : MAP R X) (Ο„ : MAP Q R) where

  source : MAP Q (C Γ— D)
  source = (pair f g ∘ Οƒ) ∘ Ο„

  target : MAP Q (C Γ— D)
  target = pair (f ∘ (Οƒ ∘ Ο„)) (g ∘ (Οƒ ∘ Ο„))

  together : source =₁ target
  together = pair-pre f g (Οƒ ∘ Ο„) βˆ™ comp-assoc Ο„ Οƒ (pair f g)

  successively : source =₁ target
  successively = pair-cong (comp-assoc Ο„ Οƒ f) (comp-assoc Ο„ Οƒ g) βˆ™
    (pair-pre (f ∘ Οƒ) (g ∘ Οƒ) Ο„ βˆ™ (pair-pre f g Οƒ β–· Ο„))

  open Realized.Boundaries f g Οƒ Ο„ public
    using (project-successively; project-together)

  compatibility : together =β‚‚ successively
  compatibility = Realized.Boundaries.compatibility f g Οƒ Ο„

pair-pre-iterated : {Q R X C D : CAT}
  (f : MAP X C) (g : MAP X D) (Οƒ : MAP R X) (Ο„ : MAP Q R)
  β†’ (Boundaries.together f g Οƒ Ο„) =β‚‚ (Boundaries.successively f g Οƒ Ο„)
pair-pre-iterated = Boundaries.compatibility
```