## When Size Does Matter - Termination Analysis for Typed Logic Programs (2002)

Venue: | Logic-based Program Synthesis and Transformation, 11th International Workshop, LOPSTR 2001, Selected Papers, volume 2372 of LNCS |

Citations: | 6 - 4 self |

### BibTeX

@INPROCEEDINGS{Vanhoof02whensize,

author = {Wim Vanhoof and Maurice Bruynooghe},

title = {When Size Does Matter - Termination Analysis for Typed Logic Programs},

booktitle = {Logic-based Program Synthesis and Transformation, 11th International Workshop, LOPSTR 2001, Selected Papers, volume 2372 of LNCS},

year = {2002},

pages = {129--147},

publisher = {Springer-Verlag}

}

### OpenURL

### Abstract

Proofs of termination typically proceed by mapping program states to a well founded domain and showing that successive states of the computation are mapped to elements decreasing in size. Automated termination analysers for logic programs achieve this by measuring and comparing the sizes of successive calls to recursive predicates. The size of the call is measured by a level mapping that in turn is based on a norm on the arguments of the call. A norm maps a term to a natural number.

### Citations

1855 |
Foundations of Logic Programming
- Lloyd
- 1987
(Show Context)
Citation Context ...tion. In section 3 we introduce a type based termination condition and we conclude in Section 4. 2 Characterising Terms 2.1 About Terms and Types We assume familiarity with logic programming concepts =-=[11, -=-1]. We use T erm = T (; V ) to denote the set of terms constructed from a set of function symbols 70 and variables V . Types, like terms are constructed from (type) variables and (type) symbols. We d... |

572 | Automatic discovery of linear restraints among variables of a program - Cousot, Halbwachs - 1978 |

416 |
Introduction to Logic Programming
- Apt
- 1990
(Show Context)
Citation Context ...er characterise the term's size in several ways, by counting the number of subterms of a particular type it contains. Reconsider Example 1 from above. Instead of characterising the size of terms like =-=[1; 2; 3]-=- and [[1]; [2]; [3; 4]] by the particularly constructed norms (k:k 1 , respectively k:k 2 ), we characterise their sizes by counting the number of integer values occurring in them, the number of lists... |

121 |
Deriving descriptions of possible values of program variables by means of abstract interpretation
- Janssens, Bruynooghe
- 1992
(Show Context)
Citation Context ... general idea is to derive for every argument position of each atom in the program an approximation of the set of terms that can occur in that position (expressed through the formalism of rigid types =-=[15]-=-) and to construct a particular norm for each such set. For the above example, [11] would derive that the second argument of flat/2 contains a list of any values, whereas thesrst argument may contain ... |

67 |
Efficient tests for top-down termination of logical rules
- ULLMAN, GELDER
- 1988
(Show Context)
Citation Context ...teed to be instantiated enough for each call. Whether or not termination can be proven often depends on the particular norm that is chosen. Some techniques for termination analysis use a specic norm [=-=15]-=-, while others provide the user with the possibility of specifying a norm that might be tailored to the program to be analysed [10]. In any case,sxing a particular norm imposes a number of restriction... |

54 |
The execution algorithm of Mercury, an e#cient purely declarative logic programming language
- Somogyi, Henderson, et al.
- 1996
(Show Context)
Citation Context ...ons which are mappings from variables to terms, we also have type substitutions which are mappings from type variables to types. We assume a standard notion of strong typing as for example in Mercury =-=[14]-=-. This means that each predicate is associated with a single type declaration and that programs are well typed. Hence, one can associate a unique type with every term and variable in a program clause.... |

45 | Inferring Argument Size Relationships with CLP
- Benoy, King
- 1996
(Show Context)
Citation Context ...r characterise the size of the term in several ways, by counting the number of subterms of a particular type it contains. Let us reconsider Example 1. Instead of characterising the size of terms like =-=[1; 2; 3]-=- and [[1]; [2]; [3; 4]] by the particularly constructed norms (k:k 1 and k:k 2 respectively), we characterise their sizes by counting the number of integer values occurring in them, the number of list... |

41 | A general framework for automatic termination analysis of logic programs - Dershowitz, Lindenstrauss, et al. |

30 | Estimating the Computational Cost of Logic Programs
- Debray, López-García, et al.
- 1994
(Show Context)
Citation Context ...able type information. The automatic derivation of norms is an important topic in termination analysis, as well as in other analyses in which the size of a term is an important notion. For example in =-=[8]-=-, information on the size of the arguments of a predicate is used to determine how many solutions it can produce and to estimate its computational cost. This work is generalised in [18] and applied to... |

29 | Abstract Interpretation over Non-deterministic Finite Tree Automata for Set-Based Analysis of Logic Programs
- Gallagher, Puebla
- 2002
(Show Context)
Citation Context ...age like Mercury [24], types and type declarations are dened by the user and the compiler checks for type correctness. However, it is also feasible to infer a correct typing based on methods such as [=-=13]-=-. In what follows, we assume that programs are in normal form. A program is in normal form if each atom is of the form p(X 1 ; : : : ; Xn ), X = Y or X = f(X 1 ; : : : ; Xn ) (with X 1 ; : : : ; Xn ) ... |

27 |
Applying static analysis techniques for inferring termination conditions of logic programs
- Mesnard, Neumerkel
- 2001
(Show Context)
Citation Context ... it is possible to prove termination automatically for a large class of programs. Since the survey in [22] a lot more work has been done towards automation and several analysers have been build, e.g. =-=[5, 17, 20-=-]. Nontermination is due to the existence of a derivation containing an innite sequence of calls to the same predicate, hence termination proofs focus on sequences of calls to recursive predicates. A ... |

18 | Some Issues in Analysis and Specialization of Modular Ciao-Prolog Programs. In Special Issue on Optimization and Implementation of Declarative Programming Languages, volume 30
- Puebla, Hermenegildo
- 2000
(Show Context)
Citation Context ...ectly by the imported predicates) but only the result of a call independent analysis (e.g. the size relations of the imported predicates for all constituents of the types from their declaration). See =-=[21, 4, 26]-=- for discussions about module based analysis. In the remainder of this section we discuss to what extend the size relations that are computed for the constituents of the types in the type declaration ... |

15 |
Typed Norms
- Bossi, Cocco, et al.
- 1992
(Show Context)
Citation Context ...flat(N,R), Y = [H|R]. Again, assume that flat/2 is dened with type list(list(int)) for itssrst argument, and list(int) for its second argument. Assume we want to prove termination for a query f lat([[=-=1; 2]-=-; [3]]; R); The analysis of [3] can show that thesrst argument in every call to flat/2 is list(list(int))-instantiated, list(int)- instantiated and int-instantiated. Consequently, the following level ... |

15 | A framework for analysis of type logic programs
- Lagoon, Stuckey
- 2001
(Show Context)
Citation Context ...nstituent. This drawback is eliminated by the authors of [14]. They extend our work by performing a single analysis that simultaneously considers several size-abstractions, following the framework of =-=[-=-16]. The eect is that norms that are determined by dierent types are mixed, and that dependencies can be maintained between the sizes of terms where each term is measured according to a dierent measur... |

15 | Mode analysis domains for typed logic programs
- Smaus, Hill, et al.
- 2000
(Show Context)
Citation Context ...dened in terms of its constituent type t(t(T )), which in turn is dened in terms of its constituent type t(t(t(T ))), . . . . Similar conditions are common in other analyses of typed programs, e.g. [1=-=3-=-]. 2.2 Size Information In what follows, we measure the \size" of a term with respect to a particular constituent of its type. The -size of a term t : 0 is dened for types 0 and is the number... |

13 | Typed norms for typed logic programs
- Martin, King, et al.
- 1997
(Show Context)
Citation Context ...ically derived from type graphs. These type graphs are constructed by a separate type graph analysis since the subject programs are untyped. Our work, on the other hand, is similar to the analysis of =-=[19-=-] in that it assumes that type information is present and that norms are derived from the readily available type denitions in the program. Polymorphism is dealt with in [19] by imposing a constraint t... |

12 |
Schreye and Stefaan Decorte. Termination of logic programs: The neverending story
- De
- 1994
(Show Context)
Citation Context ...or point of diculty in other type-based approaches. 1 Introduction and Motivation Within the context of logic programming, a lot of attention has been paid to automatic termination analysis (see e.g. =-=[12] for -=-an overview). Roughly said, a logic program terminates with respect to a query of interest Q if it can be shown that in any derivation for Q the \size" { measured over some well-founded domain { ... |

9 | Binding-time annotations without binding-time analysis, in R. Nieuwenhuis and A. Voronkov (eds
- Vanhoof, Bruynooghe
- 2001
(Show Context)
Citation Context ...these relations. This work complements our earlier work on deriving type based instantiation dependencies [4], which are a necessary ingredient for a type based termination analysis. { In recent work =-=[16]-=-, we have developed a binding-time analysis for logic programs that makes heavy use of termination analysis in order to decide what calls can be safely unfolded during specialisation. For this applica... |

8 |
Codish and Cohavit Taboch. A semantics basis for termination analysis of logic programs
- Michael
- 1999
(Show Context)
Citation Context ... it is possible to prove termination automatically for a large class of programs. Since the survey in [22] a lot more work has been done towards automation and several analysers have been build, e.g. =-=[5, 17, 20-=-]. Nontermination is due to the existence of a derivation containing an innite sequence of calls to the same predicate, hence termination proofs focus on sequences of calls to recursive predicates. A ... |

8 |
A framework for analysing the termination of de logic programs with respect to call patterns
- Schreye, Verschaetse, et al.
- 1992
(Show Context)
Citation Context ...te. It follows that two kinds of information are important in automated termination analysis: size information and instantiatedness information. To explain our contribution, we follow the approach of =-=[7-=-] and restrict our attention to denite programs that are directly recursive, i.e. they do not contain loops other than those induced by clauses having one or more body atoms with the same predicate sy... |

8 | Exploiting the power of typed norms in automatic inference of interargument relations
- Decorte, Schreye, et al.
- 1994
(Show Context)
Citation Context ...k 1 = 1 + kEsk 1 k[]k 2 = 0 k[EjEs]k 2 = kEk 1 + kEsk 2 However, while the use of dierent norms opens up a number of possibilities, it also renders the computation of size relations far from trivial [=-=9-=-], as it involves computing relations that hold between dierent norms, like e.g. a size relation for flat/2 expressing that kt 1 k 2 = kt 2 k 1 in any call f lat(t 1 ; t 2 ). In this work, we reconsid... |

6 |
A methodology for granularity-based control of parallelism in logic programs
- Lopez, Hermenegildo, et al.
- 1996
(Show Context)
Citation Context ... For example in [8], information on the size of the arguments of a predicate is used to determine how many solutions it can produce and to estimate its computational cost. This work is generalised in =-=[18-=-] and applied to control the degree of parallelism in a logic program. Types have been used before to drive the construction of suitable norms. In [2], norms are dened in terms of type schemata but no... |

5 | Pos(T): Analyzing dependencies in typed logic programs
- Bruynooghe, Vanhoof, et al.
- 2001
(Show Context)
Citation Context ...r characterise the size of the term in several ways, by counting the number of subterms of a particular type it contains. Let us reconsider Example 1. Instead of characterising the size of terms like =-=[1; 2; 3]-=- and [[1]; [2]; [3; 4]] by the particularly constructed norms (k:k 1 and k:k 2 respectively), we characterise their sizes by counting the number of integer values occurring in them, the number of list... |

5 |
García de la
- Bueno, J
- 1994
(Show Context)
Citation Context ...ectly by the imported predicates) but only the result of a call independent analysis (e.g. the size relations of the imported predicates for all constituents of the types from their declaration). See =-=[21, 4, 26]-=- for discussions about module based analysis. In the remainder of this section we discuss to what extend the size relations that are computed for the constituents of the types in the type declaration ... |

5 |
Constraint based automatic termination analysis of logic programs
- Decorte, Schreye, et al.
- 1999
(Show Context)
Citation Context ...uments. A directly recursive program P can than be shown to terminate under the left-to-right selection rule for all atomic queries in a set S if and only if P is (rigid) acceptable with respect to S =-=[1-=-0]: Denition 1. Let S be a set of atomic queries and P be a denite directly recursive program. Given a norm k:k, we say that P is acceptable with respect to S if for every predicate p=n there exists a... |

5 | Analyzing dependencies in typed logic programs - Pos - 2001 |

4 |
Cohavit Taboch. A semantic basis for termination analysis of logic programs
- Codish
- 1999
(Show Context)
Citation Context ... > jB i 0 j In practice, the callset call(P; S) can be approximated by a set of abstract calls, that represent which of a call's arguments are instantiated enough with respect to a particular norm [5]. A term t is said to be instantiated enough with respect to a norm k:k if and only if ktk = ktk for every substitution (this corresponds with the norm being rigid on t). Likewise, the computed ans... |

3 |
de Schreye, and Massimo Fabris. Automatic inference of norms: A missing link in automatic termination analysis
- Decorte, Danny
- 1993
(Show Context)
Citation Context ... of specifying a norm that might be tailored to the program to be analysed [17]. In any case,sxing a particular norm imposes a number of restrictions on the termination analysis, as was noted e.g. in =-=[2, 11-=-]. The main problem in this context is that by using a single norm an occurrence of a functor in a term is always measured in the same way, although it might make sense to treat dierent occurrences of... |

3 |
Lindenstrauss and Yehoshua Sagiv. Automatic termination analysis of logic programs
- Naomi
- 1997
(Show Context)
Citation Context ... it is possible to prove termination automatically for a large class of programs. Since the survey in [22] a lot more work has been done towards automation and several analysers have been build, e.g. =-=[5, 17, 20-=-]. Nontermination is due to the existence of a derivation containing an innite sequence of calls to the same predicate, hence termination proofs focus on sequences of calls to recursive predicates. A ... |

1 |
Vitaly Lagoon. Combining norms to prove termination
- Genaim, Codish, et al.
- 2002
(Show Context)
Citation Context ...d using a single norm. The drawback is a possible loss of generality because we consider only relations between arguments that have a common constituent. This drawback is eliminated by the authors of =-=[1-=-4]. They extend our work by performing a single analysis that simultaneously considers several size-abstractions, following the framework of [16]. The eect is that norms that are determined by dierent... |