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(algebra/ordered_ring): more granular typeclasses for with_top α and with_bot α #7845

Closed
wants to merge 9 commits into from

Conversation

eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented Jun 8, 2021

with_top α and with_bot α now inherit the following typeclasses from α with suitable assumptions:

  • mul_zero_one_class
  • semigroup_with_zero
  • monoid_with_zero
  • comm_monoid_with_zero

These were all split out of the existing canonically_ordered_comm_semiring, with their proofs unchanged.
The same instances are added for with_bot.

It is not possible to split further, as distrib' requires add_eq_zero_iff, and canonically_ordered_comm_semiring is the smallest typeclass that provides both this lemma and mul_zero_class.

With these instances in place, we can now show comm_monoid_with_zero ereal.


Open in Gitpod

`with_top α` now inherits the following typeclasses from `α` with suitable assumptions:

* `mul_zero_one_class`
* `semigroup_with_zero`
* `monoid_with_zero`
* `comm_monoid_with_zero`

These were all split out of the existing `canonically_ordered_comm_semiring`, with their proofs unchanged.

It is not possible to split further, as `distrib'` requires `add_eq_zero_iff`, and `canonically_ordered_comm_semiring` is the smallest typeclass that provides both this lemma and `mul_zero_class`.
@eric-wieser eric-wieser added the awaiting-review The author would like community review of the PR label Jun 8, 2021
@eric-wieser eric-wieser added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Jun 8, 2021
@eric-wieser eric-wieser added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Jun 9, 2021
@eric-wieser eric-wieser changed the title feat(algebra/ordered_ring): more granular typeclasses for with_top α feat(algebra/ordered_ring): more granular typeclasses for with_top α and with_bot α Jun 9, 2021
@eric-wieser eric-wieser requested a review from sgouezel June 9, 2021 09:42
src/algebra/ordered_ring.lean Outdated Show resolved Hide resolved
with_top.coe_mul.symm.trans $
with_bot.coe_eq_coe.mpr $ with_bot.mul_bot $ function.injective.ne (@option.some.inj _) h

lemma to_real_mul : ∀ {x y : ereal} (hx : x ≠ ⊤) (h'x : x ≠ ⊥) (hy : y ≠ ⊤) (h'y : y ≠ ⊥),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this holds without any assumptions on x or y.

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 copied this lemma from the one about add, but maybe you're right

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, I was able to remove all the assumptions.

@sgouezel sgouezel added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Jun 9, 2021
eric-wieser and others added 3 commits June 9, 2021 21:30
Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr>
…-community/mathlib into ericwieser/nnreal_mul_actions
@eric-wieser eric-wieser added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Jun 9, 2021
@sgouezel
Copy link
Collaborator

bors r+

@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 Jun 10, 2021
bors bot pushed a commit that referenced this pull request Jun 10, 2021
…` and `with_bot α` (#7845)

`with_top α` and `with_bot α` now inherit the following typeclasses from `α` with suitable assumptions:

* `mul_zero_one_class`
* `semigroup_with_zero`
* `monoid_with_zero`
* `comm_monoid_with_zero`

These were all split out of the existing `canonically_ordered_comm_semiring`, with their proofs unchanged.
The same instances are added for `with_bot`.

It is not possible to split further, as `distrib'` requires `add_eq_zero_iff`, and `canonically_ordered_comm_semiring` is the smallest typeclass that provides both this lemma and `mul_zero_class`.

With these instances in place, we can now show `comm_monoid_with_zero ereal`.
@bors
Copy link

bors bot commented Jun 10, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(algebra/ordered_ring): more granular typeclasses for with_top α and with_bot α [Merged by Bors] - feat(algebra/ordered_ring): more granular typeclasses for with_top α and with_bot α Jun 10, 2021
@bors bors bot closed this Jun 10, 2021
@bors bors bot deleted the ericwieser/nnreal_mul_actions branch June 10, 2021 22:02
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+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants