Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bundled homomorphisms #2383

Open
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

jamesmckinna
Copy link
Contributor

@jamesmckinna jamesmckinna commented May 8, 2024

Cherry-picked and enhanced from #1962 . Fixes #1960 .

TODO:

  • the Algebra.Morphism.Construct.{Identity|Composition} material
  • RingWithoutOne doesn't appear to export its own Raw substructure, so that should be added? ditto. KleeneAlgebra
  • homomorphisms for all the existing Structures/Bundles

NB

  • doesn't address the Setoid structure on Homs at all... (brain-fade; sigh)
  • for bundles which export two sub-bundles, usual 'diamond' problem about re-opening those publicly for export, so someone with a good eye for such things,... please nitpick those details!
  • UPDATED: Semiring and Ring homomorphisms should export a SuccessorSetHomomorphism structure/bundle
    only after going back to Literals for any ring? #1363 through the medium of (the initial) SuccessorSet and its consequences for Algebra.Structures having (Is)SuccessorSet fields...

@Taneb
Copy link
Member

Taneb commented May 8, 2024

Before I look at this at all I just want to say thanks for tackling it! I've been avoiding it with the hope that we can get a solution for #2287, but that looks a long way off.

@jamesmckinna
Copy link
Contributor Author

jamesmckinna commented May 8, 2024

@Taneb Indeed! This kind of boilerplate-bashing is quite fatiguing, until you run up against the 'diamond' re-export problem, at which point my powers fail me in different ways, trying to work out what should get re-exported from where... plus discovering that (still!) not everything is present which perhaps ought to be... ;-)

UPDATED: moving to DRAFT until I have time to finish off (some of) the outstanding items above.

Copy link
Contributor

@JacquesCarette JacquesCarette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all seems quite reasonable. I am doing this as a comment because it seems incomplete - but I have no specific improvement that I'd like to see in the code that is here.

@jamesmckinna jamesmckinna marked this pull request as ready for review May 16, 2024 09:36
@jamesmckinna
Copy link
Contributor Author

jamesmckinna commented May 16, 2024

@JacquesCarette @Taneb I have now added the 'missing' parts of the PR (as in the revised opening preamble above), and so (hopefully) now stopping there...

@jamesmckinna jamesmckinna added this to the v2.1 milestone May 16, 2024
Copy link
Member

@Taneb Taneb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following don't need changes now but we should make issues for them so we don't lose track:

src/Algebra/Morphism/Construct/Composition.agda Outdated Show resolved Hide resolved
src/Algebra/Morphism/Bundles.agda Outdated Show resolved Hide resolved
@jamesmckinna
Copy link
Contributor Author

So I think that I now have added all the relevant (requested!) sub-{structure|bundle}s, but definitely needs another pass to check, along perhaps with a downstream issue/PR to fill in yet more gaps (including in the Raw sub-hierarchy, cf. #2255 ).

@jamesmckinna
Copy link
Contributor Author

Thanks @JacquesCarette ! (modulo the need for manual effort in the absence of a Drasil-based solution...)

@jamesmckinna jamesmckinna marked this pull request as ready for review May 31, 2024 07:58
@jamesmckinna jamesmckinna requested a review from Taneb May 31, 2024 08:26
-- Morphisms between Magmas
------------------------------------------------------------------------

record MagmaHomomorphism (A : Magma a ℓa) (B : Magma b ℓb) : Set (a ⊔ b ⊔ ℓa ⊔ ℓb) where
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a brief comment documenting why you decided to use Bundles here instead of the RawBundles used by the morphism structures? Having thought about it for all of a minute, it's not terribly obvious to me why we should make the switch. In particular, these morphisms are often used to transfer properties from one structure, e.g. a magma, to prove that another structure is also a magma. Assuming that they're both a magma to starts with, prevents you from using these morphisms for that purpose.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh-ho-ho! Good catch... will have to go back to the drawing board and scratch my head for a bit.

My first (worst?) thought is that such a use case could be handled via the already-existing IsMagmaHomomorphism infrastructure... but I have not tested that conjecture (related to @Taneb 's #2276 on Monomorphisms?)... while the specific PR (#1962 ) which gave rise to (the use case giving rise to) this PR does already have the two Magma bundles at hand... and I'd never reconsidered that state of affairs...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So yes, it can (and is!) handled by IsMagmaHomomorphism and co. The question is what does making them Bundles instead of RawBundles actually gains us? I can only see downsides.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm convinced: but there's a knock-on consequence... : we can no longer define a SetoidHomomorphism manifest field at the bottom of the hierarchy... and probably Relation.Morphism.Bundles should be refactored to reflect (the eventual introduction of) RawSetoid as index for SetoidHomomorphism... ;-) cf. your #1464 / commit 9816023

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More knock-on:

  • For Algebra.Morphism.Construct.Identity, we need refl for IsXHomomorphism, so do we parametrise by xHomomorphism by the full X bundle, or the RawX bundle, with an explicit refl witness...?
  • Ditto. with trans for Algebra.Morphism.Construct.Composition...

Advice welcome!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest commits:

  • RawX bundle for the definition
  • X bundle for the Constructions

@jamesmckinna
Copy link
Contributor Author

Currently badged as v2.2, but could merge for v2.1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bundles for Algebra.*Homomorphism, and their algebra: Hom-'sets' for Algebra
4 participants