lean4-htt/tests/lean/run/library_suggestions_deprecated.lean
Kim Morrison e42262e397
fix: allow private proof-valued structure fields in library suggestions (#11962)
This PR fixes library suggestions to include private proof-valued
structure fields.

Private proof-valued structure fields (like `private size_keys' :
keys.size = values.size`) generate projections with `_private.*` mangled
names. These were being filtered out by `isDeniedPremise` because
`isInternalDetail` returns true for names starting with `_`.

The fix allows private names through by checking `!isPrivateName name`,
following the pattern from #11946. This enables `grind +suggestions` to
discover and use private proof-valued structure fields from the current
module.

Soon I would like to fix the semantics of `isInternalDetail`, as the
current behaviour is clearly wrong, but as there are many call sites, I
would like to get the behaviour of tactics correct first.

Also switches `currentFile` to use `wasOriginallyTheorem` instead of
matching on `.thmInfo`, which correctly identifies both theorems and
proof-valued projections.

🤖 Prepared with Claude Code

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-10 08:40:54 +00:00

26 lines
848 B
Text

import Lean.LibrarySuggestions.Basic
-- Define a normal theorem that should appear in suggestions
theorem normalTheorem : True := trivial
-- Define a deprecated theorem that should be filtered out by isDeniedPremise
@[deprecated "Use normalTheorem instead" (since := "1970-01-01")]
theorem deprecatedTheorem : True := trivial
-- Another normal theorem to verify filtering is selective
theorem anotherNormalTheorem : 1 + 1 = 2 := rfl
-- Test the currentFile selector which uses isDeniedPremise to filter
set_library_suggestions Lean.LibrarySuggestions.currentFile
-- This test verifies that deprecated theorems are filtered out by isDeniedPremise
-- Expected: deprecatedTheorem should NOT appear in suggestions
/--
info: Library suggestions:
normalTheorem
anotherNormalTheorem
-/
#guard_msgs in
example : True := by
suggestions
trivial