Logic Algorithm Synthesis from Examples and Properties
Total Page:16
File Type:pdf, Size:1020Kb
Abstract In the context of logic programming-in-the-small, we propose logic specifications by exam- ples and properties, the latter being disambiguating generalizations of the examples. Such specifications are easy to elaborate, but are also usually incomplete, in the sense that the in- tentions need not (or cannot) be fully described. Algorithm synthesis then consists of semi- automatically extrapolating these intentions, and of designing a (recursive) algorithm imple- menting them. We develop a very disciplined approach to algorithm synthesis, namely step- wise instantiation of the place-holders of a divide-and-conquer algorithm schema. Moreover, rather than using a uniform method for these instantiations, we deploy for each place-holder the best-suited method from a generic tool-box of (deductive, inductive, …) methods. Spe- cial care is taken to handle the correctness and progression aspects of the synthesis. Keywords Automatic programming, program synthesis, logic programming, intentions, specification, algorithm, algorithm design, algorithm schema, algorithm correctness, algorithm compari- son, stepwise design, inductive logic programming, machine learning, inductive inference, generalization, deductive inference, automated theorem proving. ii Abstract Acknowledgments iii Acknowledgments I hereby express my deepest gratitude to my advisor, Prof. Yves Deville. His patience and encouraging comments were music in my ears whenever I thought I had painted myself into a corner, and his expertise and assistance were invaluable during the development of some theoretical aspects. When deadlines were close, his availability beyond the call of duty was priceless. Moreover, his relentless pursuit of excellence drove me to improvements and gen- eralizations I would never have dreamt of, and his insightful overall perception of my re- search area guided me to a better understanding of my results and contributions. Finally, he tempered my exuberant and provocative writing style into a cautious, diplomatic language. Thank you, Yves! My warmest thanks to Prof. Alan W. Biermann (Duke University, Durham, NC, USA), who accepted my application for a leave-of-absence at his department, and who later agreed on extending this research stay and on adding other, shorter stays. His faith in my approach kept my spirit alive during many months of darkness. As my mentor on program synthesis research, he distilled a lot of wisdom during our numerous discussions. I acknowledge extraordinary assistance by Prof. Baudouin Le Charlier (FUNDP, Namur, Belgium). His spiritual patronage on this thesis is unmistakable, and the fruit of many inter- esting discussions. My gratefulness further goes to Prof. Axel van Lamsweerde (UCL), who awakened my passion for research as my MS advisor, and who provided many constructive comments on earlier versions of this dissertation. Prof. Michel Sintzoff and Prof. Elie Mil- grom (both at UCL) also offered useful feedback during the writing process. Many thanks to Prof. Norbert Fuchs (Universität Zürich, Switzerland) and Prof. Klaus- Peter Jantke (TH Leipzig, Germany) for their interest in my research, and for inviting me abroad to give seminars on it. Prof. Laurent Fribourg (ENS, Paris, France) kindly assisted me during the development of some aspects that are based on his own research. Moreover, I’m indebted to my fellow PhD-student veterans Lubos˘ Popelinsky´ (Masaryk University of Brno, Czech Republic) and Tim Gegg-Harrison (Duke University, NC, USA), for many pro- ductive life and e-mail discussions. The research for this thesis was done at three universities, and hence a possibly unusually long list of miscellaneous acknowledgments: From October 1988 to December 1991, I was a member of the Folon Research Project at the Institut d’Informatique of the Facultés Universitaires Notre-Dame de la Paix (FUNDP), in Namur (Belgium). Many thanks to my Folon colleagues (by chronological order of arrival) Pierre Deboeck, Jean Burnay, Jean-Pierre Hogne, Pascal van Hentenryck, Bruno Desart, and Jean Henrard for inspiring discussions, and to our office-mates Kaninda Musumbu and Aziz Mounji for contributing to the good spirit in our office. Thanks also to the systems guys Bruno Delcourt, Philippe Du Bois, and Naji Habra, for keeping backups handy when I goofed. The Folon project was supported by the Services de Programmation de la Politique Scientifique (SPPS) of the Belgian Government, under grant RFO/AI/12. From January 1990 to March 1991, I was a visiting research scientist at the Department of Computer Science at Duke University, in Durham (North Carolina, USA). I very much ap- preciated sharing an office with Richard Hipp, Margie Dietz, and Steve Owen, and I actually feel indebted to the entire Butterfly Wing for the excellent atmosphere. Thanks also to the sys- tems people Karen Feldman and Jeff Tannehill, for their kind assistance. This stay was also supported by the SPPS, namely under grant RFO/AI/12/2. iv Acknowledgments From January 1992 to now, I was a PhD candidate at the Unité d’Informatique of the Uni- versité Catholique de Louvain (UCL), in Louvain-la-Neuve (Belgium). Many thanks to my office-mates (by chronological order of arrival) Simone Amerijckx, Marie-Hélène Liégeois, Pierre-Yves Schobbens, Philippe de Groote, Bruno Charlier, Frédéric Geurts, and Vincent Lombart, for delightful days of research. Thanks also to the systems people Hubert Broze, Marie-France Declerfayt, and Francis Degey, for their efficient trouble-shooting. My grate- fulness further goes to Prof. Elie Milgrom for his confidence in my research. Since May 1992, I am supported by the Ministry of Scientific Research and Cultural Affairs of the Government of Luxembourg, under grant BFR 92/017. Many people at these three institutions, and elsewhere, got more or less close looks at my research. During my various local seminars, I very much appreciated the perceptive com- ments made by Prof. Don W. Loveland, Prof. Gopalan Nadathur, Tim Gegg-Harrison, and Richard Hipp (all at Duke University), and by Dr. Naji Habra, Dr. Jean-Marie Jacquet, and Prof. Pierre-Yves Schobbens (all at FUNDP). My gratitude also to those who—more or less—volunteered to review preliminary versions of some chapters of this thesis, namely Bruno Charlier (UCL) and Lubos˘ Popelinsky´ (Masaryk University of Brno). Many thanks to the anonymous referees of my papers, for showing me what I should explain with more care. Finally, I thank all those whom I might have forgotten to mention, but who feel that they have had a direct or indirect impact on this thesis. I would also like to commend Frame Technology Corporation (San Jose, California, USA) for developing the FrameMaker desktop publishing system (which suits my needs so much), for their friendly customer assistance, and especially for giving me a free license dur- ing the six months where I had access to none. Finally, extra credit goes to my parents, siblings, relatives, colleagues, and friends, for en- couraging me throughout these years. Without you, I wouldn’t have had the stamina to go through all this. A special tribute to my friends Marc Blancart and Guy Huys, for helping me to think of other things, for instance while accompanying me on backpacking journeys, and to Jonathan Polito, for many “Zen-ish” bike-rides. A moral assist goes to Duke’s Blue Devils basketball teams, to the numerous volley-ball teams I was part of, to the Alternative Happy Hour crew, and to the members of the International Association at Duke University. Background, Terminology, and Conventions v Background, Terminology, and Conventions This research is set within the framework of logic programming. We assume the reader is fa- miliar with this background (see, for instance, [Lloyd 87], of which we adopt the terminolo- gy, unless otherwise noted). Here follows a list of the most used typographic conventions, abbreviations, and predefined symbols. Others will be introduced as necessary, and the entire list can be found in the Appendix. Typographic conventions Function symbols (functors) and predicate symbols start with a lower-case letter. We often write them out followed by a slash “/” and their arity. Examples are a/0, f/2, and p/3. Excep- tions are some primitive symbols, such as =/2, </2, and •/2. Functors of arity 0 are called con- stants. By abuse of language, we often say “predicate” instead of “predicate symbol”. Variable symbols, function variable symbols, and predicate variable symbols start with an upper case letter. Examples are X, F, and P. An anonymous variable is denoted by an under- score “_”. Schema variable symbols and notation variable symbols consist of a lower-case letter. Examples are i, j, k, m, and n. The distinction with one-letter constants should always be obvious from context. By abuse of language, we often say “variable” instead of “variable symbol”. Terms and atoms are usually written in prefix notation. If no ambiguity arises, unary terms and atoms are sometimes written without parentheses, while binary terms and atoms are sometimes written in infix notation. A constructed list with head H and tail T is denoted H•T, whereas nil denotes the empty list. Another notation for a constructed list with head H and tail T is [H|T], whereas [] is an- other notation for the empty list. These alternative notations allow shorthands such as [H1,H2,…,Hn] for •(H1,•(H2,•(…,•(Hn,nil)…))), and [H1,H2,…,Hn|T] for •(H1,•(H2,•(…,•(Hn,T)…))), where n>0. Non-negative integers are successors of the constant zero, which is denoted 0. The se- quence of integers is 0, s(0), s(s(0)), …, sn(0), …, where s/1 is called the successor functor. Shorthands are 0, 1, 2, …, n, …, respectively. Variable symbols, predicate variable symbols, functors, and predicate symbols within text paragraphs are written in Times-italics. However, entirely formalized paragraphs, such as specifications, (logic) algorithms, and (logic) programs, are written in Courier. Term vectors and variable vectors of indeterminate, but finite, length are denoted by bold- face symbols.