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(RingTheory.Binomial): Add BinomialRing instance for NNRat modules. #13585

Closed
wants to merge 9 commits into from

Conversation

kcaze
Copy link
Collaborator

@kcaze kcaze commented Jun 7, 2024

This PR adds an instance of BinomialRing for NNRat modules.


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 Jun 7, 2024
Copy link

github-actions bot commented Jun 7, 2024

Import summary

Dependency changes
File Base Count Head Count Change
Mathlib.RingTheory.Binomial 941 947 +6 (+0.64%)

@kcaze kcaze added awaiting-review t-algebra Algebra (groups, rings, fields, etc) and removed new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! labels Jun 7, 2024
@ScottCarnahan
Copy link
Collaborator

Your proof doesn't seem to use any special features of the reals besides the fact that k+1 is invertible for all natural numbers k. This seems to suggest you can replace real numbers with something like {R : Type*} [AddCommMonoid R] [Module ℚ≥0 R] [Pow R ℕ].

@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 Jun 19, 2024
@kcaze kcaze changed the title feat(RingTheory.Binomial): Add BinomialRing instance for Reals feat(RingTheory.Binomial): Add BinomialRing instance for rational algebras. Jun 19, 2024
Copy link

github-actions bot commented Jun 19, 2024

PR summary b198045ae1

Import changes

No significant changes to the import graph


Declarations diff

+ instance {R : Type*} [AddCommMonoid R] [Module ℚ≥0 R] [Pow R ℕ] : BinomialRing R

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

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

@kcaze kcaze force-pushed the kcaze/binomialring_instance_real branch from e133aa0 to 9e101ac Compare June 19, 2024 20:41
@kcaze
Copy link
Collaborator Author

kcaze commented Jun 19, 2024

@ScottCarnahan Thanks for the suggestion to generalize. I wasn't able to quite get my proof to work with [AddCommMonoid R] [Module ℚ≥0 R] [Pow R ℕ]. My latest commit requires R to be [CommRing R] [CharZero R] [IsLeftCancelMulZero R] [Algebra ℚ R] instead.

@kcaze kcaze requested a review from ScottCarnahan June 19, 2024 20:44
@kcaze
Copy link
Collaborator Author

kcaze commented Jun 20, 2024

Thanks, this looks much simpler. I think that instead of a $\mathbb{Q}_{\ge 0}$ module we should however specify a $\mathbb{Q}$ module. With [Module ℚ≥0 R] we cannot synthesize a BinomialRing instance for the reals. For example def test := BinomialRing.multichoose (4:ℝ) 2 yields the error

failed to synthesize
  BinomialRing ℝ

Changing all instances of ℚ≥0 to fixes this.

Arguably, the real issue is that we lack a equivalent to NNReal.instModuleOfReal but for NNRat and Rat. What do you think?

@ScottCarnahan
Copy link
Collaborator

This is curious. I see the instance was removed from Mathlib.Algebra.Module.Basic in #11203.

@ScottCarnahan
Copy link
Collaborator

By the way, if you don't want boldface text in the PR description, put a blank line between your text and the line with three dashes.

kcaze and others added 2 commits June 21, 2024 16:08
@kcaze
Copy link
Collaborator Author

kcaze commented Jun 21, 2024

Great, thank you. I've committed your suggested version to the PR and am happy with waiting for Yaël's PR to fix synthesizing Module ℚ≥0 ℝ to come after this one.

Copy link
Collaborator

@ScottCarnahan ScottCarnahan left a comment

Choose a reason for hiding this comment

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

It looks good to me. If you want, you can change the name of the Nat_Int section to something more general like Basic_Instances, and put the instance in there.

@kcaze
Copy link
Collaborator Author

kcaze commented Jun 27, 2024

Great, I've changed the section to Basic_Instances so I think this is ready to be merged now.

@kcaze
Copy link
Collaborator Author

kcaze commented Jun 30, 2024

@ScottCarnahan, sorry for the ping, but does this need a maintainer merge comment to move into the merging queue? Or do I just need to wait for a maintainer to take a look?

@ScottCarnahan
Copy link
Collaborator

Sorry I don't have permission to advance it here, but I can start a discussion on Zulip. On an unrelated note, perhaps you should edit the PR description, e.g., change "real" to "NNRat" or "rational"

@kcaze kcaze changed the title feat(RingTheory.Binomial): Add BinomialRing instance for rational algebras. feat(RingTheory.Binomial): Add BinomialRing instance for NNRat modules. Jul 1, 2024
Copy link
Member

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

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

Thanks!

bors d+

@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Jul 1, 2024

✌️ kcaze can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@kcaze
Copy link
Collaborator Author

kcaze commented Jul 1, 2024

bors r+

mathlib-bors bot pushed a commit that referenced this pull request Jul 1, 2024
…s. (#13585)

This PR adds an instance of BinomialRing for NNRat modules.



Co-authored-by: Herman Chau <[email protected]>
@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Jul 1, 2024

Build failed (retrying...):

mathlib-bors bot pushed a commit that referenced this pull request Jul 1, 2024
…s. (#13585)

This PR adds an instance of BinomialRing for NNRat modules.



Co-authored-by: Herman Chau <[email protected]>
@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Jul 1, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat(RingTheory.Binomial): Add BinomialRing instance for NNRat modules. [Merged by Bors] - feat(RingTheory.Binomial): Add BinomialRing instance for NNRat modules. Jul 1, 2024
@mathlib-bors mathlib-bors bot closed this Jul 1, 2024
@mathlib-bors mathlib-bors bot deleted the kcaze/binomialring_instance_real branch July 1, 2024 18:25
dagurtomas pushed a commit that referenced this pull request Jul 2, 2024
…s. (#13585)

This PR adds an instance of BinomialRing for NNRat modules.



Co-authored-by: Herman Chau <[email protected]>
@adomani adomani mentioned this pull request Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-algebra Algebra (groups, rings, fields, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants