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/direct_sum): rework internally-graded objects #10127

Closed
wants to merge 8 commits into from

Conversation

eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented Nov 2, 2021

This is a replacement for the graded_ring.core typeclass in #10115, which is called set_like.graded_monoid here. The advantage of this approach is that we can use the same typeclass for graded semirings, graded rings, and graded algebras.

Largely, this change replaces a bunch of defs with instances, by bundling up the arguments to those defs to a new typeclass. This seems to make life easier for the few global gmonoid instance we already provide for direct sums of submodules, suggesting this API change is a useful one.

In principle the new [set_like.graded_monoid A] typeclass is useless, as the same effect can be achieved with [set_like.has_graded_one A] [set_like.has_graded_mul A]; pragmatically though this is painfully verbose, and probably results in larger term sizes. We can always remove it later if it causes problems.


This does not fully replace #10115: that PR also provides

class graded_ring extends graded_ring.core R A :=
( decompose : R → ⨁ i, A i)
( left_inv : function.left_inverse decompose (direct_sum.add_subgroup_coe A) )
( right_inv : function.right_inverse decompose (direct_sum.add_subgroup_coe A) )

We still want that class or something similar to it (replacing graded_ring.core with set_like.graded_monoid), but I deliberately leave it out of scope for this PR.

Open in Gitpod

@eric-wieser eric-wieser added the WIP Work in progress label Nov 2, 2021
@eric-wieser eric-wieser added this to In progress in Graded modules, rings, and algebras via automation Nov 2, 2021
@eric-wieser eric-wieser added awaiting-review The author would like community review of the PR and removed WIP Work in progress labels Nov 3, 2021

* `direct_sum.add_submonoid_coe_ring_hom` (a `ring_hom` version of `direct_sum.add_submonoid_coe`)
* `direct_sum.add_subgroup_coe_ring_hom` (a `ring_hom` version of `direct_sum.add_subgroup_coe`)
* `direct_sum.submodule_coe_ring_hom` (an `alg_hom` version of `direct_sum.submodule_coe`)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* `direct_sum.submodule_coe_ring_hom` (an `alg_hom` version of `direct_sum.submodule_coe`)
* `direct_sum.submodule_coe_alg_hom` (an `alg_hom` version of `direct_sum.submodule_coe`)

Copy link
Member Author

Choose a reason for hiding this comment

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

Whoops, nice catch; don't write docstrings at 2am!

src/algebra/direct_sum/internal.lean Outdated Show resolved Hide resolved
src/algebra/direct_sum/internal.lean Outdated Show resolved Hide resolved
src/algebra/direct_sum/internal.lean Outdated Show resolved Hide resolved
Co-authored-by: Johan Commelin <johan@commelin.net>
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 merge

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Nov 3, 2021
bors bot pushed a commit that referenced this pull request Nov 3, 2021
This is a replacement for the `graded_ring.core` typeclass in #10115, which is called `set_like.graded_monoid` here. The advantage of this approach is that we can use the same typeclass for graded semirings, graded rings, and graded algebras.

Largely, this change replaces a bunch of `def`s with `instances`, by bundling up the arguments to those defs to a new typeclass. This seems to make life easier for the few global `gmonoid` instance we already provide for direct sums of submodules, suggesting this API change is a useful one.

In principle the new `[set_like.graded_monoid A]` typeclass is useless, as the same effect can be achieved with `[set_like.has_graded_one A] [set_like.has_graded_mul A]`; pragmatically though this is painfully verbose, and probably results in larger term sizes. We can always remove it later if it causes problems.



Co-authored-by: Jujian Zhang <jujian.zhang1998@outlook.com>
@bors
Copy link

bors bot commented Nov 3, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title refactor(algebra/direct_sum): rework internally-graded objects [Merged by Bors] - refactor(algebra/direct_sum): rework internally-graded objects Nov 3, 2021
@bors bors bot closed this Nov 3, 2021
Graded modules, rings, and algebras automation moved this from In progress to Done Nov 3, 2021
@bors bors bot deleted the eric-wieser/graded_subobjects branch November 3, 2021 22:44
ericrbg pushed a commit that referenced this pull request Nov 9, 2021
This is a replacement for the `graded_ring.core` typeclass in #10115, which is called `set_like.graded_monoid` here. The advantage of this approach is that we can use the same typeclass for graded semirings, graded rings, and graded algebras.

Largely, this change replaces a bunch of `def`s with `instances`, by bundling up the arguments to those defs to a new typeclass. This seems to make life easier for the few global `gmonoid` instance we already provide for direct sums of submodules, suggesting this API change is a useful one.

In principle the new `[set_like.graded_monoid A]` typeclass is useless, as the same effect can be achieved with `[set_like.has_graded_one A] [set_like.has_graded_mul A]`; pragmatically though this is painfully verbose, and probably results in larger term sizes. We can always remove it later if it causes problems.



Co-authored-by: Jujian Zhang <jujian.zhang1998@outlook.com>
bors bot pushed a commit to leanprover-community/mathlib4 that referenced this pull request May 17, 2023
Deletes a section that was always content-free, as well as a reference to code that was removed in leanprover-community/mathlib#10127.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Development

Successfully merging this pull request may close these issues.

None yet

3 participants