Checking Termination of Queries to Logic Programs
Checking Termination of Queries to Logic Programs
复制标题
检查逻辑程序查询的终止
DOI:
--
复制
发表时间:
1996
期刊:
影响因子:
--
通讯作者:
Y. Sagiv
中科院分区:
文献类型:
--
作者:
Naomi Lindenstrauss;Y. Sagiv
Termination of programs is known to be undecidable. However in the case of logic programs , where the only possible cause for non-termination is innnite recursion, termination can actually be proved automatically for a large class of programs. This paper describes an algorithm for automatically checking termination of queries to logic programs. Given a program and query the algorithm either answers that the query terminates or that there may be non-termination due to innnite recursion. The algorithm can use any norm of a wide family of norms for proving termination. It has been implemented in SICStus Prolog. The implementation can handle automatically most of the examples we encountered in the literature on termination of logic programs, and about half the programs in a collection of benchmarks, which were originally used for purposes other than termination (for 11 of the 24 programs termination can be decided automatically and for 3 more it can be decided after suitable transformation or division to parts). The algorithm consists of three main parts| instantiation analysis, constraint inference, and construction of the query-mapping pairs associated with the program and query. It uses weighted rule graphs, which extract the information about argument norms that is in the program rules. A by-product of the inference of constraints is the separation of recursive monotonicity constraints from nonrecursive ones. This enables us to spot programs for which we will be able to prove termination after unfolding.