Zulip Chat Archive

Stream: metaprogramming / tactics

Topic: positivity discharger


Casavaca (Apr 07 2024 at 02:53):

set_option trace.Tactic.positivity true in
example {x : } (h1 : 0 < x) (h2 : x  4) : (4 - x) / x  0 := by
  positivity

[Tactic.positivity] trying to prove positivity of (4 - x) / x
[Tactic.positivity] trying to prove positivity of 4 - x
[Tactic.positivity] 4 - x => none
[Tactic.positivity] (4 - x) / x => none

How can I do something like "run positivity but try linarith when you can't make it"?

Sam Ezeh (Apr 07 2024 at 04:16):

Are you looking for the first combinator?

set_option trace.Tactic.positivity true in
example {x : } (h1 : 0 < x) (h2 : x  4) : (4 - x) / x  0 := by
  first | positivity | linarith

Casavaca (Apr 07 2024 at 06:26):

No. you totally missed the point.

Casavaca (Apr 07 2024 at 06:28):

Wish list: add option to posivitity, so that something like positivity (??? := linarith) is possible?

Yaël Dillies (Apr 07 2024 at 06:56):

This is not currently possible

Yaël Dillies (Apr 07 2024 at 06:57):

Do you have more complicated statements than this that you would like to solve with a discharger?

Yaël Dillies (Apr 15 2024 at 12:55):

If not, there is thinking happening behind the scenes between @Geoffrey Irving and I to make your examples work out of the box

Yaël Dillies (Apr 15 2024 at 12:55):

cc @Casavaca

Casavaca (Apr 16 2024 at 06:52):

Not necessarily. I remembered that in my case, it has more terms, but can be solved by linarith only [h] where h is in the context. Anyway, even if we can make positivity a little bit smarter, it would help.


Last updated: May 02 2025 at 03:31 UTC