| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Proarrow.Category.Monoidal.Cartesian
Contents
Description
Cartesian monoidal categories (Cartesian: tensor = product, with CopyDiscard as
superclass by Fox's theorem), cartesian closed ones (CCC) and bicartesian closed ones
(BiCCC, which implies Distributive): the meeting point of the monoidal and the product
worlds, which never import each other. Lives above
Proarrow.Category.Monoidal.CopyDiscard rather than with the products, because the superclass
points that way.
Synopsis
- class (a ** b) ~ (a && b) => TensorIsProduct (a :: k) (b :: k)
- class (HasProducts k, SymMonoidal k, Semicartesian k, CopyDiscard k, forall (a :: k) (b :: k). TensorIsProduct a b) => Cartesian k
- tensorToProduct :: forall {k} (a :: k) (b :: k). (HasBinaryProducts k, TensorIsProduct a b, Ob a, Ob b) => (a ** b) ~> (a && b)
- productToTensor :: forall {k} (a :: k) (b :: k). (HasBinaryProducts k, TensorIsProduct a b, Ob a, Ob b) => (a && b) ~> (a ** b)
- unparRepCartesian :: forall {j} {k} (p :: j +-> k) (a :: j) (b :: j) (a' :: k) (b' :: k). (Representable p, Cartesian k, Cartesian j, TensorIsProduct a b, TensorIsProduct a' b', Ob a, Ob b) => ((p % a) ~> a') -> ((p % b) ~> b') -> (p % (a ** b)) ~> (a' ** b')
- class (Cartesian k, Closed k) => CCC k
- curryProd :: forall {k} (a :: k) (b :: k) (c :: k). (CCC k, TensorIsProduct a b, Ob a, Ob b) => ((a && b) ~> c) -> a ~> (b ~~> c)
- applyProd :: forall {k} (a :: k) (b :: k). (CCC k, TensorIsProduct (a ~~> b) a, Ob a, Ob b) => ((a ~~> b) && a) ~> b
- type Bicartesian k = (Cartesian k, Distributive k)
- class (CCC k, Distributive k) => BiCCC k
- distLProd :: forall {k} (a :: k) (b :: k) (c :: k). (BiCCC k, Ob a, Ob b, Ob c) => (a && (b || c)) ~> ((a && b) || (a && c))
- distRProd :: forall {k} (a :: k) (b :: k) (c :: k). (BiCCC k, Ob a, Ob b, Ob c) => ((a || b) && c) ~> ((a && c) || (b && c))
- ap :: forall {j} {k} (y :: j) (a :: k) (x :: j) p. (Closed j, Cartesian k, MonoidalProfunctor p, Ob y) => p a (x ~~> y) -> p a x -> p a y
- prodToTensor :: forall {k} {cs :: [Kind -> Constraint]} {p :: CAT k} (a :: FREE cs p) (b :: FREE cs p). (Elems '[Cartesian, HasTerminalObject, HasBinaryProducts, Monoidal] cs, Ob a, Ob b) => (a *! b) ~> (a **! b)
- tensorToProd :: forall {k} {cs :: [Kind -> Constraint]} {p :: CAT k} (a :: FREE cs p) (b :: FREE cs p). (Elems '[Cartesian, HasTerminalObject, HasBinaryProducts, Monoidal] cs, Ob a, Ob b) => (a **! b) ~> (a *! b)
- termToUnit :: forall {k} {cs :: [Kind -> Constraint]} {p :: CAT k}. Elems '[Cartesian, HasTerminalObject, HasBinaryProducts, Monoidal] cs => (TermF :: FREE cs p) ~> (UnitF :: FREE cs p)
- unitToTerm :: forall {k} {cs :: [Kind -> Constraint]} {p :: CAT k}. Elems '[Cartesian, HasTerminalObject, HasBinaryProducts, Monoidal] cs => (UnitF :: FREE cs p) ~> (TermF :: FREE cs p)
Documentation
class (a ** b) ~ (a && b) => TensorIsProduct (a :: k) (b :: k) Source Github #
Instances
| (a ** b) ~ (a && b) => TensorIsProduct (a :: k) (b :: k) Source Github # | |
Defined in Proarrow.Category.Monoidal.Cartesian | |
class (HasProducts k, SymMonoidal k, Semicartesian k, CopyDiscard k, forall (a :: k) (b :: k). TensorIsProduct a b) => Cartesian k Source Github #
A cartesian monoidal category: the tensor is the product and the unit the terminal object.
By Fox's theorem this is the same as a CopyDiscard category whose copy and discard are
natural, so CopyDiscard is a superclass. Every cartesian category supplies its diagonals as
comonoids, and anything asking only for copying and discarding (prisms, for instance) accepts
a cartesian category directly. The law relating the two is copy = id &&& id and
discard = terminate.
Instances
| (HasProducts k, SymMonoidal k, Semicartesian k, CopyDiscard k, forall (a :: k) (b :: k). TensorIsProduct a b) => Cartesian k Source Github # | |
Defined in Proarrow.Category.Monoidal.Cartesian | |
tensorToProduct :: forall {k} (a :: k) (b :: k). (HasBinaryProducts k, TensorIsProduct a b, Ob a, Ob b) => (a ** b) ~> (a && b) Source Github #
In a cartesian category the tensor is the product (TensorIsProduct), but GHC only applies
that equation at the top of a type, never under another type family such as (, and
using the quantified form of it directly sends the solver in circles. These two identities take
the equation as an ordinary given (discharged at the call site from the quantified superclass
of ||)Cartesian), so it can be applied where a product-typed leg meets tensor-typed plumbing.
productToTensor :: forall {k} (a :: k) (b :: k). (HasBinaryProducts k, TensorIsProduct a b, Ob a, Ob b) => (a && b) ~> (a ** b) Source Github #
unparRepCartesian :: forall {j} {k} (p :: j +-> k) (a :: j) (b :: j) (a' :: k) (b' :: k). (Representable p, Cartesian k, Cartesian j, TensorIsProduct a b, TensorIsProduct a' b', Ob a, Ob b) => ((p % a) ~> a') -> ((p % b) ~> b') -> (p % (a ** b)) ~> (a' ** b') Source Github #
curryProd :: forall {k} (a :: k) (b :: k) (c :: k). (CCC k, TensorIsProduct a b, Ob a, Ob b) => ((a && b) ~> c) -> a ~> (b ~~> c) Source Github #
applyProd :: forall {k} (a :: k) (b :: k). (CCC k, TensorIsProduct (a ~~> b) a, Ob a, Ob b) => ((a ~~> b) && a) ~> b Source Github #
type Bicartesian k = (Cartesian k, Distributive k) Source Github #
class (CCC k, Distributive k) => BiCCC k Source Github #
Bicartesian closed: cartesian closed with coproducts. Every such category is distributive
(a && is a left adjoint, so it preserves coproducts), and the class says so, so that
Distributive never has to be asked for separately.
Instances
| (CCC k, Distributive k) => BiCCC k Source Github # | |
Defined in Proarrow.Category.Monoidal.Cartesian | |
distLProd :: forall {k} (a :: k) (b :: k) (c :: k). (BiCCC k, Ob a, Ob b, Ob c) => (a && (b || c)) ~> ((a && b) || (a && c)) Source Github #
Distributivity of the product over coproducts, derived from closedness: in any BiCCC the
functor a && is a left adjoint and so preserves coproducts.
distRProd :: forall {k} (a :: k) (b :: k) (c :: k). (BiCCC k, Ob a, Ob b, Ob c) => ((a || b) && c) ~> ((a && c) || (b && c)) Source Github #
ap :: forall {j} {k} (y :: j) (a :: k) (x :: j) p. (Closed j, Cartesian k, MonoidalProfunctor p, Ob y) => p a (x ~~> y) -> p a x -> p a y Source Github #
prodToTensor :: forall {k} {cs :: [Kind -> Constraint]} {p :: CAT k} (a :: FREE cs p) (b :: FREE cs p). (Elems '[Cartesian, HasTerminalObject, HasBinaryProducts, Monoidal] cs, Ob a, Ob b) => (a *! b) ~> (a **! b) Source Github #
The formal tensor = product isomorphisms of a free category with Cartesian in its list.
tensorToProd :: forall {k} {cs :: [Kind -> Constraint]} {p :: CAT k} (a :: FREE cs p) (b :: FREE cs p). (Elems '[Cartesian, HasTerminalObject, HasBinaryProducts, Monoidal] cs, Ob a, Ob b) => (a **! b) ~> (a *! b) Source Github #
termToUnit :: forall {k} {cs :: [Kind -> Constraint]} {p :: CAT k}. Elems '[Cartesian, HasTerminalObject, HasBinaryProducts, Monoidal] cs => (TermF :: FREE cs p) ~> (UnitF :: FREE cs p) Source Github #
unitToTerm :: forall {k} {cs :: [Kind -> Constraint]} {p :: CAT k}. Elems '[Cartesian, HasTerminalObject, HasBinaryProducts, Monoidal] cs => (UnitF :: FREE cs p) ~> (TermF :: FREE cs p) Source Github #
Orphan instances
| (Representable p, Cartesian j, Cartesian k) => MonoidalProfunctor (RepCostar p :: j -> k -> Type) Source Github # | Every functor between cartesian categories is oplax monoidal, |
| (Cartesian k, Traversable p, Traversable q) => Traversable (p :*: q :: k -> k -> Type) Source Github # | |
| Closed (PROD Type) Source Github # | |
Methods withObExp :: forall (a :: PROD Type) (b :: PROD Type) r. (Ob a, Ob b) => (Ob (a ~~> b) => r) -> r Source Github # curry :: forall (a :: PROD Type) (b :: PROD Type) (c :: PROD Type). (Ob a, Ob b) => ((a ** b) ~> c) -> a ~> (b ~~> c) Source Github # apply :: forall (a :: PROD Type) (b :: PROD Type). (Ob a, Ob b) => ((a ~~> b) ** a) ~> b Source Github # (^^^) :: forall (a :: PROD Type) (b :: PROD Type) (x :: PROD Type) (y :: PROD Type). (b ~> y) -> (x ~> a) -> (a ~~> b) ~> (x ~~> y) Source Github # | |
| HasProducts k => CopyDiscard (PROD k) Source Github # | A category with products, viewed through |
| BiCCC k => Distributive (PROD k) Source Github # | |
Methods distL :: forall (a :: PROD k) (b :: PROD k) (c :: PROD k). (Ob a, Ob b, Ob c) => (a ** (b || c)) ~> ((a ** b) || (a ** c)) Source Github # distR :: forall (a :: PROD k) (b :: PROD k) (c :: PROD k). (Ob a, Ob b, Ob c) => ((a || b) ** c) ~> ((a ** c) || (b ** c)) Source Github # absorbL :: forall (a :: PROD k). Ob a => (a ** (InitialObject :: PROD k)) ~> (InitialObject :: PROD k) Source Github # absorbR :: forall (a :: PROD k). Ob a => ((InitialObject :: PROD k) ** a) ~> (InitialObject :: PROD k) Source Github # | |
| (HasProducts k, Ob a) => CocommutativeComonoid ('PR a :: PROD k) Source Github # | |
| (HasProducts k, Ob a) => Comonoid ('PR a :: PROD k) Source Github # | In a category with products every object is a comonoid via the diagonal and the terminal
map. With this comonoid structure |