From 2769c324aba58ce63234b6949964b80243b02294 Mon Sep 17 00:00:00 2001 From: Max New <maxsnew@gmail.com> Date: Mon, 29 May 2023 00:10:29 -0400 Subject: [PATCH] more progress on evaluation contexts, stuck on an upstream issue --- .../Abstract/TermModel/Convenient.agda | 4 +- .../Abstract/TermModel/Strength.agda | 13 ++++- .../TermModel/Strength/KleisliSlice.agda | 55 ++++++++++++++++--- 3 files changed, 59 insertions(+), 13 deletions(-) diff --git a/formalizations/guarded-cubical/Semantics/Abstract/TermModel/Convenient.agda b/formalizations/guarded-cubical/Semantics/Abstract/TermModel/Convenient.agda index 04db671..d67ca5a 100644 --- a/formalizations/guarded-cubical/Semantics/Abstract/TermModel/Convenient.agda +++ b/formalizations/guarded-cubical/Semantics/Abstract/TermModel/Convenient.agda @@ -40,13 +40,13 @@ record Model â„“ â„“' : Type (â„“-suc (â„“-max â„“ â„“')) where exponentials : Exponentials cat binProd binCoprod : BinCoproducts cat monad : Monad cat - strength : Strength cat term binProd monad + strength : Strength cat binProd monad -- TODO: rename Notation and make similar modules for terminal, coprod open Notation cat binProd public open ExpNotation cat binProd exponentials public - open StrengthNotation cat term binProd monad strength public + open StrengthNotation cat binProd monad strength public 🙠= term .fst diff --git a/formalizations/guarded-cubical/Semantics/Abstract/TermModel/Strength.agda b/formalizations/guarded-cubical/Semantics/Abstract/TermModel/Strength.agda index f63a72b..d99b629 100644 --- a/formalizations/guarded-cubical/Semantics/Abstract/TermModel/Strength.agda +++ b/formalizations/guarded-cubical/Semantics/Abstract/TermModel/Strength.agda @@ -24,7 +24,7 @@ open Functor open NatTrans open BinProduct -module _ (C : Category â„“ â„“') (term : Terminal C) (bp : BinProducts C) (T : Monad C) where +module _ (C : Category â„“ â„“') (bp : BinProducts C) (T : Monad C) where -- A is a kind of "lax equivariance" -- A × T B → T (A × B) StrengthTrans = NatTrans {C = C ×C C} {D = C} (BinProductF C bp ∘F (Id {C = C} ×F T .fst )) (T .fst ∘F BinProductF C bp) @@ -33,20 +33,25 @@ module _ (C : Category â„“ â„“') (term : Terminal C) (bp : BinProducts C) (T : M open Notation _ bp -- This says the strength interacts well with the unitor + -- π₂ ≡ T π₂ ∘ σ StrengthUnitor : Type _ - StrengthUnitor = (λ (a : C .ob) → π₂ {term .fst} {T .fst ⟅ a ⟆}) ≡ λ a → σ .N-ob ((term .fst) , a) ⋆⟨ C ⟩ T .fst ⟪ π₂ ⟫ + StrengthUnitor = (λ (a : C .ob)(b : C .ob) → π₂ {a} {T .fst ⟅ b ⟆}) ≡ λ a b → σ .N-ob (a , b) ⋆⟨ C ⟩ T .fst ⟪ π₂ ⟫ -- This says the strength interacts well with the associator + -- σ ∘ (id × σ) ≡ + -- T (Ï€â‚π₠, (Ï€2Ï€1 , Ï€2)) ∘ σ ∘ ((π₠, Ï€1Ï€2) , Ï€2Ï€2) StrengthAssoc : Type _ StrengthAssoc = -- This one is nicer to express as a square along two isos (λ (a b c : C .ob) → C .id {a} ×p σ .N-ob (b , c) ⋆⟨ C ⟩ σ .N-ob (a , (b × c))) ≡ λ a b c → ((π₠,p (π₠∘⟨ C ⟩ π₂)) ,p (π₂ ∘⟨ C ⟩ π₂)) ⋆⟨ C ⟩ σ .N-ob ((a × b) , c) ⋆⟨ C ⟩ T .fst ⟪ (π₠∘⟨ C ⟩ Ï€â‚) ,p ((π₂ ∘⟨ C ⟩ Ï€â‚) ,p π₂) ⟫ - open IsMonad -- This says the strength interacts well with the unit + -- η ≡ σ ∘ (id × η) StrengthUnit : Type _ StrengthUnit = (λ (a b : C .ob) → T .snd .η .N-ob (a × b)) ≡ λ a b → (C .id ×p T .snd .η .N-ob b) ⋆⟨ C ⟩ σ .N-ob _ + -- μ ∘ T σ ∘ σ + -- σ ∘ (id × μ) StrengthMult : Type _ StrengthMult = (λ (a b : C .ob) → σ .N-ob (a , (T .fst ⟅ b ⟆)) ⋆⟨ C ⟩ T .fst ⟪ σ .N-ob (a , b) ⟫ ⋆⟨ C ⟩ T .snd .μ .N-ob _) @@ -62,6 +67,8 @@ module _ (C : Category â„“ â„“') (term : Terminal C) (bp : BinProducts C) (T : M open Notation _ bp renaming (_×_ to _×c_) σ = str .fst + strength-🙠: StrengthUnitor σ + strength-🙠= str .snd .fst strength-η : StrengthUnit σ strength-η = str .snd .snd .snd .fst diff --git a/formalizations/guarded-cubical/Semantics/Abstract/TermModel/Strength/KleisliSlice.agda b/formalizations/guarded-cubical/Semantics/Abstract/TermModel/Strength/KleisliSlice.agda index 412f3bf..b86f30e 100644 --- a/formalizations/guarded-cubical/Semantics/Abstract/TermModel/Strength/KleisliSlice.agda +++ b/formalizations/guarded-cubical/Semantics/Abstract/TermModel/Strength/KleisliSlice.agda @@ -27,10 +27,10 @@ open BinProduct open IsMonad -- -module _ (C : Category â„“ â„“') (term : Terminal C) (bp : BinProducts C) (T : Monad C) (s : Strength C term bp T) where +module _ (C : Category â„“ â„“') (term : Terminal C) (bp : BinProducts C) (T : Monad C) (s : Strength C bp T) where module C = Category C open Notation C bp - open StrengthNotation C term bp T s + open StrengthNotation C bp T s module _ (Γ : C .ob) where KleisliSlice : Category â„“ â„“' KleisliSlice .ob = C .ob @@ -55,13 +55,32 @@ module _ (C : Category â„“ â„“') (term : Terminal C) (bp : BinProducts C) (T : M ∙ C.⋆Assoc _ _ _ ∙ cong (C._∘ g) (λ i → T .snd .idl-μ i .N-ob _) ∙ C.⋆IdR g - -- μ ∘ T (T η ∘ π₂) ∘ σ ∘ (π₠, f) - -- μ ∘ T^2 η ∘ T π₂ ∘ σ ∘ (π₠, f) - -- T η ∘ μ ∘ T π₂ ∘ σ ∘ (π₠, f) + KleisliSlice .⋆IdR f = + -- μ ∘ T (η ∘ π₂) ∘ σ ∘ (π₠, f) + congâ‚‚ C._∘_ (congâ‚‚ C._∘_ refl (T .fst .F-seq _ _)) refl + -- μ ∘ T η ∘ T π₂ ∘ σ ∘ (π₠, f) + ∙ congâ‚‚ C._∘_ (C .⋆Assoc _ _ _) refl + ∙ congâ‚‚ C._∘_ (congâ‚‚ C._∘_ (λ i → T .snd .idr-μ i .N-ob _) refl) refl + ∙ congâ‚‚ C._∘_ (C .⋆IdR _) refl -- T π₂ ∘ σ ∘ (π₠, f) + ∙ C .⋆Assoc _ _ _ + ∙ congâ‚‚ C._∘_ (λ i → strength-🙠(~ i) _ _) refl + -- π₂ ∘ (π₠, f) + ∙ ×β₂ -- ≡ f - KleisliSlice .⋆IdR f = {!!} - KleisliSlice .⋆Assoc = {!!} + + -- μ ∘ T h ∘ σ ∘ (π₠, μ ∘ T g ∘ σ ∘ (Ï€1 , f)) + -- μ ∘ T h ∘ σ ∘ (π₠∘ (π₠, T g ∘ σ ∘ (Ï€1 , f)) , μ ∘ π₂ ∘ (π₠, T g ∘ σ ∘ (Ï€1 , f))) + -- μ ∘ T h ∘ σ ∘ (id ∘ Ï€1 , μ ∘ Ï€2) ∘ (π₠, T g ∘ σ ∘ (Ï€1 , f)) + -- μ ∘ T h ∘ σ ∘ (id × μ) ∘ (π₠, T g ∘ σ ∘ (Ï€1 , f)) + -- μ ∘ T h ∘ μ ∘ T σ ∘ σ ∘ (π₠, T g ∘ σ ∘ (Ï€1 , f)) + + -- μ ∘ T h ∘ μ ∘ T σ ∘ σ ∘ T (π₠, g) ∘ σ ∘ (Ï€1 , f) + -- μ ∘ T h ∘ μ ∘ T σ ∘ T (π₠, g) ∘ σ ∘ (Ï€1 , f) + -- μ ∘ μ ∘ T^2 h ∘ T σ ∘ T (π₠, g) ∘ σ ∘ (Ï€1 , f) + -- μ ∘ T μ ∘ T^2 h ∘ T σ ∘ T (π₠, g) ∘ σ ∘ (Ï€1 , f) + -- μ ∘ T (μ ∘ T h ∘ σ ∘ (π₠, g)) ∘ σ ∘ (Ï€1 , f) + KleisliSlice .⋆Assoc f g h = {!!} KleisliSlice .isSetHom = C.isSetHom module _ {Δ : C .ob} {Γ : C .ob} where @@ -69,4 +88,24 @@ module _ (C : Category â„“ â„“') (term : Terminal C) (bp : BinProducts C) (T : M (γ ^*) .F-ob a = a (γ ^*) .F-hom f = f C.∘ (γ ×p C.id) (γ ^*) .F-id = sym (C.⋆Assoc _ _ _) ∙ congâ‚‚ C._⋆_ (×β₂ ∙ C .⋆IdR π₂) refl - (γ ^*) .F-seq f g = {!!} + -- T (γ × V) ∘ σ ≡ σ ∘ (γ × T V) + + (γ ^*) .F-seq f g = + -- μ ∘ T g ∘ σ ∘ (π₠, f) ∘ (γ ∘ π₠, id ∘ π₂) + sym (C .⋆Assoc _ _ _) + ∙ congâ‚‚ C._∘_ refl (sym (C .⋆Assoc _ _ _)) + ∙ congâ‚‚ C._∘_ refl (congâ‚‚ C._∘_ refl (,p-natural + ∙ congâ‚‚ _,p_ ×β₠(sym (C .⋆IdR _) ∙ congâ‚‚ C._∘_ (sym (T .fst .F-id)) refl))) + -- ≡ μ ∘ T g ∘ σ ∘ (π₠∘ (γ ∘ π₠, id ∘ π₂) , f ∘ (γ ∘ π₠, id ∘ π₂)) + -- ≡ μ ∘ T g ∘ σ ∘ (γ ∘ π₠, T id ∘ f ∘ (γ ∘ π₠, id ∘ π₂)) + ∙ {!!} + -- ≡ μ ∘ T g ∘ σ ∘ (γ ∘ π₠, T id ∘ π₂) ∘ (π₠, f ∘ (γ ∘ π₠, id ∘ π₂)) + -- ≡ μ ∘ T g ∘ σ ∘ (γ × T id) ∘ (π₠, f ∘ (γ ∘ π₠, id ∘ π₂)) + -- + -- Problem: naturality of σ isn't behaving correctly because of some stuff we did... + ∙ congâ‚‚ C._∘_ refl (congâ‚‚ C._∘_ refl (congâ‚‚ C._∘_ ({!σ .N-hom ?!}) refl ∙ sym (C .⋆Assoc _ _ _)) + ∙ C .⋆Assoc _ _ _) + ∙ C .⋆Assoc _ _ _ + -- ≡ μ ∘ T g ∘ T (γ × id) ∘ σ ∘ (π₠, f ∘ (γ ∘ π₠, id ∘ π₂)) + ∙ congâ‚‚ C._∘_ (congâ‚‚ C._∘_ refl (sym (T .fst .F-seq _ _))) refl + -- ≡ μ ∘ T (g ∘ (γ ∘ π₠, id ∘ π₂)) ∘ σ ∘ (π₠, f ∘ (γ ∘ π₠, id ∘ π₂)) -- GitLab