Some low-level source transformations of logic programs

This paper describes an algorithm performing an analysis and transformation of logic programs. The transformation achieves two goals: redundant functors are removed from the program, and procedures may be split into two or more specialised versions handling different cases. It can be applied to most logic programming languages, including concurrent logic programming languages, because the transformations perform no unfolding of the program; they only remove some redundant operations within the unifications. The main saving is in heap usage, though time performance may also be improved. One of the main purposes of the transformation is to “clean up” programs generated by other methods of transformation or synthesis. The analysis is an example of an abstract interpretation, and is guaranteed to terminate. A Prolog implementation of the algorithm, illustrating some meta-programming techniques, is given and some results are reported.