leanprover / leanprover/lean4

RFC: 'Measure time to cancellation' option

Open
#5,363 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P-high RFC
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Proposal

We have been hearing reports (e.g. from @b-mehta) that expensive tactics often keep running in the background despite the fact that the document has already changed since the invocation of the tactic. Examples mentioned so far include exact?, aesop? and norm_num. This hints at the fact that tactics don't check for cancellation often enough after the language processor has signaled the elaboration task to stop.

Since this issue is difficult to spot in practice, it would be great if we had better diagnostic tools to help detect this. For a start, I propose that we add a debugging option that takes the current timestamp when the cancellation token is set and when it is read the next time and simply prints a debug message to stderr when the delta exceeds 500ms. We can then use this flag to evaluate our tactics for cancellation issues or prompt users to use it when they experience Lean gradually getting bogged down in old elaboration runs.

Impact

Add 👍 to issues you consider important. If others benefit from the changes in this proposal being added, please ask them to add 👍 to it.

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

The proposal does not name files, tests, or an entry point. Start by tracing cancellation-token handling between the language processor and elaboration tasks, then determine where the debugging option belongs. Done means the option records cancellation and next-read timestamps and reports deltas over 500ms to stderr.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.