Zulip Chat Archive
Stream: new members
Topic: local definition to a section ?
Nicolas Rolland (Aug 01 2024 at 21:03):
Can I make some definitions local to a section, so that reusing the names in another does not clash ?
import Mathlib.CategoryTheory.Adjunction.Basic
section MySection
lemma _aname : True := sorry
end MySection
section OtherSection
-- lemma _aname : True := sorry -- '_aname' has already been declared
end OtherSection
The intended usage of those throwaway names is to make some other definitions in the same section more readable
Kyle Miller (Aug 01 2024 at 21:12):
It's not section local, but you can use private lemma
to make it not appear outside the module.
Kyle Miller (Aug 01 2024 at 21:14):
Mathlib doesn't use _
prefixes for local things by the way. Sometimes you see an aux
suffix, or the lemma just follows the usual naming convention. Or often it turns out there's not really a need for things to be private, unless it's truly a single-use highly technical lemma.
Edward van de Meent (Aug 02 2024 at 07:30):
i think '
as a postfix also gets used for this...
Last updated: May 02 2025 at 03:31 UTC