arXivDaily arXiv每日学术速递 周一至周五更新
arXiv cs/0012015cs.LO
收藏

类型良好的逻辑程序不会出错

Well-Typed Logic Programs Are not Wrong

Pierre Deransart, Jan-Georg Smaus

摘要:

我们考虑逻辑程序的规定类型系统(如Goedel或Mercury)。在这样的系统中,类型是静态的,但它保证了一个操作属性:如果一个程序是“良好类型的”,那么所有在“良好类型的”查询中开始的派生都是“良好类型的”。这个特性被称为主体还原。我们表明,这个属性也可以被措辞为一个属性的证明理论的语义的逻辑程序,从而抽象通常的操作(自上而下)的语义。这种证明论的观点使我们质疑一个条件,这通常被认为是必要的主题还原,即头部条件。它声明每个子句的头部必须有一个类型,该类型是声明类型的变体(而不是正确的实例)。我们提供了一个更一般的条件,从而在头原子和体原子之间重新建立了某种对称性。这个条件确保在一个推导中,两个统一项的类型本身是可统一的。我们讨论了这一结果的可能影响。我们还讨论了头条件和多态递归之间的关系,这是函数式编程中的一个已知概念。

英文摘要:

We consider prescriptive type systems for logic programs (as in Goedel or Mercury). In such systems, the typing is static, but it guarantees an operational property: if a program is "well-typed", then all derivations starting in a "well-typed" query are again "well-typed". This property has been called subject reduction. We show that this property can also be phrased as a property of the proof-theoretic semantics of logic programs, thus abstracting from the usual operational (top-down) semantics. This proof-theoretic view leads us to questioning a condition which is usually considered necessary for subject reduction, namely the head condition. It states that the head of each clause must have a type which is a variant (and not a proper instance) of the declared type. We provide a more general condition, thus reestablishing a certain symmetry between heads and body atoms. The condition ensures that in a derivation, the types of two unified terms are themselves unifiable. We discuss possible implications of this result. We also discuss the relationship between the head condition and polymorphic recursion, a concept known in functional programming.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑