Skip to content

Where should homomorphisms live in the stdlib hierarchy? #1871

@jamesmckinna

Description

@jamesmckinna

Knocking off the last outstanding task in Issue #1851 re-raised a question in my mind as well regarding where, in general, proofs homomorphism-like properties belong in the library: under the source type, in *.Properties, or somewhere else?

For example, in PR#1852 I currently have Parity import Sign in order to define the operations, but it strikes me that there's an asymmetry to that decision, which might better be reflected in having subdirectories of the Algebra.* hierarchy which record concrete instances of (Semi)RingHomomorphisms etc. Similar considerations apply, mutatis mutandis, to @Taneb 's recent #1857 / #1863 : I don't regard List.length as being a homomorphism from List _ to Nat as a property of List _, rather it's a (consequence of the) universal property of the free monoid construction, of which List _ is merely a very convenient representative for the underlying carrier type of that free algebra.

Moreover the amount of additional work involved in these proofs, and especially also for the Semiring homomorphism parity from Nat to Parity, led me eventually to write this last one in a module on its own; I was at the limits of how to disambiguate all the various equational/algebraic reasoning from that already intrinsic to the structure of Nat itself, when I first tried to shoehorn this proof into Data.Nat.Properties.

It struck me before I embarked on this, but especially now afterwards, and with a categorical eye on what's going on, that it doesn't make sense to me to regard this homomorphism as a property inherent to Nat, importing structure from Parity: rather that each (through the particular lens of their respective Semiring structure) participates in the construction of a new structure/bundle, taking components from the (intrinsic/internal) Properties of each type Nat and Parity... and neither 'side' has ownership of the homomorphism. Rather, if rather prosaically, I've constructed an arrow in the (Set-/Setoid- based) category of Semirings and their homomorphisms... such that each of the Properties modules is responsible for witnessing that Nat resp. Parity is even permitted to be considered as candidate domain/codomain for such an arrow. But the arrow itself lives/should live... somewhere else, associated in the hierarchy with the abstract algebraic structure involved.

Accordingly, I suggest/propose that we have a new hierarchy below Algebra.Homomorphism|Morphism, corresponding to each of the (concrete) categories of algebras where the domain/codomain of any such homomorphism should live.

All of these decisions may already have been debated/decided/resolved in agda-categories, so it would be nice to get input from that community (esp. @JacquesCarette ?), as well perhaps as this being further impetus to migrate that development into stdlib itself...

Discussion and suggestions welcome!

(And my especial thanks to @MatthewDaggitt and @Taneb for forcing me to put my money where my mouth is ;-)
The views above are, of course, entirely my own, but I might hope might be more widely shared...)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions