Recursion 为什么精益会强制递归类型参数出现在非递归参数之后?

Recursion 为什么精益会强制递归类型参数出现在非递归参数之后?,recursion,functional-programming,recursive-datastructures,induction,lean,Recursion,Functional Programming,Recursive Datastructures,Induction,Lean,精益拒绝以下定义: inductive natlist | nil : natlist | cons: natlist → ℕ → natlist “natlist.cons”的arg#2不是递归的,但它发生在递归参数之后 如预期,接受以下定义: inductive natlist | nil : natlist | cons: ℕ → natlist → natlist 精益执行这一命令的原因是什么?精益对归纳类型的实施基于p.Dybjer(1994)的“归纳族”论文: Backhouse

精益拒绝以下定义:

inductive natlist
| nil : natlist
| cons: natlist → ℕ → natlist
“natlist.cons”的arg#2不是递归的,但它发生在递归参数之后

如预期,接受以下定义:

inductive natlist
| nil : natlist
| cons: ℕ → natlist → natlist

精益执行这一命令的原因是什么?

精益对归纳类型的实施基于p.Dybjer(1994)的“归纳族”论文:

Backhouse[Bac88]和Coquand和Paulin[COP90]允许在递归前提可能先于非递归前提的情况下进行不必要的概括。我更喜欢将所有非递归前提放在递归前提之前,因为在这里,非递归前提不能依赖于后者(但[Dyb92]中的情况会发生变化)。这一限制简化了方案的呈现,并强调了与油井顺序的关系


请注意,最近的一个版本删除了此限制,您的第一个定义现在可以使用。

我明白您的观点。但是,有些人喜欢这样定义二叉树的节点部分:
|节点:bintreea->A->bintreea->bintreea->bintreea
:)