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

[Merged by Bors] - feat: make multiplication in [Add]MonoidAlgebra irreducible #12554

Closed
wants to merge 4 commits into from

Conversation

fpvandoorn
Copy link
Member

@fpvandoorn fpvandoorn commented Apr 30, 2024

  • See Zulip
  • The example in that thread takes ~55000ms on master and 43ms on this branch.
  • I expect that this will lead to little gains in the (working) proofs of Mathlib.
  • The multiplication on MonoidAlgebra _ G and AddMonoidAlgebra _ (Additive G) are still defeq the same.

Open in Gitpod

@fpvandoorn fpvandoorn added awaiting-review The author would like community review of the PR awaiting-CI labels Apr 30, 2024
@@ -162,16 +162,18 @@ section Mul

variable [Semiring k] [Mul G]

irreducible_def mul' (f g : MonoidAlgebra k G) : MonoidAlgebra k G :=
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we get the same benefits with just @[irreducible]?

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't check. Are there advantages of @[irreducible]?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah you get the same benefits in terms of the speed-up.

The auto-*_def declarations are convenient but you can force things with with_unfolding_all if necessary.

I would generally prefer to depend on upstream tooling unless we absolutely need something that can/will not be provided. But I don't feel strongly enough to put up a fight.

Copy link
Member Author

Choose a reason for hiding this comment

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

Those are good points.
We get the same improvement, with @[irreducible], so I modified this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Using the @[irreducible] is there a way to "unfold irreducible definition X, but no other irreducible definitions"? I tried simp [mul'] or unfold mul', but they both seem to fail.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't know of a way to that unfortunately.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We also used private for Real.

Copy link
Member Author

Choose a reason for hiding this comment

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

That is orthogonal to irreducibility, and I don't particularly care about making this private.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would like to have a consistent design across the library, or there is a reason why the design is different. But I would not insist.

Copy link
Contributor

Choose a reason for hiding this comment

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

Better to do things like this (improving consistency) in separate PRs, rather than bundling it in because the relevant file was touched.

@mattrobball
Copy link
Collaborator

!bench

@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit c6fd2d1.
There were no significant changes against commit 9de65eb.

@semorrison
Copy link
Contributor

bors merge

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review The author would like community review of the PR labels May 1, 2024
mathlib-bors bot pushed a commit that referenced this pull request May 1, 2024
* See [Zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/multiplication.20on.20MvPolynomial.20should.20be.20irreducible)
* The example in that thread takes ~55000ms on master and 43ms on this branch.
* I expect that this will lead to little gains in the (working) proofs of Mathlib.
* The multiplication on `MonoidAlgebra _ G` and `AddMonoidAlgebra _ (Additive G)` are still defeq the same.
@mathlib-bors
Copy link

mathlib-bors bot commented May 1, 2024

Build failed (retrying...):

mathlib-bors bot pushed a commit that referenced this pull request May 1, 2024
* See [Zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/multiplication.20on.20MvPolynomial.20should.20be.20irreducible)
* The example in that thread takes ~55000ms on master and 43ms on this branch.
* I expect that this will lead to little gains in the (working) proofs of Mathlib.
* The multiplication on `MonoidAlgebra _ G` and `AddMonoidAlgebra _ (Additive G)` are still defeq the same.
@mathlib-bors
Copy link

mathlib-bors bot commented May 1, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat: make multiplication in [Add]MonoidAlgebra irreducible [Merged by Bors] - feat: make multiplication in [Add]MonoidAlgebra irreducible May 1, 2024
@mathlib-bors mathlib-bors bot closed this May 1, 2024
@mathlib-bors mathlib-bors bot deleted the fvd/monoidalgebramul branch May 1, 2024 02:08
apnelson1 pushed a commit that referenced this pull request May 12, 2024
* See [Zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/multiplication.20on.20MvPolynomial.20should.20be.20irreducible)
* The example in that thread takes ~55000ms on master and 43ms on this branch.
* I expect that this will lead to little gains in the (working) proofs of Mathlib.
* The multiplication on `MonoidAlgebra _ G` and `AddMonoidAlgebra _ (Additive G)` are still defeq the same.
callesonne pushed a commit that referenced this pull request May 16, 2024
* See [Zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/multiplication.20on.20MvPolynomial.20should.20be.20irreducible)
* The example in that thread takes ~55000ms on master and 43ms on this branch.
* I expect that this will lead to little gains in the (working) proofs of Mathlib.
* The multiplication on `MonoidAlgebra _ G` and `AddMonoidAlgebra _ (Additive G)` are still defeq the same.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR has been sent to bors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants