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): add lemma #6031

Closed
wants to merge 5 commits into from

Conversation

adomani
Copy link
Collaborator

@adomani adomani commented Feb 3, 2021

Add a lemma in algebra.ordered_ring proving the inequality a + (2 + b) ≤ a * (2 + b).

This is again part of the Liouville PR.


@@ -136,6 +136,12 @@ lemma le_mul_of_one_le_left (hb : 0 ≤ b) (h : 1 ≤ a) : b ≤ a * b :=
suffices 1 * b ≤ a * b, by rwa one_mul at this,
mul_le_mul_of_nonneg_right h hb

lemma add_le_mul_two_add [nontrivial α] {a b : α}
(a2 : 2 ≤ a) (b0 : 0 ≤ b) : a + (2 + b) ≤ a * (2 + b) :=
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if a more useful statement would be

Suggested change
(a2 : 2 ≤ a) (b0 : 0 ≤ b) : a + (2 + b) ≤ a * (2 + b) :=
(a2 : 2 ≤ a) (b0 : 2 ≤ b) : a + b ≤ a * b :=

It would certainly be easier to name (add_le_mul)

Copy link
Member

Choose a reason for hiding this comment

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

Oh, maybe this is not true!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My intended application is indeed in the form that you suggest, for natural numbers. However, I was not able to prove the lemma that you stated in this level of generality.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried to put the version below somewhere else in this file but Lean says that it cannot produce the instance ordered_semiring α. I do not have examples of pathological canonically_ordered_comm_semirings, but it seems that they may not be ordered_semirings with added features.

Notice that the lemma below, also removing the @, works for , which is what I really care about.

lemma add_le_mul {α : Type*} [canonically_ordered_comm_semiring α] [nontrivial α]
  {a b : α} (a2 : 2 ≤ a) (b2 : 2 ≤ b) : a + b ≤ a * b :=
begin
  rcases (le_iff_exists_add).mp b2 with ⟨k, rfl⟩,
  exact @add_le_mul_two_add _ _ _ a k a2 k.zero_le
end

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am starting to get the impression that there is a missing instance, since a c_o_c_semiring is an ordered, commutative semiring with ... but the attempt below fails.

instance cosr {α : Type*} [canonically_ordered_comm_semiring α] : ordered_semiring α :=
by apply_instance

Copy link
Collaborator Author

@adomani adomani Feb 4, 2021

Choose a reason for hiding this comment

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

I am giving up trying to prove the result that I want in this generality, since I only care about it for the natural numbers.

Something appears to be weird around the left-cancellative property of addition, if I understand correctly the issue.

Copy link
Member

Choose a reason for hiding this comment

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

I set this problem to the Xena Discord last night, and the consensus is that it may be false. @b-mehta was attempting to construct a pathological semiring to verify that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, I was going to ask on Zulip... do you want to do it yourself, or should I go ahead?

Copy link
Member

Choose a reason for hiding this comment

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

Go ahead. I'll probably try to fix the typeclass issue you mentioned, but I don't intend to spend more time myself working out if the modified statement is true! We were able to prove 2*(a+b) ≤ 2*(a*b), but there's no way to cancel the two

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, this 2*x ≤ 2*y implying x ≤ y may be the culprit. I wonder if there is some kind of 2-torsion that is allowed on canonically_ordered_... that may make the statement actually false.

@adomani
Copy link
Collaborator Author

adomani commented Feb 4, 2021

Eric, I am tempted to leave this lemma where it is, as it is true and proved.

I am planning to include in a separate PR the lemma that Johan proved, on linear_ordered_semirings. Does this sound reasonable? Or should I remove the lemma in this PR and only prove the other one?

@b-mehta
Copy link
Collaborator

b-mehta commented Feb 4, 2021

With #6034, the nontriviality assumption here is unnecessary.

@eric-wieser
Copy link
Member

Worse than unnecessary, I think it will cause the lint build to fail.

@bryangingechen bryangingechen added the awaiting-author A reviewer has asked the author a question or requested changes label Feb 4, 2021
@adomani
Copy link
Collaborator Author

adomani commented Feb 4, 2021

If I managed to merge/leanproject up and push in the correct order, I should have removed the nontrivial assumption!

Thanks for picking this up!

@adomani adomani 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 Feb 4, 2021
Copy link
Collaborator

@bryangingechen bryangingechen 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 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 Feb 6, 2021
bors bot pushed a commit that referenced this pull request Feb 6, 2021
Add a lemma in algebra.ordered_ring proving the inequality `a + (2 + b) ≤ a * (2 + b)`.

This is again part of the Liouville PR.
@bors
Copy link

bors bot commented Feb 7, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(algebra/ordered_ring): add lemma [Merged by Bors] - feat(algebra/ordered_ring): add lemma Feb 7, 2021
@bors bors bot closed this Feb 7, 2021
@bors bors bot deleted the add_le_mul branch February 7, 2021 02:14
b-mehta pushed a commit that referenced this pull request Apr 2, 2021
Add a lemma in algebra.ordered_ring proving the inequality `a + (2 + b) ≤ a * (2 + b)`.

This is again part of the Liouville PR.
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

4 participants