leanprover / leanprover/lean4

split fails with non-fvar discriminants and dependent motives

Open
#10,424 2 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

Consider this

/--
error: Tactic `split` failed: Could not split an `if` or `match` expression in the goal

n : Nat
⊢ Fin.last n =
    match id n with
    | 0 => Fin.last 0
    | n.succ => Fin.last (n + 1)
-/
#guard_msgs(pass trace, all) in
example (n : Nat) : Fin.last n = match (motive := ∀ n, Fin (n+1)) id n with
  | 0 => Fin.last 0
  | n + 1 => Fin.last (n + 1) := by
  split <;> rfl

it works if the discriminant id n were a simple variable n.

This seems to be the core issue of underlying #10195, and is blocking #10268 and similar constructions.

Versions

Lean 4.25.0-nightly-2025-09-16

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 reproducer in the issue with Lean 4.25.0-nightly-2025-09-16 and inspect the implementation of the split tactic and its handling of dependent motives. Done means the example's split <;> rfl succeeds for the non-variable discriminant while preserving the existing behavior shown in the issue.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.