leanprover / leanprover/lean4

Panic when using `intro` followed by `pattern` in `conv` mode

Open
#14,055 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Prerequisites
Description

Using pattern under a binder in conv mode causes a panic at Lean.Expr.mvarId!.

Steps to Reproduce

Lean 4 Web

-- panics at Lean.Expr.mvarId!
example : (fun x : Nat => x + (x - x)) = (fun x => x) := by
  conv =>
    lhs
    intro x
    pattern _ - _
    simp

-- works
example (x : Nat) : x + (x - x) = x := by
  conv =>
    lhs
    pattern _ - _
    simp
  simp

Expected behavior: No panic.

Actual behavior: PANIC at Lean.Expr.mvarId! Lean.Expr:1012:14: mvar expected.

Context

Discussion on Zulip about a related error

Versions

4.32.0-nightly-2026-06-10

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 with the minimal reproducer in the issue and compare it with the working example that omits the binder. Trace the conv handling of intro followed by pattern, focusing on the Lean.Expr.mvarId! panic. Done means the reproducer no longer panics and the existing working case remains valid.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.