Skip to content

feat: add sym => interactive mode#12970

Merged
leodemoura merged 1 commit intomasterfrom
lean-sym-review
Mar 18, 2026
Merged

feat: add sym => interactive mode#12970
leodemoura merged 1 commit intomasterfrom
lean-sym-review

Conversation

@leodemoura
Copy link
Copy Markdown
Member

This PR adds a sym => tactic that enters an interactive symbolic simulation
mode built on grind. Unlike grind =>, it does not eagerly introduce
hypotheses or apply by-contradiction, giving users explicit control over
intro, apply, and internalize steps.

New tactics available in sym => mode:

  • intro / intros: introduce binders and internalize into the E-graph by
    default. Use intro~ or intro (internalize := false) to skip
    internalization.
  • apply t: apply backward rules with caching for repeat.
  • internalize / internalize_all: internalize hypotheses into the E-graph.
  • by_contra: apply proof by contradiction, negating the target.

Satellite solvers (lia, ring, linarith) automatically introduce remaining
binders and apply by-contradiction in sym => mode, matching their behavior in
default tactic mode. All existing grind => tactics (finish, instantiate,
cases, etc.) also work in sym => mode. The sym-specific tactics are guarded
and rejected in regular grind => mode.

example (x : Nat) : myP x → myQ x := by
  sym [myP_myQ] =>
    intro h
    finish

example (x y z : Nat) : x > 1 → x + y + z > 0 := by
  sym =>
    lia

@leodemoura leodemoura requested a review from kim-em as a code owner March 18, 2026 14:15
@leodemoura leodemoura added the changelog-tactics User facing tactics label Mar 18, 2026
@leodemoura leodemoura enabled auto-merge March 18, 2026 14:16
@leodemoura leodemoura added the changelog-tactics User facing tactics label Mar 18, 2026
@leodemoura leodemoura added this pull request to the merge queue Mar 18, 2026
Merged via the queue into master with commit 58ef418 Mar 18, 2026
27 checks passed
@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 Mar 18, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase ea49bc9bcf41591e02e66313e5108159152e9df5 --onto 61a3443a9569d548a235f785b9a33984bb7ff622. You can force Mathlib CI using the force-mathlib-ci label. (2026-03-18 15:05:48)

@leanprover-bot
Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase ea49bc9bcf41591e02e66313e5108159152e9df5 --onto cfa8c5a036d6990635c6ec50b02d0e806995cec3. You can force reference manual CI using the force-manual-ci label. (2026-03-18 15:05:49)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-tactics User facing tactics 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