What is the name used in literature and libraries for the abstraction of "zero profunctors"
Asked Answered
J

2

6

In real world application I noticed a pattern that could be generalized to something like:

purescript:

class Profunctor p <= Zero p where
  pzero :: forall a b. p a b -- such that `forall f g. dimap f g pzero == pzero`

It seems basic enough to have its own name in literature and libraries out there. So what is its name? (Zero and pzero are made up by me.)

UPDATE

I realized I made wrong generalization. My real world data type could provide infinitely many pzero implementations while what I really meant was a unique pzero that was identity for psum :: forall a b . p a b -> p a b -> p a b. So what I was looking a name for was rather:

purescript:

class Profunctor p <= Sum p where
  psum :: forall a b . p a b -> p a b -> p a b -- such that `psum a (psum b c) == psum (psum a b) c

class (Profunctor p, Sum p) <= Zero p where
  pzero :: forall a b. p a b -- such that `psum pzero p == p == psum p pzero`

(possibly without Profunctor p constrain).

This looks like a dual of Product Profunctor so I would call it Sum Profunctor, unless the literature and libraries discovered it already under a different name.

Jetport answered 5/3, 2024 at 16:34 Comment(6)
pzero appears to be a fixed point for dimap f g. Is it supposed to be the same value for all f and g?Lavonna
yes, for all f and g (I'm updating code in the post)Jetport
I'm not sure whether it's fixed point for dimap f g as the left-hand pzero is of different type than right-hand pzero.Jetport
At least in Haskell, you'll have to be specific about your definition of ==, because for arbitrary f :: a -> b and g :: c -> d, dimap f g pzero cannot be compared with pzero itself.Lavonna
I mean == in terms of equational reasoning.Jetport
Zero seems like a good name, like zero morphism. Note that this is equivalent to having p () Void.Mastin
I
4

Your definition looks like what you want is a monoid in the Cartesian monoidal category of profunctors. This is quite similar (though not dual) to Product profunctors which are monoids wrt a different monoidal structure: the Day convolution.

As for naming, this is the analog of MonadPlus so I would probably go with ProfunctorPlus to match that

Intercom answered 6/3, 2024 at 16:34 Comment(0)
A
-3

In literature and libraries, the abstraction of "zero profunctors" is commonly referred to as "identity profunctors." These are profunctors that are the identity on objects, meaning they map every object to itself and every arrow to itself.

Allisonallissa answered 6/3, 2024 at 2:56 Comment(1)
I think you may be confusing zero and one. An identity maps everything to itself. The OP is asking for a zero element, which maps everything to a particular value, in the same way that multiplying by zero will always produce zero, regardless of the other multiplicand.Coal

© 2022 - 2025 — McMap. All rights reserved.