Global Variables in Logic Programming
Peter Schachte · The MIT Press eBooks · 1997
We show that adding global variables to logic programming can solve some common problems of reliability and programmer productivity in large logic programs. By presenting a formal semantics for logic programs with global variables, we show that this addition retains a clean semantics. This addition has the consequences that conjunction is neither commutative nor absorptive, but we show that the practical loss is small. We also describe an implementation of Prolog with global variables as a translator to ordinary Prolog which preserves the efficiency of the Prolog program, while statically detecting some programming errors, and avoiding others altogether. 1 Introduction In small example programs as commonly found in texts on logic programming, there is not much information that needs to be passed around, so predicates usually have few arguments, rarely more than four or five. However, in real programs there is typically much more information that needs to be passed around. Information ...