module Cat.Instances.OFE.Product where
Products of OFEsπ
The category of OFEs admits products: the relations are, levelwise, pairwise! That is, if and Distributing the axioms over products is enough to establish that this is actually an OFE.
open OFE-Notation module _ {βa βb βa' βb'} {A : Type βa} {B : Type βb} (O : OFE-on βa' A) (P : OFE-on βb' B) where private instance _ = O _ = P module O = OFE-on O module P = OFE-on P
Γ-OFE : OFE-on (βa' β βb') (A Γ B) Γ-OFE .within n (x , y) (x' , y') = (x β[ n ] x') Γ (y β[ n ] y') Γ-OFE .has-is-ofe .has-is-prop n x y = hlevel 1 Γ-OFE .has-is-ofe .β-refl n = O.β-refl n , P.β-refl n Γ-OFE .has-is-ofe .β-sym n (p , q) = O.β-sym n p , P.β-sym n q Γ-OFE .has-is-ofe .β-trans n (p , q) (p' , q') = O.β-trans n p p' , P.β-trans n q q' Γ-OFE .has-is-ofe .bounded (a , b) (a' , b') = O.bounded a a' , P.bounded b b' Γ-OFE .has-is-ofe .step n _ _ (p , p') = O.step n _ _ p , P.step n _ _ p' Γ-OFE .has-is-ofe .limit x y f = apβ _,_ (O.limit _ _ Ξ» n β f n .fst) (P.limit _ _ Ξ» n β f n .snd)
By construction, this OFE is actually the proper categorical product of the OFE structures we started with: since this is a very concrete category, most of the reasoning piggy-backs off of that for types, which is almost definitional. Other than the noise inherent to formalisation, the argument is immediate:
OFE-Product : β {β β'} A B β Product (OFEs β β') A B OFE-Product A B .apex = from-ofe-on (Γ-OFE (A .snd) (B .snd)) OFE-Product A B .Οβ .hom = fst OFE-Product A B .Οβ .preserves .pres-β = fst OFE-Product A B .Οβ .hom = snd OFE-Product A B .Οβ .preserves .pres-β = snd OFE-Product A B .has-is-product .β¨_,_β© f g .hom x = f # x , g # x OFE-Product A B .has-is-product .β¨_,_β© f g .preserves .pres-β p = f .preserves .pres-β p , g .preserves .pres-β p OFE-Product A B .has-is-product .Οβββ¨β© = trivial! OFE-Product A B .has-is-product .Οβββ¨β© = trivial! OFE-Product A B .has-is-product .unique p q = ext Ξ» x β p #β x ,β q #β x
module _ {βi βf βr} {I : Type βi} (F : I β Type βf) (P : β i β OFE-on βr (F i)) where private instance P-ofe : β {i} β OFE-on βr (F i) P-ofe {i} = P i module P {i} = OFE-on (P i)
Indexed productsπ
We now turn to a slightly more complicated case: indexed products of OFEs: because Agda is, by default, a predicative theory, we run into some issues with universe levels when defining the indexed product. Letβs see them:
Suppose we have an index type in the universe, and a family valued now in the universe. Moreover, the family should be pointwise an OFE, with nearness relation living in, letβs say, the universe. We will define the relation on to be
but this type is too large: Since we quantify over and return one of the approximate equalities, it must live in the universe; but if we want indexed products to be in the same category we started with, it should live in the
Fortunately, to us, this is an annoyance, not an impediment: here in the 1Lab, we assume propositional resizing throughout. Since the product type is a proposition, it is equivalent to a small type, so we can put it in any universe, including the
The construction is essentially the same as for binary products: however, since resizing is explicit, we have to do a bit more faffing about to get the actual inhabitant of that weβre interested in.
Ξ -OFE : OFE-on βr (β i β F i) Ξ -OFE .within n f g = Lift βr (β‘ (β i β f i β[ n ] g i)) Ξ -OFE .has-is-ofe .has-is-prop n x y = Lift-is-hlevel 1 squash Ξ -OFE .has-is-ofe .β-refl n = lift (inc Ξ» i β P.β-refl n) Ξ -OFE .has-is-ofe .β-sym n (lift x) = lift do x β x pure Ξ» i β P.β-sym n (x i) Ξ -OFE .has-is-ofe .β-trans n (lift p) (lift q) = lift do p β p q β q pure Ξ» i β P.β-trans n (p i) (q i) Ξ -OFE .has-is-ofe .bounded x y = lift (inc Ξ» i β P.bounded (x i) (y i)) Ξ -OFE .has-is-ofe .step n x y (lift p) = lift do p β p pure Ξ» i β P.step n (x i) (y i) (p i) Ξ -OFE .has-is-ofe .limit x y wit i j = P.limit (x j) (y j) (Ξ» n β wit' n j) i where wit' : β n i β within (P i) n (x i) (y i) wit' n i = β‘-out! (wit n .lower) i
And, again, by essentially the same argument, we can establish that this is the categorical indexed product of in the category of OFEs, as long as all the sizes match up.
OFE-Indexed-product : β {βo βr} {I : Type βo} (F : I β OFE βo βr) β Indexed-product (OFEs βo βr) F OFE-Indexed-product F .Ξ F = from-ofe-on $ Ξ -OFE (Ξ» i β β£ F i .fst β£) (Ξ» i β F i .snd) OFE-Indexed-product F .Ο i .hom f = f i OFE-Indexed-product F .Ο i .preserves .pres-β Ξ± = β‘-out! ((_$ i) <$> Ξ± .lower) OFE-Indexed-product F .has-is-ip .tuple f .hom x i = f i # x OFE-Indexed-product F .has-is-ip .tuple f .preserves .pres-β wit = lift $ inc Ξ» i β f i .preserves .pres-β wit OFE-Indexed-product F .has-is-ip .commute = trivial! OFE-Indexed-product F .has-is-ip .unique f prf = ext Ξ» x y β prf y #β x