Skip to content

split fails with let declarations #13263

@Rob23oba

Description

@Rob23oba

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions