Anti-unification in logic programming refers to the process of capturing common syntactic structure among given goals, computing as such a single new goal that is more general and hence called a generalization of the given goals. Finding an arbitrary common generalization for two goals is trivial, but looking for those common generalizations that are either as large as possible (called largest common generalizations) or as specific as possible (called most specific generalizations) is a non-trivial optimization problem, in particular when goals are considered to be unordered sets of atoms. In this work we provide an in-depth study of the problem by defining two different generalization relations. We formulate a characterization of what constitutes a most specific generalization in both settings. While these generalizations can be computed in polynomial time, we show that when the number of variables in the generalization needs to be minimized, the problem becomes NP-hard. We subsequently revisit an abstraction of the largest common generalization when anti-unification is based on injective variable renamings, and prove that it can be computed in polynomially bounded time.
翻译:在逻辑编程中,反统一是指在特定目标中捕捉共同综合结构的过程,将这种单一的新目标计算成比较一般的、因而称为对特定目标的概括性。为两个目标寻找任意的通用概括性是微不足道的,但寻找那些尽可能大(所谓的最大共同概括性)或尽可能具体(所谓的最具体的概括性)的通用性,是一个非三重优化问题,特别是当目标被视为没有顺序的原子时。在这项工作中,我们通过界定两种不同的概括性关系,对问题进行深入研究。我们对两种情况下最具体的概括性进行定性。虽然这些概括性可以在多数值时间内计算,但我们表明,当一般化中变量的数量需要尽可能小时,问题就会变得难以解决。当反统一性的目标被认为是没有顺序的一组原子时,我们随后重新审视了最大共同的抽象性一般化的抽象性,因为反统一性是以预言的变量重新命名为基础,并证明它可以在多数值约束的时间内进行计算。