Skip to content

fix: handle multi-discriminant casesOn in WF unfold equation generation#13232

Merged
nomeata merged 1 commit into
masterfrom
joachim/issue13015
Apr 1, 2026
Merged

fix: handle multi-discriminant casesOn in WF unfold equation generation#13232
nomeata merged 1 commit into
masterfrom
joachim/issue13015

Conversation

@nomeata
Copy link
Copy Markdown
Collaborator

@nomeata nomeata commented Apr 1, 2026

This PR fixes a panic when compiling mutually recursive definitions that use casesOn on indexed inductive types (e.g. Vect). The splitMatchOrCasesOn function in WF.Unfold asserted matcherInfo.numDiscrs = 1, but for indexed types the casesOn recursor has multiple discriminants (indices + major premise). The fix uses the last discriminant (the major premise) and lets the cases tactic handle index discriminants automatically.

Closes #13015

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

This PR fixes a panic when compiling mutually recursive definitions that
use `casesOn` on indexed inductive types (e.g. `Vect`). The
`splitMatchOrCasesOn` function asserted `matcherInfo.numDiscrs = 1`, but
for indexed types the casesOn has multiple discriminants (indices + major
premise). The fix uses the last discriminant (the major premise) and
lets the `cases` tactic handle index discriminants automatically.

Closes #13015

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nomeata nomeata added bug Something isn't working changelog-language Language features and metaprograms and removed bug Something isn't working labels Apr 1, 2026
@nomeata nomeata marked this pull request as ready for review April 1, 2026 15:22
@nomeata nomeata added this pull request to the merge queue Apr 1, 2026
@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 Apr 1, 2026
mathlib-nightly-testing Bot pushed a commit to leanprover-community/batteries that referenced this pull request Apr 1, 2026
@github-actions github-actions Bot added the mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN label Apr 1, 2026
mathlib-nightly-testing Bot pushed a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Apr 1, 2026
leanprover-bot added a commit to leanprover/reference-manual that referenced this pull request Apr 1, 2026
@leanprover-bot leanprover-bot added the builds-manual CI has verified that the Lean Language Reference builds against this PR label Apr 1, 2026
@leanprover-bot
Copy link
Copy Markdown
Collaborator

leanprover-bot commented Apr 1, 2026

Reference manual CI status:

Merged via the queue into master with commit 861f722 Apr 1, 2026
45 checks passed
@mathlib-lean-pr-testing mathlib-lean-pr-testing Bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Apr 1, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

Mathlib CI status (docs):

volodeyka pushed a commit that referenced this pull request Apr 16, 2026
…on (#13232)

This PR fixes a panic when compiling mutually recursive definitions that
use `casesOn` on indexed inductive types (e.g. `Vect`). The
`splitMatchOrCasesOn` function in `WF.Unfold` asserted
`matcherInfo.numDiscrs = 1`, but for indexed types the casesOn recursor
has multiple discriminants (indices + major premise). The fix uses the
last discriminant (the major premise) and lets the `cases` tactic handle
index discriminants automatically.

Closes #13015

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builds-manual CI has verified that the Lean Language Reference builds against this PR builds-mathlib CI has verified that Mathlib builds against this PR changelog-language Language features and metaprograms mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN 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.

Panic trying to compile mutually recursive definitions

2 participants