Other Agda modules in this section (89)

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

# Cancelling a restriction comparison

A restriction comparison consists of a square between two associators.
This elementary calculation reverses that square while retaining its
chosen inverse and identity comparisons.

```agda
{-# OPTIONS --safe --without-K #-}
open import Agda.Primitive using (Level)
open import SCT.VolumeI.Chapter01.Theory using (Theory)
import SCT.VolumeI.Chapter01.Section03.ProductCalculus.PairingNaturality as PN
import SCT.VolumeI.Chapter01.Section02.Isomorphisms as Isomorphisms

module SCT.VolumeI.Chapter01.Section08.MappingCalculus.Restriction.RestrictionMate
  {c m a : Level} (𝒯 : Theory c m a) where

open import SCT.VolumeI.Chapter01.Section04.Setup 𝒯
open PN vocabulary terminal products productLaws composition vertical whiskering
  using (cancel-right; move-square)
open Isomorphisms vocabulary terminal products productLaws composition vertical whiskering using (cancel-inverse)

abstract
  cancel-trailing-pair : {X Y : CAT} {aβ‚€ a₁ aβ‚‚ a₃ : MAP X Y}
    (P : aβ‚‚ =₁ a₃) (A : a₁ =₁ aβ‚‚) (B : aβ‚€ =₁ a₁)
    (B⁻ : a₁ =₁ aβ‚€) β†’ B⁻ =β‚‚ (B ⁻¹) β†’
    ((P βˆ™ (A βˆ™ B)) βˆ™ (B⁻ βˆ™ A ⁻¹)) =β‚‚ P
  cancel-trailing-pair P A B B⁻ inverse = cancel-right A P βˆ™
    (isoComp-cong
      (cancel-right B (P βˆ™ A) βˆ™ isoComp-cong (idIso ((P βˆ™ A) βˆ™ B)) inverse)
      (idIso (A ⁻¹)) βˆ™
    ((isoComp-assoc-at ((P βˆ™ A) βˆ™ B) B⁻ (A ⁻¹)) ⁻¹ βˆ™
      isoComp-cong ((isoComp-assoc-at P A B) ⁻¹) (idIso (B⁻ βˆ™ A ⁻¹))))

  prefix-transfer : {X Y : CAT} {aβ‚€ a₁ aβ‚‚ a₃ aβ‚„ aβ‚… : MAP X Y}
    (L : a₃ =₁ aβ‚„) (T : aβ‚‚ =₁ a₃) (D : aβ‚‚ =₁ aβ‚„)
    (P : a₁ =₁ aβ‚‚) (z : aβ‚€ =₁ a₁) (q : aβ‚… =₁ a₃) (u : aβ‚€ =₁ aβ‚…) β†’
    D =β‚‚ (L βˆ™ T) β†’ ((T βˆ™ P) βˆ™ z) =β‚‚ (q βˆ™ u) β†’
    ((D βˆ™ P) βˆ™ z) =β‚‚ ((L βˆ™ q) βˆ™ u)
  prefix-transfer L T D P z q u endpoint core = (isoComp-assoc-at L q u) ⁻¹ βˆ™
    (isoComp-cong (idIso L) core βˆ™
    (isoComp-assoc-at L (T βˆ™ P) z βˆ™
    (isoComp-cong (isoComp-assoc-at L T P) (idIso z) βˆ™
      isoComp-cong (isoComp-cong endpoint (idIso P)) (idIso z))))

  cancel-prefix : {X Y : CAT} {aβ‚€ a₁ aβ‚‚ a₃ aβ‚„ aβ‚… : MAP X Y}
    (O : aβ‚„ =₁ aβ‚…) (S : a₃ =₁ aβ‚„) (A : aβ‚‚ =₁ a₃)
    (K : a₁ =₁ a₃) (P : aβ‚€ =₁ a₁) (Q : aβ‚€ =₁ aβ‚„) β†’
    (S βˆ™ (K βˆ™ P)) =β‚‚ Q β†’
    ((O βˆ™ (S βˆ™ A)) βˆ™ ((A ⁻¹ βˆ™ K) βˆ™ P)) =β‚‚ (O βˆ™ Q)
  cancel-prefix O S A K P Q square = isoComp-cong (idIso O) square βˆ™
    (isoComp-cong (idIso O) (isoComp-cong (idIso S) (cancel-inverse A (K βˆ™ P))) βˆ™
    (isoComp-cong (idIso O) (isoComp-cong (idIso S)
      (isoComp-cong (idIso A) (isoComp-assoc-at (A ⁻¹) K P))) βˆ™
    (isoComp-cong (idIso O) (isoComp-assoc-at S A ((A ⁻¹ βˆ™ K) βˆ™ P)) βˆ™
      isoComp-assoc-at O (S βˆ™ A) ((A ⁻¹ βˆ™ K) βˆ™ P))))

  close-comparison : {X Y : CAT} {aβ‚€ a₁ aβ‚‚ a₃ aβ‚„ : MAP X Y}
    (source : aβ‚€ =₁ aβ‚„) (prefix : a₃ =₁ aβ‚„)
    (D : aβ‚‚ =₁ a₃) (P : a₁ =₁ aβ‚‚) (z : aβ‚€ =₁ a₁)
    (seed : aβ‚€ =₁ a₃) (boundary : a₁ =₁ aβ‚„) (result : aβ‚€ =₁ aβ‚„) β†’
    source =β‚‚ (prefix βˆ™ seed) β†’ ((D βˆ™ P) βˆ™ z) =β‚‚ seed β†’
    (prefix βˆ™ (D βˆ™ P)) =β‚‚ boundary β†’ (boundary βˆ™ z) =β‚‚ result β†’
    source =β‚‚ result
  close-comparison source prefix D P z seed boundary result start transfer remove finish = finish βˆ™
    (isoComp-cong remove (idIso z) βˆ™
    ((isoComp-assoc-at prefix (D βˆ™ P) z) ⁻¹ βˆ™
    (isoComp-cong (idIso prefix) (transfer ⁻¹) βˆ™ start)))

module Boundary {X Y : CAT} {aβ‚€ a₁ aβ‚‚ a₃ aβ‚„ : MAP X Y}
  (A : a₁ =₁ aβ‚‚) (B : aβ‚€ =₁ a₁) (C : aβ‚„ =₁ a₃)
  (S : aβ‚‚ =₁ a₃) (B⁻ : a₁ =₁ aβ‚€) (S⁻ : a₃ =₁ aβ‚‚)
  (I : aβ‚„ =₁ aβ‚„)
  (inverse-B : B⁻ =β‚‚ (B ⁻¹)) (inverse-S : S⁻ =β‚‚ (S ⁻¹))
  (identity-I : I =β‚‚ (idIso aβ‚„)) where

  comparison = C ⁻¹ βˆ™ (S βˆ™ (A βˆ™ B))
  source = B⁻ βˆ™ A ⁻¹
  target = I βˆ™ C ⁻¹

  abstract
    cancel-source : (comparison βˆ™ source) =β‚‚ (C ⁻¹ βˆ™ S)
    cancel-source = cancel-right A (C ⁻¹ βˆ™ S) βˆ™
      (isoComp-cong
        (cancel-right B ((C ⁻¹ βˆ™ S) βˆ™ A) βˆ™
          isoComp-cong (idIso (((C ⁻¹ βˆ™ S) βˆ™ A) βˆ™ B)) inverse-B)
        (idIso (A ⁻¹)) βˆ™
      ((isoComp-assoc-at (((C ⁻¹ βˆ™ S) βˆ™ A) βˆ™ B) B⁻ (A ⁻¹)) ⁻¹ βˆ™
        isoComp-cong
          ((isoComp-assoc-at (C ⁻¹ βˆ™ S) A B) ⁻¹ βˆ™
            (isoComp-assoc-at (C ⁻¹) S (A βˆ™ B)) ⁻¹)
          (idIso source)))

    cancel-target : (target βˆ™ S) =β‚‚ (C ⁻¹ βˆ™ S)
    cancel-target = isoComp-cong
      (isoComp-unitΛ‘-at (C ⁻¹) βˆ™ isoComp-cong identity-I (idIso (C ⁻¹)))
      (idIso S)

    inverse-square : (source βˆ™ S⁻) =β‚‚ (comparison ⁻¹ βˆ™ target)
    inverse-square =
      (move-square comparison source target S (cancel-target ⁻¹ βˆ™ cancel-source)) ⁻¹ βˆ™
      isoComp-cong (idIso source) inverse-S
```