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

decide looks inside definitions marked @[irreducible] #2161

Closed
1 task done
hrmacbeth opened this issue Mar 22, 2023 · 0 comments · Fixed by #2162
Closed
1 task done

decide looks inside definitions marked @[irreducible] #2161

hrmacbeth opened this issue Mar 22, 2023 · 0 comments · Fixed by #2162

Comments

@hrmacbeth
Copy link
Contributor

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Checked that your issue isn't already filed.
    • Reduced the issue to a self-contained, reproducible test case.

Description

The tactic decide seems to be looking inside definitions marked @[irreducible]. False statements involving @[irreducible] definitions fail slowly (presumably because decide is unfolding the definitions), and true statements involving @[irreducible] definitions can be proved.

Steps to Reproduce

structure Foo where num : Nat deriving DecidableEq

namespace Foo

instance : OfNat Foo n := ⟨⟨n⟩⟩

/-! # Example 1 -/

@[irreducible] def mul (a b : Foo) : Foo :=
  let d := Nat.gcd a.num 1
  ⟨(a.num.div d) * (b.num.div d)⟩

example : ((Foo.mul 4 1).mul 1).mul 1 = 4 := by decide

/-! # Example 2 -/

@[irreducible] def add (a b : Foo) : Foo := ⟨a.num * b.num⟩

example : ((Foo.add 4 1).add 1).add 1 = 4 := by decide

Expected behavior: Expect both examples to fail quickly.

Actual behavior: Example 1 fails slowly (16s for me), and Example 2 succeeds.

Reproduces how often: 100%

Versions

nightly-2023-03-15

Additional Information

@digama0 and I encountered this while investigating the following slow example in Std:

import Std.Data.Rat.Basic

example : (4:Rat) * 1 * 1 + 4 = 0 := by decide -- fails, takes 3.17s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant