In this paper, a Gaifman–Shapiro-style module architecture is tailored
to the case of smodels programs under the stable model semantics. The
composition of smodels program modules is suitably limited by module
conditions which ensure the compatibility of the module system with stable
models. Hence the semantics of an entire smodels program depends
directly on stable models assigned to its modules. This result is formalized as
a module theorem which truly strengthens V. Lifschitz and H.
Turner's splitting-set theorem (June 1994, Splitting a logic program. In
Logic Programming: Proceedings of the Eleventh International
Conference on Logic Programming, Santa Margherita Ligure, Italy, P.
V. Hentenryck, Ed. MIT Press, 23–37) for the class of smodels
programs. To streamline generalizations in the future, the module theorem is
first proved for normal programs and then extended to cover smodels
programs using a translation from the latter class of programs to the former
class. Moreover, the respective notion of module-level equivalence, namely
modular equivalence, is shown to be a proper congruence
relation: it is preserved under substitutions of modules that are modularly
equivalent. Principles for program decomposition are also addressed. The
strongly connected components of the respective dependency graph can be
exploited in order to extract a module structure when there is no explicit
a priori knowledge about the modules of a program. The
paper includes a practical demonstration of tools that have been developed for
automated (de)composition of smodels programs.