diff --git a/formalizations/guarded-cubical/Semantics/Abstract/TermModel/Convenient.agda b/formalizations/guarded-cubical/Semantics/Abstract/TermModel/Convenient.agda new file mode 100644 index 0000000000000000000000000000000000000000..88bab85ccb193810481407ca4c280912935285a5 --- /dev/null +++ b/formalizations/guarded-cubical/Semantics/Abstract/TermModel/Convenient.agda @@ -0,0 +1,37 @@ +{-# OPTIONS --cubical #-} +module Semantics.Abstract.TermModel.Convenient where + +-- A convenient model of the term language is +-- 1. A cartesian closed category +-- 2. Equipped with a strong monad +-- 3. An object modeling the numbers with models of the con/dtors +-- 4. An object modeling the dynamic type with models of the up/dn casts that are independent of the derivation + +open import Cubical.Foundations.Prelude +open import Cubical.Categories.Category +open import Cubical.Categories.Limits.Terminal +open import Cubical.Categories.Limits.BinProduct +open import Cubical.Categories.Monad.Base +open import Cubical.Categories.Exponentials + +open import Semantics.Abstract.TermModel.Strength + +private + variable + â„“ â„“' : Level + +record Model {â„“}{â„“'} : Type (â„“-suc (â„“-max â„“ â„“')) where + field + -- A cartesian closed category + cat : Category â„“ â„“' + term : Terminal cat + binProd : BinProducts cat + exponentials : Exponentials cat binProd + + -- with a strong monad + monad : Monad cat + strength : Strength cat term binProd monad + + -- a model of the natural numbers + + -- a model of dyn/casts diff --git a/formalizations/guarded-cubical/Semantics/Abstract/TermModel/Strength.agda b/formalizations/guarded-cubical/Semantics/Abstract/TermModel/Strength.agda new file mode 100644 index 0000000000000000000000000000000000000000..3e86a05967b19d3dc0733054a9c2b574e9ebb6b1 --- /dev/null +++ b/formalizations/guarded-cubical/Semantics/Abstract/TermModel/Strength.agda @@ -0,0 +1,56 @@ +{-# OPTIONS --cubical #-} +module Semantics.Abstract.TermModel.Strength where + +{- Strength of a functor between *cartesian* categories -} + +open import Cubical.Foundations.Prelude +open import Cubical.Categories.Category +open import Cubical.Categories.Functor +open import Cubical.Categories.NaturalTransformation +open import Cubical.Categories.Constructions.BinProduct +open import Cubical.Categories.Limits.Terminal +open import Cubical.Categories.Limits.BinProduct +open import Cubical.Categories.Monad.Base + +open import Cubical.Categories.Limits.BinProduct.More + +private + variable + â„“ â„“' : Level + +open Category +open Functor +open NatTrans +open BinProduct + +module _ (C : Category â„“ â„“') (term : Terminal C) (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) + + module _ (σ : StrengthTrans) where + open Notation _ bp + + -- This says the strength interacts well with the unitor + StrengthUnitor : Type _ + StrengthUnitor = (λ (a : C .ob) → π₂ {term .fst} {T .fst ⟅ a ⟆}) ≡ λ a → σ .N-ob ((term .fst) , a) ⋆⟨ C ⟩ T .fst ⟪ π₂ ⟫ + + -- This says the strength interacts well with the associator + 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 + 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 _ + + 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 _) + ≡ λ a b → C .id ×p T .snd .μ .N-ob _ ⋆⟨ C ⟩ σ .N-ob (a , b) + + open import Cubical.Data.Sigma + Strength : Type _ + Strength = Σ[ σ ∈ StrengthTrans ] (StrengthUnitor σ × (StrengthAssoc σ × (StrengthUnit σ × StrengthMult σ))) diff --git a/formalizations/guarded-cubical/gradual-typing-sgdt.agda-lib b/formalizations/guarded-cubical/gradual-typing-sgdt.agda-lib index ddf815f3bf1cc9fefe524f5a0e0ab11639aef50e..bdb1b74f46a879034d8cba8ce550f754ea665977 100644 --- a/formalizations/guarded-cubical/gradual-typing-sgdt.agda-lib +++ b/formalizations/guarded-cubical/gradual-typing-sgdt.agda-lib @@ -1,4 +1,4 @@ name: gradual-typing-sgdt include: . -depend: cubical +depend: cubical multi-poly-cats flags: --cubical \ No newline at end of file