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: positivity extension for zpow #8003
Conversation
Mathlib/Tactic/Positivity/Basic.lean
Outdated
let _a ← synthInstanceQ q(LinearOrderedField $α) | ||
haveI' : $e =Q $a ^ $b := ⟨⟩ | ||
assumeInstancesCommute | ||
pure (by exact .nonnegative q(zpow_bit0_nonneg $a $m)) |
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.
Is it possible to use Even.zpow_nonneg
here, instead of zpow_bit0_nonneg
? Would that remove the need for the linter.deprecated false
?
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.
Yes (see the current version), but this adds extra imports (namely Mathlib.Data.Int.Parity
) to get Int.even_iff
, and the way it's coded now the unusedHavesSuffices
linter flags a line that doesn't seem spurious (at least I don't know how to remove it). Doesn't seem worth it unless we're actually planning to remove bit0
entirely.
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.
Hm... I think I agree that we should try to avoid adding that new dependency.
In your original code, you can dodge linter.deprecated
by doing this:
- haveI' : $b =Q bit0 $m := ⟨⟩
+ haveI' : $b =Q $m + $m := ⟨⟩ -- b = bit0 m
That seems better to me than disabling the linter for the entire declaration.
Mathlib/Tactic/Positivity/Basic.lean
Outdated
let _a ← synthInstanceQ q(LinearOrderedField $α) | ||
haveI' : $e =Q $a ^ $b := ⟨⟩ | ||
assumeInstancesCommute | ||
pure (by exact .nonnegative q(zpow_bit0_nonneg $a $m)) |
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.
Hm... I think I agree that we should try to avoid adding that new dependency.
In your original code, you can dodge linter.deprecated
by doing this:
- haveI' : $b =Q bit0 $m := ⟨⟩
+ haveI' : $b =Q $m + $m := ⟨⟩ -- b = bit0 m
That seems better to me than disabling the linter for the entire declaration.
What's the situation here? I would like this in mathlib 😄 |
I reverted this to the initial version of the PR, before my first comment, and I switched to the more localized way of suppressing the linter that I suggested above. |
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.
LGTM!
maintainer merge
🚀 Pull request has been placed on the maintainer queue by YaelDillies. |
bors merge |
This PR adds a positivity extension for integer powers, i.e. `a ^ (r : ℤ)`. It's basically copy-pasted from the natural power extension. Note that this makes the imports of `Mathlib.Tactic.Positivity.Basic` slightly heavier since the required lemmas were not there (and the relevant file doesn't import positivity so I couldn't put it there either). It's probably not too bad, but I can put it in a new file if people think this would be better. Co-authored-by: David Renshaw <dwrenshaw@gmail.com>
Pull request successfully merged into master. Build succeeded: |
This PR adds a positivity extension for integer powers, i.e. `a ^ (r : ℤ)`. It's basically copy-pasted from the natural power extension. Note that this makes the imports of `Mathlib.Tactic.Positivity.Basic` slightly heavier since the required lemmas were not there (and the relevant file doesn't import positivity so I couldn't put it there either). It's probably not too bad, but I can put it in a new file if people think this would be better. Co-authored-by: David Renshaw <dwrenshaw@gmail.com>
This PR adds a positivity extension for integer powers, i.e.
a ^ (r : ℤ)
. It's basically copy-pasted from the natural power extension. Note that this makes the imports ofMathlib.Tactic.Positivity.Basic
slightly heavier since the required lemmas were not there (and the relevant file doesn't import positivity so I couldn't put it there either). It's probably not too bad, but I can put it in a new file if people think this would be better.