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: add Inv, Abs, and natAbs positivity extensions #1190

Closed
wants to merge 8 commits into from

Conversation

dwrensha
Copy link
Member

@dwrensha dwrensha commented Dec 23, 2022

Adds positivity extensions for inversion, absolute value, and natAbs.

Compare the the mathlib3 versions here, here, and here.

For the absolute value case, I got stuck trying to make it work in the fully Qq-ified style, so I fell back to the AppBuilder style that's closer to how mathlib3 does it.

@dwrensha dwrensha added the awaiting-review The author would like community review of the PR label Dec 23, 2022

/-- Port note: in mathlib3 this alias is `private`, but mathlib4's `alias` does not
(yet) support that. -/
alias abs_pos ↔ _ abs_pos_of_ne_zero
Copy link
Member

Choose a reason for hiding this comment

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

Mathlib3's alias doesn't support private either. I think the statement should just be written out.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done -- rewritten as a private theroem.

alias abs_pos ↔ _ abs_pos_of_ne_zero

/-- The `positivity` extension which identifies expressions of the form `|a|`. -/
@[positivity |(_ : α)|, Abs.abs _]
Copy link
Member

Choose a reason for hiding this comment

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

These two patterns are the same. The reason add and mul have two patterns instead of one is because they match both HAdd.hAdd and Add.add.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, and similar for evalInv.

@dwrensha dwrensha changed the title feat: add Abs and Inv positivity extensions feat: add Inv, Abs, and natAbs positivity extensions Dec 24, 2022
@hrmacbeth hrmacbeth added the t-meta Tactics, attributes or user commands label Jan 2, 2023
@gebner
Copy link
Member

gebner commented Jan 5, 2023

bors r+

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review The author would like community review of the PR labels Jan 5, 2023
bors bot pushed a commit that referenced this pull request Jan 5, 2023
Adds `positivity` extensions for inversion, absolute value, and natAbs.

Compare the the mathlib3 versions [here](https://github.com/leanprover-community/mathlib/blob/3813d4ea1c6a34dbb472de66e73b8c6855b03964/src/tactic/positivity.lean#L535-L546), [here](https://github.com/leanprover-community/mathlib/blob/3813d4ea1c6a34dbb472de66e73b8c6855b03964/src/tactic/positivity.lean#L616-L631), and [here](https://github.com/leanprover-community/mathlib/blob/09258fb7f75d741b7eda9fa18d5c869e2135d9f1/src/tactic/positivity.lean#L633-L650).

For the absolute value case, I got stuck trying to make it work in the fully `Qq`-ified style, so I fell back to the `AppBuilder` style that's closer to how mathlib3 does it.
@bors
Copy link

bors bot commented Jan 5, 2023

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat: add Inv, Abs, and natAbs positivity extensions [Merged by Bors] - feat: add Inv, Abs, and natAbs positivity extensions Jan 5, 2023
@bors bors bot closed this Jan 5, 2023
@bors bors bot deleted the dwrensha-positivity branch January 5, 2023 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR has been sent to bors. t-meta Tactics, attributes or user commands
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants