leanprover / leanprover/lean4

`split` fails with `let` declarations

Open
#13,263 0 comments 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

split fails when the discriminant of a match being split is a let variable.

Context

Writing a definition with partial_fixpoint. Consider:

def test : Nat :=
  let a := 1
  match a with | 0 => test | k + 1 => 0
partial_fixpoint
Steps to Reproduce
/--
error: Tactic `split` failed: Could not split an `if` or `match` expression in the goal

a : Nat := 3
⊢ (match a with
    | 0 => 3
    | k.succ => 3) =
    3
---
trace: [split.failure] `split` tactic failed at
      match a with
      | 0 => 3
      | k.succ => 3
    Dependent elimination failed: Failed to solve equation
      a = 0
-/
#guard_msgs in
example : let a := 3; (match a with | 0 | k + 1 => 3) = 3 := by
  intro a
  set_option trace.split.failure true in
  split

Expected behavior: split produces a new state containing h : a = 0 or h : a = k.succ.

Actual behavior: split immediately tries to substitute the equation, resulting in the error.

Versions

Lean 4.31.0-nightly-2026-04-02

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

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 by running the minimal #guard_msgs reproduction and inspect the split tactic behavior with trace.split.failure enabled. The expected result is a state containing either h : a = 0 or h : a = k.succ, rather than immediate substitution and failure.

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
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.