Scoping constructs in logic programming: Implementation problems and their solution

Gopalan Nadathur, Bharat Jayaraman, Keehang Kwon

Research output: Contribution to journalArticlepeer-review

11 Scopus citations

Abstract

The inclusion of universal quantification and a form of implication in goals in logic programming is considered. These additions provide a logical basis for scoping, but they also raise new implementation problems. When universal and existential quantifiers are permitted to appear in mixed order in goals, the devices of logic variables and unification that are employed in solving existential goals must be modified to ensure that constraints arising out of the order of quantification are respected. Suitable modifications that are based on attaching numerical tags to constants and variables and on using these tags in unification are described. The resulting devices are amenable to an efficient implementation and can, in fact, be assimilated easily into the usual machinery of the Warren Abstract Machine (WAM). The provision of implications in goals results in the possibility of program clauses being added to the program for the purpose of solving specific subgoals. A naive scheme based on asserting and retracting program clauses does not suffice for implementing such additions for two reasons. First, it is necessary to also support the resurrection of an earlier existing program in the face of backtracking. Second, the possibility for implication goals to be surrounded by quantifiers requires a consideration of the parameterization of program clauses by bindings for their free variables. Devices for supporting these additional requirements are described as also is the integration of these devices into the WAM. Further extensions to the machine are outlined for handling higher-order additions to the language. The ideas presented here are relevant to the implementation of the higher-order logic programming language λProlog.

Original languageEnglish (US)
Pages (from-to)119-161
Number of pages43
JournalThe Journal of Logic Programming
Volume25
Issue number2
DOIs
StatePublished - Nov 1995

Bibliographical note

Funding Information:
The inclusion of universal quantification and a form of implication in goals in logic programming is considered. These additions provide a logical basis for scoping, but they also raise new implementation problems. When universal and existential quantifiers are permitted to appear in mixed order in goals, the devices of logic variables and unification that are employed in solving existential goals must be modified to ensure that constraints arising out of the order of quantification are respected. Suitable modifications that are based on attaching numerical tags to constants and variables and on using these tags in unification are described. The resulting devices are amenable to an efficient implementation and can, in fact, be assimilated easily into the usual machinery of the Warren Abstract Machine (WAM). The provision of implications in goals results in the possibility of program clauses being added to the program for the purpose of solving specific subgoals. A naive scheme based on asserting and retracting program clauses does not suffice for implementing such additions for two reasons. First, it is necessary to also support the resurrection of an earlier existing program in the face of backtracking. Second, the possibility for implication goals to be surrounded by quantifiers requires a consideration of the parameterization Work on this paper has been partly supported by NSF Grants CCR-89-05825 and CCR-92-08465.

Fingerprint

Dive into the research topics of 'Scoping constructs in logic programming: Implementation problems and their solution'. Together they form a unique fingerprint.

Cite this