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

mdata bug affecting interaction of simp and match #2173

Closed
1 task done
semorrison opened this issue Mar 28, 2023 · 1 comment · Fixed by #2177
Closed
1 task done

mdata bug affecting interaction of simp and match #2173

semorrison opened this issue Mar 28, 2023 · 1 comment · Fixed by #2177
Labels
bug Something isn't working

Comments

@semorrison
Copy link
Collaborator

semorrison commented Mar 28, 2023

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

Running simp (config := {decide := false}) inside a branch of a match statement will often leave an unsolved goal True.
This behaviour has been hidden by the default decide := true, which subsequently closes the True.

Steps to Reproduce

example : 0 = 0 := by
  simp (config := {decide := false}) -- Works fine.

example (n : Nat) : 0 = 0 := by
  match n with
  | 0 => simp (config := {decide := false}) -- Fails: unsolved goal `True`
  | _ => simp

example (n : Nat) : 0 = 0 := by
  match n with
  | 0 => simp (config := {decide := true}) -- this is the default, so masks the problem?
  | _ => simp

Expected behavior:
All three examples to work.

Actual behavior:
The second example fails in the 0 branch, with unsolved goal True.

@Kha says "this looks like an mdata bug. pp.raw + trace_state uncovers the difference."

⊢ Eq.{1} Nat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))

n : Nat
⊢ [mdata noImplicitLambda:1 Eq.{1} Nat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))]

Reproduces how often:

Always.

Versions

Lean (version 4.0.0-nightly-2023-03-17, commit 8650804, Release)

Additional Information

Reported on zulip.

@gebner gebner added the bug Something isn't working label Mar 30, 2023
@gebner
Copy link
Member

gebner commented Mar 30, 2023

Here are some other related failures:

example : True := by
  have : True := ⟨⟩
  simp (config := {decide := false}) -- unsolved goals

example : True := by
  let x : True := ⟨⟩
  simp (config := {decide := false}) -- unsolved goals

example : True := by
  suffices True by simp (config := {decide := false}) -- unsolved goals
  constructor

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