Zulip Chat Archive

Stream: lean4

Topic: suggest imports


Kevin Buzzard (May 17 2024 at 10:08):

Am I living in a dream world if I am hoping that, within mathlib, if I type example : IsTensorProduct then a little paperclip pops up saying "I see that you're looking for a declaration you've not imported: shall I add import Mathlib.RingTheory.IsTensorProduct at the top of your file?"?

Eric Wieser (May 17 2024 at 11:47):

This is probably a little fiddly as you'd want it to respect currently open namespace etc, but feels like something that could be supported by reading (possibly-out-of-date) ilean files

Marc Huisinga (May 17 2024 at 11:49):

Investigating this is on my to-do list.

Arthur Paulino (May 17 2024 at 11:52):

Kevin Buzzard said:

within mathlib

Ideally it would also check for dependencies, so not only within mathlib but also, for example, in a project that depends on mathlib

Mario Carneiro (May 17 2024 at 12:53):

The interface for this I like is the one from rust-analyzer, where autocomplete will suggest definitions which are not imported, with a (import Mathlib.Foo) line in the completion, and accepting the completion will both complete the identifier and also insert the import Mathlib.Foo line at the top of the file


Last updated: May 02 2025 at 03:31 UTC