Skip to content

Mess around with IsSemiringWithoutOne reexports #2499

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

Merged
merged 4 commits into from
Dec 10, 2024

Conversation

Taneb
Copy link
Member

@Taneb Taneb commented Nov 13, 2024

It was missing several and had some duplicated, which was causing problems when trying to use those names

I don't know how to changelog this

It was missing several and had some duplicated, which was causing problems when trying to use those names

I don't know how to changelog this
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.

Also need a Changelog entry.

; isMonoid to +-isMonoid
; isCommutativeMagma to +-isCommutativeMagma
; isCommutativeSemigroup to +-isCommutativeSemigroup
)

open Setoid setoid public
open IsEquivalence isEquivalence public
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this removal of open Setoid setoid public change the export, i.e. Carrier is no longer visible?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this is intentional - no other structure exposes Carrier, and doing so was causing issues when trying to use the corresponding bundle.

Copy link
Contributor

@jamesmckinna jamesmckinna Nov 16, 2024

Choose a reason for hiding this comment

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

[UPDATED} Indeed, no (other) Structure Only IsSuccessorSet and IsMagma export setoid, but I think, on balance, that they should not. Suggest a downstream PR to look at this more closely, unless @Taneb you want to investigate this further as part of this PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

Re: the export of setoid from IsMagma: this is used by IsGroup in this module, so can't be removed at this stage.

@MatthewDaggitt
Copy link
Contributor

I don't know how to changelog this

I would document this as a bug fix. Noting the removal of the Carrier export and then listing the new exports.

@MatthewDaggitt MatthewDaggitt added this to the v2.2 milestone Nov 14, 2024
@jamesmckinna
Copy link
Contributor

jamesmckinna commented Nov 15, 2024

As the author of the prior, now offending, commit, I drew attention in the discussion comments on the relevant PR to the possibility of having introduced such a bug...

... having said that, the setoid export was for a reason, and I think that the revisions here revert the relevant consequence (namely to export negated equality...), so I think I'd prefer it if instead

  • either Carrier is part of an explicit hiding directive when exporting setoid (open world assumption)
  • or, that the exports are specifically restricted via a using directive (closed world assumption, which I think @JacquesCarette favours?)

There's a meta-issue here:

  • the offending commit passed an approving review by the author of the present PR
  • the originating history of the offending commit does not seem to have been referred back to for context/rationale/explanation

This is not to throw shade either on me (for a buggy commit), or @Taneb for the fix here, but to point out that, wittingly or unwittingly, reverting prior commits may have further subsequent negative downstream consequences.

Happy to be corrected if I've misconstrued the situation here!

@jamesmckinna
Copy link
Contributor

Allow me to correct myself, after yesterday's splurge/rant, for which I apologise. I did some more digging through the history, and the various import/export dependencies...

Summary:

  • indeed, I think the setoid export is a mistake, both on its face, but also because it is an example of a Structure exporting a sub-Bundle, which as @Taneb points out, happens nowhere else in the library (so is definitely a bug! sorry for introducing it...)
  • the relevant exports of _≉_ are already handled in Algebra.Bundles via their Raw sub-bundles, so my objections above don't stand up, either.

Hope this helps! Apologies for interruptions in the smooth running of things...

Copy link
Contributor

@jamesmckinna jamesmckinna left a comment

Choose a reason for hiding this comment

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

Suggest removing the export of setoid completely... but not (yet) sure what the knock-on consequences of that might be...

@@ -415,15 +415,22 @@ record IsSemiringWithoutOne (+ * : Op₂ A) (0# : A) : Set (a ⊔ ℓ) where
zero : Zero 0# *

open IsCommutativeMonoid +-isCommutativeMonoid public
using (setoid)
using (setoid; isEquivalence)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd double down on @Taneb 's suggestions, and remove the setoid export entirely. As noted in my longer meta-comment, I think it's a design error for a Structure to export a sub-Bundle... one to chalk up to my relative inexperience/lack of understanding when raising and then tackling #1917 which caused all this in the first place. hey-ho!

; isMonoid to +-isMonoid
; isCommutativeMagma to +-isCommutativeMagma
; isCommutativeSemigroup to +-isCommutativeSemigroup
)

open Setoid setoid public
open IsEquivalence isEquivalence public
Copy link
Contributor

@jamesmckinna jamesmckinna Nov 16, 2024

Choose a reason for hiding this comment

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

[UPDATED} Indeed, no (other) Structure Only IsSuccessorSet and IsMagma export setoid, but I think, on balance, that they should not. Suggest a downstream PR to look at this more closely, unless @Taneb you want to investigate this further as part of this PR?

@jamesmckinna
Copy link
Contributor

Suggest removing the export of setoid completely... but not (yet) sure what the knock-on consequences of that might be...

Ugh. Worse that I thought: the uniqueness properties of inverse, defined as manifest fields, in Algebra.Structures.IsGroup, rely on Algebra.Consequences.Setoid, which depends, as the name suggests, on having a Bundled Setoid, rather than the underlying IsEquivalence for access to the properties of equality. So following my suggestion (to have IsMagma not export a setoid field) would actually have a larger scale knock-on effect.

Nevertheless, I think deleting the setoid export from IsSemiringWithoutOne should be harmless?

@MatthewDaggitt
Copy link
Contributor

Gah these algebra imports, re-exports are always nightmarish. I'm not across the exact details, but my understanding aligns with both @jamesmckinna and @Taneb in that we try to avoid structures exporting bundles.

Copy link
Contributor

@jamesmckinna jamesmckinna left a comment

Choose a reason for hiding this comment

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

My suggestions could be considered downstream, but I think are worth doing here as immediate consequences of the new exports you propose?

Comment on lines +454 to +459
distribˡ : * DistributesOverˡ +
distribˡ = proj₁ distrib

distribʳ : * DistributesOverʳ +
distribʳ = proj₂ distrib

Copy link
Contributor

@jamesmckinna jamesmckinna Nov 27, 2024

Choose a reason for hiding this comment

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

These additions make sense, but if you are going to make them, then perhaps you should re-export them downstream from eg IsRingWithoutOne via opening an isSemiringWithoutOne manifest field... etc. which might simplify those exports elsewhere, too?

@jamesmckinna
Copy link
Contributor

@Taneb do you want me to add a CHANGELOG entry and merge this?

@jamesmckinna
Copy link
Contributor

Lots of other merges happening right now... so CHANGELOG conflict sadly inevitable!

@jamesmckinna
Copy link
Contributor

@JacquesCarette I think you can now approve the changes and merge?

@jamesmckinna jamesmckinna added this pull request to the merge queue Dec 10, 2024
Merged via the queue into master with commit d38e964 Dec 10, 2024
2 checks passed
@MatthewDaggitt MatthewDaggitt deleted the IsSemiringWithoutOne-fixes branch January 3, 2025 09:15
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.

4 participants