feat: include current file in default premise selector (#11168)

This PR changes the default library suggestions (e.g. for `grind
+suggestions` or `simp_all? +suggestions) to include the theorems from
the current file in addition to the output of Sine Qua Non.
This commit is contained in:
Kim Morrison 2025-11-14 12:31:30 +11:00 committed by GitHub
parent 46ff76aabd
commit bc9cc05082
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 6 deletions

View file

@ -11,15 +11,17 @@ import all Lean.LibrarySuggestions.SineQuaNon
/-!
# Default library suggestions engine
This module sets the default library suggestions engine to Sine Qua Non.
This module sets the default library suggestions engine to "Sine Qua Non",
along with the theorems from the current file.
.
Any module that imports this (directly or transitively) will have library suggestions enabled.
-/
namespace Lean.LibrarySuggestions
open Lean LibrarySuggestions SineQuaNon
-- Set the default library suggestions engine to Sine Qua Non
set_library_suggestions Lean.LibrarySuggestions.sineQuaNonSelector
-- Set the default library suggestions engine to
-- a combination of "Sine Qua Non" and the theorems from the current file.
-- For now we just intersperse the results, but in future we should re-rank them.
set_library_suggestions open Lean.LibrarySuggestions in sineQuaNonSelector.intersperse currentFile
end Lean.LibrarySuggestions

View file

@ -13,7 +13,11 @@ already be set from importing Lean.LibrarySuggestions (which imports Default).
-/
/--
info: ✓ Selector found in imported state: `Lean.LibrarySuggestions.sineQuaNonSelector
info: ✓ Selector found in imported state: (Term.open
"open"
(Command.openSimple [`Lean.LibrarySuggestions])
"in"
(Term.app `sineQuaNonSelector.intersperse [`currentFile]))
---
info: ✓ Successfully retrieved selector using getSelector!
-/