Skip to content

feat: add built-in sym_simproc and sym_discharger elaborators#13031

Merged
leodemoura merged 4 commits intomasterfrom
lean-sym-simp-dsl-2
Mar 22, 2026
Merged

feat: add built-in sym_simproc and sym_discharger elaborators#13031
leodemoura merged 4 commits intomasterfrom
lean-sym-simp-dsl-2

Conversation

@leodemoura
Copy link
Copy Markdown
Member

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]):

  • groundevalGround
  • telescopesimpTelescope
  • selfsimp (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]):

  • selfdischargeSimpSelf
  • nonedischargeNone

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.

leodemoura and others added 4 commits March 21, 2026 18:49
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>
Use syntax quotation patterns instead of raw `stx[i]` indexing.
Add `elabOptDischarger` helper, remove `elabWithClause`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use `Lean.Parser.Sym.Simp.orElse` in the `@[builtin_sym_simproc]`
attribute to avoid name resolution conflict where `orElse` resolves
to a different syntax node kind.

Add comprehensive DSL elaboration tests that go through the full
pipeline: syntax → `elabSymSimproc`/`elabSymDischarger` → `Simproc`/`Discharger`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@leodemoura leodemoura added the changelog-language Language features and metaprograms label Mar 22, 2026
@leodemoura leodemoura requested a review from kim-em as a code owner March 22, 2026 02:29
@leodemoura leodemoura added changelog-language Language features and metaprograms changelog-tactics User facing tactics and removed changelog-language Language features and metaprograms labels Mar 22, 2026
@leodemoura leodemoura enabled auto-merge March 22, 2026 02:30
@leodemoura leodemoura added this pull request to the merge queue Mar 22, 2026
Merged via the queue into master with commit e848039 Mar 22, 2026
37 checks passed
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