-
Notifications
You must be signed in to change notification settings - Fork 314
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: Let positivity
handle ENNReal
-valued ofNat
#17212
Conversation
PR summary 8d8c7cc2c8Import changes for modified filesNo significant changes to the import graph Import changes for all files
Declarations diffNo declarations were harmed in the making of this PR! 🐙 You can run this locally as follows## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/declarations_diff.sh long <optional_commit> The doc-module for |
Mathlib/Data/ENNReal/Basic.lean
Outdated
example : (0 : ℝ≥0∞) < 1 := by positivity | ||
example : (0 : ℝ≥0∞) < 2 := by positivity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might add a test for \le or \ne as well, but I'll leave it to you whether that's useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No indeed, positivity already takes care of that
Rather than having a special ENNReal-ofNat positivity extension, I think we should fix the existing positivity extension for numerals to handle this use case. Note that currently import Mathlib
example : 0 < (2:ENNReal) := by positivity -- fails
example : 0 ≤ (2:ENNReal) := by positivity -- works The reason is that in the tactic code proving @YaelDillies I am sure you are very capable of finding or inventing a typeclass which (i) holds for ENNReal and (ii) implies that positive numerals are positive. |
Well, that was easy. For some reason I remembered that |
positivity
extension for ENNReal
-valued ofNat
positivity
handle ENNReal
-valued ofNat
@@ -23,6 +23,9 @@ example : 0 ≤ 3 := by positivity | |||
|
|||
example : 0 < 3 := by positivity | |||
|
|||
example : (0 : ℝ≥0∞) < 1 := by positivity | |||
example : (0 : ℝ≥0∞) < 2 := by positivity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add a test like this?
example : (0 : ℝ≥0∞) < 3 - 2 := by positivity
(since the norm_num
positivity extension should handle that too.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't work. I suspect it's because norm_num
doesn't know about truncated subtraction.
Is your "should" meant as in "it should work" or as in "you should make it work"? I think it's pretty out of scope for this PR regardless of your answer.
In fact, my motivation here is to have positivity
prove that the L2 norm of a nonzero function is positive, and there I really don't have any truncated subtraction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was operating under the mistaken assumption that norm_num
reduces (2:ENNReal) - 1
to 1
. (It does for Nat but apparently not here.). No action required!
bors d+ |
✌️ YaelDillies can now approve this pull request. To approve and merge a pull request, simply reply with |
I will try to make the bors merge |
bors merge |
The meta code was looking for `StrictOrderedSemiring` instead of the weaker `OrderedSemiring` + `Nontrivial`, which is enough. From LeanAPAP
Pull request successfully merged into master. Build succeeded: |
positivity
handle ENNReal
-valued ofNat
positivity
handle ENNReal
-valued ofNat
The meta code was looking for
StrictOrderedSemiring
instead of the weakerOrderedSemiring
+Nontrivial
, which is enough.From LeanAPAP