A Parameterised Module System for Constructing Typed Logic Programs

Patricia M. Hill

Introduction

In the field of logic programming, modularity is essential for managing the complexity of large-scale software systems. While languages like Gödel provide a robust foundation for knowledge representation, their original module systems often lacked the flexibility required for modern software engineering. P.M. Hill from the University of Leeds addresses this limitation by proposing a parameterised module system that allows for the creation of truly generic and reusable software components.

The Challenge of Modularity in Logic Programming

Traditional logic programming environments often enforce a rigid structure where predicates must be fully defined within a single module. This constraint hinders the development of generic libraries. For instance, a developer might wish to define the logic for a transitive closure once and apply it to various relations, such as "ancestor," "part-of," or "less-than." Without parameterisation, the logic must be duplicated or hardcoded for each specific use case, leading to maintenance challenges and code bloat.

The Parameterised Module Framework

The proposed extension introduces modules defined by a signature—a collection of types or predicates that serve as placeholders or parameters. An "initial module" contains the generic logic, which is then instantiated by providing a substitution that maps these parameters to specific symbols in the target application. This allows for a clean separation between the abstract logic and the concrete data it operates on.

Module definitions showing parameterisation for family relations and transitive closures.

As shown in the example above, the system allows for the decoupling of logic from data. A module like Trans (defining transitivity) can be defined generically and then reused for both family relations (Person) and geometric connectivity (Point). This approach enables finer-grained reuse compared to systems that parameterize by entire module names, offering developers more precise control over code integration.

Demodularisation and Formal Semantics

To maintain the formal integrity of the underlying logic, the system employs a process called demodularisation. This mapping transforms the modular, parameterised program into a "flat," module-free typed logic program. This ensures that the modular abstractions do not conflict with the standard semantics of logic programming, allowing the code to be compiled and executed using existing logic engines.

The result of the demodularisation process on a modular program.

The demodularisation process (illustrated above) handles the resolution of symbol names, ensuring that even when a predicate's definition is split across multiple modules or inherited through multiple paths, the resulting flat program remains sound. This formal framework ensures that encapsulation and independent compilation are preserved without sacrificing logical correctness.

Conclusion

By bridging the gap between formal logic and practical software engineering, this parameterised module system significantly enhances the utility of the Gödel language. It provides a robust framework for building encapsulated, reusable, and maintainable logic programs, effectively overcoming the "reusability bottleneck" that previously limited the scale and flexibility of such systems.

Summary updated

BibTeX
@inproceedings{hill1993parameterised,
  author = {Patricia M. Hill},
  title = {{A Parameterised Module System for Constructing Typed Logic Programs}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {1993},
}
Figure