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

Can't use omega as a simp discharger #3805

Closed
1 task done
fpfu opened this issue Mar 29, 2024 · 3 comments · Fixed by #3828
Closed
1 task done

Can't use omega as a simp discharger #3805

fpfu opened this issue Mar 29, 2024 · 3 comments · Fixed by #3828
Assignees
Labels
bug Something isn't working

Comments

@fpfu
Copy link

fpfu commented Mar 29, 2024

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Check that your issue is not already filed.
    • Reduce the issue to a minimal, self-contained, reproducible test case. Avoid dependencies to mathlib4 or std4.

Description

Context

Steps to Reproduce

--import Mathlib.Tactic.Linarith

variable {x y: Nat} {p: Nat → Nat → Prop}
theorem Foo (h: ¬ y < x): p x y := sorry

set_option trace.Meta.Tactic.simp.discharge true
  example (h:   x < y): p x y := by simp (discharger:= omega     ) only [Foo] -- [Meta.Tactic.simp.discharge] @Foo discharge ❌ ¬y < x
  example (h:  ¬y < x): p x y := by simp (discharger:= assumption) only [Foo] -- [Meta.Tactic.simp.discharge] @Foo discharge ✅ ¬y < x
--example (h:   x < y): p x y := by simp (discharger:= linarith  ) only [Foo] -- also works

Expected behavior: omega can be used as discharger

Actual behavior: omega fails to discharge ¬y < x target

Versions

4.7.0-rc2

Additional Information

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

@fpfu fpfu added the bug Something isn't working label Mar 29, 2024
@kim-em
Copy link
Collaborator

kim-em commented Apr 1, 2024

It appears that omega is not even being called here: not even the first analyzing n hypotheses: trace message from omega gets printed:

import Mathlib.Tactic.Linarith

variable {x y: Nat} {p: Nat → Nat → Prop}
theorem Foo (h: ¬ y < x): p x y := sorry

set_option trace.omega true 
set_option trace.linarith true
set_option trace.Meta.Tactic.simp.discharge true

example (h:   x < y): p x y := by apply Foo; omega 
example (h:   x < y): p x y := by simp (discharger:= omega     ) only [Foo] -- [Meta.Tactic.simp.discharge] @Foo discharge ❌ ¬y < x
example (h:  ¬y < x): p x y := by simp (discharger:= assumption) only [Foo] -- [Meta.Tactic.simp.discharge] @Foo discharge ✅ ¬y < x
example (h:   x < y): p x y := by simp (discharger:= linarith  ) only [Foo] -- also works

@fpfu
Copy link
Author

fpfu commented Apr 1, 2024

I assume that the log from the user's discharger is simply discarded

@kim-em
Copy link
Collaborator

kim-em commented Apr 1, 2024

Possibly, I haven't had a chance to look at the code yet. Notice that the log from linarith is not discarded, however. It's possible that logs only from failed dischargers are discarded, but it seems unlikely.

@kim-em kim-em self-assigned this Apr 2, 2024
github-merge-queue bot pushed a commit that referenced this issue Apr 3, 2024
Possibly the more principled fix is to not have `simp` invoke
dischargers under `withReducible`.

In the meantime, this ensures that `falseOrByContra` still succeeds with
`intro1` on a `Not` goal, which previously was breaking `omega` as a
simp discharger.

Closes #3805.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants