Coq中的程序定点和功能之间有什么区别? [英] What's the difference between Program Fixpoint and Function in Coq?
本文介绍了Coq中的程序定点和功能之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
它们似乎具有相似的目的。到目前为止,我注意到的一个区别是,虽然 Program Fixpoint
将接受类似 {measure(length l1 + length l2)} / code>,
函数
似乎拒绝了,只会允许 {卷长l1}
。
They seem to serve similar purposes. The one difference I've noticed so far is that while Program Fixpoint
will accept a compound measure like {measure (length l1 + length l2) }
, Function
seems to reject this and will only allow {measure length l1}
.
严格来说,程序定位点
比功能
强大,或者
Is Program Fixpoint
strictly more powerful than Function
, or are they better suited for different use cases?
推荐答案
这可能不是一个完整的列表,但这是我到目前为止发现的:
This may not be a complete list, but it is what I have found so far:
- 正如您已经提到的,
Program Fixpoint
允许该措施查看更多 -
Function
创建一个可以使用的foo_equation
引理。用其RHS重写对foo
的调用。对于避免诸如程序修订点的Coq简化这样的问题非常有用。 - 简单吗?)情况下,
Function
可以定义foo_ind
引理,以沿着<$ c的递归调用的结构执行归纳$ c> foo 。同样,对于证明foo
的事情而又没有有效地重复证明中的终止参数非常有用。 -
程序Fixpoint
可以被欺骗来支持嵌套递归,请参见 https://stackoverflow.com/a/46859452/946226 。这也是为什么程序修订点
可以定义Function
不能的Ackermann 函数。
- As you already mentioned,
Program Fixpoint
allows the measure to look at more than one argument. Function
creates afoo_equation
lemma that can be used to rewrite calls tofoo
with its RHS. Very useful to avoid problems like Coq simpl for Program Fixpoint.- In some (simple?) cases,
Function
can define afoo_ind
lemma to perform induction along the structure of recursive calls offoo
. Again, very useful to prove things aboutfoo
without effectively repeating the termination argument in the proof. Program Fixpoint
can be tricked into supporting nested recursion, see https://stackoverflow.com/a/46859452/946226. This is also whyProgram Fixpoint
can define the Ackermann function whenFunction
cannot.
这篇关于Coq中的程序定点和功能之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文