Most instances define each method using Lean.Parser.Command.declaration : commandwhere syntax:
instance ::= ... |instance ((priority := prio))?`attrKind` matches `("scoped" <|> "local")?`, used before an attribute like `@[local simp]`.declId?`declId` matches `foo` or `foo.{u,v}`: an identifier possibly followed by a list of universe namesdeclSig where structInstField*`declSig` matches the signature of a declaration with required type: a list of binders and then `: type`
However, type classes are inductive types, so instances can be constructed using any expression with an appropriate type:
instance ::= ... |instance ((priority := prio))?`attrKind` matches `("scoped" <|> "local")?`, used before an attribute like `@[local simp]`.declId?`declId` matches `foo` or `foo.{u,v}`: an identifier possibly followed by a list of universe namesdeclSig := term`declSig` matches the signature of a declaration with required type: a list of binders and then `: type`Termination hints are `termination_by` and `decreasing_by`, in that order.
Instances may also be defined by cases; however, this feature is rarely used outside of Decidable instances:
instance ::= ... |instance ((priority := prio))?`attrKind` matches `("scoped" <|> "local")?`, used before an attribute like `@[local simp]`.declId?`declId` matches `foo` or `foo.{u,v}`: an identifier possibly followed by a list of universe namesdeclSig (| term => term)*`declSig` matches the signature of a declaration with required type: a list of binders and then `: type`Termination hints are `termination_by` and `decreasing_by`, in that order.