Other Agda modules in this section (188)

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

# Composing paired projection frames

Pairing two composite projection frames agrees with composing their
paired frames. The comparison keeps the external associator. It follows
from the existing pairing assembly theorem and vertical cancellation.

This supplies the rectangle-coordinate assembly for square currying.

```agda
{-# OPTIONS --safe --without-K #-}
open import Agda.Primitive using (Level)
open import SCT.VolumeI.Chapter01.Theory using (Theory)
import SCT.VolumeI.Chapter01.Section04.MappingAnimae as Mapping
import SCT.VolumeI.Chapter01.Section07.FunctorCategories as Categories

module SCT.VolumeI.Chapter02.Section02.EvaluationCalculus.PairedProjectionComposition
  {c m a : Level} (𝒯 : Theory c m a) (M : Mapping.MappingAnimae 𝒯)
  (β„± : Categories.FunctorCategories 𝒯 M) where

open import SCT.VolumeI.Chapter02.Section01.EvaluationCalculus.EndpointEvaluation 𝒯 M β„±
open import SCT.VolumeI.Chapter01.Section04.SquareCalculus.ProjectionSquares 𝒯 using (compose-base; Square)
open import SCT.VolumeI.Chapter01.Section04.ProductCalculus.ProductAssociativity 𝒯 M using (module PairingAssembly; cancel-inverse-tail)
import SCT.VolumeI.Chapter01.Section03.ProductCalculus.PairingNaturality as PN
open PN vocabulary terminal products productLaws composition vertical whiskering using (cancel-right; pair-pre-natural-substitution)
import SCT.VolumeI.Chapter01.Section03.ProductCalculus.PairingCoherence as Pairing
open Pairing vocabulary terminal products productLaws composition vertical whiskering using (pair-cong-id; pair-cong-comp; pair-cong-Isoβ‚‚)

abstract
  paired-square : {X Y A B : CAT} (f : MAP Y A) (g : MAP Y B)
    {r s : MAP X Y} {x : MAP X A} {y : MAP X B}
    (fr : (f ∘ r) =₁ x) (fs : (f ∘ s) =₁ x)
    (gr : (g ∘ r) =₁ y) (gs : (g ∘ s) =₁ y) (Ξ΄ : r =₁ s) β†’
    Square f fr fs Ξ΄ β†’ Square g gr gs Ξ΄ β†’
    Square (pair f g) (pair-cong fr gr βˆ™ pair-pre f g r) (pair-cong fs gs βˆ™ pair-pre f g s) Ξ΄
  paired-square f g {r} {s} fr fs gr gs Ξ΄ first second =
    isoComp-cong (pair-cong-Isoβ‚‚ first second) (idIso (pair-pre f g r)) βˆ™
    isoComp-cong ((pair-cong-comp fs (f ◁ Ξ΄) gs (g ◁ Ξ΄)) ⁻¹) (idIso (pair-pre f g r)) βˆ™
    (isoComp-assoc-at (pair-cong fs gs) (pair-cong (f ◁ Ξ΄) (g ◁ Ξ΄)) (pair-pre f g r)) ⁻¹ βˆ™
    isoComp-cong (idIso (pair-cong fs gs)) ((pair-pre-natural-substitution f g Ξ΄) ⁻¹) βˆ™
    isoComp-assoc-at (pair-cong fs gs) (pair-pre f g s) (pair f g ◁ Ξ΄)

module At {Q R X A B : CAT} (f : MAP X A) (g : MAP X B) (r : MAP R X) (t : MAP Q R)
  {f₁ : MAP R A} {g₁ : MAP R B} {fβ‚‚ : MAP Q A} {gβ‚‚ : MAP Q B}
  (u : (f ∘ r) =₁ f₁) (v : (g ∘ r) =₁ g₁)
  (w : (f₁ ∘ t) =₁ fβ‚‚) (z : (g₁ ∘ t) =₁ gβ‚‚) where
  first = pair-cong u v βˆ™ pair-pre f g r
  second = pair-cong w z βˆ™ pair-pre f₁ g₁ t
  left = compose-base f r u t w
  right = compose-base g r v t z
  direct = pair-cong left right βˆ™ pair-pre f g (r ∘ t)
  composite = compose-base (pair f g) r first t second
  module Assemble = PairingAssembly f g r t (r ∘ t) (idIso (r ∘ t))
    u v w z left right (idIso fβ‚‚) (idIso gβ‚‚)
  Aβ‚€ = comp-assoc t r (pair f g)
  tail = first β–· t

  abstract
    clear : {D : CAT} (h : MAP X D) {h₁ : MAP R D} {hβ‚‚ : MAP Q D}
      (b : (h ∘ r) =₁ h₁) (d : (h₁ ∘ t) =₁ hβ‚‚) β†’
      (compose-base h r b t d βˆ™ ((h ◁ idIso (r ∘ t)) βˆ™ comp-assoc t r h)) =β‚‚
      (idIso hβ‚‚ βˆ™ (d βˆ™ (b β–· t)))
    clear h b d = (isoComp-unitΛ‘-at (d βˆ™ (b β–· t))) ⁻¹ βˆ™
      cancel-inverse-tail (d βˆ™ (b β–· t)) (comp-assoc t r h) βˆ™
      isoComp-cong ((isoComp-assoc-at d (b β–· t) ((comp-assoc t r h) ⁻¹)) ⁻¹)
        (idIso (comp-assoc t r h)) βˆ™
      isoComp-cong (idIso (compose-base h r b t d))
        (isoComp-unitΛ‘-at (comp-assoc t r h) βˆ™
          isoComp-cong (postWhisker-idIso h (r ∘ t)) (idIso (comp-assoc t r h)))

    short-normal : Assemble.short =β‚‚ (direct βˆ™ Aβ‚€)
    short-normal = isoComp-cong (idIso direct)
      (isoComp-unitΛ‘-at Aβ‚€ βˆ™ isoComp-cong (postWhisker-idIso (pair f g) (r ∘ t)) (idIso Aβ‚€))
    long-normal : Assemble.long =β‚‚ (second βˆ™ tail)
    long-normal = isoComp-unitΛ‘-at (second βˆ™ tail) βˆ™
      isoComp-cong (pair-cong-id fβ‚‚ gβ‚‚) (idIso (second βˆ™ tail))
    associated : (direct βˆ™ Aβ‚€) =β‚‚ (second βˆ™ tail)
    associated = long-normal βˆ™ Assemble.assemble (clear f u w) (clear g v z) βˆ™ short-normal ⁻¹

    comparison : direct =β‚‚ composite
    comparison = isoComp-assoc-at second tail (Aβ‚€ ⁻¹) βˆ™
      isoComp-cong associated (idIso (Aβ‚€ ⁻¹)) βˆ™ (cancel-right Aβ‚€ direct) ⁻¹
```