Skip to content

feat: add sym_simproc and sym_discharger DSL syntax categories#13026

Merged
leodemoura merged 1 commit intomasterfrom
lean-sym-simp-dsl
Mar 21, 2026
Merged

feat: add sym_simproc and sym_discharger DSL syntax categories#13026
leodemoura merged 1 commit intomasterfrom
lean-sym-simp-dsl

Conversation

@leodemoura
Copy link
Copy Markdown
Member

This PR adds the infrastructure for simproc and discharger DSLs used to specify pre/post simproc chains and conditional rewrite dischargers in Sym.simp variants.

Syntax categories (src/Init/Sym/Simp/SimprocDSL.lean):

  • sym_simproc with primitives (ground, telescope, rewrite, self, none) and combinators (>>, <|>)
  • sym_discharger with primitives (self, none) for the with clause of rewrite

Elaboration attributes (src/Lean/Elab/Tactic/Grind/SimprocDSL.lean):

  • builtin_sym_simproc / sym_simproc mapping syntax to Syntax → GrindTacticM Simproc
  • builtin_sym_discharger / sym_discharger mapping syntax to Syntax → GrindTacticM Discharger
  • elabSymSimproc, elabSymDischarger, and elabWithClause dispatchers

Built-in elaborators for each primitive/combinator will follow in a subsequent PR after the stage0 update.

This PR adds the infrastructure for simproc and discharger DSLs used to
specify `pre`/`post` simproc chains and conditional rewrite dischargers
in `Sym.simp` variants.

Syntax categories:
- `sym_simproc` with primitives (`ground`, `telescope`, `rewrite`, `self`,
  `none`) and combinators (`>>`, `<|>`)
- `sym_discharger` with primitives (`self`, `none`) for the `with` clause
  of `rewrite`

Elaboration attributes:
- `builtin_sym_simproc` / `sym_simproc` mapping syntax to
  `Syntax → GrindTacticM Simproc`
- `builtin_sym_discharger` / `sym_discharger` mapping syntax to
  `Syntax → GrindTacticM Discharger`

Dispatchers: `elabSymSimproc`, `elabSymDischarger`, `elabWithClause`.

Built-in elaborators for each primitive/combinator will follow in a subsequent
PR after the stage0 update.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@leodemoura leodemoura requested a review from kim-em as a code owner March 21, 2026 22:06
@leodemoura leodemoura added changelog-language Language features and metaprograms changelog-tactics User facing tactics and removed changelog-language Language features and metaprograms labels Mar 21, 2026
@leodemoura leodemoura enabled auto-merge March 21, 2026 22:07
@leodemoura leodemoura added this pull request to the merge queue Mar 21, 2026
Merged via the queue into master with commit 545f279 Mar 21, 2026
31 checks passed
leodemoura added a commit that referenced this pull request Mar 22, 2026
This PR adds the built-in elaborators for the `sym_simproc` and `sym_discharger`
DSL syntax categories introduced in #13026.

Simproc elaborators (`@[builtin_sym_simproc]`):
- `ground` → `evalGround`
- `telescope` → `simpTelescope`
- `self` → `simp` (recursive simplification)
- `none` → identity (no simplification)
- `rewrite setName [with discharger]` → named theorem set rewriting
- `rewrite [thm₁, ...] [with discharger]` → inline theorem rewriting
- `>>` → `andThen` combinator
- `<|>` → `orElse` combinator

Discharger elaborators (`@[builtin_sym_discharger]`):
- `self` → `dischargeSimpSelf`
- `none` → `dischargeNone`

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
github-merge-queue bot pushed a commit that referenced this pull request Mar 22, 2026
…3031)

This PR adds the built-in elaborators for the `sym_simproc` and
`sym_discharger` DSL syntax categories introduced in #13026.

Simproc elaborators (`@[builtin_sym_simproc]`):
- `ground` → `evalGround`
- `telescope` → `simpTelescope`
- `self` → `simp` (recursive simplification)
- `none` → identity (no simplification)
- `rewrite setName [with discharger]` → named theorem set rewriting
- `rewrite [thm₁, ...] [with discharger]` → inline theorem rewriting
- `>>` → `andThen` combinator
- `<|>` → `orElse` combinator

Discharger elaborators (`@[builtin_sym_discharger]`):
- `self` → `dischargeSimpSelf`
- `none` → `dischargeNone`

Note: `orElse` requires a fully-qualified attribute name
(`Lean.Parser.Sym.Simp.orElse`) to avoid a name resolution conflict
where the bare `orElse` resolves to a different syntax node kind.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-tactics User facing tactics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant