将属性附加到定义会导致语法错误

Attaching an attribute to a definition causes syntax errors

我要定义一个属性reducible。我很确定我的语法是正确的,因为我从 tutorial (p. 118).

逐字复制了它
definition pr1 [reducible] (A : Type) (a b : A) : A := a
attribute pr1 [reducible]

两个属性的组合均未通过语法检查:将其直接附加到定义会导致 type expected at reducible,而独立声明会导致 command expected.

我正在 Windows,使用 Lean 3.1 二进制分发版和 VS Code 语言工具,fwiw,但它似乎在浏览器中也不起作用。

您使用的教程版本已过时,最新版本是 here。您可以使用以下语法:

@[reducible]
definition pr1 (A : Type) (a b : A) : A := a

attribute [reducible]
definition pr1 {A B : Type} (a : A) (b : B) := a

One can also assign the attribute any time after the definition takes place:

definition pr1 (A : Type) (a b : A) : A := a
-- some code
attribute [reducible] pr1