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] - fix: catch 'none' exception in Real.sqrt positivity extension #8014

Closed
wants to merge 1 commit into from

Conversation

dwrensha
Copy link
Member

@dwrensha dwrensha commented Oct 29, 2023

This example currently fails

example (x : ℝ) : 0 ≤ Real.sqrt x := by positivity

due to the exception being thrown here:

throwNone (pure result)

It should succeed, because the junk value used for sqrt of a negative number is non-negative.

This PR fixes it by catching the exception, a pattern used elsewhere:

let r ← catchNone <| Meta.Positivity.core zα pα e


Open in Gitpod

@dwrensha dwrensha added awaiting-review The author would like community review of the PR t-meta Tactics, attributes or user commands labels Oct 29, 2023
@dwrensha
Copy link
Member Author

@urkud
Copy link
Member

urkud commented Oct 29, 2023

Thanks! 🎉
bors merge

@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 Oct 29, 2023
bors bot pushed a commit that referenced this pull request Oct 29, 2023
This example currently fails
```lean
example (x : ℝ) : 0 ≤ Real.sqrt x := by positivity
```
due to the exception being thrown here:
https://github.com/leanprover-community/mathlib4/blob/b56efa53d7479fda9740f364170cbaef34699dee/Mathlib/Tactic/Positivity/Core.lean#L304

It should succeed, because the junk value used for `sqrt` of a negative number is non-negative.

This PR fixes it by catching the exception, a pattern used elsewhere:
https://github.com/leanprover-community/mathlib4/blob/b56efa53d7479fda9740f364170cbaef34699dee/Mathlib/Tactic/Positivity/Core.lean#L325
@bors
Copy link

bors bot commented Oct 29, 2023

Pull request successfully merged into master.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title fix: catch 'none' exception in Real.sqrt positivity extension [Merged by Bors] - fix: catch 'none' exception in Real.sqrt positivity extension Oct 29, 2023
@bors bors bot closed this Oct 29, 2023
@bors bors bot deleted the positivity-sqrt-bugfix branch October 29, 2023 15:52
grunweg pushed a commit that referenced this pull request Nov 1, 2023
This example currently fails
```lean
example (x : ℝ) : 0 ≤ Real.sqrt x := by positivity
```
due to the exception being thrown here:
https://github.com/leanprover-community/mathlib4/blob/b56efa53d7479fda9740f364170cbaef34699dee/Mathlib/Tactic/Positivity/Core.lean#L304

It should succeed, because the junk value used for `sqrt` of a negative number is non-negative.

This PR fixes it by catching the exception, a pattern used elsewhere:
https://github.com/leanprover-community/mathlib4/blob/b56efa53d7479fda9740f364170cbaef34699dee/Mathlib/Tactic/Positivity/Core.lean#L325
fgdorais pushed a commit that referenced this pull request Nov 1, 2023
This example currently fails
```lean
example (x : ℝ) : 0 ≤ Real.sqrt x := by positivity
```
due to the exception being thrown here:
https://github.com/leanprover-community/mathlib4/blob/b56efa53d7479fda9740f364170cbaef34699dee/Mathlib/Tactic/Positivity/Core.lean#L304

It should succeed, because the junk value used for `sqrt` of a negative number is non-negative.

This PR fixes it by catching the exception, a pattern used elsewhere:
https://github.com/leanprover-community/mathlib4/blob/b56efa53d7479fda9740f364170cbaef34699dee/Mathlib/Tactic/Positivity/Core.lean#L325
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
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants