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

fix: have simpa ... using ... do exact-like checks #5648

Merged
merged 10 commits into from
Oct 8, 2024

Conversation

kmill
Copy link
Collaborator

@kmill kmill commented 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✝:

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
-/

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.
@kmill kmill requested a review from digama0 as a code owner October 8, 2024 06:49
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Oct 8, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 8, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Oct 8, 2024
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Oct 8, 2024

Mathlib CI status (docs):

@leanprover-community-bot leanprover-community-bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Oct 8, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 8, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Oct 8, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 8, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Oct 8, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 8, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Oct 8, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 8, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Oct 8, 2024
@leanprover-community-bot leanprover-community-bot added builds-mathlib CI has verified that Mathlib builds against this PR and removed breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan labels Oct 8, 2024
@kmill kmill enabled auto-merge October 8, 2024 22:56
@kmill kmill added this pull request to the merge queue Oct 8, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 8, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Oct 8, 2024
Merged via the queue into leanprover:master with commit 15bb8a2 Oct 8, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builds-mathlib CI has verified that Mathlib builds against this PR toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicated error when using placeholders in simpa simpa type mismatch error message could be improved
2 participants