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: generalize DirectSum results to avoid negation #10828

Closed
wants to merge 8 commits into from

Conversation

AntoineChambert-Loir
Copy link
Collaborator

@AntoineChambert-Loir AntoineChambert-Loir commented Feb 21, 2024

Three files are modified, where the hypotheses are relaxed from Ring or CommRing to Semiring or CommSemiring, and AddCommGroup to AddCommMonoid.
Besides this, no definition is changed, and for one proof in RingTheory.Flat.Basic, I needed to add an instance (letI…) in the proof.
(Everything pertains to direct sums of modules.)


Open in Gitpod

@AntoineChambert-Loir
Copy link
Collaborator Author

The compilation of RingTheory.Flat.Basic doesn't work well.
Lean can't find an instance that a direct sum of groups is a group…

@AntoineChambert-Loir
Copy link
Collaborator Author

So I could make it work, but this is strange.

noncomputable local instance (ι : Type v)
    (M : ι → Type w) [(i : ι) → AddCommGroup (M i)] [(i : ι) → Module R (M i)]
    (I : Ideal R) :
    AddCommGroup (⨁ i, ↥I ⊗[R] M i) :=
  instAddCommGroupDirectSumToAddCommMonoid fun i ↦ ↥I ⊗[R] M i

I found it using apply?, but inferInstance doesn't work.

@riccardobrasca
Copy link
Member

!bench

@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit eeeb6c8.
The entire run failed.
Found no significant differences.

@AntoineChambert-Loir
Copy link
Collaborator Author

@riccardobrasca , can you launch bench again? — I fear the missing dostring made it fail.

@riccardobrasca
Copy link
Member

!bench

@riccardobrasca
Copy link
Member

I think anyone can do it (but I am not sure)

@AntoineChambert-Loir
Copy link
Collaborator Author

AntoineChambert-Loir commented Feb 21, 2024

(I tried, and nothing happened… apparently, one needs admin privileges…)

@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit b7dd119.
There were significant changes against commit 8b2dfa4:

  Benchmark                                        Metric         Change
  ======================================================================
+ ~Mathlib.LinearAlgebra.DirectSum.Finsupp         instructions   -45.8%
+ ~Mathlib.LinearAlgebra.DirectSum.TensorProduct   instructions   -42.3%

Antoine Chambert-Loir and others added 2 commits February 22, 2024 08:35
@eric-wieser eric-wieser changed the title generalize direct sums to CommSemiring, AddCommMonoid… feat: generalize direct sums results to avoid negation Feb 22, 2024
Copy link
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

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

bors merge

Thanks!

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the ready-to-merge This PR has been sent to bors. label Feb 22, 2024
@eric-wieser eric-wieser changed the title feat: generalize direct sums results to avoid negation feat: generalize direct sum results to avoid negation Feb 22, 2024
mathlib-bors bot pushed a commit that referenced this pull request Feb 22, 2024
Three files are modified, where the hypotheses are relaxed from `Ring` or `CommRing` to `Semiring` or `CommSemiring`, and `AddCommGroup` to `AddCommMonoid`.
Besides this, no definition is changed, and for one proof in `RingTheory.Flat.Basic`, I needed to add an instance (`letI`…) in the proof.
(Everything pertains to direct sums of modules.)



Co-authored-by: Antoine Chambert-Loir <antoine.chambert-loir@math.univ-paris-diderot.fr>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@eric-wieser eric-wieser changed the title feat: generalize direct sum results to avoid negation feat: generalize DirectSum results to avoid negation Feb 22, 2024
@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Feb 22, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat: generalize DirectSum results to avoid negation [Merged by Bors] - feat: generalize DirectSum results to avoid negation Feb 22, 2024
@mathlib-bors mathlib-bors bot closed this Feb 22, 2024
@mathlib-bors mathlib-bors bot deleted the ACL/generalizeSemiring branch February 22, 2024 23:46
thorimur pushed a commit that referenced this pull request Feb 24, 2024
Three files are modified, where the hypotheses are relaxed from `Ring` or `CommRing` to `Semiring` or `CommSemiring`, and `AddCommGroup` to `AddCommMonoid`.
Besides this, no definition is changed, and for one proof in `RingTheory.Flat.Basic`, I needed to add an instance (`letI`…) in the proof.
(Everything pertains to direct sums of modules.)



Co-authored-by: Antoine Chambert-Loir <antoine.chambert-loir@math.univ-paris-diderot.fr>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
bustercopley added a commit that referenced this pull request Feb 25, 2024
Generalize `Basis.tensorProduct` and `instance Module.Free.tensor`
to CommSemiring and AddCommMonoid

Plus style fixes:
* tidy up LinearAlgebra.DirectSum.Finsupp.lean:
  * delete unused `universe` declaration
  * delete duplicate `open TensorProduct`
  * delete redundant `noncomputable` annotation and associated comment
  * replace `open Classical` with `DecidableEq` type class implicit arguments
    * add `DecidableEq` elsewhere when needed as a result
  * use `variable`
* delete "typeclass reminders" in "Module.Flat.iff_rTensor_injective'" (no
longer needed)
* whitespace fixes
* simplify file structure (`section`/`namespace`/`open`/`variable`)
bustercopley added a commit that referenced this pull request Feb 25, 2024
Generalize `Basis.tensorProduct` and `instance Module.Free.tensor`
to CommSemiring and AddCommMonoid

Plus style fixes:
* tidy up LinearAlgebra.DirectSum.Finsupp.lean:
  * delete unused `universe` declaration
  * delete duplicate `open TensorProduct`
  * delete redundant `noncomputable` annotation and associated comment
  * replace `open Classical` with `DecidableEq` type class implicit arguments
    * add `DecidableEq` elsewhere when needed as a result
  * use `variable`
* delete "typeclass reminders" in "Module.Flat.iff_rTensor_injective'" (no
longer needed)
* whitespace fixes
* simplify file structure (`section`/`namespace`/`open`/`variable`)
mathlib-bors bot pushed a commit that referenced this pull request Feb 25, 2024
Generalize `Basis.tensorProduct` and `instance Module.Free.tensor` to CommSemiring and AddCommMonoid, as a follow-up to #10828.

Plus style fixes:
* tidy up LinearAlgebra.DirectSum.Finsupp.lean:
  * delete unused `universe` declaration
  * delete duplicate `open TensorProduct`
  * delete redundant `noncomputable` annotation and associated comment (due to `noncomputable section` in the same file)
  * use `variable`
* delete "typeclass reminders" in "Module.Flat.iff_rTensor_injective'" (no longer needed)
* whitespace fixes
* simplify file structure (`section`/`namespace`/`open`/`variable`)



Co-authored-by: Richard Copley <rcopley@gmail.com>
thorimur pushed a commit that referenced this pull request Feb 26, 2024
Three files are modified, where the hypotheses are relaxed from `Ring` or `CommRing` to `Semiring` or `CommSemiring`, and `AddCommGroup` to `AddCommMonoid`.
Besides this, no definition is changed, and for one proof in `RingTheory.Flat.Basic`, I needed to add an instance (`letI`…) in the proof.
(Everything pertains to direct sums of modules.)



Co-authored-by: Antoine Chambert-Loir <antoine.chambert-loir@math.univ-paris-diderot.fr>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
riccardobrasca pushed a commit that referenced this pull request Mar 1, 2024
Three files are modified, where the hypotheses are relaxed from `Ring` or `CommRing` to `Semiring` or `CommSemiring`, and `AddCommGroup` to `AddCommMonoid`.
Besides this, no definition is changed, and for one proof in `RingTheory.Flat.Basic`, I needed to add an instance (`letI`…) in the proof.
(Everything pertains to direct sums of modules.)



Co-authored-by: Antoine Chambert-Loir <antoine.chambert-loir@math.univ-paris-diderot.fr>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
riccardobrasca pushed a commit that referenced this pull request Mar 1, 2024
Generalize `Basis.tensorProduct` and `instance Module.Free.tensor` to CommSemiring and AddCommMonoid, as a follow-up to #10828.

Plus style fixes:
* tidy up LinearAlgebra.DirectSum.Finsupp.lean:
  * delete unused `universe` declaration
  * delete duplicate `open TensorProduct`
  * delete redundant `noncomputable` annotation and associated comment (due to `noncomputable section` in the same file)
  * use `variable`
* delete "typeclass reminders" in "Module.Flat.iff_rTensor_injective'" (no longer needed)
* whitespace fixes
* simplify file structure (`section`/`namespace`/`open`/`variable`)



Co-authored-by: Richard Copley <rcopley@gmail.com>
dagurtomas pushed a commit that referenced this pull request Mar 22, 2024
Three files are modified, where the hypotheses are relaxed from `Ring` or `CommRing` to `Semiring` or `CommSemiring`, and `AddCommGroup` to `AddCommMonoid`.
Besides this, no definition is changed, and for one proof in `RingTheory.Flat.Basic`, I needed to add an instance (`letI`…) in the proof.
(Everything pertains to direct sums of modules.)



Co-authored-by: Antoine Chambert-Loir <antoine.chambert-loir@math.univ-paris-diderot.fr>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
dagurtomas pushed a commit that referenced this pull request Mar 22, 2024
Generalize `Basis.tensorProduct` and `instance Module.Free.tensor` to CommSemiring and AddCommMonoid, as a follow-up to #10828.

Plus style fixes:
* tidy up LinearAlgebra.DirectSum.Finsupp.lean:
  * delete unused `universe` declaration
  * delete duplicate `open TensorProduct`
  * delete redundant `noncomputable` annotation and associated comment (due to `noncomputable section` in the same file)
  * use `variable`
* delete "typeclass reminders" in "Module.Flat.iff_rTensor_injective'" (no longer needed)
* whitespace fixes
* simplify file structure (`section`/`namespace`/`open`/`variable`)



Co-authored-by: Richard Copley <rcopley@gmail.com>
Louddy pushed a commit that referenced this pull request Apr 15, 2024
Three files are modified, where the hypotheses are relaxed from `Ring` or `CommRing` to `Semiring` or `CommSemiring`, and `AddCommGroup` to `AddCommMonoid`.
Besides this, no definition is changed, and for one proof in `RingTheory.Flat.Basic`, I needed to add an instance (`letI`…) in the proof.
(Everything pertains to direct sums of modules.)



Co-authored-by: Antoine Chambert-Loir <antoine.chambert-loir@math.univ-paris-diderot.fr>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Louddy pushed a commit that referenced this pull request Apr 15, 2024
Generalize `Basis.tensorProduct` and `instance Module.Free.tensor` to CommSemiring and AddCommMonoid, as a follow-up to #10828.

Plus style fixes:
* tidy up LinearAlgebra.DirectSum.Finsupp.lean:
  * delete unused `universe` declaration
  * delete duplicate `open TensorProduct`
  * delete redundant `noncomputable` annotation and associated comment (due to `noncomputable section` in the same file)
  * use `variable`
* delete "typeclass reminders" in "Module.Flat.iff_rTensor_injective'" (no longer needed)
* whitespace fixes
* simplify file structure (`section`/`namespace`/`open`/`variable`)



Co-authored-by: Richard Copley <rcopley@gmail.com>
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