Other Agda modules in this section (76)

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

# Evaluating a pair along a section

If a projection has a specified section, evaluating a pair along that
section agrees with evaluating its two coordinates. This lemma packages
the pairing unit, substitution naturality, and substitution composition
into one comparison with all boundary identifications retained.

```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.PairingCoherence as Pairing
import SCT.VolumeI.Chapter01.Section03.ProductCalculus.PairingNaturality as Naturality
import SCT.VolumeI.Chapter01.Section03.ProductCalculus.PairingUnits as PairUnits
import SCT.VolumeI.Chapter01.Section03.ProductCalculus.IteratedPairing as Iterated

module SCT.VolumeI.Chapter01.Section04.ProductCalculus.PairSectionEvaluation
  {c m a : Level} (𝒯 : Theory c m a) where

open import SCT.VolumeI.Chapter01.Section04.Setup 𝒯
open import SCT.VolumeI.Chapter01.Section04.SquareCalculus.SplitProjectionCalculus 𝒯
open import SCT.VolumeI.Chapter01.Section04.Substitution.IsomorphismReasoning 𝒯
open Pairing vocabulary terminal products productLaws composition vertical whiskering
  using (pair-cong-comp)
open Naturality vocabulary terminal products productLaws composition vertical whiskering
  using (pair-pre-natural-substitution; pair-pre-natural-inputs)
open PairUnits vocabulary terminal products productLaws composition vertical whiskering pentagonTriangle
  using (pair-pre-id)
open Iterated vocabulary terminal products productLaws composition vertical whiskering pentagonTriangle
  using (pair-pre-iterated)

module At {X K A B : CAT} (Ο€ : MAP K X) (i : MAP X K)
  (b : (Ο€ ∘ i) =₁ (id X)) (u : MAP X A) (v : MAP X B) where
  j = pair u v
  ru = comp-unitΚ³ u
  rv = comp-unitΚ³ v
  units = pair-cong ru rv
  inputs = pair-cong (u ◁ b) (v ◁ b)
  au = comp-assoc i Ο€ u
  av = comp-assoc i Ο€ v
  assoc = comp-assoc i Ο€ j
  associators = pair-cong au av
  before = pair-pre u v (Ο€ ∘ i)
  after = pair-pre u v (id X)
  inner = pair-pre (u ∘ Ο€) (v ∘ Ο€) i
  outer = pair-pre u v Ο€ β–· i
  coordinates = pair-cong (section-image Ο€ i b u) (section-image Ο€ i b v)

  abstract
    expand-unit : section-image Ο€ i b j =β‚‚
      (units βˆ™ (after βˆ™ ((j ◁ b) βˆ™ assoc)))
    expand-unit = isoComp-assoc-at units after ((j ◁ b) βˆ™ assoc) βˆ™
      isoComp-cong ((pair-pre-id u v) ⁻¹) (idIso ((j ◁ b) βˆ™ assoc))

    change-input : (units βˆ™ (after βˆ™ ((j ◁ b) βˆ™ assoc))) =β‚‚
      (units βˆ™ (inputs βˆ™ (before βˆ™ assoc)))
    change-input = isoComp-cong (idIso units)
      (isoComp-assoc-at inputs before assoc βˆ™
      (isoComp-cong ((pair-pre-natural-substitution u v b) ⁻¹) (idIso assoc) βˆ™
        (isoComp-assoc-at after (j ◁ b) assoc) ⁻¹))

    compose-inputs : (units βˆ™ (inputs βˆ™ (before βˆ™ assoc))) =β‚‚
      (units βˆ™ (inputs βˆ™ (associators βˆ™ (inner βˆ™ outer))))
    compose-inputs = isoComp-cong (idIso units)
      (isoComp-cong (idIso inputs) (pair-pre-iterated u v Ο€ i))

    collect-coordinates : (units βˆ™ (inputs βˆ™ associators)) =β‚‚ coordinates
    collect-coordinates = (pair-cong-comp ru ((u ◁ b) βˆ™ au) rv ((v ◁ b) βˆ™ av)) ⁻¹ βˆ™
      isoComp-cong (idIso units) ((pair-cong-comp (u ◁ b) au (v ◁ b) av) ⁻¹)

    finish : (units βˆ™ (inputs βˆ™ (associators βˆ™ (inner βˆ™ outer)))) =β‚‚
      (coordinates βˆ™ (inner βˆ™ outer))
    finish = isoComp-cong collect-coordinates (idIso (inner βˆ™ outer)) βˆ™
      ((isoComp-assoc-at units (inputs βˆ™ associators) (inner βˆ™ outer)) ⁻¹ βˆ™
        isoComp-cong (idIso units) ((isoComp-assoc-at inputs associators (inner βˆ™ outer)) ⁻¹))

    comparison : section-image Ο€ i b (pair u v) =β‚‚
      (pair-cong (section-image Ο€ i b u) (section-image Ο€ i b v) βˆ™
        (pair-pre (u ∘ Ο€) (v ∘ Ο€) i βˆ™ (pair-pre u v Ο€ β–· i)))
    comparison = beginβ‚‚
      section-image Ο€ i b j =β‚‚βŸ¨ expand-unit ⟩
      (units βˆ™ (after βˆ™ ((j ◁ b) βˆ™ assoc))) =β‚‚βŸ¨ change-input ⟩
      (units βˆ™ (inputs βˆ™ (before βˆ™ assoc))) =β‚‚βŸ¨ compose-inputs ⟩
      (units βˆ™ (inputs βˆ™ (associators βˆ™ (inner βˆ™ outer)))) =β‚‚βŸ¨ finish ⟩
      (coordinates βˆ™ (inner βˆ™ outer)) βˆŽβ‚‚
```

A comparison into the pair may be supplied before evaluating the section.
Its two coordinate comparisons are then retained in the result.

```agda
open import SCT.VolumeI.Chapter01.Section06.ConeCalculus.InverseCalculus 𝒯 using (pre-inverse)
open import SCT.VolumeI.Chapter01.Section02.Isomorphisms
  vocabulary terminal products productLaws composition vertical whiskering using (cancel-inverse)

module ComparedInputs {X K A B : CAT} (Ο€ : MAP K X) (i : MAP X K)
  (b : (Ο€ ∘ i) =₁ (id X)) (u : MAP X A) (v : MAP X B)
  {f : MAP K A} {g : MAP K B} (Ξ± : f =₁ (u ∘ Ο€)) (Ξ² : g =₁ (v ∘ Ο€)) where
  module Base = At Ο€ i b u v
  input = pair-cong Ξ± Ξ²
  before = pair-pre u v Ο€
  after = pair-pre (u ∘ Ο€) (v ∘ Ο€) i
  out = before ⁻¹ βˆ™ input
  image = input β–· i
  step = pair-pre f g i
  cu = section-image Ο€ i b u
  cv = section-image Ο€ i b v
  coordinates = pair-cong cu cv
  changed = pair-cong (Ξ± β–· i) (Ξ² β–· i)

  abstract
    restricted : (out β–· i) =β‚‚ ((before β–· i) ⁻¹ βˆ™ image)
    restricted = isoComp-cong (pre-inverse before i) (idIso image) βˆ™
      preWhisker-isoComp-at (before ⁻¹) input i

    cancel-comparison :
      ((coordinates βˆ™ (after βˆ™ (before β–· i))) βˆ™ ((before β–· i) ⁻¹ βˆ™ image)) =β‚‚
      (coordinates βˆ™ (after βˆ™ image))
    cancel-comparison = isoComp-cong (idIso coordinates)
        (isoComp-cong (idIso after) (cancel-inverse (before β–· i) image) βˆ™
          isoComp-assoc-at after (before β–· i) ((before β–· i) ⁻¹ βˆ™ image)) βˆ™
      isoComp-assoc-at coordinates (after βˆ™ (before β–· i)) ((before β–· i) ⁻¹ βˆ™ image)

    comparison : (section-image Ο€ i b (pair u v) βˆ™ (out β–· i)) =β‚‚
      (pair-cong (cu βˆ™ (Ξ± β–· i)) (cv βˆ™ (Ξ² β–· i)) βˆ™ pair-pre f g i)
    comparison = isoComp-cong ((pair-cong-comp cu (Ξ± β–· i) cv (Ξ² β–· i)) ⁻¹) (idIso step) βˆ™
      ((isoComp-assoc-at coordinates changed step) ⁻¹ βˆ™
      (isoComp-cong (idIso coordinates) ((pair-pre-natural-inputs Ξ± Ξ² i) ⁻¹) βˆ™
      (cancel-comparison βˆ™ isoComp-cong Base.comparison restricted)))
```