leanprover / leanprover/lean4

`try_for` tactic (timeouts in tactics)

Open
#3,812 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The situation does not seem to have changed since #1364 , but there is no current issue tracking this so I thought I would open this so we don't forget. There is currently no equivalent of the try_for tactic from lean 3, which amounts to a metaprogramming API which allows you to abort a tactic call if a heartbeat limit is exceeded. CoreM has a heartbeat counter, and there is also a (unrelated?) heartbeat counter in the C++ code, but attempts to hook these up into a reliable timeout mechanism appear to have failed.

Desired behavior:

example : True := by
  -- Note, this may not actually work as a test case 
  -- since `try_for` counts heartbeats and `sleep` counts ms. 
  -- Substitute any expensive tactic for a better test
  fail_if_success try_for 100 (sleep 1000)
  try_for 10000 (sleep 1000)
  trivial

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 by examining the CoreM heartbeat counter and the separate C++ heartbeat counter, then review the history referenced by issue #1364 to understand why previous timeout attempts failed. Use the provided try_for example as the behavioral target, including aborting an over-limit tactic and allowing one within the limit.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.