proarrow
Safe HaskellNone
LanguageGHC2024

Proarrow.Squares.Limit

Description

Weighted limits and colimits as squares. The weight is a vertical profunctor; diagrams and their limits or colimits are horizontal functors.

Synopsis

Documentation

type Cone (j :: i +-> a) (p :: a +-> k) (d :: i +-> k) = Sq (j '::: ('Nil :: Path a a)) ('Nil :: Path k k) (p '::: ('Nil :: Path k k)) (d '::: ('Nil :: Path k k)) Source Github #

A j-weighted cone from an apex functor p to a diagram d. No universal property or chosen limit object is required.

limit :: forall {i} {a} (j :: i +-> a) k (d :: i +-> k). (HasLimits j k, Representable d) => Cone j (Limit j d) d Source Github #

The limiting cone, with the weight vertical and the limit and diagram horizontal.

A-----j-----I
|     |     |
l>----@---->d
|           |
K-----------K

limitUniv :: forall {i} {a} (j :: i +-> a) k (d :: i +-> k) (p :: a +-> k). (HasLimits j k, Representable d, Representable p) => Cone j p d -> Sq ('Nil :: Path a a) ('Nil :: Path k k) (p '::: ('Nil :: Path k k)) (Limit j d '::: ('Nil :: Path k k)) Source Github #

Factor a cone through the limit.

The dotted inner square is the input; the solid outer square is the result.

A-------------------A
|                   |
|   A.....j.....I   |
|   :     |     :   |
p>--------@---->d   l
|   :           :   |
|   K...........K   |
|                   |
K-------------------K

rightAdjointPreservesLimits :: forall {k} {k'} {i} {a} (j :: i +-> a) (p :: k +-> k') (d :: i +-> k). (Adjunction p, Representable d, HasLimits j k, HasLimits j k') => Sq ('Nil :: Path a a) ('Nil :: Path k' k') (Limit j (p :.: d) '::: ('Nil :: Path k' k')) (Limit j d '::: (p '::: ('Nil :: Path k' k'))) Source Github #

Preservation of weighted limits by a right adjoint p. Here l is the j-weighted limit of d, and l' is the limit of p . d.

A-----------A
|      /--->l
l'>---@     |
|      \--->p
B-----------B

Bend the residual p out of the limiting cone of p :.: d. Since p is also the conjoint of CorepStar p, it bends onto the left as that functor, allowing limitUniv to factor the cone through l. Bending p back onto the right gives the comparison above. The bends use the unit and counit of CorepStar p ⊣ p.

In the expanded composite, f = CorepStar p. The dotted rectangle encloses the cone passed to limitUniv; its factor is l on the outer right boundary. The three @ nodes, from top to bottom, are the limiting cone of p . d, the counit, and the unit. The pairs of bends are drawn as unit and counit nodes, and combining and splitting paths is left implicit.

A-----------------------------------A
|                                   |
|         A.......j...........I     |
|         :       | --------->d     l
|         :       |/          :     |
l'>---------------@           :     |
|         :        \          :     |
|         :         --p       :     |
|         :            \      :     |
|         :             @     :     |
|         :            /      :     |
|       --f>-----------       :     |
|      /  K...................K     |
|     @                             |
|      \                            |
|       --------------------------->p
|                                   |
B-----------------------------------B

rightAdjointPreservesLimitsInv :: forall {k} {k'} {i} {a} (j :: i +-> a) (p :: k +-> k') (d :: i +-> k). (Representable p, Representable d, HasLimits j k, HasLimits j k') => Sq ('Nil :: Path a a) ('Nil :: Path k' k') (Limit j d '::: (p '::: ('Nil :: Path k' k'))) (Limit j (p :.: d) '::: ('Nil :: Path k' k')) Source Github #

The inverse comparison, which exists for any representable p. Applying p to the limiting cone of d gives a cone for p :.: d; limitUniv factors it through l'.

A-----------A
l>---\      |
|     @--->l'
p>---/      |
B-----------B

The dotted rectangle encloses the cone obtained by applying p to the limiting cone of d. Its two right-hand functors are combined before limitUniv produces l' on the outer boundary.

A---------------------------A
|                           |
|   A.........j.........I   |
|   :         |         :   |
l>------------@-------->d  l'
|   :                   :   |
|   :                   :   |
p>--------------------->p   |
|   B...................B   |
|                           |
B---------------------------B

colimit :: forall {i} {a} (j :: a +-> i) k (d :: k +-> i). (HasColimits j k, Corepresentable d) => Sq (j '::: ('Nil :: Path i i)) ('Nil :: Path k k) (CorepStar d '::: ('Nil :: Path k k)) (CorepStar (Colimit j d) '::: ('Nil :: Path k k)) Source Github #

The colimiting cocone, expressed using the corepresenting functors.

I-----j-----A
|     |     |
d>----@---->c
|           |
K-----------K

colimitUniv :: forall {i} {a} (j :: a +-> i) k (d :: k +-> i) (p :: k +-> a). (HasColimits j k, Corepresentable d, Corepresentable p) => Sq (j '::: ('Nil :: Path i i)) ('Nil :: Path k k) (CorepStar d '::: ('Nil :: Path k k)) (CorepStar p '::: ('Nil :: Path k k)) -> Sq ('Nil :: Path a a) ('Nil :: Path k k) (CorepStar (Colimit j d) '::: ('Nil :: Path k k)) (CorepStar p '::: ('Nil :: Path k k)) Source Github #

Factor a cocone through the colimit.

The dotted inner square is the input; the solid outer square is the result.

A-------------------A
|                   |
|   I.....j.....A   |
|   :     |     :   |
c   d>----@-------->p
|   :           :   |
|   K...........K   |
|                   |
K-------------------K

leftAdjointPreservesColimits :: forall {k} {k'} {i} {a} (j :: a +-> i) (p :: k' +-> k) (d :: k +-> i). (Adjunction p, Corepresentable d, HasColimits j k, HasColimits j k') => Sq ('Nil :: Path a a) ('Nil :: Path k' k') (CorepStar (Colimit j d) '::: (CorepStar p '::: ('Nil :: Path k' k'))) (CorepStar (Colimit j (d :.: p)) '::: ('Nil :: Path k' k')) Source Github #

Preservation of weighted colimits by the left adjoint f = CorepStar p. Here c is the j-weighted colimit of d, and c' is the colimit of f . d.

A-----------A
c>---\      |
|     @--->c'
f>---/      |
B-----------B

Transpose the cocone of f . d along f ⊣ p, factor the resulting cocone through c with colimitUniv, and transpose the factor back.

The dotted rectangle encloses the cocone passed to colimitUniv; its factor is c on the outer left boundary. The three @ nodes are the colimiting cocone of f . d, the unit, and the counit. Combining and splitting functor encodings is left implicit.

A-----------------------------------A
|                                   |
|     I...........j.......A         |
c     d>--------- |       :         |
|     :          \|       :         |
|     :           @--------------->c'
|     :          /        :         |
|     :       f--         :         |
|     :      /            :         |
|     :     @             :         |
|     :      \            :         |
|     :       ----------->p--       |
|     K...................K  \      |
|                             @     |
|                            /      |
f>---------------------------       |
|                                   |
B-----------------------------------B

leftAdjointPreservesColimitsInv :: forall {k} {k'} {i} {a} (j :: a +-> i) (p :: k' +-> k) (d :: k +-> i). (Corepresentable p, Corepresentable d, HasColimits j k, HasColimits j k') => Sq ('Nil :: Path a a) ('Nil :: Path k' k') (CorepStar (Colimit j (d :.: p)) '::: ('Nil :: Path k' k')) (CorepStar (Colimit j d) '::: (CorepStar p '::: ('Nil :: Path k' k'))) Source Github #

The inverse comparison, which exists for any corepresentable p. Applying f = CorepStar p to the colimiting cocone of d gives a cocone for d :.: p; colimitUniv factors it through c'.

A-----------A
|      /--->c
c'>---@     |
|      \--->f
B-----------B

The dotted rectangle encloses the cocone obtained by applying f to the colimiting cocone of d. Its left-hand functors are combined before colimitUniv produces c' on the outer boundary.

A---------------------------A
|                           |
|   I.........j.........A   |
|   :         |         :   |
c'  d>--------@------------>c
|   :                   :   |
|   :                   :   |
|   f>--------------------->f
|   B...................B   |
|                           |
B---------------------------B

coneAt :: forall {j1} {j2} {k} (i :: j1 +-> j2) (j3 :: j2 +-> j1) (p :: j1 +-> k) (d :: j2 +-> k). (Representable i, Representable j3, Representable p, Representable d, SameRep (j3 :.: i) (Id :: j1 -> j1 -> Type)) => Cone j3 p d -> Sq ('Nil :: Path j1 j1) ('Nil :: Path k k) (p '::: ('Nil :: Path k k)) (i '::: (d '::: ('Nil :: Path k k))) Source Github #

Restrict a weighted cone along a section i of its representable weight j. The composite j . i must be the identity functor, on objects and arrows. The result is p => d . i. For the codiagonal weight, i = Rep Lft or i = Rep Rgt selects the corresponding projection. This picks a component without exposing the identity-weight cancellation. No universal property of the cone is required.

coconeAt :: forall {j1} {j2} {k} (i :: j1 +-> j2) (j3 :: j1 +-> j2) (d :: j2 +-> k) (p :: j1 +-> k). (Representable i, Corepresentable j3, Representable d, Representable p, SameRep (CorepStar j3 :.: i) (Id :: j1 -> j1 -> Type)) => Sq (j3 '::: ('Nil :: Path j2 j2)) ('Nil :: Path k k) (d '::: ('Nil :: Path k k)) (p '::: ('Nil :: Path k k)) -> Sq ('Nil :: Path j1 j1) ('Nil :: Path k k) (i '::: (d '::: ('Nil :: Path k k))) (p '::: ('Nil :: Path k k)) Source Github #

Restrict a weighted cocone along a section i of its corepresenting weight. The composite CorepStar j . i must be the identity functor, on objects and arrows. The result is d . i => p. For the codiagonal weight, i = Rep Lft or i = Rep Rgt selects the corresponding injection. This is the cocone counterpart of coneAt.