In this paper we present a new static data type inference algorithm for logic programming. Without the need of declaring types for predicates, our algorithm is able to automatically assign types to predicates which, in most cases, correspond to the data types processed by their intended meaning. The algorithm is also able to infer types given data type definitions similar to data definitions in Haskell and, in this case, the inferred types are more informative in general. We present the type inference algorithm, prove some properties and finally, we evaluate our approach on example programs that deal with different data structures.
翻译:在本文中,我们为逻辑编程提出了一个新的静态数据类型推论算法。在不需要宣布上游类型的情况下,我们的算法能够自动指定上游类型,在大多数情况下,这些类型与预期含义处理的数据类型相对应。这种算法还可以推断出与哈斯凯尔数据定义相类似的数据类型定义类型,在此情况下,所推断的类别在总体上更为丰富。我们提出了类型的推论算法,证明了某些属性,最后,我们评估了我们处理不同数据结构的示例程序的方法。