Bidirectional inference of mode information for logic programs



Mode information (directional information concerning the arguments of predicates) is important in improving the speed of the execution of logic programs. This paper proposes a bidirectional inference algorithm for inferring precise mode information. Compared with the conventional inference algorithms, the proposed algorithm has the following two features: (1) the algorithm utilizes not only the modes of the predicates at the top level but also the modes of the built-in predicates used in the program; and (2) by propagating the modes of the top level predicates top-down and that of the built-in predicates bottom-up, more precise mode information can be inferred.