UCSC-CRL-95-32: LINEAR TIME UNIT RESOLUTION FOR PROPOSITIONAL FORMULAS--IN PROLOG, YET

04/01/1995 09:00 AM
Computer Science
A procedure to analyze a propositional formula in clause form by unit resolution is described and illustrated with a Prolog implementation. It runs in worst-case time that is linear in the length of the formula. The main idea has been independently rediscovered by several implementers. Apparently, its first journal appearance was a sketch by Dalal and Etherington in 1992. However, there also had arisen a folkloric belief that unit resolution requires quadratic time. This report shows that the implementation sketched for imperative languages, such as C, consumes quadratic time if translated to Prolog. This degradation occurs even if clause indexing permits the retrieval of an asserted clause in constant time. It is rather due to the way Prolog handles assertions involving data structures, such as lists. A modified Prolog implementation that restores linear time is described. The time remains linear even if the procedure is run ``on-line\'\', meaning that new clauses appear in the input as processing proceeds. This property is useful in applications that have several mechanisms for deriving new clauses. The technique may have application in other problems that can be described as inductive closures on finite domains. Ad hoc solutions to such problems are error-prone and often inefficient.

UCSC-CRL-95-32