Journal of Automated Reasoning

, Volume 21, Issue 2, pp 233–275

# Automated Synthesis of Recursive Programs from a ∀∃ Logical Specification

• Jacques Chazarain
• Serge Muller
Article

## Abstract

The specification of a function is often given by a logical formula, called a ∀∃-formula, of the following form: ∀x∃yΦ(x,y). More precisely, a specification is given in the context of a certain theory E and is stated by the judgment

E ⊢ ∀x∃y Φ(x,y).

In this paper, we consider the case in which E is an equational theory. It is divided into two parts. In the first part, we develop a theory for the automated proof of such judgments in the initial model ofE . The validity in the initial model means that we consider not only equational theorems but also inductive ones. From our theory we deduce an automated method for the proof of a class of such judgments. In the second part, we present an automatedmethod for program synthesis. We show how the previous proof method can be used to generate a recursive program for a function f that satisfies a judgment

E ⊢ ∀x Φ(x, f(x)).

We illustrate our method with the automated synthesis of some recursive programs on domains such as integers and lists. Finally, we describe our system LEMMA, which is an implementation in Common Lisp of these new methods.

automated reasoning program synthesis theorem proving test set inductive reasoning term rewriting systems

## References

1. 1.
Bachmair, L.: Proof by consistency in equational theories, in 3rd Symposium on Logic in Computer Science, IEEE, Edinburgh (UK), 1988, pp. 228–233.Google Scholar
2. 2.
Barras, B., Boutin, S., Cornes, C., Courant, J., Filliâtre, J.-C., Giménez, E., Herbelin, H., Huet, G., Muñoz, C., Murthy, C., Parent, C., Paulin-Mohring, C., Saïbi, A., and Werner, B.: The Coq proof assistant, reference manual: Version 6.1, Technical Report RT-0203, INRIA, 1996.Google Scholar
3. 3.
Bellegarde, F.: Automating synthesis by completion, in C. Queinnec, V. Viguie Donzeau-Gouge, and P. Weiss (eds), Journées Francophones des Langages Applicatifs, Vol. 13 of Collection didactique, INRIA, January 1995, pp. 177–202.Google Scholar
4. 4.
Biundo, S.: A synthesis system mechanizing proofs by induction, in B. Du Boulay, D. Hogg, and L. Steels (eds), Advances in Artificial Intelligence, Vol. 2, Elsevier Science Publishers B.V. (North-Holland), 1987, pp. 287–296.Google Scholar
5. 5.
Biundo, S.: Automated synthesis of recursive algorithms as a theorem proving tool, in Y. Kodratoff (ed.), 8th European Conference on Artificial Intelligence, Munich (Germany), August 1988, pp. 553–558.Google Scholar
6. 6.
Bouhoula, A.: Preuves automatiques par récurrence dans les théories conditionnelles, Ph.D. thesis, Université de Nancy I, March 1994.Google Scholar
7. 7.
Bouhoula, A., Kounalis, E., and Rusinowitch, M.: Automated mathematical induction, Journal of Logic and Computation 5(5) (1995), 631–668.Google Scholar
8. 8.
Bouhoula, A. and Rusinowitch, M.: Implicit induction in conditional theories, Journal of Automated Reasoning 14 (1995), 189–235.Google Scholar
9. 9.
Boyer, R. and Moore, J.: A Computational Logic, Academic Press, New York (USA), 1979.Google Scholar
10. 10.
Bundy, A., Smaill, A., and Wiggins, G.: The synthesis of logic programs from inductive proofs, in J. Lloyd (ed.), Symposium on Computational Logic, Esprit Basic Research Series, Springer-Verlag, 1990, pp. 135–149.Google Scholar
11. 11.
Bundy, A., Stevens, S., van Harmelen, F., Ireland, A., and Smaill, A.: Rippling: A heuristic for guiding inductive proofs, Artificial Intelligence 62 (1993), 185–253.Google Scholar
12. 12.
Bundy, A., van Harmelen, F., Horn, C., and Smaill, A.: The Oyster-Clam system, in M. E. Stickel (ed.), 10th Conference on Automated Deduction, LNCS 449, Springer-Verlag, Kaiserslautern (Germany), July 1990, pp. 647–648.Google Scholar
13. 13.
Burstall, R.: Proving properties of programs by structural induction, Computer Journal 12(1) (1969), 41–48.Google Scholar
14. 14.
Burstall, R. and Darlington, J.: A transformation system for developing recursive programs, Journal of the ACM 24(1) (1977), 44–67.Google Scholar
15. 15.
Chazarain, J. and Kounalis, E.: Mechanizable inductive proofs for a classs of ∀ ∃ formulas, in A. Bundy (ed.), 12th Conference on Automated Deduction, LNCS 814, Springer-Verlag, Nancy (France), 1994, pp. 118–132.Google Scholar
16. 16.
Chazarain, J. and Muller, S.: Lemma: A system for automated synthesis of recursive programs in equational theories, in J. Hsiang (ed.), 6th International Conference on Rewriting Techniques and Applications, RTA-95, LNCS 914, Springer-Verlag, Kaiserslautern (Germany), April 1995, pp. 420–425.Google Scholar
17. 17.
Constable, R. L., Allen, S. F., Bromley, H. M., Cleaveland, W., Cremer, J., Harper, R., Howe, D., Knoblock, T., Mendler, N. P., Panangaden, P., Sasaki, J., and Smith, S.: Implementing Mathematics with the NuPrl Proof Development System, Prentice Hall, 1986.Google Scholar
18. 18.
Darlington, J.: An experimental program transformation and synthesis system, Artificial Intelligence 16(1) (1981), 1–46.Google Scholar
19. 19.
Dershowitz, N.: Computing with rewrite systems, Information and Control 65(2–3) (1985), 122–157.Google Scholar
20. 20.
Dershowitz, N.: Synthesis by completion, in 9th International Joint Conference on Artificial Intelligence, Vol. 1, Los Angeles (USA), 1985, pp. 208–214.Google Scholar
21. 21.
Dershowitz, N.: Termination of rewriting, Journal of Symbolic Computation 3(1–2) (1987), 69–116.Google Scholar
22. 22.
Dershowitz, N. and Manna, Z.: Proving termination with multiset orderings, Communications of the ACM 22(8) (1979), 465–476.Google Scholar
23. 23.
Dershowitz, N. and Pinchover, E.: Inductive synthesis of equational programs, in 8th National Conference on Artificial Intelligence (AAAI-90), MIT Press, Boston (USA), 1990, pp. 234–239.Google Scholar
24. 24.
Dershowitz, N. and Reddy, U.: Deductive and inductive synthesis of equational programs, Journal of Symbolic Computation 15 (1993), 467–494.Google Scholar
25. 25.
Fribourg, L.: A strong restriction of the inductive completion procedure, Journal of Symbolic Computation 8(3) (1989), 253–276.Google Scholar
26. 26.
Fribourg, L.: Extracting logic programs from proofs that use extended Prolog execution and induction, in J.-M. Jacquet (ed.), Constructing Logic Programs, Chapter 2, Wiley, 1993, pp. 39–66.Google Scholar
27. 27.
Garland, M. and Guttag, J.: Inductive methods for reasoning about abstract data types, in 15th Symposium on Principles of Programming Languages, ACM, San Diego (USA), 1988, pp. 219–228.Google Scholar
28. 28.
Green, C. C.: Application of theorem-proving to problem solving, in 1st International Joint Conference on Artificial Intelligence, Washington, DC (USA), May 1969, pp. 219–239.Google Scholar
29. 29.
Hesketh, J., Bundy, A., and Smaill, A.: Using middle-out reasoning to control the synthesis of tail-recursive programs, in D. Kapur (ed.), 11th Conference on Automated Deduction, LNCS 607, Springer-Verlag, Saratoga Springs, NY, June 1992, pp. 310–324.Google Scholar
30. 30.
Hogger, C. J.: Derivation of logic programs, Journal of the ACM 28(2) (1981), 372–392.Google Scholar
31. 31.
Huet, G. and Hullot, J.-M.: Proofs by induction in equational theories with constructors, Journal of Computer and System Sciences 25(2) (1982), 239–266.Google Scholar
32. 32.
Hullot, J.-M.: Compilation de formes canoniques dans des théories équationnelles, Ph.D. thesis, Université Paris-Sud, November 1980.Google Scholar
33. 33.
Jouannaud, J.-P. and Kounalis, E.: Proofs by induction in equational theories without constructors, in 1st Symposium on Logic in Computer Science, IEEE, June 1986, pp. 358–366. Full paper in Information and Computation 82 (1989).Google Scholar
34. 34.
Kapur, D., Narendran, P., and Zhang, H.: Proof by induction using test sets, in J. H. Siekmann (ed.), 8th Conference on Automated Deduction, LNCS 230, Springer-Verlag, Oxford (UK), July 1986, pp. 99–117.Google Scholar
35. 35.
Kounalis, E.: A simplification-based approach to program synthesis, in 10th European Conference on Artificial Intelligence (ECAI 92), Vienna (Austria), August 1992, pp. 82–86.Google Scholar
36. 36.
Kounalis, E.: Testing for the ground (co)-reducibility property in term rewriting systems, Theoretical Computer Science 106 (1992), 87–117.Google Scholar
37. 37.
Kounalis, E. and Rusinowitch, M.: Mechanizing inductive reasoning, Bulletin of the European Association for Theoretical Computer Science 41 (1990), 216–226.Google Scholar
38. 38.
Kraan, I., Basin, D., and Bundy, A.: Middle-out reasoning for synthesis and induction, Journal of Automated Reasoning 16 (1996), 113–145.Google Scholar
39. 39.
Manna, Z. and Waldinger, R.: A deductive approach to program synthesis, ACM Transactions on Programming Languages and Systems 2(1) (1980), 90–121.Google Scholar
40. 40.
Manna, Z. and Waldinger, R.: Fundamentals of deductive program synthesis, IEEE Transactions on Software Engineering 18(8) (1992), 674–704.Google Scholar
41. 41.
Musser, D.: On proving inductive properties of abstract data types, in 7th Symposium on Principles of Programming Languages, Las Vegas (USA), Association for Computing Machinery, 1980, pp. 154–162.Google Scholar
42. 42.
Padawitz, P.: Computing in Horn Clause Theories, EATCS Monographs on Theoretical Computer Science 16, Springer-Verlag, 1988.Google Scholar
43. 43.
Reddy, U.: Rewriting techniques for program synthesis, in N. Dershowitz (ed.), 3rd International Conference on Rewriting Techniques and Applications, LNCS 355, Springer-Verlag, Chapel Hill (USA), 1989, pp. 388–403.Google Scholar
44. 44.
Reddy, U.: Term rewriting induction, in M. E. Stickel (ed.), 10th Conference on Automated Deduction, LNCS 449, Springer-Verlag, Kaiserslautern (Germany), July 1990, pp. 162–177.Google Scholar
45. 45.
Smith, D.: Derived preconditions and their use in program synthesis, in D. W. Loveland (ed.), 6th Conference on Automated Deduction, LNCS 138, Springer-Verlag, New York (USA), 1982.Google Scholar
46. 46.
Traugott, J.: Deductive synthesis of sorting programs, Journal of Symbolic Computation 7 (1989), 533–572.Google Scholar
47. 47.
Walther, C.: Argument-bounded algorithms as a basis for automated termination proofs, in E. Lusk and R. Overbeek (eds), 9th Conference on Automated Deduction, LNCS 310, Springer-Verlag, Argonne (USA), May 1988, pp. 602–621.Google Scholar
48. 48.
Zhang, H., Kapur, D., and Krishnamoorthy, M. S.: A mechanizable induction principle for equational specifications, in E. Lusk and R. Overbeek (eds), 9th Conference on Automated Deduction, LNCS 310, Springer-Verlag, Argonne (USA), May 1988, pp. 162–181.Google Scholar