Skip to content

[Merged by Bors] - feat: quantales#17289

Closed
PieterCuijpers wants to merge 98 commits intomasterfrom
PieterCuijpers_Quantales
Closed

[Merged by Bors] - feat: quantales#17289
PieterCuijpers wants to merge 98 commits intomasterfrom
PieterCuijpers_Quantales

Conversation

@PieterCuijpers
Copy link
Copy Markdown
Collaborator

First definition of Quantales - a non-commutative generalization of Locales/Frames. There are still some points of discussion, which would require changes elsewhere in Mathlib, but this definition should be workeable as a starting point (I think).
It's my first PR, but I've tried to stay close to what I've seen in CompleteLattices.


Open in Gitpod

@github-actions github-actions bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label Sep 30, 2024
@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 30, 2024

PR summary fe23b837f9

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Algebra.Order.Quantale 266

Declarations diff

+ IsAddQuantale
+ IsQuantale
+ iSup_mul_distrib
+ instance : MulLeftMono α
+ instance : MulRightMono α
+ leftAddResiduation
+ leftMulResiduation
+ leftMulResiduation_le_iff_mul_le
+ mul_iSup_distrib
+ mul_sSup_distrib
+ mul_sup_distrib
+ rightAddResiduation
+ rightMulResiduation
+ rightMulResiduation_le_iff_mul_le
+ sSup_mul_distrib
+ sup_mul_distrib

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

Copy link
Copy Markdown
Contributor

@j-loreaux j-loreaux left a comment

Choose a reason for hiding this comment

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

Welcome to Mathlib! I've left some comments to get you started. Please let me / us know if you have questions. Also, please see the commit conventions about the PR title and description.

@j-loreaux j-loreaux added the awaiting-author A reviewer has asked the author a question or requested changes. label Sep 30, 2024
PieterCuijpers and others added 4 commits September 30, 2024 17:08
Different bullet style

Co-authored-by: Jireh Loreaux <loreaujy@gmail.com>
Style change, including 'left'

Co-authored-by: Jireh Loreaux <loreaujy@gmail.com>
@PieterCuijpers PieterCuijpers removed the awaiting-author A reviewer has asked the author a question or requested changes. label Sep 30, 2024
@j-loreaux j-loreaux added the awaiting-author A reviewer has asked the author a question or requested changes. label Oct 1, 2024
@PieterCuijpers PieterCuijpers removed the awaiting-author A reviewer has asked the author a question or requested changes. label Oct 2, 2024
@PieterCuijpers
Copy link
Copy Markdown
Collaborator Author

@j-loreaux Do I understand correctly that removing the awaiting author label will draw your attention to these files again?
I've made quite a few changes, but the file now also starts to grow a bit...

@j-loreaux
Copy link
Copy Markdown
Contributor

j-loreaux commented Oct 2, 2024

Yes, generally, although it is also possible to request review.

I see that you now also consider semigroups, which has led to a proliferation of classes. I think there is yet another possibility to consider here: make the algebraic structure an argument to the class rather than extending it.

So you would write

class Quantale (\a : Type*) [Semigroup \a] extends CompleteLattice \a where ...`

The downside is that you have to write two things to get a quantale, but the upside is that you can easily change the underlying algebraic structure without defining all new classes.

So, to get a bare bones quantale, you just write: but to get a commutative unital one, you simply change this to: [CommMonoid \a] [Quantale \a].

After that, you could potentially make IsIdem or IsIntegral mixin classes. It depends on how often they come up, and whether they come up in conjunction with each other. This is hard for me to say with my limited knowledge of quantales.

@j-loreaux j-loreaux added the awaiting-author A reviewer has asked the author a question or requested changes. label Oct 2, 2024
@PieterCuijpers
Copy link
Copy Markdown
Collaborator Author

So you would write

class Quantale (\a : Type*) [Semigroup \a] extends CompleteLattice \a where ...`

The downside is that you have to write two things to get a quantale, but the upside is that you can easily change the underlying algebraic structure without defining all new classes.

That does not seem the best way to go to me. I think the definition I have now for quantales fits best.
As I explain in the preceding comments, the term is not completely consistent within literature, with some authors
using it for a semigroup and others using it for a monoid, so we have to decide on which stance Mathlib will take on it.
But in many papers I actually see it acknowledged that the original is without assuming the unit element, to subsequently
say: but in this paper we use the term to mean a unital quantale. Therefore, from a Mathlib point of view, I guess it is okay
to drag along the OneQuantale whenever a paper you are formalizing says Quantale.

The construct you are proposing would make sense if the general way of looking at it is that "you turn a semigroup into a quantale", but (just like with a ring consisting of two semigroups) that is not the way quantales are being used imo.

Thanks for thinking along though! It really helps to have someone giving feedback :-)

@PieterCuijpers PieterCuijpers removed the awaiting-author A reviewer has asked the author a question or requested changes. label Nov 17, 2024
@PieterCuijpers PieterCuijpers added the awaiting-author A reviewer has asked the author a question or requested changes. label Nov 19, 2024
@PieterCuijpers
Copy link
Copy Markdown
Collaborator Author

I've decided to remove the variable_alias for the time being, awaiting the PR by Julian on VectorSpaces and having the discussion on how to use it there.

This lead to a small change again regarding namespaces in the Quantale file.
I would like the main namespaces to be Quantale and AddQuantale, not IsQuantale and IsAddQuantale.

When I introduced the variable alias for AddQuantale, this also introduced its namespace, so the definition of addLeftResidual could be done through to_additive. Now, however, the AddQuantale namespace is not implicitly introduced anymore, which meant I had to pull the introduction of those definitions forward.

Do you agree that using the namespace Quantale is better than IsQuantale?
Especially with an eye on the future introduction of the variable_alias, I think it is more natural, but at the moment it has a small cost involved in not being able to use to_additive for the introduction of leftAddResidual.

@PieterCuijpers PieterCuijpers removed the awaiting-author A reviewer has asked the author a question or requested changes. label Nov 19, 2024
@YaelDillies
Copy link
Copy Markdown
Contributor

I would personally stick to the IsQuantale and IsAddQuantale namespaces, with a view towards renaming if ever Quantale and AddQuantale become a thing

@PieterCuijpers
Copy link
Copy Markdown
Collaborator Author

What I think is happening, is that to_additive needs to have made the connection between the Quantale namespace and the AddQuantale namespace, before it can transfer between the two. But there is no way to put the @[to_additive] before a namespace declaration, you can only do that in front of a structure or class definition. So only after you've defined a class or structure with the name of the namespace, to_additive can do its job.

Copy link
Copy Markdown
Contributor

@j-loreaux j-loreaux left a comment

Choose a reason for hiding this comment

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

Thanks! I know this was a long process, but with more experience (and more theorems instead of definitions), it will likely go quicker! Looking forward to having more contributions from you @PieterCuijpers

bors merge

@ghost ghost added the ready-to-merge This PR has been sent to bors. label Nov 19, 2024
mathlib-bors bot pushed a commit that referenced this pull request Nov 19, 2024
First definition of Quantales - a non-commutative generalization of Locales/Frames. There are still some points of discussion, which would require changes elsewhere in Mathlib, but this definition should be workeable as a starting point (I think).
It's my first PR, but I've tried to stay close to what I've seen in CompleteLattices.
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Nov 19, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat: quantales [Merged by Bors] - feat: quantales Nov 19, 2024
@mathlib-bors mathlib-bors bot closed this Nov 19, 2024
@mathlib-bors mathlib-bors bot deleted the PieterCuijpers_Quantales branch November 19, 2024 18:27
TobiasLeichtfried pushed a commit that referenced this pull request Nov 21, 2024
First definition of Quantales - a non-commutative generalization of Locales/Frames. There are still some points of discussion, which would require changes elsewhere in Mathlib, but this definition should be workeable as a starting point (I think).
It's my first PR, but I've tried to stay close to what I've seen in CompleteLattices.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! ready-to-merge This PR has been sent to bors. t-order Order theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants