leanprover-community / leanprover-community/lean

prove_goal_async fails when there are instances in the context

Open
#242 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
434
Forks
79
PR merge metrics
No merged PRs in 30d

Description

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 first thing prove_goal_async tries to do is revert everything in the context, but if there are frozen instances then this fails.

Steps to Reproduce
example {α : Type} [inhabited α] (x : α) : x = x :=
begin
do
  -- tactic.unfreeze_local_instances,
  tactic.prove_goal_async `[refl]
end

Expected behavior: The goal is solved

Actual behavior:

/home/rwbarton/lean/mathlib/obviously/bug.lean:3:0: error: failed to revert '_inst_1', it is a frozen local instance (possible solution: use tactic `tactic.unfreeze_local_instances` to reset the set of local instances)
state:
α : Type,
_inst_1 : inhabited α,
x : α
⊢ x = x

Uncommenting tactic.unfreeze_local_instances fixes this, but probably prove_goal_async should take care of this? The fact that it uses revert is an implementation detail.

In theory maybe should "refreeze" the originally frozen instances in the context in which the inner tactic will eventually run? Maybe it's not worth worrying about.

Reproduces how often: Always

Versions

Lean (version 3.11.0, commit fb3f3e88be8a, Release)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the implementation of tactic.prove_goal_async and reproduce the provided Lean example with a frozen local instance. Trace the initial context reversion and verify that the example succeeds without requiring tactic.unfreeze_local_instances, while preserving the intended behavior for asynchronous tactics.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.