Home

# Logic + control: On program construction and verification

## Abstract

This paper presents an example of formal reasoning about the semantics of a Prolog program of practical importance (the SAT solver of Howe and King). The program is treated as a definite clause logic program with added control. The logic program is constructed by means of stepwise refinement, hand in hand with its correctness and completeness proofs. The proofs are declarative – they do not refer to any operational semantics. Each step of the logic program construction follows a systematic approach to constructing programs which are provably correct and complete. We also prove that correctness and completeness of the logic program is preserved in the final Prolog program. Additionally, we prove termination, occur-check freedom and non-floundering.

Our example shows how dealing with “logic” and with “control” can be separated. Most of the proofs can be done at the “logic” level, abstracting from any operational semantics.

The example employs approximate specifications; they are crucial in simplifying reasoning about logic programs. It also shows that the paradigm of semantics-preserving program transformations may be not sufficient. We suggest considering transformations which preserve correctness and completeness with respect to an approximate specification.

## References

Hide All
Apt, K. R. 1997. From Logic Programming to Prolog. International Series in Computer Science. Prentice-Hall.
Apt, K. R. and Luitjes, I. 1995. Verification of logic programs with delay declarations. In Proc. of Algebraic Methodology and Software Technology, AMAST '95, Alagar, V. S. and Nivat, M., Eds. Lecture Notes in Computer Science, vol. 936. Springer, 6690.
Apt, K. R. and Pedreschi, D. 1993. Reasoning about termination of pure Prolog programs. Information and Computation 106, 1, 109157.
Bezem, M. 1993. Strong termination of logic programs. Journal of Logic Programming 15, 1&2, 7997.
Carlsson, M. and Mildner, P. 2012. SICStus Prolog – the first 25 years. TPLP 12, 1–2, 3566.
Clark, K. L. 1979. Predicate Logic as Computational Formalism. Technical Report 79/59, Imperial College, London. December.
Davis, M., Logemann, G. and Loveland, D. W. 1962. A machine program for theorem-proving. Communications of the ACM 5, 7, 394397.
Deransart, P. 1993. Proof methods of declarative properties of definite programs. Theoretical Computer Science 118, 2, 99166.
Deransart, P. and Małuszyński, J. 1993. A Grammatical View of Logic Programming. The MIT Press.
Deville, Y. 1990. Logic Programming: Systematic Program Development. Addison-Wesley.
Drabent, W. 2012. Logic + control: An example. In Technical Communications of the 28th International Conference on Logic Programming (ICLP'12), Dovier, A. and Costa, V. S., Eds. Leibniz International Proceedings in Informatics (LIPIcs), Schloss Dagstuhl – Leibniz-Zentrum für Informatik GmbH, Dagstuhl Publishing, Saarbrücken/Wadern, Germany, vol. 17, 301311. http://drops.dagstuhl.de/opus/volltexte/2012/3631.
Drabent, W. 2015. On completeness of logic programs. In Logic Based Program Synthesis and Transformation, LOPSTR 2014. Revised Selected Papers. Lecture Notes in Computer Science, vol. 8981. Springer. Extended version in CoRR abs/1411.3015 (2014). http://arxiv.org/abs/1411.3015.
Drabent, W. 2016a. Correctness and completeness of logic programs. ACM Transactions on Computational Logic 17, 3, 18:118:32.
Drabent, W. 2016b. On definite program answers and least Herbrand models. TPLP 16, 4, 498508.
Drabent, W. 2017. Proving completeness of logic programs with the cut. Formal Aspects of Computing 29, 1, 155172.
Drabent, W. and Miłkowska, M. 2005. Proving correctness and completeness of normal programs – a declarative approach. TPLP 5, 6, 669711.
Genaim, S. and King, A. 2008. Inferring non-suspension conditions for logic programs with dynamic scheduling. ACM Transactions on Computational Logic 9, 3, 17:117:43.
Gomes, C. P., Kautz, H., Sabharwal, A. and Selman, B. 2008. Satisfiability solvers. In Handbook of Knowledge Representation, van Harmelen, F., Lifschitz, V. and Porter, B., Eds. Chapter 2, Elsevier, 89134.
Howe, J. M. and King, A. 2012. A pearl on SAT and SMT solving in Prolog. Theoretical Computer Science 435, 4355.
King, A. 2012. Private communication.
Kowalski, R. A. 1979. Algorithm = logic + control. Communications of the ACM 22, 7, 424436.
Maher, M. J. 1988. Equivalences of logic programs. In Foundations of Deductive Databases and Logic Programming, Minker, J., Ed. Morgan Kaufmann, 627658.
Nguyen, M. T., Schreye, D. D., Giesl, J. and Schneider-Kamp, P. 2011. Polytool: Polynomial interpretations as a basis for termination analysis of logic programs. TPLP 11, 1, 3363.
Pedreschi, D. and Ruggieri, S. 1999. Verification of logic programs. Journal of Logic Programming 39, 1–3, 125176.
Pedreschi, D., Ruggieri, S. and Smaus, J.-G. 2002. Classes of terminating logic programs. TPLP 2, 3, 369418.
Pettorossi, A., Proietti, M. and Senni, V. 2010. The transformational approach to program development. In A 25-Year Perspective on Logic Programming: Achievements of the Italian Association for Logic Programming, GULP, Dovier, A. and Pontelli, E., Eds. Lecture Notes in Computer Science, vol. 6125. Springer, 112135.
Pfenning, F., Ed. 1992. Types in Logic Programming. The MIT Press.
Shapiro, E. 1983. Algorithmic Program Debugging. The MIT Press.
Smaus, J., Hill, P. M. and King, A. 1998a. Preventing instantiation errors and loops for logic programs with multiple modes using block declarations. In Proc. of Logic Programming Synthesis and Transformation, LOPSTR'98, Flener, P., Ed. Lecture Notes in Computer Science, vol. 1559. Springer, 289307.
Smaus, J., Hill, P. M. and King, A. 1998b. Termination of logic programs with block declarations running in several modes. In Proc. of Principles of Declarative Programming, PLILP'98, Palamidessi, C., Glaser, H. and Meinke, K., Eds. Lecture Notes in Computer Science, vol. 1490, 7388.

## Metrics

### Full text viewsFull text views reflects the number of PDF downloads, PDFs sent to Google Drive, Dropbox and Kindle and HTML full text views.

Total number of HTML views: 0
Total number of PDF views: 0 *