大多数实例使用 Lean.Parser.Command.declaration : commandwhere 语法定义每个方法:
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`
但是,类型类是归纳类型,因此可以使用具有适当类型的任何表达式来构造实例:
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.
实例也可以通过案例来定义;但是,此功能很少在 Decidable 实例之外使用:
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.