# Documentation

Std.Lean.AttributeExtra

• The environment extension for the attribute.

• A list of "base" declarations which have been pre-tagged.

TagAttributeExtra works around a limitation of TagAttribute, which is that definitions must be tagged in the same file that declares the definition. This works well for definitions in lean core, but for attributes declared outside the core this is problematic because we may want to tag declarations created before the attribute was defined.

To resolve this, we allow a one-time exception to the rule that attributes must be applied in the same file as the declaration: During the declaration of the attribute itself, we can tag arbitrary other definitions, but once the attribute is declared we must tag things in the same file as normal.

Instances For
Equations
def Lean.registerTagAttributeExtra (name : Lean.Name) (descr : String) (extra : ) (validate : optParam () fun x => ) (ref : ) :

Registers a new tag attribute. The extra field is a list of definitions from other modules which will be "pre-tagged" and are not subject to the usual restriction on tagging in the same file as the declaration.

Note: The extra fields bypass the validate function - we assume the builtins are also pre-validated.

Equations
• One or more equations did not get rendered due to their size.

Does declaration decl have the tag attr?

Equations
• One or more equations did not get rendered due to their size.

Get the list of declarations tagged with the tag attribute attr.

Equations
• One or more equations did not get rendered due to their size.
• The underlying ParametricAttribute.

attr :
• A list of pre-tagged declarations with their values.

base :

ParametricAttributeExtra works around a limitation of ParametricAttribute, which is that definitions must be tagged in the same file that declares the definition. This works well for definitions in lean core, but for attributes declared outside the core this is problematic because we may want to tag declarations created before the attribute was defined.

To resolve this, we allow a one-time exception to the rule that attributes must be applied in the same file as the declaration: During the declaration of the attribute itself, we can tag arbitrary other definitions, but once the attribute is declared we must tag things in the same file as normal.

Instances For
Equations
• Lean.instInhabitedParametricAttributeExtra = { default := { attr := default, base := default } }
def Lean.registerParametricAttributeExtra {α : Type} [inst : ] (impl : ) (extra : List ()) :

Registers a new parametric attribute. The extra field is a list of definitions from other modules which will be "pre-tagged" and are not subject to the usual restriction on tagging in the same file as the declaration.

Equations
• One or more equations did not get rendered due to their size.
def Lean.ParametricAttributeExtra.getParam? {α : Type} [inst : ] (attr : ) (env : Lean.Environment) (decl : Lean.Name) :

Gets the parameter of attribute attr associated to declaration decl, or none if decl is not tagged.

Equations
def Lean.ParametricAttributeExtra.setParam {α : Type} (attr : ) (env : Lean.Environment) (decl : Lean.Name) (param : α) :

Applies attribute attr to declaration decl, given a value for the parameter.

Equations