skip to main content
article
Open access

On the occur-check-free PROLOG programs

Published: 01 May 1994 Publication History

Abstract

In most PROLOG implementations, for efficiency occur-check is omitted from the unification algorithm. This paper provides natural syntactic conditions that allow the occur-check to be safely omitted. The established results apply to most well-known PROLOG programs, including those that use difference lists, and seem to explain why this omission does not lead in practice to any complications. When applying these results to general programs, we show their usefulness for proving absence of floundering. Finally, we propose a program transformation that transforms every program into a program for which only the calls to the built-in unification predicate need to be resolved by a unification algorithm with the occur-check.

References

[1]
ALBERT, L., CASAS, R., AND FAGES, F. 1993. Average case analysis of unification algorithms. Theor. Comput. Sci. 113, 1, 24, 3-34.
[2]
APT, K.R. 1990. Logic programming. In Handbook of Theoretical Computer Science, vol. B, J. van Leeuwen, Ed. Elsevier, North-Holland, New York, 493-574.
[3]
APT, K. R. AND DOLTS, K. 1994. A new definition of SLDNF-resolution. J. Logic Program. 18, 177-190.
[4]
APT, K. R., AND PELLEGRINI, A. 1992. Why the occur-check is not a problem. In Proceedings of the 4th International Symposium on Programmtng Language Implementation and Logic Programming (PLILP 92), M. Bruynooghe and M. Wirsing, Eds. Lecture Notes in Computer Science, vol 631, Springer-Verlag, Berlin, 69-86.
[5]
APT, K. R., vAN EMDE BOAS, P., AND WELLING, A. 1994. The STO problem is NP-hard. Res. Rep. CT-94-08, Dept of Mathematics and Computer Science, Univ. of Amsterdam, The Netherlands.
[6]
BEER, J. 1988. The occur-check problem revisited. J. Logic Program. 5, 243-261.
[7]
BossI, A., AND Cocco, N. 1990. Basic transformation operations for logic programs which preserve computed answer substitutions. Tech. Rep. 16, Dipartimento di Matematica Puraed Applicata, Universit~ di Padova, Italy.
[8]
CHADHA, R., AND PLAISTED, D. A. 1994. Correctness of unification without occur check in Prolog. J. Logic Program. 18, 99-122.
[9]
CLARK, K.L. 1979. Predicate logic as a computational formalism. Res. Rep. DOC 79/59, Dept. of Computing, Imperial College, London.
[10]
CURRY, H. B., AND FEYS, R. 1958. Combinatory Logic. Vol. I. Studies zn Logic and the Foundation of Mathematics. North-Holland, Amsterdam.
[11]
DECKER, H. 1991. On generalized cover axioms. In Proceedings of the 8th international Conference on Logic Programming, K. Furukawa, Ed. MIT Press, Paris, France, 693-707.
[12]
DEMBINSKI, P., AND MALUSZYNSKI, J. 1985. AND-parallelism with intelligent backtracking for annotated logic programs. In Proceedings of the International Symposium on Logic Programming (Boston, Mass.). 29-38.
[13]
DERANSART, P., AND MALUSZYNSKI, J. 1985. Relating logic programs and attribute grammars. J. Logtc Program., 2, 119-156.
[14]
DERANSART, P., FERRAND, G., AND TI~GUIA, M. 1991. NSTO programs (not subject to occur-check). In Proceedings of the International Logtc Symposium, V. Saraswat and K. Ueda, Eds. MIT Press, Cambridge, Mass., 533-547.
[15]
DRABENT, W. 1987. Do logic programs resemble programs in conventional languages? In International Symposium on Logic Programmtng (San Francisco, Calif., Aug.) IEEE, New York, 389-396.
[16]
DUMANT, B. 1992. Checking soundness of resolution schemes. In Proceedings of the Joint International Conference and Symposium on Logic Programming, K. R. Apt, Ed. MIT Press, Cambridge, Mass., 37-51.
[17]
LASSEZ, J.-L., MAHER, M. J., AND MARRIOTT, K. 1988. Unification revisited. In Foundations of Deducttve Databases and Logic Programming, J. Minker, Ed. Morgan Kaufmann, Los Altos, Calif., 587-625.
[18]
LLOYD, J.W. 1987. Foundations of Logic Programming. 2nd ed. Springer-Verlag, Berlin.
[19]
MARIOTT, K., SONDERGAARD, H., AND DART, P. 1990. A characterization of non-floundering logic programs. In Proceedings of the North American Conference on Logtc Programming '90, S. Debray and M. Hermenegildo, Eds. MIT Press, Cambridge, Mass. 661-680.
[20]
MARTELLI, A., AND MONTANARI, U. 1982. An efficient unification algorithm. ACM Trans. Program. Lang. Syst. 4, 258-282.
[21]
MELLISH, C.S. 1981. The automatic generation of mode declarations for Prolog programs. DAI Res. Pap. 163, Dept of Artificial Intelligence, Univ. of Edinburgh, Aug.
[22]
PLAISTED, D.A. 1984. The occur-check problem in Prolog. In Proceedings of the International Conference on Logic Programming. IEEE, New York, 272-280.
[23]
REDD~, W. ~. 1984. Transformation of logic programs into functional programs. In Interna- tional Sympostum on Logic Programming (Silver Spring, Md., Feb.). IEEE, New York, 187-198.
[24]
REDDY, U.S. 1986. On the relationship between logic and functional languages. In Functional and Logic Programming, D. DeGroot and G. Lindstrom, Eds. Prentice-Hall, Englewood Cliffs, N.J., 3-36.
[25]
ROSENBLUETH, D.A. 1991. Using program transformation to obtain methods for eliminating backtracking in fixed-mode logic programs. Tech Rep. 7, Instituto de Investigaclones en Matematicas Aplicadas yen Sistemas. Universidad Nacional Autonoma de Mexico
[26]
SHEPHERDSON, J.C. 1991. Unsolvable problems for SLDNF resolution. J Logic Program. 10, 1, 19-22.
[27]
SCNDERGAARD, g. 1986. An application of abstract interpretation of logic programs: Occur check reduction. In Proceedzngs of ESOP'86 (Sarrbruecken, Germany). 327-338
[28]
STERLING, L., AND SHAPIRO, E. 1986. The Art ofProlog, MIT Press, Cambridge, Mass.
[29]
STROETMAN, K. 1993. A completeness result for SLDNF resolution. J. Logic Program. 15, 337-357.
[30]
TAMAKI, H., AND SATO, T. 1984. Unfold/fold transformation of logic programs. In Proceedings of the 2nd International Conference on Logic Programming (Uppsala, Sweden). 127-137.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Programming Languages and Systems
ACM Transactions on Programming Languages and Systems  Volume 16, Issue 3
May 1994
773 pages
ISSN:0164-0925
EISSN:1558-4593
DOI:10.1145/177492
Issue’s Table of Contents

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 01 May 1994
Published in TOPLAS Volume 16, Issue 3

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. PROLOG programs
  2. moded programs
  3. occur-check problem
  4. unification algorithm

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)68
  • Downloads (Last 6 weeks)26
Reflects downloads up to 19 Oct 2024

Other Metrics

Citations

Cited By

View all
  • (2023)A relaxed condition for avoiding the occur-checkTheoretical Computer Science10.1016/j.tcs.2023.114107975:COnline publication date: 9-Oct-2023
  • (2021)A Note on Occur-CheckElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.345.17345(54-67)Online publication date: 17-Sep-2021
  • (2009)Functional Modelling and Mathematical Models: A Semantic AnalysisPhilosophy of Technology and Engineering Sciences10.1016/B978-0-444-51667-1.50029-X(665-692)Online publication date: 2009
  • (2009)LP with flexible grouping and aggregates using modesProceedings of the 19th international conference on Logic-Based Program Synthesis and Transformation10.1007/978-3-642-12592-8_6(67-81)Online publication date: 1-Sep-2009
  • (2006)Termination of logic programs with block declarations running in several modesPrinciples of Declarative Programming10.1007/BFb0056608(73-88)Online publication date: 2-Jun-2006
  • (2005)cTI: a constraint-based termination inference tool for ISO-PrologTheory and Practice of Logic Programming10.1017/S14710684040020175:1-2(243-257)Online publication date: 1-Jan-2005
  • (2005)Time in Qualitative Simulation10.1016/S1574-6526(05)80022-7(655-664)Online publication date: 2005
  • (2005)Abstracting unification: A key step in the design of logic program analysesComputer Science Today10.1007/BFb0015257(406-425)Online publication date: 9-Jun-2005
  • (2005)A comparison of three occur-check analysersStatic Analysis10.1007/3-540-61739-6_40(159-173)Online publication date: 2-Jun-2005
  • (2005)Mode and termination checking for higher-order logic programsProgramming Languages and Systems — ESOP '9610.1007/3-540-61055-3_44(296-310)Online publication date: 2-Jun-2005
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media