Proposal for Global Variables in Standard Prolog

Katsuhiko Nakamura, Nobukuni Kino, Japanese Prolog Wg · 2007

Data types of Prolog are essentially restricted to terms at the cost of compactness and the unity of a logic programming language. On the other hand, it has been commonly recognized that Prolog has two practical problems, which considerably prevent the language and logic programming from being used for broader area of information processing. One problem is that Standard Prolog does not have the direct means for efficient random access of data in a large working memory such as arrays or hash memories. The other problem is that pure Prolog has no global variables such as those in Lisp and C. The array functions are closely related to the global variables, as the values of both global variables and the array elements need to be updated. It is well known that the global variables in logic programs are converted to additional arguments. This conversion causes, however, inefficiency in program execution as well as difficulties in reading and writing programs, since the numbers of arguments need to be increased in large programs. Schachte [5] showed formal semantics for programs with the global variables and a method of transforming programs with the global variables into efficient logic programs. In general, logic programming observes the single assignment rule so that no variable is destructively assigned in usual execution. On the other hand, we need to update the values in the global variables and array elements. The logical assignment is a mechanism to compromise these two contradictory conditions, by which we can update the values of global variables and array elements

Read the paper · More papers on PaperTik