Skip to content

fix: fun_induction rejecting names for all hypotheses with let and generalizing - #14475

Merged
nomeata merged 1 commit into
masterfrom
joachim/issue14472
Jul 21, 2026
Merged

fix: fun_induction rejecting names for all hypotheses with let and generalizing#14475
nomeata merged 1 commit into
masterfrom
joachim/issue14472

Conversation

@nomeata

@nomeata nomeata commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

This PR fixes a spurious "Too many variable names provided" error from fun_induction (and induction/cases) when an alternative had a let-bound field, so that all hypotheses of such an alternative can now be named.

The error came from getNumExplicitFields, which counted nameable fields with a telescope that reduces let bindings away and then over-reads into later binders, disagreeing with the introN that actually names them. It now introduces the fields via the same introN path and counts the explicit (and let-bound) ones, so the count and the naming can no longer diverge.

Fixes: #14472

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

…d `generalizing`

This PR fixes a spurious "Too many variable names provided" error from `fun_induction` (and `induction`/`cases`) when an alternative had a `let`-bound field, so that all hypotheses of such an alternative can now be named.

The error came from `getNumExplicitFields`, which counted nameable fields with a telescope that reduces `let` bindings away and then over-reads into later binders, disagreeing with the `introN` that actually names them. It now introduces the fields via the same `introN` path and counts the explicit (and `let`-bound) ones, so the count and the naming can no longer diverge.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019PWpd2DPNidwHGtS7mvGpf
@nomeata
nomeata requested a review from kim-em as a code owner July 21, 2026 09:47
@nomeata nomeata added the changelog-tactics User facing tactics label Jul 21, 2026
@nomeata
nomeata enabled auto-merge July 21, 2026 09:48
@nomeata
nomeata added this pull request to the merge queue Jul 21, 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 Jul 21, 2026
@leanprover-bot

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2026-07-20 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-manual, reference manual CI should run now. You can force reference manual CI using the force-manual-ci label. (2026-07-21 10:15:01)

@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 Jul 21, 2026
Merged via the queue into master with commit be66a44 Jul 21, 2026
29 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 Jul 21, 2026
@mathlib-lean-pr-testing

Copy link
Copy Markdown

Mathlib CI status (docs):

robsimmons pushed a commit that referenced this pull request Jul 29, 2026
…d `generalizing` (#14475)

This PR fixes a spurious "Too many variable names provided" error from
`fun_induction` (and `induction`/`cases`) when an alternative had a
`let`-bound field, so that all hypotheses of such an alternative can now
be named.

The error came from `getNumExplicitFields`, which counted nameable
fields with a telescope that reduces `let` bindings away and then
over-reads into later binders, disagreeing with the `introN` that
actually names them. It now introduces the fields via the same `introN`
path and counts the explicit (and `let`-bound) ones, so the count and
the naming can no longer diverge.

Fixes: #14472

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

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

Labels

builds-mathlib CI has verified that Mathlib builds against this PR changelog-tactics User facing tactics 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.

fun_induction does not allow naming all hypotheses

2 participants