Skip to content

refactor: dispatch try? builtins via @[builtin_try_tactic]#13766

Merged
nomeata merged 1 commit into
masterfrom
joachim/try-dispatch
May 18, 2026
Merged

refactor: dispatch try? builtins via @[builtin_try_tactic]#13766
nomeata merged 1 commit into
masterfrom
joachim/try-dispatch

Conversation

@nomeata
Copy link
Copy Markdown
Collaborator

@nomeata nomeata commented May 18, 2026

This PR moves the evalSuggest combinator and trace-handler dispatch
from a hardcoded match on syntax kinds to the existing
tryTacticElabAttribute registration mechanism, bringing try?'s
extensibility model in line with normal tactics and interactive grind.

Each built-in combinator (<;>, first, paren, try, attempt_all,
attempt_all_par, first_par, seq1) and trace handler (grind?,
simp?, simp_all?, exact?) is now registered as
@[builtin_try_tactic <kind>]. evalSuggestImpl becomes a thin
attribute-driven dispatcher mirroring evalTactic/evalGrindTactic.

The post-run "no unsolved goals in terminal mode" check is no longer
applied centrally by the dispatcher. Handlers that may leave goals
open (simp?, simp_all?, the atomic fallback) call the new
checkTerminalGoals helper themselves; handlers that close the goal
by construction (grind?, exact?) and combinators that delegate via
evalSuggest need no explicit call.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

This PR moves the `evalSuggest` combinator and trace-handler dispatch
from a hardcoded `match` on syntax kinds to the existing
`tryTacticElabAttribute` registration mechanism, bringing `try?`'s
extensibility model in line with normal tactics and interactive `grind`.

Each built-in combinator (`<;>`, `first`, `paren`, `try`, `attempt_all`,
`attempt_all_par`, `first_par`, `seq1`) and trace handler (`grind?`,
`simp?`, `simp_all?`, `exact?`) is now registered as
`@[builtin_try_tactic <kind>]`. `evalSuggestImpl` becomes a thin
attribute-driven dispatcher mirroring `evalTactic`/`evalGrindTactic`.

The post-run "no unsolved goals in terminal mode" check is no longer
applied centrally by the dispatcher. Handlers that may leave goals
open (`simp?`, `simp_all?`, the atomic fallback) call the new
`checkTerminalGoals` helper themselves; handlers that close the goal
by construction (`grind?`, `exact?`) and combinators that delegate via
`evalSuggest` need no explicit call.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@nomeata nomeata added the changelog-tactics User facing tactics label May 18, 2026
@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 May 18, 2026
@leanprover-bot
Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2026-05-16 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-manual, reference manual CI should run now. You can force reference manual CI using the force-manual-ci label. (2026-05-18 09:13:59)

@github-actions github-actions Bot added the mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN label May 18, 2026
@mathlib-lean-pr-testing mathlib-lean-pr-testing Bot added the builds-mathlib CI has verified that Mathlib builds against this PR label May 18, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

Mathlib CI status (docs):

@nomeata nomeata marked this pull request as ready for review May 18, 2026 19:41
@nomeata nomeata requested a review from kim-em as a code owner May 18, 2026 19:41
@nomeata nomeata added this pull request to the merge queue May 18, 2026
Merged via the queue into master with commit ebbbec0 May 18, 2026
33 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 changelog-tactics User facing tactics mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN 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.

2 participants