Abstract
Although the ability to simulate nondeterminism and to compute multiple solutions for a single query is a powerful and attractive feature of logic programming languages, it is expensive in both time and space. Since programs in such languages are very often functional, that is, they do not produce more than one distinct solution for a single input, this overhead is especially undesirable. This paper describes how programs may be analyzed statically to determine which literals and predicates are functional, and how the program may then be optimized using this information. Our notion of “functionality” subsumes the notion of “determinacy” that has been considered by various researchers. Our algorithm is less reliant on language features such as the cut, and thus extends more easily to parallel execution strategies, than others that have been proposed.
- 1 BRUYNOOGHE, M., AND PEREIRA, L. M. Deduction revision by intelligent backtracking. In Implementations of Prolog, J. A. Campbell, Ed. Ellis Horwood Ltd., Chichester, 1984, pp. 194-215.Google Scholar
- 2 BUTLER, R., LUSK, E. L., OLSON, R., AND OVERBEEK, R.A. ANLWAM: A parallel implementation of the Warren abstract machine. Intern. Rep., Argonne National Laboratory, Chicago, Ill., 1986.Google Scholar
- 3 CHANG, J., AND DESPAIN, A.M. Semi-intelligent backtracking of Prolog based on static data dependency analysis. In Proceedings of the 1985 Symposium on Logic Programming (Boston, Mass., Feb. 1985). IEEE, Washington, D.C., 1985, pp. 10-21.Google Scholar
- 4 CLARK, $. r. Negation as failure. In Logic and Data Bases, H. Gallaire and J. Minker, Eds. Plenum, New York, 1978.Google Scholar
- 5 CONERY, J.S. Parallel Execution of Logic Programs. Kluwer, The Netherlands, 1987. Google Scholar
- 6 DEBRAY, S.K. The SB-Prolog system, version 2.3.2: A user manual. Tech. Rep. 87-15, Dept. of Computer Science, Univ. of Arizona, Tucson, Ariz., Dec. 1987. (Revised March 1988.)Google Scholar
- 7 DEBRAY, S. K., AND MISHRA, P. Denotational and operational semantics for Prolog. J. Logic Program. 5, I (Mar. 1988), 61-91. Google Scholar
- 8 DEBRAY, S. K., AND WARREN, D.S. Automatic mod.~ inference for logic programs. J. Logic Program. 5, 3 (Sept. 1988), 207-229. Google Scholar
- 9 DEGROOT, D. Restricted AND-parallelism. In Proceedings of the International Conference on Fifth Generation Computer Systems ICOT, (Tokyo, 1984 ).Google Scholar
- 10 DERANSART, P., AND MALUSZYNSKI, J. Relating logic programs and attribute grammars. J. Logic Program. 2, 2 (July 1985), 119-156.Google Scholar
- 11 HAUSMAN, B., CIEPIELEWSKI, A., AND HARIDI, S. Or-parallel Prolog made efficient on shared memory multiproeessors. In Proceedings of the 1987 IEEE Symposium on Logic Programming (San Francisco, Calif., Aug. 1987). IEEE, New York, 191~7, pp. 69-79.Google Scholar
- 12 HERMENEGILDO, M. V. An abstract machine for resLricted AND-parallel execution of logic programs. In Proceedings of the 3rd International Conlerence on Logic Programming (London, July 14-18, 1986). Springer, New York, 1986, pp. 25-39. (Springer-Verlag LNCS vol. 225.) Google Scholar
- 13 JONES, N. D., AND MYCROrT, A. Stepwise developmenL of operational and denotational semantics for PROLOG. In Proceedings of the 1984 Internatwnal Symposium on Logic Programming (Atlantic City, N.J., Feb. 6-9, 1984). IEEE, New York, ~.984, pp. 289-298.Google Scholar
- 14 KALE, L. V. The REDUCE-OR process model for parallel evaluation of logic programs. In Proceedings of the 4th International Conference on Logi( Programming. (Melbourne, May 25-29, 1987). MIT Press, Cambridge, Mass., 1987, pp. 616-632Google Scholar
- 15 LLOYD, J.W. Foundations of Logic Programming. Springer-Verlag, New York, 1984. Google Scholar
- 16 MAIER, D. The Theory of Relational Databases. Computer Science Press, Rockville, Md., 1983. Google Scholar
- 17 MELLISH, C.S. Some global optimizations for a Prok,g compiler. J. Logic Program. 2, I (Apr. 1985), 43-66.Google Scholar
- 18 MENOELZON, A.O. Functional dependencies in logic programs. In Proceedings of the 11th ACM International Conference on Very Large Data Bases (Stockholm, Aug. 1985). ACM, New York, 1985.Google Scholar
- 19 NAISH, L. Negation and qnantifiers in NU-Prolog. iln Proceedings of the 3rd International Conference on Logic Programming (London, July 14-18, 1986). Springer-Verlag, New York, 1986, pp. 624-634. (Springer-Verlag LNCS vol. 225.) Google Scholar
- 20 NAISH, L. Negation and Control in Prolog. LNCS vol. ~38. Springer-Verlag, New York, 1986. Google Scholar
- 21 O'KEEFE, R.A. On the treatment of cuts in Prolog sou me-level tools. In Proceedings of the 1985 Symposium on Logic Programming (Boston, Mass., Julv 15-18, 1985) IEEE, Washington, D.C., 1985, pp. 73-77.Google Scholar
- 22 OVERBEEK, R. a., GABRIEL, J., LINDHOLM, W., AND I. USK, E.L. Prolog on multiprocessors. Intern. Rep., Argonne National Laboratory, Chicago, IlL 1985.Google Scholar
- 23 ROBINSON, J.A. Logic programming--Past, present end future. New Generation Comput. I, 2 (1983).Google Scholar
- 24 SAWAMURA, $., AND TAKESHIMA, T. Recursive unsob~ability of determinacy, solvable cases of determinacy and their applications to Prolog optimizati(,n. In Proceedings of the 1985 Symposium on Logic Programming (Boston, Mass., July 15-18, 19~5). IEEE, Washington, D.C., 1985, pp. 200-207.Google Scholar
- 25 VAN EMDEN, M. H., AND KOWALSKI, R.A. The semantics of predicate logic as a programming language. J. ACM 23, 4 (Oct. 1976), 733-742. Google Scholar
- 26 WARREN, D. $. D. Implementing Prolog--Compiling predicate logic programs. Res. Reps. 39 and 40, Dept. of Artificial Intelligence, Univ. of Edinbul'gh, 1977.Google Scholar
- 27 WARREN, D. H.D. Efficient processing of interactive relational database queries expressed in logic. In Proceedings of the 7th Conference on Very Large Data Bases (Cannes, Sept. 9-11, 1981). ACM, New York, 1981, pp. 272-281.Google Scholar
- 28 WARREN, D. $. D. An abstract Prolog instruction set. Tech. Note 309, SRI International, Menlo Park, Calif., Oct. 1983.Google Scholar
- 29 WARREN, D. $. D. The SRI model for or-parallel execution of Prolog--Abstract design and implementation issues. In Proceedings of the 1987 IEEE Symposium on Logic Programming (San Francisco, Calif., Aug. 31-Sept. 4, 1987). IEEE, New Ycrk, pp. 92-102.Google Scholar
- 30 WARREN, D. S., AHAMAD, M., DEBRAY, S. K., AND KALE, L.V. Executing distributed Prolog programs on a broadcast network. In Proceedings of the 1984 International Symposium on Logic Programming (Atlantic City, N.J., Feb. 1984). IEEE, Washington, D.C., 1984.Google Scholar
- 31 WESTPHAL, H., ROBERT, P., CHASSIN, J., AND SYRE, J. The PEPSys model: Combining backtracking, AND- and OR-parallelism. In Proceedings of the 1987 IEEE Symposium on Logic Programming, (San Francisco, Calif., Aug. 31-Sept. 4, 1987). IEEE, New York, 1987, pp. 436-448.Google Scholar
- 32 WISE, M.J. Epilog: Reinterpreting and extending Prolog for a multiprocessor environment. In Implementations o{ Prolog, J. A. Campbell, Ed. Ellis Horwood Ltd., Chichester, 1984, pp. 341-351.Google Scholar
Index Terms
- Functional computations in logic programs
Recommendations
The completeness of functional logic
AbstractA new first-order logic, functional logic, was proposed recently by Staples, Robinson and Hazel. The logic provides a formal means of describing and reasoning about dependence on an implicit parameter, a prime motivation being the unification of ...
Proving Failure in Functional Logic Programs
CL '00: Proceedings of the First International Conference on Computational LogicHow to extract negative information from programs is an important issue in logic programming. Here we address the problem for functional logic programs, from a proof-theoretic perspective. The starting point of our work is CRWL (Constructor based ...
Comments