Skip to content

fix: beta reduction in grind must respect generation threshold#13560

Merged
leodemoura merged 2 commits into
masterfrom
grind_beta_gen
Apr 28, 2026
Merged

fix: beta reduction in grind must respect generation threshold#13560
leodemoura merged 2 commits into
masterfrom
grind_beta_gen

Conversation

@leodemoura
Copy link
Copy Markdown
Member

This PR fixes a bug in propagateBetaEqs (in Lean.Meta.Tactic.Grind.Beta)
where new equalities/terms introduced by beta reduction were added to the goal
without checking the generation threshold. The generation of the new fact
is the maximum generation of the lambda, the function f, and its
arguments, plus one. Without the threshold check, beta reduction can
cascade indefinitely on self-similar lambdas such as
(fun b => f (b + 1)) = fun b => f b, which kept producing
f n = f (n + 1) for every n. The fix aggregates argument generations
before the threshold check and bails out when the resulting generation
reaches maxGeneration.

@leodemoura leodemoura added the changelog-tactics User facing tactics label Apr 28, 2026
@leodemoura leodemoura enabled auto-merge April 28, 2026 21:25
@leodemoura leodemoura added this pull request to the merge queue Apr 28, 2026
Merged via the queue into master with commit 5852865 Apr 28, 2026
17 checks passed
@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 28, 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-04-24 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-04-28 22:29:35)

@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 28, 2026
@mathlib-lean-pr-testing mathlib-lean-pr-testing Bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Apr 28, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

Mathlib CI status (docs):

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.

2 participants