Efficient local unfolding with ancestor stacks*

  • Authors:
  • GermÁn Puebla;Elvira Albert;Manuel Hermenegildo

  • Affiliations:
  • School of computer science, technical university of madrid, e28660-boadilla del monte, madrid, spain (e-mail: german@fi.upm.es);School of computer science, complutense university of madrid, e28040-profesor josé garcía santesmases, s/n, madrid, spain (e-mail: elvira@sip.ucm.es);School of computer science, technical university of madrid, e28660-boadilla del monte, madrid, spain (e-mail: herme@fi.upm.es) and madrid institute for advanced studies in software development tec ...

  • Venue:
  • Theory and Practice of Logic Programming
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

The most successful unfolding rules used nowadays in the partial evaluation of logic programs are based on well quasi orders (wqo) applied over (covering) ancestors, i.e., a subsequence of the atoms selected during a derivation. Ancestor (sub)sequences are used to increase the specialization power of unfolding while still guaranteeing termination and also to reduce the number of atoms for which the wqo has to be checked. Unfortunately, maintaining the structure of the ancestor relation during unfolding introduces significant overhead. We propose an efficient, practical local unfolding rule based on the notion of covering ancestors which can be used in combination with a wqo and allows a stack-based implementation without losing any opportunities for specialization. Using our technique, certain nonleftmost unfoldings are allowed as long as local unfolding is performed, i.e., we cover depth-first strategies. To deal with practical programs, we propose assertion-based techniques which allow our approach to treat programs that include (Prolog) built-ins and external predicates in a very extensible manner, for the case of leftmost unfolding. Finally, we report on our implementation of these techniques embedded in a practical partial evaluator, which shows that our techniques, in addition to dealing with practical programs, are also significantly more efficient in time and somewhat more efficient in memory than traditional tree-based implementations.