索引dif/2
Indexing dif/2
摘要:
许多Prolog程序是不必要的不纯的,因为没有足够的手段来表达语法的不平等。虽然经常提供的内置`dif/2`能够正确地描述预期的答案,但在程序中直接使用它往往会导致过于复杂和低效的定义-主要是由于缺乏足够的索引机制。我们建议克服这些问题,通过使用一个新的谓词,通过具体化包含平等和不平等。代码的复杂性降低了一个单调的,高阶的if-then-else结构的基础上'调用/N'。对于不纯定义的可比正确使用,我们的方法是确定的,同样有效的不纯同行。
英文摘要:
Many Prolog programs are unnecessarily impure because of inadequate means to express syntactic inequality. While the frequently provided built-in `dif/2` is able to correctly describe expected answers, its direct use in programs often leads to overly complex and inefficient definitions --- mainly due to the lack of adequate indexing mechanisms. We propose to overcome these problems by using a new predicate that subsumes both equality and inequality via reification. Code complexity is reduced with a monotonic, higher-order if-then-else construct based on `call/N`. For comparable correct uses of impure definitions, our approach is as determinate and similarly efficient as its impure counterparts.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。