Other Agda modules in this section (47)

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

# Evaluating a family at an absolute object

Evaluation at a fixed object inserts that object as the second product
coordinate. The comparisons below relate this formula to Section 1.7's
evaluation functor, uncurrying, and restriction of a family of diagrams.

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

open import SCT.VolumeI.Chapter01.Section07.Setup 𝒯 M β„± public
open import SCT.VolumeI.Chapter01.Section04.Uncurrying 𝒯 M using (productMap-pair)
open import SCT.VolumeI.Chapter01.Section07.TerminalDomain 𝒯 M β„± using (evalAt)
open import SCT.VolumeI.Chapter01.Section07.AbsoluteObjects 𝒯 M β„± public

insert : {X I : CAT} β†’ Obj-abs I β†’ MAP X (X Γ— I)
insert {X} x = pair (id X) (const x)

evaluate : {I C : CAT} β†’ Obj-abs I β†’ MAP (Fun I C) C
evaluate x = funEval ∘ insert x

evaluate-agrees : {I C : CAT} (x : Obj-abs I) β†’ (evalAt {D = C} x) =₁ (evaluate x)
evaluate-agrees {I} {C} x = funEval ◁
  (pair-cong (comp-unitΛ‘ (id (Fun I C))) (idIso (const x)) βˆ™
    productMap-pair (id (Fun I C)) x (id (Fun I C)) (terminate (Fun I C)))

insert-natural : {X Y I : CAT} (h : MAP X Y) (x : Obj-abs I) β†’
  (insert x ∘ h) =₁ (productMap h (id I) ∘ insert x)
insert-natural {X} {Y} {I} h x =
  (pair-cong (comp-unitΚ³ h) (comp-unitΛ‘ (const x)) βˆ™
    productMap-pair h (id I) (id X) (const x)) ⁻¹ βˆ™
  (pair-cong (comp-unitΛ‘ h) (const-pre x h) βˆ™ pair-pre (id Y) (const x) h)

evaluate-uncurry : {X I C : CAT} (x : Obj-abs I) (h : MAP X (Fun I C)) β†’
  (evaluate x ∘ h) =₁ (funUncurry h ∘ insert x)
evaluate-uncurry {I = I} x h = (comp-assoc (insert x) (productMap h (id I)) funEval) ⁻¹ βˆ™
  ((funEval ◁ insert-natural h x) βˆ™ comp-assoc h (insert x) funEval)

evaluate-curry : {X I C : CAT} (x : Obj-abs I) (H : MAP (X Γ— I) C) β†’
  (evaluate x ∘ funCurry H) =₁ (H ∘ insert x)
evaluate-curry x H = (funCurry-Ξ² H β–· insert x) βˆ™ evaluate-uncurry x (funCurry H)

evaluate-post : {I C D : CAT} (x : Obj-abs I) (F : MAP C D) β†’
  (evaluate x ∘ funPost F) =₁ (F ∘ evaluate x)
evaluate-post x F = comp-assoc (insert x) funEval F βˆ™
  ((funPost-Ξ² F β–· insert x) βˆ™ evaluate-uncurry x (funPost F))

evaluate-post-at : {X I C D : CAT} (x : Obj-abs I) (F : MAP C D) (h : MAP X (Fun I C)) β†’
  (evaluate x ∘ (funPost F ∘ h)) =₁ (F ∘ (evaluate x ∘ h))
evaluate-post-at x F h = comp-assoc h (evaluate x) F βˆ™
  ((evaluate-post x F β–· h) βˆ™ (comp-assoc h (funPost F) (evaluate x)) ⁻¹)

constantDiagram : (I C : CAT) β†’ MAP C (Fun I C)
constantDiagram I C = funCurry pr₁

evaluate-constant : {I C : CAT} (x : Obj-abs I) β†’
  (evaluate x ∘ constantDiagram I C) =₁ (id C)
evaluate-constant {C = C} x = pair-β₁ (id C) (const x) βˆ™ evaluate-curry x pr₁

evaluate-name : {I C : CAT} (x : Obj-abs I) (f : MAP I C) β†’
  (evaluate x ∘ nameFun f) =₁ (f ∘ x)
evaluate-name x f = (f ◁ const-One x) βˆ™
  ((f ◁ pair-Ξ²β‚‚ (id One) (const x)) βˆ™
    (comp-assoc (insert x) prβ‚‚ f βˆ™ evaluate-curry x (f ∘ prβ‚‚)))

evaluate-cong : {I C : CAT} {x y : Obj-abs I} β†’ x =₁ y β†’
  (evaluate {C = C} x) =₁ (evaluate y)
evaluate-cong {I} {C} Ξ± = funEval ◁ pair-cong (idIso (id (Fun I C))) (Ξ± β–· terminate (Fun I C))

evaluate-pre : {I J C : CAT} (f : MAP I J) (x : Obj-abs I) β†’
  (evaluate x ∘ funPre {D = C} f) =₁ (evaluate (f ∘ x))
evaluate-pre {I} {J} {C} f x = (funEval ◁
  (pair-cong (comp-unitΛ‘ (id (Fun J C))) ((comp-assoc (terminate (Fun J C)) x f) ⁻¹) βˆ™
    productMap-pair (id (Fun J C)) f (id (Fun J C)) (const x))) βˆ™
  (comp-assoc (insert x) (productMap (id (Fun J C)) f) funEval βˆ™
    ((funPre-Ξ² f β–· insert x) βˆ™ evaluate-uncurry x (funPre f)))

constantDiagram-point : {I C : CAT} (x : Obj-abs C) β†’
  (constantDiagram I C ∘ x) =₁ (nameFun (const {P = I} x))
constantDiagram-point {I} {C} x = funReflect _ _
  ((funCurry-Ξ² (const x ∘ prβ‚‚)) ⁻¹ βˆ™
  ((comp-assoc prβ‚‚ (terminate I) x) ⁻¹ βˆ™
  ((x ◁ terminal-iso _ _) βˆ™
  (pair-β₁ (x ∘ pr₁) (id I ∘ prβ‚‚) βˆ™
    ((funCurry-Ξ² pr₁ β–· productMap x (id I)) βˆ™ funUncurry-restrict (constantDiagram I C) x)))))
```