Skip to content

Conversation

@kim-em
Copy link
Collaborator

@kim-em kim-em commented Jan 4, 2026

This PR fixes a panic that occurred when a theorem had a docstring on an
auxiliary definition within a where clause.

Reproducer:

theorem foo : True := aux where /-- -/ aux := True.intro

The issue was that asyncMayModify used .any to check if a nested
declaration could have its extension state modified, which returned
false when the declaration wasn't yet in asyncConsts. Using .all
instead returns true for none (vacuously true), allowing modification
of extension state for nested declarations that haven't been added to
asyncConsts yet.

Closes #11799

🤖 Prepared with Claude Code

… `where`

This PR fixes a panic that occurred when a theorem had a docstring on an
auxiliary definition within a `where` clause.

The issue was that `asyncMayModify` used `.any` to check if a nested
declaration could have its extension state modified, which returned
`false` when the declaration wasn't yet in `asyncConsts`. Using `.all`
instead returns `true` for `none` (vacuously true), allowing modification
of extension state for nested declarations that haven't been added to
`asyncConsts` yet.

Closes #11799

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kim-em kim-em added the changelog-language Language features and metaprograms label Jan 4, 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 Jan 5, 2026
@leanprover-community-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 9f404d8fbe334425cc6fd1e44b01d00f59f695ed --onto 4e8b5cfc4696efb13c2fb3dc8ae6033197ae2b1f. You can force Mathlib CI using the force-mathlib-ci label. (2026-01-05 00:45:59)

@leanprover-bot
Copy link
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 9f404d8fbe334425cc6fd1e44b01d00f59f695ed --onto 78c9a01bb265cdddb5d187a02ba2200479b3f97c. You can force reference manual CI using the force-manual-ci label. (2026-01-05 00:46:01)

/-- first aux -/ aux1 := True.intro
/-- second aux -/ aux2 := True.intro

-- Verify the docstrings are actually attached
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem to be testing the doc-strings, but rather that the functions themselves exist, right?

Use `findDocString?` to verify the docstrings are correctly set,
rather than just checking the declarations exist.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

Labels

changelog-language Language features and metaprograms 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 in async elaboration for theorems with a docstring within where

5 participants