-------------------------------------------------------------------------------- Ettore Aldrovandi, ealdrovandi@fsu.edu Started: June 2023 -------------------------------------------------------------------------------- Port of [HoTT-Agda](https://github.com/HoTT/HoTT-Agda) `PathSeq` library to TypeTopology. \begin{code} {-# OPTIONS --without-K --safe #-} open import MLTT.Spartan open import UF.Base open import PathSequences.Type open import PathSequences.Reasoning module PathSequences.Ap where \end{code} ap-seq is the extension of ap to path sequences. \begin{code} module _ {X : π€ Μ } {Y : π₯ Μ } (f : X β Y) where ap-seq : {x x' : X} β x β‘ x' β f x β‘ f x' ap-seq [] = [] ap-seq (p ββ s) = ap f p ββ ap-seq s \end{code} β‘-to-οΌ can be interpreted as a transformation between ap and ap-seq. In other words, with f : X β Y, we have a commutative diagram (pointwise on PathSeq x x', of course). ap-seq f x β‘ x' ----------> f x β‘ f x' | | | [ _β] | [_ β] β β x οΌ x' ---------> f x οΌ f x' ap f \begin{code} β‘-οΌ-nat : {x x' : X} (s : x β‘ x') β ap f [ s β] οΌ [ (ap-seq s) β] β‘-οΌ-nat [] = refl β‘-οΌ-nat (p ββ s) = ap f (p β [ s β]) οΌβ¨ ap-β f p ([ s β]) β© ap f p β ap f [ s β] οΌβ¨ ap (Ξ» v β ap f p β v ) (β‘-οΌ-nat s) β© ap f p β [ (ap-seq s) β] β \end{code} The original uses the following namesβit is not clear why. \begin{code} ap-seq-β-= = β‘-οΌ-nat \end{code} On the other hand, we have ap-seq f x β‘ x' ----------> f x β‘ f x' | β | [ _β] | _ββ β | x οΌ x' ---------> f x οΌ f x' ap f in two ways: \begin{code} ap-seq-β : {x x' : X} (s : x β‘ x') β ap f [ s β] ββ οΌβ ap-seq s ap-seq-β s = οΌβ-in (ap-seq-β-= s) β-ap-seq : {x x' : X} (s : x β‘ x') β ap-seq s οΌβ ap f [ s β] ββ β-ap-seq s = (ap-seq-β s) β»ΒΉβ \end{code} from which we can prove that ap-seq preserves οΌβ between path sequences: \begin{code} ap-seq-οΌβ : {x x' : X} {s t : x β‘ x'} β s οΌβ t β ap-seq s οΌβ ap-seq t ap-seq-οΌβ {s = s} {t} (οΌβ-in p) = ap-seq s οΌββ¨ β-ap-seq s β© ap f [ s β] ββ οΌββ¨ ap (ap f) p β© ap f [ t β] ββ οΌββ¨ ap-seq-β t β© ap-seq t ββ \end{code} Two-variable version of the above \begin{code} module _ {X : π€ Μ } {Y : π₯ Μ } {Z : π¦ Μ } (f : X β Y β Z) where apβ-seq : {x x' : X} {y y' : Y} β x β‘ x' β y β‘ y' β f x y β‘ f x' y' apβ-seq [] [] = [] apβ-seq {x} [] (p ββ t) = ap-seq (f x) (p ββ t) apβ-seq {y = y} (p ββ s) [] = ap-seq (Ξ» x β f x y) (p ββ s) apβ-seq (p ββ s) (q ββ t) = apβ f p q ββ apβ-seq s t \end{code} Once again, [_β] acts as a natural transformation as apβ-seq f x β‘ x' Γ y β‘ y' ----------> f x y β‘ f x' y' | | | [ _β] | [_ β] β β x οΌ x' Γ y οΌ y' ---------> f x y οΌ f x' y' apβ f and then as a lift \begin{code} β‘-οΌ-natβ : {x x' : X} {y y' : Y} β (s : x β‘ x') (t : y β‘ y') β apβ f [ s β] [ t β] οΌ [ apβ-seq s t β] β‘-οΌ-natβ [] [] = refl β‘-οΌ-natβ {x} [] (p ββ t) = apβ f refl (p β [ t β]) οΌβ¨ apβ-refl-left f _ β© ap (f x) (p β [ t β]) οΌβ¨ ap-β (f x) p ([ t β]) β© ap (f x) p β (ap (f x) [ t β]) οΌβ¨ ap (Ξ» v β (ap (f x) p) β v) (ap-seq-β-= (f x) t) β© ap (f x) p β [ ap-seq (f x) t β] β β‘-οΌ-natβ {y = y} (p ββ s) [] = apβ f (p β [ s β]) refl οΌβ¨ apβ-refl-right f _ β© ap fβ (p β [ s β]) οΌβ¨ ap-β fβ p ([ s β]) β© ap fβ p β ap fβ [ s β] οΌβ¨ ap (Ξ» v β ap fβ p β v) (ap-seq-β-= fβ s) β© ap fβ p β [ (ap-seq fβ s) β] β where fβ = Ξ» v β f v y β‘-οΌ-natβ (p ββ s) (q ββ t) = apβ f (p β [ s β]) (q β [ t β]) οΌβ¨ apβ-β f p ([ s β]) q ([ t β]) β© apβ f p q β apβ f [ s β] [ t β] οΌβ¨ ap (Ξ» v β apβ f p q β v) (β‘-οΌ-natβ s t) β© apβ f p q β [ (apβ-seq s t) β] β apβ-seq-β-= = β‘-οΌ-natβ apβ-seq-β : {x x' : X} {y y' : Y} β (s : x β‘ x') (t : y β‘ y') β apβ f [ s β] [ t β] ββ οΌβ apβ-seq s t apβ-seq-β s t = οΌβ-in (apβ-seq-β-= s t) β-apβ-seq : {x x' : X} {y y' : Y} β (s : x β‘ x') (t : y β‘ y') β apβ-seq s t οΌβ apβ f [ s β] [ t β] ββ β-apβ-seq s t = (apβ-seq-β s t) β»ΒΉβ \end{code}