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_sub): define truncated subtraction in general #8503

Closed
wants to merge 36 commits into from

Conversation

fpvandoorn
Copy link
Member

@fpvandoorn fpvandoorn commented Aug 1, 2021

  • Define and prove properties of truncated subtraction in general
  • We currently only instantiate it for nat. The other types (multiset, finsupp, nnreal, ennreal, ...) will be in future PRs.

Todo in future PRs:

  • Provide has_ordered_sub instances for all specific cases
  • Remove the lemmas specific to each individual type

Open in Gitpod

@fpvandoorn fpvandoorn added the WIP Work in progress label Aug 1, 2021
@fpvandoorn fpvandoorn added awaiting-review The author would like community review of the PR and removed WIP Work in progress labels Aug 2, 2021
@github-actions github-actions bot added the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Aug 6, 2021
@github-actions github-actions bot removed the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Aug 8, 2021
@github-actions github-actions bot added the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Aug 13, 2021
@github-actions github-actions bot removed the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Aug 16, 2021
src/algebra/ordered_monoid.lean Outdated Show resolved Hide resolved
src/algebra/ordered_monoid.lean Outdated Show resolved Hide resolved
src/algebra/ordered_sub.lean Outdated Show resolved Hide resolved
@@ -467,166 +468,137 @@ end
@[simp] lemma pred_one_add (n : ℕ) : pred (1 + n) = n :=
by rw [add_comm, add_one, pred_succ]

/-! ### `sub` -/
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the motivation for deleting some lemmas and keeping some with a new proof?

Copy link
Member Author

Choose a reason for hiding this comment

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

The goal is to remove (basically) all of them, and only use the lemmas that are proven for general types. But I'll do that in future PRs (that is what I meant by "Remove the lemmas specific to each individual type").
I currently replace the proof to show that we have the general lemma.

I have already removed a couple of lemmas, but I'll do the rest in future PRs

src/algebra/ordered_sub.lean Show resolved Hide resolved
section ordered_add_comm_monoid
variables {a b c d : α} [partial_order α] [add_comm_monoid α] [has_sub α] [has_ordered_sub α]

@[simp] lemma sub_le_iff_right : a - b ≤ c ↔ a ≤ c + b :=
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you explain how you selected this set of lemmas for the remainder of the file? Is it based on what we have already proven for ℕ + any intermediate results needed for them?

Copy link
Member Author

Choose a reason for hiding this comment

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

It was mostly the stuff proven for nat;
Some of it was proven for another specific type like ennreal;
Some of the lemmas were variations on already existing lemmas (for example: for nat and iff was proven, and contravariant_class is needed for one direction. That results in 3 lemmas: the direction that always holds without assumptions, the iff under an add_le_cancellable assumption and the iff under an contravariant_class assumption);
Some of the lemmas are analogues of subtraction lemmas from ordered_group (often with additional assumptions in this file).

@Vierkantor Vierkantor 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 Aug 16, 2021
@fpvandoorn
Copy link
Member Author

Thanks for the review!

@fpvandoorn fpvandoorn 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 Aug 16, 2021
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.

LGTM! Thanks 🐙 🎉

bors d+

Comment on lines 641 to 642


Copy link
Member

Choose a reason for hiding this comment

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

Are these intentional?

@bors
Copy link

bors bot commented Aug 18, 2021

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

@github-actions github-actions bot added delegated The PR author may merge after reviewing final suggestions. and removed awaiting-review The author would like community review of the PR labels Aug 18, 2021
@fpvandoorn
Copy link
Member Author

bors merge

@github-actions github-actions bot added the ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) label Aug 18, 2021
bors bot pushed a commit that referenced this pull request Aug 18, 2021
…8503)

* Define and prove properties of truncated subtraction in general
* We currently only instantiate it for `nat`. The other types (`multiset`, `finsupp`, `nnreal`, `ennreal`, ...) will be in future PRs.

Todo in future PRs:
* Provide `has_ordered_sub` instances for all specific cases
* Remove the lemmas specific to each individual type



Co-authored-by: Floris van Doorn <fpv@andrew.cmu.edu>
@bors
Copy link

bors bot commented Aug 18, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(algebra/ordered_sub): define truncated subtraction in general [Merged by Bors] - feat(algebra/ordered_sub): define truncated subtraction in general Aug 18, 2021
@bors bors bot closed this Aug 18, 2021
@bors bors bot deleted the ordered_sub_new branch August 18, 2021 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated The PR author may merge after reviewing final suggestions. 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

5 participants