Meta definitions
Meta definitions are usually defined externally in Java code, but it is also possible to describe simple metas directly in Arend code. The general syntax of such a meta looks like this:
\meta f x_1 ... x_n => ewhere f is a name, x_1, ... x_n are names of parameters, and e is an expression. This expression is typechecked only when the meta is invoked. It expects n arguments and f e_1 ... e_n is replaced with e[e_1/x_1, ... e_n/x_n] and this expression is typechecked instead of the original application.
Attributes
A definition can be marked with attributes, which are references to other definitions. Attributes are specified with the keyword \attr followed by one or more names. They are written before the definition (after the access modifier and before \use):
\attr positivity
\lemma root>=0 {n : Nat} {x : Real} : 0 <= root n x
...
\private \attr positivity gcongr \lemma foo ...Attributes are used to give definitions to metas. For example, the metas positivity and gcongr from Algebra.Meta use lemmas marked with the corresponding attributes. A meta written in Java can get the list of definitions marked with a given attribute using the method getAttributedDefinitions of ExpressionTypechecker. It can also check marked definitions by implementing AttributeChecker.
Attributed definitions are visible to a definition in the same way as instances: these are definitions marked earlier in the same module (including definitions in \where blocks and private definitions) and definitions marked in directly imported modules. A definition that refers to an attribute (directly or through a meta) depends on the attributed definitions visible to it, so they are typechecked before it.