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

Duplicated error when using placeholders in simpa #5634

Closed
3 tasks done
TwoFX opened this issue Oct 7, 2024 · 0 comments · Fixed by #5648
Closed
3 tasks done

Duplicated error when using placeholders in simpa #5634

TwoFX opened this issue Oct 7, 2024 · 0 comments · Fixed by #5648
Labels
bug Something isn't working

Comments

@TwoFX
Copy link
Member

TwoFX commented Oct 7, 2024

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

The following code

example : False := by
  have htrue : True := trivial
  simpa using id _

leads to two errors: one is the expected don't know how to synthesize placeholder for argument 'a' on the underscore. However, additionally, on the entire first line of the proof, we get another don't know how to synthesize placeholder error (this time without reference to the argument).

Steps to Reproduce

  1. Copy the above code into live.lean-lang.org

Expected behavior: Only one error on the underscore

Actual behavior: A second error on the have line.

Versions

4.12.0-nightly-2024-10-03 on live.lean-lang.org

Impact

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

@TwoFX TwoFX added the bug Something isn't working label Oct 7, 2024
kmill added a commit to kmill/lean4 that referenced this issue Oct 8, 2024
Closes leanprover#5634. Before assigning the `using` clause expression to the goal, this adds a check that the expression has no new metavariables. It also admits the goal when we report new metavariables since asserting the term as a new hypothesis causes it to be linked to pre-existing goals, leading to "don't know how to synthesize placeholder" errors for them. We also throw in an occurs check immediately after elaboration to avoid some counterintuitive behavior with simp.
github-merge-queue bot pushed a commit that referenced this issue Oct 8, 2024
Closes #5634. Before assigning the simplified `using` clause expression
to the goal, this adds a check that the expression has no new
metavariables. It also adjusts how new hypotheses are added to the goal
to prevent spurious "don't know how to synthesize placeholder" errors on
that goal metavariable. We also throw in an occurs check immediately
after elaboration to avoid some counterintuitive behavior when
simplifying such a term closes the goal.

Closes #4101. This also improves the type mismatch error message,
showing the elaborated `using` clause rather than `h✝`:
```lean
example : False := by
  simpa using (fun x : True => x)
/-
error: type mismatch, term
  fun x => x
after simplification has type
  True : Prop
but is expected to have type
  False : Prop
-/
```
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.

1 participant