A Theory of Modules for Logic Programming

We present a logical language which extends the syntax of positive Horn clauses by permitting implications in goals and in the bodies of clauses. The operational meaning of a goal which is an implication is given by the deduction theorem. That is, a goal D ⊃ G is satisfied by a program P if the goal G is satisfied by the larger program P ∪ {D}. If the formula D is the conjunction of a collection of universally quantified clauses, we interpret the goal D ⊃ G as a request to load the code in D prior to attempting G, and then unload that code after G succeeds or fails. This extended use of implication provides a logical explanation of parametric modules, some uses of Prolog's assert predicate, and certain kinds of abstract datatypes. Both a model-theory and proof-theory are presented for this logical language. We show how to build a possible-worlds (Kripke) model for programs by a fixed point construction and show that the operational meaning of implication mentioned above is sound and complete for intuitionistic, but not classical, logic. 1. Implications as Goals Let A be a syntactic variable which ranges over atomic formulas of first-order logic. Let G range over a class of formulas, called goal formulas, to be specified shortly. We shall assume, however, that this class always contains ⊤ (true) and all atomic formulas. The formulas represented by A and G may contain free variables. Given these two classes, we define definite clauses, denoted by the syntactic variable D, as follows: