Automatic mode inference for logic programs

Saumya K Debray, David S. Warren

Research output: Contribution to journalArticle

83 Citations (Scopus)

Abstract

In general, logic programs are undirected, i.e., there is no concept of "input" and "output" arguments to a procedure. An argument may be used either as an input or as an output argument, and programs may be executed either in a "forward" direction or in a "backward" direction. However, it is often the case that in a given program, a predicate is used with some of its arguments used consistently as input arguments and others as output arguments. Such mode information can be used by a compiler to effect various optimizations. This paper considers the problem of automatically inferring the models of the predicates in a program. The dataflow analysis we use is more powerful than approaches relying on syntactic characteristics of programs. Our work differs from that of Mellish in that (1) we give a sound and efficient treatment of variable aliasing in mode inference; (2) by propagating instantiation information using state transformations rather than through dependencies between variables, we achieve greater precision in the treatment of unification, e.g. through =/2; and (3) we describe an efficient implementation based on the dynamic generation of customized mode interpreters. Several optimizations to improve the performance of the mode inference algorithm are described, as are various program optimizations based on mode information.

Original languageEnglish (US)
Pages (from-to)207-229
Number of pages23
JournalJournal of Logic Programming
Volume5
Issue number3
DOIs
StatePublished - 1988
Externally publishedYes

Fingerprint

Logic Programs
Data flow analysis
Syntactics
Predicate
Optimization
Output
Acoustic waves
Aliasing
Data Flow
Unification
Efficient Implementation
Compiler

ASJC Scopus subject areas

  • Logic

Cite this

Automatic mode inference for logic programs. / Debray, Saumya K; Warren, David S.

In: Journal of Logic Programming, Vol. 5, No. 3, 1988, p. 207-229.

Research output: Contribution to journalArticle

Debray, Saumya K ; Warren, David S. / Automatic mode inference for logic programs. In: Journal of Logic Programming. 1988 ; Vol. 5, No. 3. pp. 207-229.
@article{64aad293c7234d63ada0fca1d3644384,
title = "Automatic mode inference for logic programs",
abstract = "In general, logic programs are undirected, i.e., there is no concept of {"}input{"} and {"}output{"} arguments to a procedure. An argument may be used either as an input or as an output argument, and programs may be executed either in a {"}forward{"} direction or in a {"}backward{"} direction. However, it is often the case that in a given program, a predicate is used with some of its arguments used consistently as input arguments and others as output arguments. Such mode information can be used by a compiler to effect various optimizations. This paper considers the problem of automatically inferring the models of the predicates in a program. The dataflow analysis we use is more powerful than approaches relying on syntactic characteristics of programs. Our work differs from that of Mellish in that (1) we give a sound and efficient treatment of variable aliasing in mode inference; (2) by propagating instantiation information using state transformations rather than through dependencies between variables, we achieve greater precision in the treatment of unification, e.g. through =/2; and (3) we describe an efficient implementation based on the dynamic generation of customized mode interpreters. Several optimizations to improve the performance of the mode inference algorithm are described, as are various program optimizations based on mode information.",
author = "Debray, {Saumya K} and Warren, {David S.}",
year = "1988",
doi = "10.1016/0743-1066(88)90010-6",
language = "English (US)",
volume = "5",
pages = "207--229",
journal = "Journal of Logic Programming",
issn = "1567-8326",
publisher = "Elsevier Inc.",
number = "3",

}

TY - JOUR

T1 - Automatic mode inference for logic programs

AU - Debray, Saumya K

AU - Warren, David S.

PY - 1988

Y1 - 1988

N2 - In general, logic programs are undirected, i.e., there is no concept of "input" and "output" arguments to a procedure. An argument may be used either as an input or as an output argument, and programs may be executed either in a "forward" direction or in a "backward" direction. However, it is often the case that in a given program, a predicate is used with some of its arguments used consistently as input arguments and others as output arguments. Such mode information can be used by a compiler to effect various optimizations. This paper considers the problem of automatically inferring the models of the predicates in a program. The dataflow analysis we use is more powerful than approaches relying on syntactic characteristics of programs. Our work differs from that of Mellish in that (1) we give a sound and efficient treatment of variable aliasing in mode inference; (2) by propagating instantiation information using state transformations rather than through dependencies between variables, we achieve greater precision in the treatment of unification, e.g. through =/2; and (3) we describe an efficient implementation based on the dynamic generation of customized mode interpreters. Several optimizations to improve the performance of the mode inference algorithm are described, as are various program optimizations based on mode information.

AB - In general, logic programs are undirected, i.e., there is no concept of "input" and "output" arguments to a procedure. An argument may be used either as an input or as an output argument, and programs may be executed either in a "forward" direction or in a "backward" direction. However, it is often the case that in a given program, a predicate is used with some of its arguments used consistently as input arguments and others as output arguments. Such mode information can be used by a compiler to effect various optimizations. This paper considers the problem of automatically inferring the models of the predicates in a program. The dataflow analysis we use is more powerful than approaches relying on syntactic characteristics of programs. Our work differs from that of Mellish in that (1) we give a sound and efficient treatment of variable aliasing in mode inference; (2) by propagating instantiation information using state transformations rather than through dependencies between variables, we achieve greater precision in the treatment of unification, e.g. through =/2; and (3) we describe an efficient implementation based on the dynamic generation of customized mode interpreters. Several optimizations to improve the performance of the mode inference algorithm are described, as are various program optimizations based on mode information.

UR - http://www.scopus.com/inward/record.url?scp=0024085102&partnerID=8YFLogxK

UR - http://www.scopus.com/inward/citedby.url?scp=0024085102&partnerID=8YFLogxK

U2 - 10.1016/0743-1066(88)90010-6

DO - 10.1016/0743-1066(88)90010-6

M3 - Article

AN - SCOPUS:0024085102

VL - 5

SP - 207

EP - 229

JO - Journal of Logic Programming

JF - Journal of Logic Programming

SN - 1567-8326

IS - 3

ER -