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(tactic/positivity): Handle a ≠ 0 assumptions #16529

Closed
wants to merge 24 commits into from

Conversation

YaelDillies
Copy link
Collaborator

@YaelDillies YaelDillies commented Sep 16, 2022

Make positivity handle a ≠ 0 assumptions. This involves

  • adding a third constructor to positivity.strictness, that I've called nonzero. It is meant to hold proofs of a ≠ 0, not 0 ≠ a
  • modifying the existing extensions to handle that new case.
  • changing positivity.orelse' to account for the fact that if we can prove 0 ≤ a and a ≠ 0 then we can prove 0 < a.
  • making compare_hyp handle eq and ne hypotheses.

Other changes

  • Introduce tac1 ≤|≥ tac2 as notation for positivity.orelse' tac1 tac2. This has the same precedence as the <|> notation for orelse.
  • Make positivity extensions fail with more informative error messages. This is useless when running positivity alone but:
    • It clearly marks within the code what each failure means
    • The errors can show up when calling an extension directly. Not sure why you would do that, but you could.
  • Add a has_to_format strictness instance. This is mostly useful for debugging.

Open in Gitpod

@YaelDillies YaelDillies added awaiting-review The author would like community review of the PR t-meta Tactics, attributes or user commands t-algebra Algebra (groups, rings, fields etc) t-order Order hierarchy labels Sep 16, 2022
Copy link
Collaborator

@Vierkantor Vierkantor left a comment

Choose a reason for hiding this comment

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

bors d+

mul_inv_cancel := λ I, fractional_ideal.mul_inv_cancel,
.. fractional_ideal.comm_semiring }
.. fractional_ideal.comm_semiring, ..(coe_to_fractional_ideal_injective le_rfl).nontrivial }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure why this is included here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The simpa call failed because simp now closes the goal thanks to the change to bot_ne_top. It was easier to golf than to fix.

src/tactic/positivity.lean Outdated Show resolved Hide resolved
@bors
Copy link

bors bot commented Oct 4, 2022

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

@leanprover-community-bot-assistant leanprover-community-bot-assistant added the delegated The PR author may merge after reviewing final suggestions. label Oct 4, 2022
@leanprover-community-bot-assistant leanprover-community-bot-assistant removed the awaiting-review The author would like community review of the PR label Oct 4, 2022
@YaelDillies
Copy link
Collaborator Author

bors merge

bors bot pushed a commit that referenced this pull request Oct 5, 2022
Make `positivity` handle `a ≠ 0` assumptions. This involves
* adding a third constructor to `positivity.strictness`, that I've called `nonzero`. It is meant to hold proofs of `a ≠ 0`, not `0 ≠ a`
* modifying the existing extensions to handle that new case.
* changing `positivity.orelse'` to account for the fact that if we can prove `0 ≤ a` and `a ≠ 0` then we can prove `0 < a`.
* making `compare_hyp` handle `eq` and `ne` hypotheses.

## Other changes

* Introduce `tac1 ≤|≥ tac2` as notation for `positivity.orelse' tac1 tac2`. This has the same precedence as the `<|>` notation for `orelse`.
* Make `positivity` extensions fail with more informative error messages. This is useless when running `positivity` alone but:
  * It clearly marks within the code what each failure means
  * The errors can show up when calling an extension directly. Not sure why you would do that, but you could.
* Add a `has_to_format strictness` instance. This is mostly useful for debugging.
@bors
Copy link

bors bot commented Oct 5, 2022

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(tactic/positivity): Handle a ≠ 0 assumptions [Merged by Bors] - feat(tactic/positivity): Handle a ≠ 0 assumptions Oct 5, 2022
@bors bors bot closed this Oct 5, 2022
@bors bors bot deleted the positivity_nonzero branch October 5, 2022 12:40
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. t-algebra Algebra (groups, rings, fields etc) t-meta Tactics, attributes or user commands t-order Order hierarchy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants