Other Agda modules in this section (188)

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

# Currying comparisons with specified endpoints

Currying respects identifications of framed transformations. The proof
retains the restriction square for each endpoint through both currying
operations. In particular, it does not replace endpoint compatibility by
an identification of the underlying diagrams alone.

```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
import SCT.VolumeI.Chapter01.Section06.PullbackLaws as Laws
import SCT.VolumeI.Chapter02.Section01.WalkingMorphism as Walking
import SCT.VolumeI.Chapter02.Section01.IntervalEndpoints as Endpoints

module SCT.VolumeI.Chapter02.Section02.MorphismCalculus.CurryingExpressionComparisons
  {c m a : Level} (𝒯 : Theory c m a) (M : Mapping.MappingAnimae 𝒯)
  (β„± : Categories.FunctorCategories 𝒯 M) (P : Laws.PullbackStructure 𝒯)
  (I : Walking.WalkingMorphism 𝒯) (E : Endpoints.IntervalEndpoints 𝒯 M β„± P I) where

open import SCT.VolumeI.Chapter02.Section01.Morphisms 𝒯 M β„± I public
open import SCT.VolumeI.Chapter01.Section07.EvaluationCalculus.IsomorphismLifting 𝒯 M β„±
  using (funIsoReflect; funIsoReflect-Ξ²; funReflect-Isoβ‚‚)
import SCT.VolumeI.Chapter02.Section02.MorphismCalculus.CurryingExpressions as Currying
import SCT.VolumeI.Chapter02.Section02.MorphismCalculus.UncurriedExpressionComparisons as Uncurried
import SCT.VolumeI.Chapter02.Section02.MorphismCalculus.DiagramExpressionIdentifications as Diagrams
import SCT.VolumeI.Chapter01.Section02.Isomorphisms as Iso
import SCT.VolumeI.Chapter01.Section03.IdentificationCalculus.Structural as Structural
open Iso vocabulary terminal products productLaws composition vertical whiskering using (cancel-inverse)
open Structural vocabulary terminal products productLaws composition whiskering using (preWhisker-comp-at)

private
  paste : {Y Z : CAT} {hβ‚€ h₁ kβ‚€ k₁ t : MAP Y Z}
    (u : hβ‚€ =₁ kβ‚€) (v : h₁ =₁ k₁) (p : hβ‚€ =₁ h₁) (q : kβ‚€ =₁ k₁)
    (r : h₁ =₁ t) (s : k₁ =₁ t) β†’
    (s βˆ™ v) =β‚‚ r β†’ (q βˆ™ u) =β‚‚ (v βˆ™ p) β†’
    ((s βˆ™ q) βˆ™ u) =β‚‚ (r βˆ™ p)
  paste u v p q r s upper lower =
    isoComp-cong upper (idIso p) βˆ™
    (isoComp-assoc-at s v p) ⁻¹ βˆ™
    isoComp-cong (idIso s) lower βˆ™ isoComp-assoc-at s q u

  reassociate : {Y Z : CAT} {hβ‚€ h₁ hβ‚‚ h₃ hβ‚„ hβ‚… : MAP Y Z}
    (v : hβ‚„ =₁ hβ‚…) (w : h₃ =₁ hβ‚„) (x : hβ‚‚ =₁ h₃)
    (y : h₁ =₁ hβ‚‚) (z : hβ‚€ =₁ h₁) β†’
    (v βˆ™ (w βˆ™ (x βˆ™ (y βˆ™ z)))) =β‚‚ ((((v βˆ™ w) βˆ™ x) βˆ™ y) βˆ™ z)
  reassociate v w x y z =
    (isoComp-assoc-at ((v βˆ™ w) βˆ™ x) y z) ⁻¹ βˆ™
    (isoComp-assoc-at (v βˆ™ w) x (y βˆ™ z)) ⁻¹ βˆ™
    (isoComp-assoc-at v w (x βˆ™ (y βˆ™ z))) ⁻¹

module At {Ξ“ X C : CAT} (f g : MAP Ξ“ (Fun X C))
  {Ξ± Ξ² : MorphismExpression (funUncurry f) (funUncurry g)} (ΞΎ : ExpressionIso Ξ± Ξ²) where
  module A = Currying.Curry 𝒯 M β„± I f g Ξ±
  module B = Currying.Curry 𝒯 M β„± I f g Ξ²
  module U = Uncurried.UncurryComparison 𝒯 M β„± P I E ΞΎ
  Ξ΄ = U.underlying
  Ξ΄-diagram = Ξ΄ β–· A.permutation
  bA = funCurry-Ξ² A.diagram
  bB = funCurry-Ξ² B.diagram
  lifted = funIsoReflect A.first-curry B.first-curry (bB ⁻¹ βˆ™ (Ξ΄-diagram βˆ™ bA))

  abstract
    lifted-square : (bB βˆ™ funUncurryIso lifted) =β‚‚ (Ξ΄-diagram βˆ™ bA)
    lifted-square = cancel-inverse bB (Ξ΄-diagram βˆ™ bA) βˆ™
      isoComp-cong (idIso bB) (funIsoReflect-Ξ² A.first-curry B.first-curry (bB ⁻¹ βˆ™ (Ξ΄-diagram βˆ™ bA)))

  module Endpoint (z : Obj-abs [1]) (h : MAP Ξ“ (Fun X C))
    (p : (evaluate z ∘ MorphismExpression.arrow Ξ±) =₁ funUncurry h)
    (q : (evaluate z ∘ MorphismExpression.arrow Ξ²) =₁ funUncurry h)
    (compatible : (q βˆ™ (evaluate z ◁ ExpressionIso.comparison ΞΎ)) =β‚‚ p) where
    module AE = A.Endpoint z h p
    module BE = B.Endpoint z h q
    i = insert {X = Ξ“} z
    j = insert {X = Ξ“ Γ— X} z
    step = AE.step
    ΞΊ = AE.insertion-comparison
    frontA = p βˆ™ (evaluate-uncurry z (MorphismExpression.arrow Ξ±)) ⁻¹
    frontB = q βˆ™ (evaluate-uncurry z (MorphismExpression.arrow Ξ²)) ⁻¹
    tA = A.original ◁ ΞΊ
    tB = B.original ◁ ΞΊ
    aA = comp-assoc step A.permutation A.original
    aB = comp-assoc step B.permutation B.original
    rA = funUncurry-restrict A.first-curry i
    rB = funUncurry-restrict B.first-curry i

    abstract
      front-square : (frontB βˆ™ (Ξ΄ β–· j)) =β‚‚ frontA
      front-square = U.Endpoint.comparison z p q compatible

      coordinate-square : ((frontB βˆ™ tB) βˆ™ (Ξ΄ β–· (A.permutation ∘ step))) =β‚‚ (frontA βˆ™ tA)
      coordinate-square = paste _ _ tA tB frontA frontB front-square ((interchange-at δ κ) ⁻¹)

      diagram-square : (((frontB βˆ™ tB) βˆ™ aB) βˆ™ (Ξ΄-diagram β–· step)) =β‚‚ ((frontA βˆ™ tA) βˆ™ aA)
      diagram-square = paste _ _ aA aB _ _ coordinate-square (preWhisker-comp-at Ξ΄ A.permutation step)

      beta-square : ((((frontB βˆ™ tB) βˆ™ aB) βˆ™ (bB β–· step)) βˆ™ (funUncurryIso lifted β–· step)) =β‚‚
        (((frontA βˆ™ tA) βˆ™ aA) βˆ™ (bA β–· step))
      beta-square = paste _ _ (bA β–· step) (bB β–· step) _ _ diagram-square
        (preWhisker-isoComp-at Ξ΄-diagram bA step βˆ™
          (preWhisker step ◁ lifted-square) βˆ™
          (preWhisker-isoComp-at bB (funUncurryIso lifted) step) ⁻¹)

      raw-square : (BE.raw βˆ™ funUncurryIso (lifted β–· i)) =β‚‚ AE.raw
      raw-square = (reassociate frontA tA aA (bA β–· step) rA) ⁻¹ βˆ™
        paste _ _ rA rB _ _ beta-square (funUncurry-restrict-inputs lifted i) βˆ™
        isoComp-cong (reassociate frontB tB aB (bB β–· step) rB) (idIso (funUncurryIso (lifted β–· i)))

      comparison : (BE.reflected βˆ™ (lifted β–· i)) =β‚‚ AE.reflected
      comparison = funReflect-Isoβ‚‚ _ _
        ((AE.reflected-image) ⁻¹ βˆ™ raw-square βˆ™
          isoComp-cong BE.reflected-image (idIso (funUncurryIso (lifted β–· i))) βˆ™
          funUncurryIso-comp BE.reflected (lifted β–· i))

  value : ExpressionIso A.value B.value
  value = Diagrams.At.comparison 𝒯 M β„± P I E A.first-curry B.first-curry lifted
    A.Source.reflected A.Target.reflected B.Source.reflected B.Target.reflected
    (Endpoint.comparison zero f (MorphismExpression.source-frame Ξ±) (MorphismExpression.source-frame Ξ²)
      (ExpressionIso.source-compatible ΞΎ))
    (Endpoint.comparison one g (MorphismExpression.target-frame Ξ±) (MorphismExpression.target-frame Ξ²)
      (ExpressionIso.target-compatible ΞΎ))
```