Other Agda modules in this section (54)

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

# Frames for a precomposition triangle

A chosen evaluated composite determines a common middle frame for the
triangle. This calculation retains the two product projections and does
not identify composition with a projection strictly.

```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.Chapter01.Section07.EvaluationCalculus.PrecompositionTriangleFrames
  {c m a : Level} (𝒯 : Theory c m a) (M : Mapping.MappingAnimae 𝒯)
  (β„± : Categories.FunctorCategories 𝒯 M) where

open import SCT.VolumeI.Chapter01.Section07.Setup 𝒯 M β„± public
import SCT.VolumeI.Chapter01.Section03.ProductCalculus.PairingNaturality as PN
open PN vocabulary terminal products productLaws composition vertical whiskering using (cancel-right)

module At {C D : CAT} (K : CAT) (l : MAP C D) (r : MAP D C)
  (u : funUncurry (funPre {D = K} l ∘ funPre {D = K} r) =₁
    (funEval ∘ pair (pr₁ {Fun C K} {C}) (r ∘ (l ∘ prβ‚‚)))) where
  X = Fun C K
  Y = Fun D K
  L : MAP X Y
  L = funPre {D = K} r
  R : MAP Y X
  R = funPre {D = K} l
  e : MAP (X Γ— C) K
  e = funEval
  W : MAP (X Γ— D) (X Γ— C)
  W = productMap (id X) r
  H : MAP (X Γ— C) (X Γ— C)
  H = pair pr₁ (r ∘ (l ∘ prβ‚‚))
  outside-object : MAP (X Γ— D) K
  outside-object = e ∘ pair pr₁ (r ∘ prβ‚‚)
  middle-object : MAP (X Γ— D) K
  middle-object = e ∘ pair pr₁ (r ∘ (l ∘ (r ∘ prβ‚‚)))
  outside : funUncurry L =₁ outside-object
  outside = (e ◁ pair-cong (comp-unitΛ‘ pr₁) (idIso (r ∘ prβ‚‚))) βˆ™ funPre-Ξ² {D = K} r
  first-coordinate : (pr₁ ∘ W) =₁ (pr₁ {X} {D})
  first-coordinate = comp-unitΛ‘ pr₁ βˆ™ pair-β₁ (id X ∘ pr₁) (r ∘ prβ‚‚)
  second-coordinate : (prβ‚‚ ∘ W) =₁ (r ∘ prβ‚‚ {X} {D})
  second-coordinate = pair-Ξ²β‚‚ (id X ∘ pr₁) (r ∘ prβ‚‚)
  nested-coordinate : ((r ∘ (l ∘ prβ‚‚)) ∘ W) =₁ (r ∘ (l ∘ (r ∘ prβ‚‚ {X} {D})))
  nested-coordinate = (r ◁ ((l ◁ second-coordinate) βˆ™ comp-assoc W prβ‚‚ l)) βˆ™ comp-assoc W (l ∘ prβ‚‚) r
  product-frame : (H ∘ W) =₁ pair (pr₁ {X} {D}) (r ∘ (l ∘ (r ∘ prβ‚‚)))
  product-frame = pair-cong first-coordinate nested-coordinate βˆ™ pair-pre pr₁ (r ∘ (l ∘ prβ‚‚)) W
  evaluation-frame : ((e ∘ H) ∘ W) =₁ middle-object
  evaluation-frame = (e ◁ product-frame) βˆ™ comp-assoc W H e
  restricted-frame : (funUncurry (R ∘ L) ∘ W) =₁ middle-object
  restricted-frame = evaluation-frame βˆ™ (u β–· W)
  middle : funUncurry ((L ∘ R) ∘ L) =₁ middle-object
  middle = evaluation-frame βˆ™ ((u β–· W) βˆ™
    (funPre-uncurry r (R ∘ L) βˆ™ funUncurryIso (comp-assoc L R L)))

  abstract
    post-comparison : (middle βˆ™ funUncurryIso ((comp-assoc L R L) ⁻¹)) =β‚‚
      (restricted-frame βˆ™ funPre-uncurry r (R ∘ L))
    post-comparison = cancel-right (funUncurryIso (comp-assoc L R L))
        (restricted-frame βˆ™ funPre-uncurry r (R ∘ L)) βˆ™
      isoComp-cong
        ((isoComp-assoc-at restricted-frame (funPre-uncurry r (R ∘ L)) (funUncurryIso (comp-assoc L R L))) ⁻¹ βˆ™
          (isoComp-assoc-at evaluation-frame (u β–· W)
            (funPre-uncurry r (R ∘ L) βˆ™ funUncurryIso (comp-assoc L R L))) ⁻¹)
        (funUncurryIso-inverse (comp-assoc L R L))
```