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] - refactor(Algebra/Polynomial/Basic): define nsmul/zsmul for Polynomial #19095

Closed
wants to merge 1 commit into from

Conversation

Vierkantor
Copy link
Contributor

The goal of this PR is to make the ring instances on Polynomial independent of the module structure. This is currently somewhat useless and will only be useful in an upcoming PR that splits this entire file Polynomial/Basic.lean. But since adding definitions while splitting files is very annoying to review, let's do it in multiple steps.


Open in Gitpod

The goal of this PR is to make the ring instances on `Polynomial` independent of the module structure. This will be useful in an upcoming PR that splits this entire file. But since adding definitions while splitting files is very annoying to review, let's do it in multiple steps.
@Vierkantor Vierkantor added awaiting-CI t-algebra Algebra (groups, rings, fields, etc) labels Nov 15, 2024
Copy link

PR summary 4318efebfe

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ instNSMul
+ instZSMul
+ ofFinsupp_nsmul
+ ofFinsupp_zsmul
+ toFinsupp_nsmul
+ toFinsupp_zsmul

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
Collaborator

@Ruben-VandeVelde Ruben-VandeVelde left a comment

Choose a reason for hiding this comment

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

Thanks!

maintainer merge

Copy link

🚀 Pull request has been placed on the maintainer queue by Ruben-VandeVelde.

@adomani
Copy link
Collaborator

adomani commented Nov 15, 2024

Thanks!

bors merge

@github-actions github-actions bot added the ready-to-merge This PR has been sent to bors. label Nov 15, 2024
mathlib-bors bot pushed a commit that referenced this pull request Nov 15, 2024
…#19095)

The goal of this PR is to make the ring instances on `Polynomial` independent of the module structure. This is currently somewhat useless and will only be useful in an upcoming PR that splits this entire file `Polynomial/Basic.lean`. But since adding definitions while splitting files is very annoying to review, let's do it in multiple steps.
@eric-wieser
Copy link
Member

The goal of this PR is to make the ring instances on Polynomial independent of the module structure.

Why is this desirable? The nsmul/zsmul pattern is a lot more pleasant if you can define the general smul instance first and recover the nsmul/zsmul actions as special cases.

@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Nov 15, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title refactor(Algebra/Polynomial/Basic): define nsmul/zsmul for Polynomial [Merged by Bors] - refactor(Algebra/Polynomial/Basic): define nsmul/zsmul for Polynomial Nov 15, 2024
@mathlib-bors mathlib-bors bot closed this Nov 15, 2024
@mathlib-bors mathlib-bors bot deleted the Polynomial-nzsmul branch November 15, 2024 22:48
@Vierkantor
Copy link
Contributor Author

Ouch, the bot was slightly too fast for your review :(

Anyway, the nsmul/zsmul instance are defined separately since there is no correct instance of SMul M R -> SMul M R[X]: they need to preserve 0 too.

@eric-wieser
Copy link
Member

Right; I guess my claim is that SMulZeroClass should be treated as just as primitive as MulZeroClass, and so it doesn't seem problematic to me to require it when building the AddCommGroup structure.

@adomani
Copy link
Collaborator

adomani commented Nov 16, 2024

Oh, the second PR that I merged and I already did something controversial... 🤦

Vierkantor added a commit that referenced this pull request Nov 18, 2024
In the comments of #19095 we discussed that `MonoidAlgebra` and `Polynomial` need scalar multiplication by `Nat` or `Int` early on, to define a `Semiring` or `Ring` structure. We can define a generic `SMulWithZero` instance and then specialize it to get `nsmul` and `zsmul`, but only if that instance is available early on for `Finsupp`. So: split this off from `Finsupp/Basic.lean` into a higher-up file.

This PR used Damiano's `upstreamableDecls` linter to find out which results could move together with the definitions for free.
Vierkantor added a commit that referenced this pull request Nov 20, 2024
In the comments of #19095 we discussed that `MonoidAlgebra` and `Polynomial` need scalar multiplication by `Nat` or `Int` early on, to define a `Semiring` or `Ring` structure. We can define a generic `SMulWithZero` instance and then specialize it to get `nsmul` and `zsmul`, but only if that instance is available early on for `Finsupp`. So: split this off from `Finsupp/Basic.lean` into a higher-up file.

This PR used Damiano's `upstreamableDecls` linter to find out which results could move together with the definitions for free.
TobiasLeichtfried pushed a commit that referenced this pull request Nov 21, 2024
…#19095)

The goal of this PR is to make the ring instances on `Polynomial` independent of the module structure. This is currently somewhat useless and will only be useful in an upcoming PR that splits this entire file `Polynomial/Basic.lean`. But since adding definitions while splitting files is very annoying to review, let's do it in multiple steps.
Vierkantor added a commit that referenced this pull request Nov 25, 2024
In the comments of #19095 we discussed that `MonoidAlgebra` and `Polynomial` need scalar multiplication by `Nat` or `Int` early on, to define a `Semiring` or `Ring` structure. We can define a generic `SMulWithZero` instance and then specialize it to get `nsmul` and `zsmul`, but only if that instance is available early on for `Finsupp`. So: split this off from `Finsupp/Basic.lean` into a higher-up file.

This PR used Damiano's `upstreamableDecls` linter to find out which results could move together with the definitions for free.
Vierkantor added a commit that referenced this pull request Nov 29, 2024
In the comments of #19095 we discussed that `MonoidAlgebra` and `Polynomial` need scalar multiplication by `Nat` or `Int` early on, to define a `Semiring` or `Ring` structure. We can define a generic `SMulWithZero` instance and then specialize it to get `nsmul` and `zsmul`, but only if that instance is available early on for `Finsupp`. So: split this off from `Finsupp/Basic.lean` into a higher-up file.

This PR used Damiano's `upstreamableDecls` linter to find out which results could move together with the definitions for free.
mathlib-bors bot pushed a commit that referenced this pull request Dec 10, 2024
In the comments of #19095 we discussed that `MonoidAlgebra` and `Polynomial` need scalar multiplication by `Nat` or `Int` early on, to define a `Semiring` or `Ring` structure. We can define a generic `SMulWithZero` instance and then specialize it to get `nsmul` and `zsmul`, but only if that instance is available early on for `Finsupp`. So: split this off from `Finsupp/Basic.lean` into a higher-up file.

This PR used Damiano's `upstreamableDecls` linter to find out which results could move together with the definitions for free.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintainer-merge ready-to-merge This PR has been sent to bors. t-algebra Algebra (groups, rings, fields, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants