Skip to content

Pull lattice-like structures out of Algebra, into Algebra.Lattice #1108

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 15 commits into from
Nov 20, 2021

Conversation

laMudri
Copy link
Contributor

@laMudri laMudri commented Mar 9, 2020

Following this comment, here is an attempt at moving and fixing the definitions of lattice-like structures found in the Algebra part of the library. What exists now is work towards an ideal hierarchy, which was done for clarity and my own convenience. For this to be merged, I'd expect to have better backwards compatibility.

Comments welcome.

Copy link
Contributor

@MatthewDaggitt MatthewDaggitt left a comment

Choose a reason for hiding this comment

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

Looks mostly pretty good! I'm wondering how we can maximise backwards compatibility somehow though. I think the best bet is to keep old variants around (Algebra.Lattice.Old?), then people don't have to upgrade immediately.

Obviously there's various other files that'll need updating...

@MatthewDaggitt
Copy link
Contributor

@laMudri apologies, was trying to bring this up-to-date and ended up messing up the commits. I've ended up having to force push. I'm happy to take responsibility for merging this in for v2.0.

@MatthewDaggitt
Copy link
Contributor

Hmm actually this is more work then I'd first envisaged. @laMudri any chance you could help out by moving all the lattice constructions in Algebra.Construct to corresponding files in Algebra.Lattice.Construct, e.g.

semilattice : Semilattice a ℓ₁ Semilattice b ℓ₂

@MatthewDaggitt
Copy link
Contributor

Also a couple of quick points on some of the design decisions. I reverted your change to define IsLattice in terms of two IsSemilattice proofs. As @Taneb found in #1540, defining it in this way results in the record having two different proofs that the equality relation is an equivalence which is often undesirable. In order to keep the ease of constructing it, I've added your original version to a new Algebra.Lattice.Structures.Biased. Hope that's okay?

The second is that aren't we missing the smart constructors for the IsDistributiveLattice? Which ones were you planning on adding?

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@laMudri
Copy link
Contributor Author

laMudri commented Jul 11, 2021

If this is for version 2, can't we find a general solution to these redundancy problems? For example, I'd start by taking the isEquivalence field out of IsMagma and putting it into Magma, Monoid, Semiring, &c.

I think any further thought or effort from me on this is going to come next weekend at the earliest. I'm happy to discuss the first point earlier, though, given that I have it in mind.

@MatthewDaggitt
Copy link
Contributor

MatthewDaggitt commented Jul 11, 2021

If this is for version 2, can't we find a general solution to these redundancy problems? For example, I'd start by taking the isEquivalence field out of IsMagma and putting it into Magma, Monoid, Semiring, &c.

Eek that sounds rather drastic. Isn't having a well-formed equality relation part of being a magma etc.? To be honest, with the current design of Agda, I don't think you're ever going to find a solution to all redundancy problems + get 100% usability. I think the best we can probably aim for is consistency and eliminate the worst pain points.

More concretely, ignoring the duplicate equality problem, what advantage does your definition of IsLattice have over the current one + smart constructors?

@MatthewDaggitt
Copy link
Contributor

Well that was unbelievably painful, let's not do that again 😢

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

Successfully merging this pull request may close these issues.

Algebraic semilattice theories are missing
2 participants