Journal of Symbolic Computation Editor Bruno Buchberger
Johannes Kepler Universitat, Institut fUr Mathematik, A-4040 L...
11 downloads
537 Views
29MB Size
Report
This content was uploaded by our users and we assume good faith they have the permission to share this book. If you own the copyright to this book and it is wrongfully on our website, we offer a simple DMCA procedure to remove your content from our site. Start by pressing the button below!
Report copyright / DMCA form
Journal of Symbolic Computation Editor Bruno Buchberger
Johannes Kepler Universitat, Institut fUr Mathematik, A-4040 Linz, Austria
Associate Editors Wolfgang Bibel John Cannon Bob Caviness James Davenport Kazuhiro Fuchi Gerard Huet Zohar Manna Jiirg Nievergelt David Stoutemeyer David Yun
Technische Universitiit Miinchen, Munich, FRG University of Sydney, Sydney, Australia University of Delaware, Newark, Delaware, USA University of Bath, Bath, England ICOT, Tokyo, Japan INRIA, Le Chesnay, France Stanford University, Stanford, California, USA University of North Carolina at Chapel Hill, USA University of Hawaii at Manoa, Honolulu, Hawaii, USA Southern Methodist University, Dallas, Texas, USA
Editorial Board A. L. R. A. R.
Biermann (USA) Bole (Poland) Book (USA) Borodin (Canada) Boyer (USA) J. Cahnet (France) H. Coelho (Portugal) G. Collins (USA) N. G. de Bruijn (The Netherlands) J. Dixon (Canada) E. Engeler (Switzerland) R. Fateman (USA) V. Gerdt (USSR) E. Goto (Japan) L. Guibas (USA)
C. A. R. Hoare (England) M. Hussain (USA) J-P. Jouannaud (France) K. S. Kolbig (Switzerland) J-L. Lassez (Australia) W. Lassner (GDR) D. Lazard (France) C. Leedham-Green (England) A. Lenstra (Amsterdam) H. Maurer (Austria) M. Mignotte (France) G. Mine (USSR) A. Miola (Italy) D. Musser (USA) W. Nef (Switzerland) I. Nemeti (Hungary)
M. Newman (Australia) R. Pavelle (USA) D. Plaisted (USA) D. Prawitz (Sweden) F. Preparata (USA) R. Riesenfeld (USA) J. A. Robinson (USA) C. Sims (USA) M. F. Singer (USA) C. S. Tang (China) B. Trager (USA) H. van Hulzen (The Netherlands) V. Weispfenning (FRG) H. Zassenhaus (USA) H. G. Zimmer (FRG)
ISSN 0747-7171 Copyright © 1985 by Academic Press Inc. (London) Ltd The appearance of the code at the bottom of the first page of a paper in this journal indicates the copyright owner's consent that copies of the paper may be made for personal or internal use, or for the personal or internal use of specific clients in the USA. This consent is given on the condition, within the USA, that the copier pay the stated per-copy fee through the Copyright Cleawnce Center, Inc., 21 Congress Street, Salem, MA 01970 (617) 744-3350, for copying beyond that permitted by Sections 107 or 108 of the US Copyright Law. This consent does not extend to other kinds of copying, such as copying for general distribution, for advertising or promotional purposes, for creating new collective works, for resale or for copying or distributing outside the USA. PL1blished quarterly by Academic Press Inc. (London) Ltd at 24-28 Oval Road, London NWI, England. 1985, Volume I. 4 issues (March-December). Inland £60.00 including postage; abroad $95.00 including postage. Subscription orders should be sent to Academic Press Inc. (London) Ltd, High Street, Foots Cray, Sidcup, Kent DAI4 5HP, England, except those from Canada, Central and South America and the USA, which should be sent to Academic Press Inc.. Ill Fifth Avenue, New York, NY I 0003, USA. Send notices of change of address to the office of the publishers at least 6--8 weeks in advance. Please include both old and new addresses. USA Postmaster, send changes of address to Journal of' Symbolic Computation, Academic Press, Inc., Ill Fifth Avenue. New York, NY 10003. Second-class postage paid at Jamaica, New York 11431, USA. Air freight and mailing in the USA by Publications Expediting Inc., 200 Meacham Avenue, Elmont, NY 10003, USA.
J. Symbolic Computation
(1985) l, 1-6
Symbolic Computation (An Editorial)
The short description given below of the scope, goal, and structure of the Journal of Symbolic Computation is the result of intensive discussions among the persons involved in initiating this journal. The editors will use it as a guide for the development of the journal and potential authors can use it to decide whether to make this journal a forum for their research results.
Scope of the Journal The scope of the Journal of Symbolic Computation is -the algorithmic solution of problems dealing with symbolic objects. In a very broad sense, all mathematical objects (and their representations in computers) could be considered as symbolic objects. However, in accordance with two major research traditions that have developed in the last two decades, namely -computational algebra and computational logic, only certain classes of symbolic objects and specific algorithmic problems will be considered in this journal. Still, the scope is broad enough to integrate computational geometry, as a companion to computational algebra, and automatic programming (computer-assisted program verification, transformation and synthesis), as a field that is intimately connected with computational logic. In these areas, all three aspects of the algorithmic solution of problems will be within the scope of the journal, namely -mathematical foundations, correctness and complexity of new (sequential and parallel) algorithms -implementation and integration of these algorithms in software systems -applications of these systems for advanced problem solving in the natural and technical sciences. Various names have been used in the past for the different sub-areas covered in the journal. Thus, for example, computational algebra is also called computer algebra, formula manipulation, symbolic and algebraic computation, computation in finite terms, computer analysis, analytic computation, or symbolic mathematics. Similarly, different names are in use for computational logic, computational geometry and automatic programming. We do not want to give priority to the usage of particular names. Rather, we chose "symbolic computation" as a short name for embracing the above areas without wanting to restrict the usage of other forms. Moreover, a standardised name or an exact definition of the bounda~ies of the field or the subfields could prevent further evolution of the field. 0747-7171/85/010001 +06 $03.00/0
© 1985 Academic Press Inc. (London) Ltd
2
Symbolic Computation (An Editorial)
More specifically, the following topics are certainly within the scope of this journal: -symbolic integration, symbolic summation, symbolic solution of differential equations and of other problems in analysis -term simplification -arithmetic in basic and higher algebraic domains -polynomial factorisation -symbolic solution of equations and systems of equations -combinatorial group theory -permutation and matrix groups -computation of characters and representations -computations in Lie groups -computational number theory -computational problems in non-associative and other algebras -algorithmic combinatorics -computational geometry -computational aspects of algebraic geometry -algorithmic analysis of real manifolds -algorithmic problems in differential geometry -algebraic algorithms in coding theory and cryptography -interface between symbolic and numerical algorithms -universal automated theorem proving -unification -automated theorem proving in special theories (for example, in the theory of real closed fields) -automated proof checking -algorithmic proof theory -algorithmic problems in combinatorial logic and lambda calculus -algorithmic logic -automatic program synthesis -automatic program transformation -automatic program verification -symbolic execution of programs -algorithmic treatment of abstract data type specifications -interpreters for high-level programs (functional programs, rewrite rule programs, logic programs) -intrinsic complexity of problems in symbolic computation -complexity analysis of algorithms in symbolic computation -heuristic tuning of algorithms in symbolic computation -design issues of software systems for symbolic computation -parallel and other special hardware for symbolic computation -programming languages for symbolic computation -descriptions of available symbolic software systems -descriptions of typical symbolic systems applications -impact of symbolic computation on mathematical education For a pragmatic further specification of the scope of the journal it may also help to mention some areas that, though algorithmic, will definitely be excluded from the journal.
Symbolic Computation (An Editorial)
3
Such areas are, for example, numerical analysis (if not combined with symbolic methods), algorithm theory (in the sense of general recursive function theory), compiler construction (if not in connection with symbolic software systems), algorithmic graph theory (if not relevant for one of the areas included). These areas will be excluded either because they consider objects (for example, floating point numbers) that are not symbolic objects in the sense of the research tradition of computational algebra and computational logic or because we feel that these areas are already covered sufficiently by existing journals. The above enumerative characterisation of the scope was simply by inclusion and exclusion. However, it may also make evident some important common features of the areas covered by the Journal of Symbolic Computation. First, the algorithmic emphasis of the journal is on practical algorithms, i.e. algorithms that perform in reasonable computing time or at least aim at showing a direction for the solution of a symbolic problem on real computers. Second, the objects treated by the algorithms should either be algebraic in nature or expressions in formal languages. Typically, algebraic objects admit exact computation as opposed to the approximative character of numerical computations. Examples of algebraic objects are basic objects as the integers of arbitrary precision and the rationals, polynomials with coefficients in (basic) algebraic domains, matrices of (basic) algebraic objects, (representatives of) residue classes modulo congruence relations, elements of (finite) groups etc. Typically, computations on expressions in formal languages (terms, formulae, programs) have the flavour of operating on a metalevel of numerical computations. For example, numerically, a fixed finite sum can be evaluated for variable input values; a symbolic algorithm can take a whole spectrum of finite sum expressions as inputs and can transform them into a simpler form, whose simplicity then allows more efficient numerical evaluation.
Aspects of Symbolic Computation The researchers working in the development of new algorithms for symbolic computation, the implementers of symbolic computation software systems, and the users applying these systems to problem solving in science and engineering naturally tend to lose contact with each other. This unfortunate situation has often been deplored in the past. In fact, the feedback obtainable from system users would be a crucial stimulus for algorithm and system designers in the further improvement of the systems. Similarly, the interaction between algorithm designers and system designers is of vital importance. Finally, for ill"\proving the quality and scope of applications, clear and concise information about existing systems and the power of available algorithms is mandatory for potential users of symbolic software systems in science and engineering. This multiple flow of information between algorithm designers, system designers and users, however, has proved to be difficult to achieve in the past. First, it is often nearly impossible for algorithm and systems designers to understand the details of an application paper that presupposes a huge amount of special knowledge about an application area, such as general relativity, high energy physics or industrial mechanics. Furthermore, these papers normally include only occasional remarks on the successful use of symbolic software systems. Similarly, it is often difficult for the system designers and potential users to extract the algorithmic details from basic research papers on symbolic algorithms.
4
Symbolic Computation (An Editorial)
Seemingly the above necessities and constraints contradict each other. Finding a balanced solution that hopefully satisfies the needs of the algorithm designers, the system implementers and the users as well was not an easy task for the editorial board of the Journal of Symbolic Computation. After careful consideration, we finally came up with a structure for the issues of the journal that should serve the needs of and make the journal attractive to all three groups of researchers involved in symbolic computation.
Goal of the Journal It is the explicit goal of the Journal of Symbolic Computation to promote the growth and interaction of the research areas enumerated above and of contiguous areas by establishing one common publication forum. This endeavour seems to be overdue for several reasons. First, in spite of a large increase in research activity over the last two decades none of these research areas has yet found a specific publication forum. Rather, the pertinent research results have been scattered up to now in many different journals or published in conference proceedings only. This is particularly true of computer algebra. Furthermore, from a mathematical point of view, it is becoming increasingly clear that on the basis of common mathematical insights these areas share many advanced algorithmic ideas as, for example, lifting and completion. Also, many particular algorithms, e.g. unification algorithms or polynomial factorisation algorithms, occur as important subalgorithms in the solution of problems in several of these areas. For some of these research areas, e.g. the area of decision procedures for real closed fields or certain geometrical decision procedures, it would actually be hard to determine whether they belong to computational algebra, computational geometry, or computational logic. Some of the areas are prerequisites to each other. For example, algorithmic proof theory provides a basis for advanced approaches to program synthesis. Thus, there is strong evidence that mathematically the areas enumerated in the description of the scope of this journal are developing into a coherent field. Finally, from the practical point of view, it seems that users are starting to require more than just independent software systems for numerical analysis, computer algebra, automated theorem proving, computational geometry, and automatic programming. Rather, the construction of software systems for "scientific computation", i.e. software systems integrating numeric, algebraic, geometric and logic computation, embedded in an automatic programming and knowledge engineering environment is a major challenge for the next decade. A common research publication integrating the component areas is of vital importance to move towards the successful development of these "mathematical expert systems". Besides promoting the growth and interaction of the various subareas of symbolic computation, it is also a goal of the Journal of Symbolic Computation to provide a home for the three groups of researchers in symbolic computation, namely the algorithm designers, the system implementers, and the users, and also for their interaction with one another. The editorial policy, reflected in the structure of the issues of the Journal of Symbolic Computation, aims to guarantee that these goals will be achieved.
Symbolic Computation (An Editorial)
5
Structure of the Issues Typically, each issue of the journal will have the following structure: Tutorial Section Research Contributions Section Systems Descriptions Section Applications Letters Section Bibliography Section.
Tutorial Section. Each tutorial section will contain one or two tutorials on subfields of symbolic computation. These contributions will be invited. Normally, they will give an overview of the mathematical foundations and basic ideas of the algorithmic methods used in that particular area and/or a survey on available systems and/or successful applications. This section should bridge the gap between algorithm designers on the one hand and system designers and users on the other but also stimulate the interaction between researchers working in different subfields of symbolic computation. Research Contributions Section. Original papers are presented in this section, which, of course, forms the core of the journal. The research aspect can either be on symbolic algorithms (mathematical foundation, correctness, complexity), or on new software techniques for the implementation of symbolic software systems. This section contains up-to-date information for specialists actively involved in research on symbolic computation. However, authors of such papers will be encouraged to provide introductions that clarify the relevance of their paper for contiguous areas of symbolic computation in order to make the papers interesting for as wide a readership as possible. Systems Descriptions Section. This section will contain one or two (in vi ted) survey papers describing running and well established symbolic (hardware and) software systems that have found acceptance with users. Typically, these papers will provide descriptions of symbolic systems as they appear to the user and should motivate the application of these systems in problem solving. Of course, such descriptions will also be interesting for other system designers. However, these surveys will not normally concentrate on details of the specific software techniques used. (Papers on new software techniques belong in the research contributions section.) Applications Letters Section. In this section short letters (! to 4 pages each) will be included describing successful applications of symbolic software systems in various application fields. Since we feel that this section will be of particular importance for. bridging the gap between users of symbolic software systems and algorithm and system designers, the editorial policy for the applications letters section is described in more detail here.' Typically, application letters will have the following structure: -short statement of the problem solved -short characterisation of the mathematical method, in particular symbolic method, used -symbolic software system used -results achieved -suggestions for other possible applications, generalisations, and improvements -details of how and where to obtain program and output listings and reference to a detailed publication.
6
Symbolic Computation (An Editorial)
The extent of the details of an application letter should allow another specialist in the application area to test similar problems using the same symbolic program or system. It should also allow the developers of the symbolic software system to understand the significance of the application model, the scope of its impact, and the possible improvements for the system. Finally, it should challenge the algorithm designer to determine which algorithmic problems need (better) solutions. Application letters will be refereed like all the other papers in the journal. They will typically be short versions (extended abstracts) of detailed publications in other refereed journals or proceedings, for example in a journal of the particular application field. However, many details pertinent to the particular application science can normally be left out and more information on the symbolic computation aspect should be added. Hence, a clear reference to the detailed publication must be made in the application letter and a copy of the detailed publication should be enclosed when submitting the application letter. In case the material covered in the application letter has not yet been published elsewhere, a program listing and tape for verification and a detailed technical report or equivalent material must be enclosed for verification when submitting the application letter. Bibliography Section. In some issues we hope to include at least one short (annotated) bibliography on a particular subfield of symbolic computation, for which it might be difficult to obtain bibliographic data. In some issues we will have complete bibliographies on major and well-established subfields of symbolic computation. From time to time, updates to previous bibliographies will be published. It is our strong desire that by a vigorous cooperation with the authors the goals set forth in this editorial will be achieved.
The Editors
J. Symbolic Computation (1985) 1, 7-29
Equational Methods in First Order Predicate Calculus ETIENNE PAUL Centre National d'Etudes des Telecommunications, 38/40 Rue du Glmeral Leclerc, 92131 Jssy les M ou!ineaux, France (Received 12 July 1984)
We show that the application of the resolution principle to a set of clauses can be regarded as the construction of a term rewriting system confluent on valid formulas. This result allows the extension of usual properties and methods of equational theories (such as Birkhoff's theorem and the Knuth and Bendix completion algorithm) to quantifier-free first order theories. These results are extended to first order predicate calculus in an equational theory, as studied by Plotkin (1972), Slagle (1974) and Lankford (1975). This paper is a continuation of the work of Hsiang & Dershowitz (1983), who have already shown that rewrite methods can be used in first order predicate calculus. The main difference is the following: Hsiang uses rewrite methods only as a refutational proof technique, the initial set of formulas being unsatisfiable iff the equation TRUE= FALSE is generated by the completion algorithm. We generalise these methods to satisfiable theories; in particular, we show that the concept of confluent rewriting system, which is the main tool for studying equational theories, can be extended to any quantifier-free first order theory. Furthermore, we show that rewrite methods can be used even if formulas are kept in clausal form.
1. Introduction We show in this paper that the resolution algorithm applied to a set of clauses has the same goal as the Knuth & Bendix algorithm applied to a set of equations, namely the construction of a confluent rewriting system, but with the restriction that the system obtained is confluent only on valid formulas. More specifically, let S be a quantifier-free theory defined by a set of clauses. We show that the application of the resolution principle to S produces a rewriting system R such that any quantifier-free first order formula F which is a valid consequence of S reduces to TRUE, using reductions from R in any order. Conversely, only valid consequences of S reduce to TRUE. But the system R is not confluent in general, for F may possess several normal forms ' if it is not a valid consequence of S. Such partly confluent rewriting systems have already been studied in equational theories: for example, the Greendlinger-Bucken algorithm (Bucken, 1979) for finitely presented groups constructs a rewriting system which, under certain conditions, is confluent on the relators (i.e. words equal to the identity in the group). The word problem can then be decided as follows: two words a and b are equal iff the normal form of the word a. b - l is the identity. A preliminary version of this paper was presented as "A new interpretation of the resolution principle" at the 7th International Conference on Automated Deduction in Napa, California, May 1984. The proceedings are in Springer-Verlag, Lecl!lre Notes in Computer Sciences 170, edited by R. E. Shostak. 0747 7171/85/010007+23 $03.00/0
© 1985 Academic Press Inc. (London) Ltd
8
Etienne Paul
In the same way, the equivalence between two quantifier-free formulas F and G in the theory S can be decided by computing the normal form of the compound formula F (=) G: F and G are equivalent iff this normal form is TRUE. From this first result, we obtain that usual properties and methods of equational theories (such as Birkhoff's theorem and the Knuth & Bendix completion algorithm) can be extended to any quantifier-free first order theory. The organisation of the paper is as follows: In Section 2, we introduce a rewriting system in propositional calculus confluent on valid formulas. Since we do not need general confluence, we will not use the system discovered by Hsiang ( 1983), because this system is not practical for manipulating clauses. Our system will be constructed from the usual Boolean connectors "and", "or", "not". In Section 3, we extend this result to first order predicate calculus: we describe a completion algorithm based on the resolution principle which generates, from any initial set of clauses, a rewriting system confluent on valid formulas. In Section 4, we prove Birkhoff's theorem for first order predicate calculus. This theorem states that equational-like deduction (i.e. deduction by instantiation and replacement of equivalents by equivalents), together with a suitable equational axiomatisation of propositional calculus, is complete for quantifier-free first order theories. From this theorem, we obtain another completion algorithm, based on the Knuth & Bendix algorithm and the Hsiang system for propositional calculus. In Section 5, the previous results are extended to first order predicate calculus in an equational theory.
2. Confluence on Valid Formulas in Propositional Calculus 2.1.
REVIEW OF EQUATIONAL TERM REWRITING SYSTEMS
It is assumed that the reader is familiar with the literature on equational theories and term rewriting systems. See Huet & Oppen (1980) for a full description. We start with a vocabulary of variables and function symbols; we define terms, occurrences, substitutions, unification, most general unifier (mgu). If M is a term and u an occurrence of M, M/u denotes the subterm of M at occurrence u, and M[u .. ., k,) we store the sequence B; of x-coordinates (maxx(pk" PkJ, .. ., maxx(pk,-r• Pk,)), k, = lextPc,J B; subdivides the x-axis
Optimal Solutions for a Class of Point Retrieval Problems
55
L3--------~--~--------~~+---~~--------I
(3 =Kl
'
I
--ii-1____._~---+---,---'11--+--\~j\~ :J ~~ J\ lt\
L2 ___:..... ""==--.-.
•
Fig. 5. Connecting layers with the hive-graph.
into t non-overlapping intervals, each belonging in the obvious manner to an index in {kl' . .. , kr}. The hive-graph is obtained by the following procedure: set Bt: = Bkt for i : = K - 1 to 1 do pick every other x-value in Bt+ 1 and merge the chosen values with B;. Let Bt be the resulting list. For each value a in Bt, set up a pointer to the largest b in Br+ 1 with b :::; a. end for Figure 5 illustrates the connections between schematic layers that are introduced by the hive-graph. It is a straightforward exercise to verify that the hive-graph satisfies properties (i) and (ii) above. Details can also be found in Chazelle (1983b). All this leads to the main result of this paper. THEOREM II. Let P be a set ofn points in E2 and C a convex computable figure. There exists a data structure that stores Pin O(n) space such that O(k +log 11) time suffices to retrieve all points of Plying inside a query translate Cq. The data structure can be constructed in O(n 2 ) time. We list a number of immediate consequences. CoROLLARY 12. For n points in E 2 , O(n) space and O(k +log n) time suffice to retrieve the k points within a fixed radius of an arbitrary query point. It seems worthwhile to note that for the fixed radius problem Cis a disk, thus making the partition into an upper and lower part unnecessary since both parts lead to the same decomposition of E 2 • Another interesting special case arises when C is a convex polygon with m edges and m is considered a parameter of the problem. In this case, C violates the requirement of being computable. This can be fixed by allowing the primitive operations to take O(log m) time (this is motivated by the existence of a trivial algorithm for detecting whether a point lies inside a convex m-gon in O(log m) time). Our method yields
CoROLLARY 13. Let C be a convex polygon with m edges in E 2 • A set P of n points can be stored in O(n+m) space such that O(k+Iogm!ogn) time suffices to retrieve the k points of P lying inside a query translate of C. 5. Discussion The problems examined in this paper fall into a general class involving a fixed set of objects and d-dimensional queries. A query is d-dimensional if it can be specified by d
56
B. Chazelle and H. Edelsbnmner
parameters; in this paper d = 2. By contrast, more difficult problems like orthogonal or triangular range search are respectively four- and six-dimensional. Studying the complexity of retrieval problems along this taxonomy appears to be of great methodological value. In general, can the complexity of query problems be asserted within a theory based on the dimensionality of queries? Let us briefly recall the main tools used in this paper: 1. 2. 3. 4.
transforming the problem, using a decomposition of E2 into cells and introducing silos, exploiting layers of silos to speed up searching, connecting layers into a hive-graph.
All of these ideas have appeared-in most cases separately-in the computational geometry literature: layers and transformations were exploited to give an optimal solution to the case where halfplanes are query ranges (Chazelle et al., 1983). There, too, the structure shared the connection of layers into a hive-graph. The notion of silos is closely related to the somehow dual concept of ct-hull developed in Edelsbrunner et al. ( 1983). Finally, using decompositions into cells seems almost as old as the field itself (Knuth, 1973).
References Bentley, J. L., Maurer, H. A. (1979). A note on Euclidean near neighbor searching in the plane. li!forrn. Process. Lett., 8, 133-136. Chazelle, B. (1983a). An improved algorithm for the fixed-radius neighbor problem. Inform. Process. Le/1. 16, 193-198. Chazelle, B. (1983b). Filtering search: A new approach to query-answering. Proc. 24th Ann. Symp. Found. Camp. Sci., 122-132. Chazelle, B., Cole, R., Preparata, F. P., Yap, C. K. (1984). New Upper Bounds for Neighbor Searching. Technical Report CS-84-11. Providence: Brown University. Chazelle, B., Guibas, L. J., Lee, D. T. (1983). The power of geometric duality. Proc. 24th Atm. Symp. Found. Comp. Sci., 217-225. Cole, R., Yap, C. K. (1983). Geometric retrieval problems. Proc. 24th Ann. Symp. Fou11d. Camp. Sci., 112-121. Edelsbrunner, H., Kirkpatrick, D. G., Maurer, H. A. (1982). Polygonal intersection search. Inform. Process. Lett. 14, 74-79. Edelsbrunner, H., Kirkpatrick, D. G., Seidel, R. (1983). On the shape of a set of points in the plane. IEEE Trans. lliform. Theory. IT-29, 551-559. Edelsbrunner, H., Welzl, E. (1983). Halfplanar Range Search in Linear Space and O(n°' 695 ) Query Time. Report FIll, Institutes of Information Processing, Tech. Univ., Graz, Austria. Knuth, D. E. (1973). Sorting and Searching-The Art of Computer Programming, III. Chapter 6.5. Reading: Addison-Wesley. Willard, D. E. (1985). New data structures for orthogonal queries. SIAM J. Comput. (in press).
J. Symbolic Computation (1985) 1, 57-67
Fast Parallel Absolute Irreducibility Testingt ERICH KALTOFEN:j: University of Toronto, Department of Computer Science, Toronto, Ontario M5SlA4, Canada (Received 3 August 1984)
We present a fast parallel deterministic algorithm for testing multivariate integral polynomials for absolute irreducibility, that is irreducibility over the complex numbers. More precisely, we establish that the set of absolutely irreducible integral polynomials belongs to the complexity class NC of Boolean circuits of polynomial size and logarithmic depth. Therefore it also belongs to the class of sequentially polynomial-time problems. Our algorithm can be extended to compute in parallel one irreducible complex factor of a multivariate integral polynomial. However, the coefficients of the computed factor are only represented modulo a not necessarily irreducible polynomial specifying a splitting field. A consequence of our algorithm is that multivariate polynomials over finite fields can be tested for absolute irreducibility in deterministic sequential polynomial time in the size of the input. We also obtain a sharp bound for the last prime p for which, when taking an absolute irreducible integral polynomial modulo p, the polynomial's irreducibility in the algebraic closure of the finite field of order p is not preserved.
1. Introduction The determination of the irreducibility of a polynomial with coefficients in a unique factorisation domain is an old problem. Recently, several new algorithms for univariate and multivariate factorisation over various coefficient domains have been proposed within the framework of sequential polynomial-time complexity. For the coefficients being rational numbers, the first solutions are due to Lenstra et al. (1982) in the univariate and to Kaltofen (1982, 1983) in the dense multivariate case. It seems natural to ask whether any of these algorithms can be converted to a parallel one. Unfortunately, for rationals as coefficients, all algorithms developed so far utilise the construction of a short vector in an integral lattice, a process which seems to resist a parallel approach (cf. von zur Gathen (1983a) where the problem is related to integer GCD computation). In this paper we primarily consider irreducibility over the complex numbers. An integer polynomial is said to be absolutely irreducible if it remains irreducible when one allows the coefficients of factors to be com'plex. For example, x 2 + y3 is absolutely irreducible, whereas x 2 +y 2 =(x+iy)(x-iy) is not. We first observe that all previously known sequential algorithms such as Noether's criterion (1922), the multivariate Hensel algorithm (cf. Davenport & Trager, 1981) and the elimination algorithm by Heintz & Sieveking (1981) are exponential in the degrees of the input polynomials. For this
t
This research was partially supported by the National Science and Engineering Council of Canada under grant 3-643-126-90. Author's current address: Rensselaer Polytechnic Institute, Department of Computer Science, Troy, New York, 12181, U.S.A.
t
0747-7171/85/010057+ II $03.00/0
© 1985 Academic Press Inc. (London) Ltd.
58
Erich Kaltofen
problem, however, we shall do much better than just giving an algorithm polynomial in the input degree. Our algorithm is a parallel one which runs in polynomial-time in the logarithm of the degree of the input polynomial and the logarithm of the coefficient length. It needs polynomially many processors thus showing that ABSOLUTE IRREDUCIBILITY E NC c P (cf. Cook (1981) for a definition of the class NC and its relation to the class of sequential polynomial-time algorithms P). We wish to remark that this seems to be the first parallel and deterministic irreducibility test for polynomials over any of the usual coefficient domains. If the coefficients lie in a finite field, parallel factorisation procedures are known for small characteristics but the algorithms are probabilistic except the irreducibility test (cf. von zur Gathen, 1983a). Our parallel computation model is uniform Boolean circuits which means that we also account for the length of intermediately computed integers. We make extensive use of recently developed parallel algorithms for integer and polynomial arithmetic (cf. Reif, 1983), computing matrix determinants, solving singular linear systems over the rational numbers, computing polynomial greatest common divisors (cf. Borodin et al., 1982) and computing squarefree polynomial factors (cf. von zur Gathen, 1983a). We can extend our algorithm to find in parallel an irreducible complex factor of a given multivariate integral polynomial. It is not quite clear what the correct representation of such complex coefficients should be. We only can represent them as polynomials modulo a not necessarily irreducible integral polynomial whose splitting field defines an algebraic extension over which the input polynomial factors. If we could isolate a root of an integral polynomial to high precision in parallel, t then we could also obtain an arbitrarily high approximation of the coefficients of our factor. A further application of our methods is a new proof with a sharpened bound of a theorem by Ostrowski (1919) stating the following. An absolutely irreducible integral polynomial remains absolutely irreducible modulo all but finitely many prime numbers. Known upper bounds for the largest prime making the modular polynomial reducible seem to have been exceedingly large, e.g. a triple exponential bound in the degree of the polynomial is given in Schmidt (1976). We derive a bound which is of polynomial length in the degree. It is a consequence of Noether's (1922) theorem on the existence of reducibility-forms that one can test a polynomial over an arbitrary field for absolute irreducibility by field arithmetic alone, that is addition, subtraction, multiplication and division as well as testing elements to be equal to zero. We remark that our algorithm for absolute irreducibility also needs only the field operations and thus is not only restricted to the rational coefficient case. One interesting consequence is that we can give a sequential deterministic algorithm which tests a multivariate polynomial over a finite field for absolute irreducibility in polynomial-time of the total degree and the logarithm of the order of the field. The corresponding parallel algorithm is unfortunately a probabilistic one. But we view the sequential result a step towards solving the open question of how to deterministically test multivariate polynomials over finite fields for irreducibility. In this paper we restrict ourselves to bivariate polynomials though we will mention in the conclusion how to generalise our results to more than two variables. Section 2 contains some prerequisite algorithms and a theorem, section 3 the irreducibility test and section 4 the extension to finding a factor. Section 5 presents a new proof and an effective bound for Ostrowski's theorem. t To my knowledge it has not been rigorously established that one can quickly approximate a complex root of a polynomial in parallel.
Fast Parallel Absolute Irreducibility Testing
59
NOTATION. By 1L we denote the integers, by iQ the rationals and by I[; the complex numbers. F denotes the algebraic closure of a field F. D[y, x] denotes the polynomials in y and x over D, D[[y ]] the domain of formal power series in y over D; degx(j) denotes the highest degree of x in f E D[y, x] and deg(j) the total degree off The coefficient of the highest power of x in_(, a polynomial in y, is referred to as the leading coefficient off in x and will be denoted by ldcfx{f). We call f monic in x if ldcfx(j) is a unit of D. As is well known, D[y, x] is a unique factorisation domain (UFD) provided that D is a UFD. In this case the content of jE D[y, x] in x, contx(f), is the greatest common divisor (GCD) of all coefficients ofj(x) as elements in D[y]. The infinity norm ofjE C[y, x], the maximum of the absolute values of the coefficients off, will be denoted by If[. The sq uareroot of the sum of squares of the coefficients off, the square norm off, will be denoted by 1/1 2 • Let f(y, x) and g(y, x) E D[y, x]. By resx{f, g) we denote the resultant off and g with respect to the indeterminate x. As is well known, resx{f, g)# 0 if and only if GCD(f, g) E D[y]. Furthermore, there exist polynomials
s(y, x), t(y, x) E D[y, x], degx(s) < degx(g), degx(t) < degx(j) such that
s(y, x)f(y, x) +t(y, x)g(y, x) = resx(f, g).
2. Preliminary Results The overall structure of our algorithm will be quite similar to the reduction in Kaltofen (1983). We first transform/such thatf(O, x) is squarefree andfis monic in x. For this we can adopt algorithm 1 in Kaltofen (1983) which works briefly as follows:
1. Check that contx(f) = 1. This is a GCD computation of all coefficients of x in f which are polynomials in y. If contx(f) # 1 then f is reducible. 2. Check that f(y, x) is squarefree, i.e. GCD(f, offox)= 1. We can also, as we will need in section 4, determine a sq uarefree factor off quickly in parallel. 3. Make f monic in x by replacing f by the monic polynomial j(y, x) = ldcfx(j)deg,(fl -1 f(y,
ldc~(f)).
Notice thatfis absolutely irreducible if and only if/is. In fact, if g(y, x) is a factor of/(y, x) then g(y, idcfx(f)x) divided by its content is one for f 4. Find an integer w with lwl ~ degx(/)degy(/) such that./(w, x) remains squarefree, and replace J by f(y, x) = /(w + y, x). Such an integer w must exist and we find it by testing in parallel for all integers in the given range whether GCD(/(w, x), o]jox(w, x)) == 1. We now outline the irreducibility test forf, first over an arbitrary field Fin whichf(O, x) has a root (cf. Kaltofen (1983), Algorithm 2): ALGORITHM I. [Given f(y, x) E F[y, x] monic in x,f(O, x) squarefree, F an arbitrary field, and given a0 E F such thatf(O, a0 ) = 0, this algorithm determines an irreducible factor off over F:]
(N) [Compute approximation of root in F[[y]]:] n +-- degx(f); d +-- degy(f); K ~ (2n- l)d. By Newton iteration, calculate at> ... , aK E F such that
60
Erich Kaltofen
f(y, a0 +a 1 y+ ... +aKyK)
= OmodyK+l_
a~ a0 + . .. +aKyK.
(L) [Find minimal polynomial of a in F[y, x] :] [Compute powers of a:] FOR it-0, ..., n-1 DO aUl~a 1 mod yK+ 1. FOR it- 1, ..., n -1 DO Try to solve the equation aUl +
i- 1
L uiy)aW = 0 mod yK + 1
j=O
for polynomials ui E F[y] with deg(ui) ~d. This equation leads to a linear system over Fin K + 1 equations and i(d + 1) unknown coefficients of ui. If there exists a solution then xi+ L:~: ~ ui(y)x.i divides f(y, x). (Cf. Kaltofen (1983), Theorem 3; the solution is also unique.) In this case RETURN ("reducible"). [At this point, the FOR loop has not found a factor:] RETURN ("irreducible"). This algorithm supplies us with a theorem which will be of crucial importance for our irreducibility test. THEOREM 1. Let f(y, x) E .Z[y, x] be monic in x such that f(O, x) is squarefree. Furthermore, let F be a subfield of C in which f(O, x) possesses a root. Then f is absolutely irreducible if and only iff is irreducible in F[y, x]. PROOF. Obviously irreducibility over F is necessary for that over (. Assume f were reducible in C. Then algorithm 1 will find a factor ofjin C[y, x] provided we replace F by C throughout the algorithm. However, we may choose a0 E FcC which automatically forces the a1 (see algorithm 2, step (N)), and later the (unique!) solution for the linear system to remain in F. Thus the factor found over C is in fact an element of F[y, x]. We will use an algorithm very similar to the previous algorithm for the absolute irreducibility test. First of all, we observe that if we had an irreducible factor t(x) off(O, x) we could choose F = il)[z]/(t(z)) in algorithm 1. Using the sequential polynomial-time factorisation procedure this immediately shows that absolute irreducibility can be decided in polynomial-time. However, we want to construct a parallel solution and, at the current moment, there seems to be no fast parallel algorithm for finding t.
3. Testing Polynomials in Z[y, x] for Absolute Irreducibility In this section we present an algorithm which when given a polynomialf(y, x) E Z[y, x] monic in x such that ftO, x) is square free determines in (log deg(f) +log log lfi)°Cll steps whether f is absolutely irreducible using (deg(f) log lfi)°C 1l processors, thus showing that ABSOLUTE IRREDUCIBILITY E N C. We use the idea of algorithm 1 but work in a ring R with zerodivisors in which JtO, x) has a root. The choice is R = ll)[z]/(ftO, z)) and we construct our algorithm such that we never need to invert a zerodivisor in R. The detailed description follows now: ALGORITHM 2. [Given f(y, x) E l[y, x] monic in x, f(O, x) squarefree, this algorithm determines whether f is absolutely irreducible.]
Fast Parallel Absolute Irreducibility Testing
(I) [Initialise:] n ~ degxCf); d ~ degy(f); By determinant formulas compute polynomials s(z), t(z)
s(z)f(O, z) + t(z)
:~ (0, z) =
p
= resz
E
61
tr:[z] such that
(reo, z), :~ (0, z))
and deg(t) < deg(f). [Since f(O, x) is squarefree, p is an integer not equal to zero.]
ct 0 ~ z modf(O, z) [
Notice that flO,
E
ct 0 )
R = IQ[z]/Cf(O, z));
1
fJo ~- t(z) p
1
= 0 and!'(0, ct ) = {3 0
E
R.
in R, where f' denotes
0
~~ .J
ux
FOR j in {0, ... , n} DO aWl ~ ex~ E R. (N) [Approximate a root ofj(y, x) in R[[y]]] [Order of approximation:] K ~(2n-1)d. FOR i ~ 0, ... , I log 2 (K) I DO 21 1 ct1+ 1 ~(ct 1 -{Jcf(y, ct 1)) mod y + •
1 1
[At this point etc+ 1 is an approximation of a root offto order / + • Notice that 1 1 f(y, a1) mod / + is a multiple of y 21 and moreover can be quickly computed using aFl .] 21 2 FORj in {2, ... , n} DO ctFl 1 t-ct{+ 1 mody + • [Notice that aFJ 1 is, as thejth power of a root off, only correct to order y 21 + 1 - 1 • We need twice as many terms the next time we substitute into f. One can compute these powers in parallel by binary exponentiation though this is not the fastest way possible (cf. Reif (1983)).] 21 1 {3 1+1 ~(2fJc-f'(y, ct;+t)f3t) mod Y + • 1 [At this point, {3 1+tf'(y, etc+ d = 1 mod y 21 + • Again f'(y, etc+ 1 ) can be 1 1 quickly computed using o:Fl 1 mod / + .] FOR j in {0, ..., n- 1} DO aUl ~ ct\111 mod yK+ 1 . [The index i = 1 log 2 K I, hence aUl is the correct Kth order approximation of the jth power of a root off. Notice that al~ 1 =ct;+ 1 .] (L) [Find a polynomial in R[y, x] for which aC 1l is a root:] Examine whether the equation n-2
aCn-1)+
L u1(y)aC 1l=OmodyK+l
(1)
i=o
is solvable for polynomials and let
u(y) E R[y] such that deg(u1) ~d. Let u(y) = L;=o Ucsl 1
1
K
aUl =
L a~l yk,
a~l E R.
k=O
Then (1) leads to the linear system n-2
d
ae•-l)+" "~ k ~
i= 0 s= o
k-s u ~
a(C)
=0
(2)
for k = 0, ..., K in the variables u1• E R, i = O, ..., n- 2, s = 0, ..., d. We solve (2) by further refining the unknowns to polynomials in iQ[zJ/(JtO, z)).t Let
t
Thanks go to Joachim von zur Gat hen for pointing out this approach.
62
Erich Kallofen "n-l j an d Jet z ). =L. mo dji(O ,z ) WI"th 1, 0 c;.1z ;" = n, .. ., 2n- 2, C;.j E 71... Then the coefficient of zi, 0 ~ l ~ n -1, for each equation . (2) .IS, settmg . In ak(i)1 an d u;.1 to 0 f or J. ~ n,
,n-1
j
tlis==L..J=ouisjz,
(i)
,n-1
(i) j
ak =L..}=oak1 z
(3) which is a linear expression in u;.1 and which must vanish on a solution of (2). This leads to a linear system over IQ in p=n(K+1) equations and q=n(n-1)(d+1) unknowns. If this system has a solution, we return "f is reducible in C", otherwise, we return "f is absolutely irreducible". The reader can find a proof that step (N) computes a Kth order approximation of a root off in Lipson (1982), Sect. 3.3. The correctness of algorithm 2 now hinges on the following theorem. 2. The linear system (2) (resp. (3)) has a solution in R (resp. I!J) factors over C. THEOREM
If: Let
if and only ifj(y, x)
t, be the factorisation off(O, x) into irreducibles. By p1 we denote the projection from R onto F)= Q[z]/(t1(z)), 1 ~j ~r. Then for a== a(ll, p1(a) = L~=o p1(ak 11 )l is the Kth order approximation for a root off(y, x) in Fj[[y]J[x]. Now assume thatf(y, x) splits over C. SinceftO, x) has a root in F1, by theorem lj(y, x) splits in FJy, x]. Therefore, the minimal polynomial gj(y, x) E Fj[y, x] for p1(a) has degree nj < n. Let g(y, x) E R[y, x] be the unique polynomial (by the Chinese Remainder Theorem) such that PROOF.
t 1 ...
f1(g(y, x)) = x"- 1 -"Jgiy, x)
for
1~ j
~
r.
=
Since f1(g(y, et)) 0 mod yK + 1 in F1 [[y]] for all 1 ~j ~ r, g(y, a) :::= 0 mod yK+ 1 m R [[y]] and hence its coefficients solve (2). ·
Only if: Assume (2) admits a solution, i.e. there exists a polynomial g(y, x) E R[y, x] of degree n-1 such that g(y,a):=OmodyK+t. Let gt(y,x)=p 1 (g(y,x)) and let p(y) = resx(f, g 1) over F 1. There exist polynomials s(y, x) and t(y, x) E F 1[y, x] such that p(y) = s(y, x)f(y, x) + t(y, x)g 1 (y, x). Therefore
p(y) == s(y, Pt(a))fty, Pt(a))+t(y, p1(a))g 1(y, p 1(ct))
=0 mod yK+
1
.
But degy(f), degy(g 1 ) ~ d and hence deg(p(y)) ~ (2n -1)d. Thus p(y)""" 0 and the GCD(f, g 1 ) in F1 [y, x] is non-trivial. This GCD is, of course, a factor ofj(y, x) in CC[y, x]. We finally furnish a count for the number of arithmetic operations in Q as well as bounds for the intermediately computed numerators and denominators. The inversion of f'(O, a 0 ) is a determinant computation and can be performed in parallel in O(log 2 (n)) steps. Each ring operation in R costs no more than the normalisation, that is the final remainder step modulo /(0, z), which can be done in parallel in O(log 2 (n)) operations in Q, though 2 this again could be improved. As said before, we compute a{+ 1 mod y 2 i+ by binary exponentiation. However, we perform the normalisation only after the exponentiation. Since deg_(a/ + 1) ~ n2 and the degree in y can be kept below 2i+ 2 = O(K) throughout the 2 exponenti;tion process, computing the powers of rt;+ 1 mod y 2 i+ can be accomplished in
Fast Parallel Absolute Irreducibility Testing
63
parallel in O(log 2(n) log(K)) operations in Q. Therefore, step (N) takes O(log 2(n) log 2(K)) parallel arithmetic steps. The bounds for the occurring rationals in step (N) follow from the elaborate analysis in Kaltofen (1983), Sect. 6. There we provet that in (3) for n ~ 4 E PlK-taCi! k1
71..
[Lemma 7]
'os::··s::
IP2K-ta~JI~(2nlfi)4Kn3[(8)]
and
of
10S:k&K .....,z,J.....,n-' '""" ""' 3
IPI = res (f(O, z), x (0, z)) ~ (2nlfl)'' [(5)]. 0 In fact, all intermediate numerators and denominators of rational coefficients are bounded that way. It is easy to find a bound for lc.ul· e.g. lc , 11~ 1!1~ ~ (nlfl)''. The approach is to investigate the linear system arising from the identity x" = q(x)f(O, x) + r(x), deg(r) < n, where the coefficients of q and r are the unknowns and apply Cramer's rule and Hadamard's determinant inequality. Thus the integer arithmetic of step (N) consumes O((log deg(f) +log log 1/1) 2) steps which is again not the best upper bound and thus binary complexity of step (N) is crudely bounded by O(log6 (degf)+log 4(degf) log 2(log lfl)). (4) Step (L) is deciding the solvability of a linear, non-square system in q = n(n-1)(d+ 1) unknowns and about twice as many equations whose coefficients are integers with O(deg4 (f) log(lfl)) digits. The parallel complexity given in (4) dominates this step as can be inferred from Borodin et al. (1984), Corollary 4.4, and Ibarra et al. (1980). It should be clear that our methods are not restricted to polynomials over the integers, but work for any perfect coefficient field. (Perfectness of the field is required because of preprocessing step 2.) The most interesting case is then when the coefficients lie in a finite field GF(q). There are two peculiarities in this case. First, an element w such that J(w, x) remains squarefree may not exist in GF(q), as was necessary in the 4. preprocessing step. But it can be shown (cf. von zur Gathen & Kaltofen, 1983, Sect. 4.2) that a small algebraic extension GF(q 111 ) can be constructed deterministically such that a wE GF(q'") with the required property can be located. Since our input polynomial is to be tested for absolute irreducibility we do not lose generality by working over G F(q'"). Secondly, singular linear systems over finite fields can only be solved probabilistically in parallel (cf. Borodin et a/., 1982). That means, that the algorithm might fail to produce any decision, but that with diminishing probability. However, we can return to the sequential technique and thus get the following interesting result. Testing fl.y, x) E GF(q)[y, x] for irreducibility in the algebraic closure of GF(q) can be performed deterministically in (deg(f) log(q))°Cll binary steps. We mention this result, because testing f for irreducibility over GF(q) itself is not known to be in deterministic polynomial time.
4. The Computation of an Irreducible Factor In this section we show how to compute g(y, x) E C[y, x] irreducible such that g divides fl.y, x) E ?!..[y, x]. It should be clear from the preprocessing procedure as explained in section 2, that we only have to concern ourselves with f monic in x and fl.O, x) sq uarefree. We will represent g E R[y, x] where R = Q[z]/(¢(z)) with ¢(z) some factor of f(O, z).
t Actually, the given proof is modulo an irreducible factor of f{O, x) but this fact is never used. The bounds work for any factor and we use this also in section 4.
64
Erich Kaltofen
Moreover, g will be monic in x and division off by g, thus always possible, will leave a zero remainder in R[y, x]. Therefore, if we evaluate the coefficients of g at any root of cfJ we get a factor off in C[y, x]. We also guarantee that for one root of ¢ the image of g under this evaluation is irreducible. We realise that one cannot speak properly of irreducibility over R since this domain is not necessarily a field. We wish to observe that we know no fast parallel construction for the full factorisation of f(y, x) over C. Even to determine how many factors f has over IC yet escapes our attempts. 3. [Given f(y, x) E &l'[y, x] monic in x, f(O, x) squarefree, this algorithm determines ¢(z) E &l'[z] and g(y, x) E R[y, x], R = Q[z]/(¢(z)), such that g is a monic and irreducible factor of f.] (1)-(N) as in algorithm 2. ALGORITHM
(LF) [Find a minimal polynomial for o:C 1l in R[y, x]. It may become necessary in this step to restart the whole computation with R being replaced by a homomorphic image. Therefore, we initially set c/J(z) = f(O, z).] FOR
I in {1, ... , n-1}
DO
Examine whether the equation 1-1 o:U-ll +
L0 u1(y)aCll = 0 mod yK+ 1
(5)
l=
is solvable for polynomials u 1(y) E R[y] such that deg(u 1) ~d. As in step (L) of algorithm 2 this amounts to solving a linear system in deg(¢)K equations and deg(¢)(/ -l)(d+ 1) unknowns over IQ. Pick the smallest I for which (5) was solvable and denote it by I solution to (5) with I. I 0 and set
g(y, x) t - xio +
0.
Compute one
Io L U;(y)xi. i'= 0
Take the remainder h(y, x) E R[y, x] ofj(y, x) divided by g(y, x) w.r.t. x. [Since g is monic in x, lz(y, x) is uniquely determined. The standard division algorithm shows that degy(h) ~ (n- I 0 + l)d. However, R is not a field and we deem it necessary to explain a parallel procedure for performing this division.] Compute the coefficients of q(y, x) and h(y, x) E R[y, x] such that
f(y, x) = q(y, x)g(y, x) + h(y, x),
degx(q) = n- I 0 , degx(h) < I o·
Since q is monic in x and degy(q) ~ (n- I 0 )d this leads to a linear system in
11 = ((n- I 0 + l)d + l)I 0 +((n- I 0 )d + l)(n- I o) unknowns and v~((n-I 0 +l)d+l) n equations over R. This system can be rewritten as a linear system in deg(¢) tt unknowns and deg(¢) v equations over Q in exactly the same way as it was done in step (L). IF
h= 0
THEN RETURN
(g(y,
X) E
Q[z]/(c/J)[y, x]).
the following: For any coefficient V; 0 s0 E R of y•oxio in h(y, x) with v 1080 =/= 0 compute y(z) t - GCD(¢(z), v10 • 0 (z)) E l[z]. [We show below that y(z) =I= 0. Then y is a non-trivial factor of ¢ since also deg(v!oso) < deg(¢).] Replace ¢ by y if ELSE DO
Fast Parallel Absolute Irreducibility Testing
65
deg(y) ~ deg(¢)/2 and by ¢/Y if deg(y) > deg(¢)/2. [The new¢ has degree at most half of the old one.] Project the coefficients of a(l), 1 ~ i ~ n- 1, into the new R = IQ[z]/(¢) by taking them modulo the just obtained new ¢. Then go back to step (LF).
It should be clear that this algorithm runs in poly-logarithmic depth. Since the degree of¢ is at least halved every time we restart at step (LF), this can happen at most llog 2 (n) I times. We now prove its correctness. Let ¢ = t 1 .•. t, be the factorization of ¢ into irreducible polynomials. As in the proof of theorem 2, F1 = IQ[z]j(tj) are fields obtainable by projection from R via p1. Now the minimal polynomial g1 E Fj[y, x] corresponding to pia.5(U, Aoo. · · ., A,10) =
L ¢k(Aoo• · · ., Aoo)Uk
k=O
a Reduzibilitiietsform (reducibility-form) for 0. The existence of such a reducibility-form immediately implies the following theorem of Ostrowski (1919).
OK[x, y] is absolutely irreducible. Thenf(x, y) modulo P remains absolutely irreducible over OK/ P for all but finitely many prime ideals P of OK. THEOREM
3. Let K be a number field, OK its ring of integers. Assume thatf(x, y)
E
In particular, if K = Q an absolute irreducible polynomial f(x, y) remains absolutely irreducible modulo all but finitely many rational primes p. It is, however, not so easy to
66
Erich Kaltofcn
give a good lower bound B1 such that absolute irreducibility is preserved for all primes p ~ B1. One such bound is calculated in Schmidt (1976), Corollary 2B, namely 26 B1 = (41fl)1a+ 1 > • ', c5 = deg(f). The following theorem establishes a much better bound whose proof is based on algorithm 2.
4. Let f(x, y) E l[y, x] be monic in x, absolutely irreducible, with 8 = deg(f). Then f modulo pis absolutely irreducible over GF(p) for all primes p with THEOREM
P ~ Bf = (2
(02)
I
N 1 (- + 1 ) X
-
H 1 ((- + 1) X
-
1 1 ) (- + 1) X X
=0
==== N
=1
In (C3), MACSYMA is asked to sum (02) to 1000 and the resulting expression (D3) (which has been truncated) has a large number of terms. The MACSYMA function NTERMS gives one a handle on the size an expression would be if it were fully expanded and no simplification of like terms occurred and for this case, there are 503 504. From the binomial theorem, it is not hard to show that this number is precisely (M"2 +7*M +8)/2 for M = 1000. Finally, MACSYMA is asked to simplify (D3), and after almost 2 CPU hours, the expected answer is returned. ( C3) 02,H = 1000,SUH; ( 03)
ggg 1000 1 1 + (- + 1 ) + ••• + (- + 1 ) X X 1 1000 1 - 1) (- + 1) X -((-+1) X X
( C4) NTERHS( LHS( 03)); ( 04) (C5) RATSIHP(03); Time= 7226000 msec.
0
'nt\_!:*hl"\ut_y
~
MACSYMA
•
1 + (- + 1 ) + 1 X
0
hrs)
7.2 In this example
2
503504
= (2
( 05)
1 (- + 1 ) X
=
0
TAYLOR SERIES
is asked to compute the first 500 terms of the Taylor series of
()_ Tho._rn.r-7"nn..,_,:,......._:
,
·-
..
_1•
MACSYMA from F to G
7.3
EINSTEIN'S FIELD EQUATIONS IN
4
97
DIMENSIONS
Here is a problem with more physical motivation which may better illustrate the question of limits on computational power today. For 2, 3 and 4 dimensions we have computed and completely simplified the components of the Ricci tensor (the object which is the source of the vacuum field equations of Einstein's General Theory of Relativity) using the most general metric tensor. In 4 dimensions the components of the metric tensor can be expressed by the matrix A( X, V, Z, T)
B(X,V,Z,T) C(X,V,Z,T) D(X,V,Z,T)
B(X,V,Z,T)
E(X,V,Z,T) f(X,V,Z,T)
G(X,V,Z,T)
C(X,V,Z,T)
F(X,V,Z,T)
H(X,V,Z,T)
l(X,V,Z,T)
( D(X,V,Z,T)
G(X,V,Z,T)
l(X,V,Z,T) J(X,V,Z,T)
( ( ( ( ( (
] ] ] ] ] ] ]
For this case the covariant Ricci tensor consists of 10 second-order coupled partial differential equations in the four space-time variables. The diagonal components have 9990 terms each and the off-diagonal components have 13 280 terms each. Some researchers have speculated that these equations will eventually be solved in this most general case. Pondering the complexity of the expressions, one wonders if this could really come to pass. Each component, when printed, is the size of a 200-page book. The object of the exercise is to compute and simplify the components of the covariant Ricci tensor. Here is a table of the result of the computation:
Dimension
Diagonal terms
17 416 9990
2 3
4
Off diagonal terms
CPU MACSYMA
CPU CAMAL
5 30 350
1 3 45
17 519 13280
Several Computer Algebra systems attempted to generate the table above. Not all were successful. The CPU times to complete the 3 and 4 dimensional calculations (on the systems which succeeded) ranged from an average of 30 and 350 CPU seconds/component respectively by L. S. Hornfeldt and the authors using MACSYMA to an average of 3 and 45 seconds/component respectively by R. G. McLenaghan and G. J. Fee using CAMAL (Fitch, 1975). MACSYMA was run on the MIT Multics operating system on a Honeywell 68/DPS and CAMAL on an IBM 4341 at University of Waterloo, Canada. The time difference is mainly due to the difference in machine speed. Special algorithms were constructed which reduced the computation times.
7.4
COMPUTATIONAL POWER IN
2085·?
What about the power of Computer Algebra systems 100 years from now? Below is a 14x 14 matrix:
98
Richard Pavelle and PaulS. Wang MATR=
M•• Mba Mea Mda M•• Mr. Msa Mha Mia Mja Mka M,. Mma Maa
Mab Mbb Mcb Mdb M.b Mrb Msb Mhb M;b MJb Mkb Mlb Mmb Mab
M •• Mbc M •• Mdc M •• Mfc Mgc Mhc M;c Mjc Mk:c Mlc Mmc Mnc
Mad Mbd Mcd Mdd Med Mrd Msd Mhd M;d Mid Mkd Mid Mmd Mud
M•• Mbe M•• Mde M•• Mr. Ms• Mhe M;. Mje Mke M,. Mme Mae
M.r Mbr Mer Mdr M.r Mrr Msr Mhr M1r MJr Mkr M,r Mmr Mar
Mag Mbs Meg Mds M•s Mrs M" Mhs M;B Mis Mks Mls Mmg Mas
Mah Mbh MCh Mdh M.h Mrh Msh Mhh Mlh Mih Mkh Mlb Mmh Mnh
M.; Mhl M.; Md; M.; Mn Msl Mh; Mn Mil Mki Mu Mml Mal
Maj Mbi Mcj MdJ M•i MfJ MgJ Mhi Mu MJi MkJ Mli Mmj Maj
M.k M.l Mbk Mb; Mck Mel Mok Mdl M.k Mel Mrk MJn Msk Mgl Mhk Mhl M;k Mn Mik Mil Mkk Mkl Mlk Mu Mmk Ma,l Mak Mal
Mom Mbm Mcm Mdm Mem Mrm Mgm Mbm Mlm Mjm Mkm Mlm Mmm Mnm
Man Mba Men Mdn Men Mfn Mgn Mhn M;a Mjn Mkn Min Mmn Mnn
Let us call this matrix MATR for the purposes of illustration below. MACSYMA computes the determinant in about 4 CPU hours. The number of terms in the determinant of a general N x N matrix is N! and no simplification is possible. Indeed, simply attempting to print one term exhausts the memory of the machine. A reason for this is that the algorithm MACSYMA uses for computing determinants involves an expansion by co-factors so that the determinant is a deeply nested product. Of course, as we see, 14! is also a very large number. Perhaps 100 years from now (or perhaps in only 10 years), with advances in hardware and software, one will be able to compute and manipulate such expressions on a hand held device. (Cl) DETERHINANT(HATR)$ Time= 13672000 msec. (C2) 14!; ( 02)
87178291200
8. Current Developments 8.1
HARDWARE
As supermicros and LISP machines become less expensive and more powerful, large Computer Algebra systems such as MACSYMA will become more readily available. One important trend which we see today is the scientific workstation which integrates symbolic computing, numeric computing and graphics in one powerful system. These systems have a high-resolution bit-mapped display. Under software control, these displays exhibit multiple windows that are used for various functions in an advanced user interface. In this computing environment numeric code can be derived and generated by symbolic computation while graphics can be used to display results obtained on an interactive basis. Today it costs a minimum of about $20 000 to buy a computer which can run MACSYMA. This impacts the distribution greatly. When the price drops to the equivalent of today's $3000 we can expect to see a large distribution of the software to students. There is already a trend in the application of Computer Algebra in mathematics education at the high school and college levels. Computer Algebra systems running on inexpensive hardware can make a significant impact by providing a "mathematical laboratory" for
MACSYMA from F to G
99
pre-college students. Such a laboratory encourages experimentation, increases interest, and provides a degree of concreteness to a subject which is very abstract in nature. It is believed that Computer Algebra tools are necessary for most people who wish to enter into or compete within the high technology areas. 8.2
SOFTWARE
Along with the faster, more powerful computers one must have a Computer Algebra system which can run on many different machines. Some Computer Algebra systems are being designed from the ground up with portability in mind. In the case of MACSYMA, various efforts are under way to modify the code and develop interfaces which address the portability issue. In very general terms, there are a number of areas which are receiving attention now. The degree of user friendliness is being substantially improved through software development. Software that facilitates the maintenance and testing of large Computer Algebra systems is receiving more attention. The interface of symbolic, numeric and graphic facilities is playing an increasingly important role. The use of Computer Algebra systems for generating numeric programs is now an important resource at many sites. Extending the capability of current systems and improving the speed of computations is continuing. A Computer Algebra system such as MACSYMA will continue to expand and provide more capabilities and features. One useful subsystem under development at Kent State University provides the ability to derive and generate FORTRAN code automatically. Current focus of this research is the generation of code for finite element analysis (Wang & Gates, 1984). MACSYMA is used to derive the strain-displacement matrices and the stiffness coefficients needed. These are then generated into FORTRAN using a code translation package (Wang et al., 1984) which is written in LISP. Techniques used to generate code include the use of automatically generated intermediate labels, interleaving code derivation and code generation, generating functions and subroutines and the use of symmetry to simplify the code generated. Mechanical aids for verifying the correctness of the generated code, as well as the employment of a "code optimiser'' are under investigation. Another important area we are considering is the manipulation of expressions in the complex plane. We previously gave an example of the capabilities of the ordinary differential equation solver ODE described in section 4.15. While this is impressive, solving differential equations is really a kind of scientific art. Given a differential equation whose form or structure is not immediately recognisable, one looks for transformations which will convert the given problem into one which is known. ODE already has some modest heuristic capability in this area: It is in this direction that we can expect future developments in MACSYMA. Over the next several years, we expect that clever expression recognisers will be added which will simplify and transform problems in very much the same way mathematicians who specialise in the field do. The rules are fairly well known; the problem is to build them within the resources of MACSYMA and provide enough user control to allow reasonably rapid convergence to either a solution or to a decision that it cannot solve the problem (i.e. the problem cannot be solved in terms of known functions). For a large system such as MACSYMA one would like to incorporate as much useful mathematics as possible into the system. This can be done by adding capabilities to basic functions such as INTEGRATE or LIMIT or by writing new code which is added to the
I00
Richard Pavelle and Paul S. Wang
existing SHARE libraries. These enhancements require a large effort. The way it will happen with MACSYMA will be to coordinate users at various sites and encourage them to submit their code to a technical advisory group. The code will then be tested and, if useful, will be prepared for redistribution. References Berlekamp, E. R. (1967). Bell System Tech. J. 46, 1853. Dingle, H. ( 1933). Proc. Nat. A cad. Sci., U.S.A. 19, 559. Fitch, J.P. (1975). CAMAL Users Manual. University of Cambridge Computation Laboratory. Gasper, R. W. (1978). Proc. Nat. Acad. Sci., U.S.A. 75, 40. Goursat, E. (1904). A Course in Mathematical Analysis I (Section 30). New York: Dover Publications. Gradshteyn, I. S., Ryzhik, I. M. (1965). Table of Integrals, Series and Products (4th ed.), p. 85. (The error is corrected in the 4th edition (1980).) New York: Academic Press. Karr, M. (1981). J. Assoc. Camp. Mach. 28, 305. Kamke, E. ( 1943). Dif.ferentlalgleichungen: Losungsmethoden und Losungen.. Leipzig: Akademische Verlagsgellschaft. Klerer, M., Grossman, F. (1971). A New Table of Indefinite Integrals (Complller Processed). New York: Dover Publications. Knuth, D. E. (1980). The Art of Computer Programming 2 (2nd edn), ch. 4. Reading, Massachusetts: Addison Wesley. THE MACSYMA Reference Manual (Version 10) (1984). Vol. 2, Sect. 3. Massachusetts Institute of Technology and Symbolics. Mansouri, F., Chang, L. N. (1976). Phys. Rev. D13, 3192. Moses, J. (1974). MACSYMA-the fifth year. Proceedings Euro.mm 74 Conference, Stockholm. Rosenlicht, M. (1972). Amer. Math. Monthly, November. Proceedings of the /977 M ACSYMA Users' Conference ( 1977). University of California, Berkeley, Ca. Proceedings of the 1979 MACSYMA Users' Conference (1979). Washington, D.C. Proceedings of the /984 MACSYMA Users' Conference (1984). General Electric Corporate Research and Development, Schenectady, NY. Pavelle, R., Rothstein, M., Fitch, J.P. (1981). Computer Algebra. Sci. Am. 245, December. Pavelle, R. (1978). Phys. Rev. Lei/. 40, 267. Pavelle, R., Bogen, R. A. (1977). !:..ell. Math. Physics 2, 55 (erratum 2 (1978), 255). Rainville, E. D. ( 1964). Elemelllary Differential Equations. New York: Macmillan. Risch, R. (1969). Trans. Amer. Math. Soc. 139, 167. Risch, R. (1970). Bull. Amer. Math. Soc. 76, 605. Rosenlicht, M. (1972). Amer. Math. Monthly, November, 963. v::~_n___HjlhPn
T
A.
r~tmPt
T (1QR1) ComnutP.r alaPhrn_c:::v~temc::: Tn• tl~llf'hhPrapr
R.
rn111n 0; n, m = 0, 1, 2, ... ),
(3.4)
min (m,n)
= Jn(-1)"p-•-!m!
L
S(p, n)Cm-p(4p; 2, 0, 1),
p=O
(Re fl > 0; n, m = 0, 1, 2, ... ),
(Jarg /31 < n, n ~ 0, l ~ n + 2, m ~ 0),
" I 0
x"lnm x dx (1-x)
---,-.,-----,1
1
= ( -1)m+n+l
m.
(1-1)!
Ln mt"'O
s~~: 1)
L (-1)'"2S~~~::.\) (2 n )m-mt-m21Bm-m, -mz '
l-n-2 mz=O
1
(3.6)
(m-m 1-m2)!
(n ~ 0, l ~ n + 2, m ~ 1-1),
"' I
x"-t lnm x o (1 +f3x)l dx ( -l)l+m+ 1
-
/3"+! m-mt-m2
X
L
(3.7)
ma=O
(larg /31 < n, n;;;:: 0, I~ n+ 1, m ~ 0),
112
K. S. Kolbig
= ( -1l+m+n+ 1
1-n-1 X
L
ml
Ln (
. l -l)m'S(m1, n) (l-l).m 1 =0
S(m2,l-n-1)(2n)m-mt-m2+1
(2m-rnt-m2+1_1)JB
m2=0
(n ~ 0,
min (m-m,,l- n- 2)
x
L m2=0
.
1
m-m,-m2+1, (m-m1-m2+1)!
l
~
(3.8)
n+1, m ~ 1-1),
A
(-l)m 2 S(m 2 ,l-n-2)Cm-m,-m2 (Zf3; 1, -2, --:-1),
(3.9)
(larg /31 < n, n ~ 0, l ~ n + 2, m ~ 0).
In formulae (3.5) to (3.9), n, m, and l are integers. The integrals in (3.6) and (3.8) are to be understood as Cauchy principal value integrals if m = 1- 1. Note that
Hence this integral can be obtained from (3.9). For each of the integrals (3.5) to (3. 8), there exist relations connecting integrals with different parameter values. These relations and a short explicit table of these integrals for small values of n, m, and I, obtained by REDUCE (Hearn, 1984) on the .IBM 3081 and a Siemens 7880 at CERN, are given in Kolbig (1985). Listings of the REDUCE programs are available from the author. In these programs, heavy use of the SUM operator available in REDUCE is made.
4. Some Examples Below, we give a set of examples, obtained with REDUCE, in order to illustrate the complexity of the results. We have used the well-known formula
for the Riemann zeta function in order to simplify further the results obtained by (3.1) to (3.9).
f
t-
1 ln 5 t ln 6 (1- t) dt =-
~H~~nn 12 - 200n 6 , 2 (3)- 6720n 4 ,(3)C(5)
- 14400n 2n3K(7)-72000n 2' 2(5) + 21600, 4 (3) + 241noo,(3K(9)+ 22464oo,(5)n7).
(4.1)
Explicit Evaluation of Certain Definite Integrals Involving Powers of Logarithms nt2
I
n
2
ln cost ln sin t dt = 5
0
384
113
{3n 6a-n 4(13C(3)+32a 3)
+ 4n 2 (60C(3)a 2 -75C(5)- 24a 5 ) + 8(315C 2(3)a- 210C(3)a 4 -180C(5)a 2 + 135C(7)-24a 7)}
(4.2)
where a = In 2.
1
I
00
e- JJ't 5 ln 4 t dt = - {- 24c 5 + 250c 4 - 20(2n 2 + 35)c 3 ~6
0
-10(48C(3)-25n 2 -60)c 2 + 2(1000C(3) -9n 4 - 175n 2 -60)c - 80C(3)n 2-1400C(3)- 576C(5) +1fn 4 + 100n 2 },
(4.3)
(Re Jl > 0).
where c = y+ln fl.
J oo
e-J.l!t7i21n5 t dt =
Jfi
{934lc4_16rc3+ 15(1lin2 +95)c2
fl.
0
+ 3e2fl5C(3)-16rn2- 460)c (4.4)
where c = y +In 4p (Re fl.> 0).
where b
= In p (larg /31 < n).
J
Ins Xs d x = (1-x)
oo X
0
"'I 0
72
x 1 (
1
91t
2(
n 2 - 15) .
(4.6)
5
ln x d = _!!____ { _...J2..b5 +.lib4 _1(1.2.n2 +il)b3
1 +f3x) 5
x
/3 912
12
12s
4 16
3
2 +(¥n 2 +20)b 2 -(H§n 4 -lpn 2 - 5)b+n (Wn +20)}, 2
where b
= In f3
(4.7)
(larg /31 < n). (4.8)
I
00
X
2
ln
4
X
1 {_l_Q_ 4
32( 2 2 1)b2 +715n2 4 6 + ~~(- 4C(3)+!n 2 +2)b- 74(tC(3) +nn -3n )}, _ll_b3
(l+f3x) 912 dx=f3 3 10sb +ras
0
where b
= In (/3/4) (larg /31 < n).
(4.9)
114
K.
s. Kolbig References
Abramowitz, M., Stegun, I. A. (eds) (1966). Handbook of Mathematical Functions, with Formulas, Graphs, and Machematical Tables. 5th printing with corrections, Nat. Bur. Standards Appl. Math. Series 55. Washington, D.C.: US Government Printing Office. Comtet, L. (1974). Advanced Combinatorics. Dordrecht: Reidel. Gradshteyn, I. S., Ryzhik, I. M. (1980). Tables of Integrals, Series, and Products. New York: Academic Press. Hearn, A. C. (1984). REDUCE User's Manual. Version 3.1. Santa Monica: Rand Publishing. Knuth, D. E. (!969). The Art of Compwer Programming, Vol. 2. Reading, Massachusetts: Addison-Wesley. Kiilbig, K. S. (!982). Closed expressions for t- 1 log"- 1 t log" (I-t) dt. Math. Comp. 39, 647-654. Kiilbig, K. S. (!983a). On the integral J~12 log" cos x log" sin x dx. Math. Comp. 40, 565-570. Kolbig, K. S. (!983b). On the integral e-pt tv- 1 logm t dt. Math. Comp. 41, !71-182. Kolbig, K. s. (!985). On the integrals; xv- 1(1 + Px)-l.lnm X dx. J. Camp. Appl. Math. (in press).
g
J;
J. Symbolic Computation (1985) 1, 115-118
A Bibliography on Parallel Inference Machines W. BIBELt AND K. ASPETSBERGERt
t
Technische Universitiit Miinchen, Institut fur Informatik, Arcisstraj3e 21, D-8000 Munchen 2, Federal Republic of Germany, and tJohannes Kepler Universitiit, lnstitutfiir Mathematik, Altenbergerstraj3e 69, A--4040 Linz, Austria (Received 10 December 1984)
Introduction The realisation of a parallel machine for automated theorem proving, logic and functional programming and other types of symbolic computations is a research topic that is currently pursued world-wide. At this early stage, most of the material on parallel machines for symbolic computation is contained in technical reports and proceedings of conferences. This bibliography aims at supporting and challenging future research on this subject area by pointing to most of the existing papers in this field without trying to give any assessment. Some attempt at completeness has been made. However, at this stage, it turned out to be nearly impossible to keep track of all the work at present evolving in the various research groups throughout the world. Therefore, we would like to urge the readers to submit information about other entries that should appear in this bibliography. A list of addenda will be published in the bibliography section in one of the forthcoming issues of this journal. Papers qualifying for this bibliography should meet the following criteria: -
the architecture should be truely parallel (no simulation of parallelism on sequential machines) the architecture must be realised in hardware (or, at least, must promise to be realisable in hardware) the intended application of the machine should be in the area of symbolic computation in the sense of the word used in this journal. List of Papers
Aso, M., Onai, R. ( 1983). XP's: An Extended OR-Parallel Pro log System. Tech. Rep. TR 023, ICOT, 1983 (Japanese). Bibel, W., Buchberger, B. (1984). Towards a Connection Machine for Logical Inference. Int. Symp. on Fifth Generation and Super Computers, Rotterdam, 11-13 December 1984. To appear in Future Generations Computer Systems. North Holland Publishing Co. Bic, L. (1984). A Data-Driven Model for Parallel Interpretation of Logic Programs. Proceedillgs of the lntemational Conference on Fifth Generation Computer Systems, Tokyo, 6-9 November 1984, pp. 517-523. Borgwardt, P. ( 1984) Parallel Prolog Using Stack Segments on Shared Memory Multiprocessors. Proceedings of the /984 International Symposium on Logic Programming. Atlantic City, New Jersey, 6-9 February 1984. 0747-7171/85/010115+04 $03.00/0
© 1985 Academic Press Inc. (London) Ltd
116
W. Bibel and K. Aspetsberger
Buchberger, B. (I 983). Components for Restructurable Multi-Microprocessor Systems. Proceedings of the MIM/83 Conference, Lugano, 2I-24June 1983, Acta Press, Zurich, pp. 67-71. Buchberger, B. (1984). The Present State of the L-Networks Project. Proceedings of the MIMI 84 Conference, Bari, 5-8 June 1984, Acta Press, Zurich, pp. 178-181. Burkimsher, P. C. (1983). PRISM; A DSM Multiprocessor Reduction Machine for the Parallel Implementation of Applicative Languages. Proceedings of the Declarative Programming Workshop at University College, London, 11-13 April 1983. Ciepielewski, A., Haridi, S. (I 984). Execution of Bag of on the 0 R-parallel Token Machine. Proceedings of the International Conference on Fifth Generation Computer Systems, Tokyo, 6-9 November 1984, pp. 551-562. Darlington, J., Reeve, M. (1981). ALICE: A Multiprocessor Reduction Machine for the Parallel Evaluation of Applicative Languages. Proceedings of the 1981 ACM/MIT Conference of Functional Programming Languages and Computer Architecture, 1981, pp. 65-76. Darlington, J., Reeve, M. (1983). ALICE and the Parallel Evaluation of Logic Programs. The lOth Annual International Symposium on Computer Architecture, Stockholm, 1983. Giloi, W. K. (1984). STARLET-An Advanced Object Orientated Computer Architecture. Int. Symp. on Fifth Generation and Super Computers, Rotterdam, 11-13 December 1984. To appear in Future Generations Computer Systems, North Holland Publishing Co. Goto, A., Aida, H., Maruyama, T., Yuhara, M., Tanaka, H., Moto-oka, T. (1983). A Highly Parallel Inference Engine: PIE. Proc. of the Logic Programming Conference (/COT), 1983. Gregory, S. (1984). Implementing PARLOG on the ALICE Machine, Imperial College, London, to appear. Gregory, S. (1984). The PARLOG Compiler and Abstract Machine. Imperial College, London, to appear. Grit, D. H., Page, R. L. (1980). Performance of a Multiprocessor for Applicative Programs. Performance '80, Toronto, May 1980. Grit, D. H., Page, R. L. (1980). A Multiprocessor Model for Parallel Evaluation of Applicative Programs. Journal of Digital Systems 4, 2 (Summer). Haridi, S., Ciepielewski, A. ( 1983). An OR-paraUel Token Machine. Logic Programming Workshop '83, Praio da Falesia, Algrave, Portugal, 1983. Hierata, K., eta/. (1983). An Efficient Processing Method of Structured Data on the Highly Parallel Inference Engine PIE. EICEJ Technical Group Meeting EC 83-38, Japan, 1983. Hillyer, B. K., Shaw, D. E. (1983). Rapid Execution of AI Production Systems on the NON-VON Supercomputer. Tech. Rep., Dept. of Comp. Sc., Columbia Univ., New York, November 1983. Hillyer, B. K., Shaw, D. E. (1984). Execution of Production Systems on a Massively Parallel Machine. Submitted to Journal of Parallel and Distributed Computing, October 1984. Ida, T. (I 984). Towards a Parallel Reduction Architecture. The Second International Symposium on Symbolic and Algebraic Computation by Computers at R!KEN, 21-22 August 1984, pp. 8-1. Ishida, T., Stolfo, S. J. (1984). Simultaneous Firing of Production Rules on Tree-structured Machines. Tech. Rep., Dept. of Comp. Sc., Columbia Univ., New York, 1984. Ito, N., Masuda, Y. (1983). Parallel Inference Machine Based on the Data Flow Model. Tech. Rep. TR-033, ICOT, 1983. Ito, N., Onai, R., Masuda, K., Shimizu, H. (1983). Parallel Prolog Machine Based on Data Flow Mechanism. Pro c. of the Logic Programming Conference (/COT), 1983. Kluge, W. E. (1983). Cooperating Reduction Machines. IEEE Transactions on Computers C-32, II November 1983, pp. 1002. Mago, G. A. (1979). A Network of Microprocessors to Execute Reductions Languages. International Journal of Computation and Information Sciences, 8, 5, 349-385; 8, 6, 435-4 71, 1979. Mago, G. A. (1980). A Cellular Computer Architecture for Functional Programming. Digest (~f Papers, COMPCON80, 20th IEEE Computer Society Annual Conference, 1980.
A Bibliography on Parallel Inference Machines
117
Mairyama, T., eta!. (1983). A Highly Parallel Inference Engine PIE. Proc. of Electronic Computer Society of IECE of Japan, EC 83-39, Japan, 1983 (Japanese). Marti, J., Fitch, J. (1982). The Bath Concurrent LISP Machine. School of Mathematics, University of Bath, England, December 1982. Moto-oka, T., Fuchi, K. (1983). The Architectures in the Fifth Generation Computer. Information Processing, Rea Mason (Ed.), IFIP, 1983. Moto-oka, T., Tanaka, H., Aida, H., Hirata, K., Maruyama, T. (1984). The Architecture of a Parallel Inference Engine-PIE. Proceedings of the International Conference on Fifth Generation Computer Systems, Tokyo, 6-9 November 1984, pp. 479-488. Murakami, K., Kakuta, T., Onai, R. (1984). Architectures and Hardware Systems: Parallel Inference Machine and Knowledge Base Machine. Proceedings of the International Conference on Fifth Generation Computer Systems, Tokyo, 6-9 November 1984, pp. 18-36. Onai, R., Asou, M., Takeuchi, A. (1984). An Approach to a Parallel Inference Machine Based on Control-Driven and Data-Driven Mechanisms. Tech. Rep. TR-042, ICOT, January 1984. Shapiro, E. Y. (1983). Lecture notes on the Bagel: a Systolic Concurrent PROLOG Machine. ICOT Technical Memorandum TM-0031, November 1983. Shapiro, E. Y. (1984). Systolic Programming: A Paradigm of Parallel Processing. Proc. of Int. Conf. on Fifth Gen. Camp. Systems 84, Ohmsha, Tokyo, 6-9 November 1984, pp. 458-470. Also Tech. Rep. TR CS84-21, Weizmann Institute, August 1984. Shaw, D. E. 1981). NON-VON: A Parallel Machine Architecture for Knowledge Based Information Processing. Proc. 7th International Joint Conference on Artificial Intelligence, ( /JCAI-81), Vancouver, British Columbia, Canada, August 1981, pp. 961-963. Shaw, D. E. ( 1982). The NON-VON Supercomputer. Tech. Rep. Dept. of Comp. Sc., Columbia U niv., New York, August 1982. Stolfo, S. J., Miranker, D., Shaw, D. E. (1983). Architecture and Applications of DADO: A LargeScale Parallel Computer for Artificial Intelligence. Proc. of the Eighth Int. Joint Conf. on Artificial Intelligence, Karls!'Uhe, West Germany, 8-12 August 1983, pp. 850-854. Stolfo, S. J., Miranker, D. P. (I 984). The DADO Production System Machine: System-level Details. Submitted to Journal of Parallel and Distributed Computing, 1984. Stolfo, S. J., Miranker, D. P. ( 1984). DADO: A Parallel Processor for Expert Systems. Proceedings of the 1984 International Parallel Processing Conference, 1984. Stolfo, S. J., Shaw, D. E. (1981). Specialised Hardware for Production Systems. Tech. Rep., Dept. of Comp. Sc., Columbia Univ., New York, August 1981. Stolfo, S. J., Shaw, D. E. (1982). DADO: A Tree-structured Machine Architecture for Production Systems. Proceedings of the National Collference of the AAAI. Pittsburgh, August 1982. Stolfo, S. J. (1983). The DADO Parallel Computer. Tech. Rep., Dept. of Camp. Sc., Columbia Univ., New York, 1983. Sugimoto, S., Tabata, K., Agusa, K., Ohno, Y. (1981). Concurrent LISP on a Multi-MicroProcessor System. Proceedings of the 7th Int. Joint Conference on Artificial Intelligence ( !JCAI81), Vancouver, British Columbia, Canada, August 1981, pp. 949-954. Tamura, N., Kaneda, Y. (1984). Implementing Parallel Pro log on a Multiprocessor Machine. Proceedings of the 1984 International Symposium on Logic Programming, Atlantic City, New Jersey, 6-9 February 1984. Taylor, S., Maio, C., Stolfo, S. J., Shaw, D. E. (1983). Pro log on the DADO Machine: a Parallel System for High-speed Logic Programming. Tech. Rep., Department of Computer Science, Columbia University, January 1983. Also in: Prac. Third Int. Plweni:r Conf. on Computers and Communication, 1984. Tick, E., Warren, D. H. D. (1984). Towards a Pipclined Prolog-Processor. Proceedings of the 1984 International Symposium on Logic Programming, Atlantic City, New Jersey, 6-9 February 1984. Treleaven, P. C., Hopkins, R. P. ( 1982). A Recursive Computer Architecture for VLSI. Proceedings of the 9th Annual Symposium on Computer Architecture, SIGARCH newsletter vol. 10, no. 3 (April), 1982, pp. 229-238.
118
W. Bibel and K. Aspetsberger
Uchida (1983). Inference Machine: From Sequential to Parallel. Proc. of the lOth Annual International Symposium on Computer Architecture, Sweden, June 1983.
Abbreviations Used ICOT: Institute for New Generation Computer Technology, Tokyo, Japan. RIKEN: The Institute of Physical and Chemical Research, Wako, Saitama 351, Japan. IJCAI: International Joint Conference on Artificial Intelligence. AAAI: American Association of Artificial Intelligence. We are indebted to the following for providing input to the bibliography: Philippe Jorrand, LIFIA, Saint Martin d'Heres, France; Steve Gregory, Imperial College, London, Great Britain; Ehud Shapiro, The Weizman Institute of Science, Israel; L. 0. Hertzberger, University of Amsterdam, The Netherlands; Frank Warren Burton, University of Colorado at Denver, U.S.A.; George E. Lindamood, Burroughs Co. Ltd., Tokyo, Japan; H. Langmaack, F. Simon, Christian Albrechts Universitiit, Kiel, FRG; Sal Solfo, Chris Maio, Columbia University, New York, U.S.A.; Larry J. Thomas, Burroughs Co. Ltd., Austin Research Center, Texas, U.S.A. The work has been partially supported by the Osterreichischer Fonds zur Forderung der wissenschaftlichen Forschung, project nr. 3896; ESPRIT project 415 subproject F, and a grant from Siemens (Munich) to the University of Linz.
J. Symbolic Computation (1985) 1, 119-142
Automatic Programming: A Tutorial on Formal Methodologies ALAN W. BIERMANN Department of Computer Science, Duke University, Durham, North Carolina 27706, U.S.A. (Received 4 March 1985)
Ten methodologies for automatic program construction are presented, discussed and compared. Some of the techniques generate code from formal input-output specifications while others work from examples of the target behaviour or !fom natural language input.
1. Introduction
Computer programming is the process of translating a variety of vague and fragmentary pieces of information about a task into an efficient machine executable program for doing that task. Automatic computer programming or automatic programming occurs whenever a machine aids in this process. · The amount of automatic programming that is occurring is a variable quantity that depends on how much aid the human is given. There are a number of dimensions on which the level of help can be measured including the level of the language used by the human, the amount of informality allowed, the degree to which the system is told what to do rather than how to do it, and the efficiency of the resulting code. Thus we usually say that there is a higher degree of automatic programming whenever a higher level language is used, less precision is required of the human, the input instructions are more declarative and less procedural, and the quality of the object code is better. The technologies of automatic programming thus include the fields that help move the programming experience along any of these dimensions: algorithm synthesis, programming language research, compiler theory, human factors, and others. This paper will concentrate on only the first of these topics, formal methodologies for the automatic construction of algorithms from fragmentary information. The formal methodologiest have been separated into two categories, synthesis from formal specifications and synthesis from examples. In the former case, it is assumed a specification is given for the target program with adequate domain information so that the target program can be derived in a series of logical steps. In the later case, behavioural This material is based on work supported by the Air Force Office of Scientific Research, Air Force Systems Command, USAF under Grant 81-0221 and the U.S. Army Research Office under Grant DAAG-29-84-K-0072. ' t The formal methodologies that transform specifications, domain information and behavioural examples into programs operate on symbolic objects (logical formulae and programs) and aim at total or partial automatisation of this transformation process. Also, most of these methodologies are intimately connected with automatic theorem proving. Hence, automatic programming should be viewed in the context of symbolic computation as defined in the editorial of this journal. 0747-7171/85/020119 + 24 $03.00/0 5
© 1985 Academic Press Inc, (London) Ltd.
120
Alan W. Biermann
examples are given for the desired program, and it is inferred by a series of generalisation steps. After completing the coverage of these formal methodologies, a short section mentions some work on the generation of programs from natural language input using artificial intelligence knowledge based systems. The various synthesis methodologies will be described by illustrating their operation on a single programming problem. In all cases, many details have been omitted or modified from the original sources to maintain brevity and readability. The reader is always encouraged to return to the referenced papers for more complete coverage.
2. Information Sources The target program in a programming environment must be derived from basic information about the desired behaviour. Some of this information is furnished by the buman user and some may be general domain knowledge. In all cases, enough information must be available to specify the target program. However, the "structural distance" between the source information and the target may vary greatly. In some cases, the form of the axiomatic information may be quite close to that of the generated code, in which case we say that little automatic programming has occurred. In the extreme case, the user gives code in a compiled language that can be directly translated into the target language. In a less severe case, the user needs to specify axioms in a relatively exacting form, and the synthesiser performs only modest translations to assemble the target. In the most impressive cases, the source of information may be extremely random and fragmentary in nature leaving the synthesiser to discover essentially all of the structure required to do the computation. For the sake of concreteness, we will study synthesis methodologies as they construct a program to remove the nonatomic entries from a list. Thus the desired behaviour transforms the input list (A (B) C) to (A C). If the input list has length zero, the output list is this same list, i.e. nil yields nil. The process of generating this program illustrates the construction of both a loop and a nested branch. Relatively standard notations will be used in this paper If x =(A (B) C) then car (x) will be a function that finds the first entry on the list, A. The function cdr (x) will return list x with the first entry removed, ((B) C) in this example. The cons (u, v) operator will add its fi);St argument u to the front of its second argument, list v. Thus cons (x, x) will yield ((A (B) C) A (B) C). The symbol atom is a predicate which yields true if its argument is an atomic unit or list of length zero. Thus atom ((A (B) C)) is FALSE and atom (A) is TRUE. The function length will give the length of a list. Thus length ((A (B) C)) is 3. In specifying the example problem given above, several key facts need to be included. Thus it will be necessary to give the fact that input nil is to yield output nil. This will be known as fact Fl in later discussions. It may be written as if x = nil then f(x) = nil
(Fl)
where f is the name of the target program. But some synthesis methodologies will require other notations. For example, the notation R(x, z) will denote the target relationship between the input x and output z. So the nil case is specified as R(nil, nil) or as R(x, nil) ::? TRUE if x = nil. The ::? symbol can be read as "may be replaced by''. If the input list xis not nil, its associated output z must also be specified. Considering the output list as a set, one can write f(x) = z where
Automatic Programming: A Tutorial on Formal Methodologies
121
for all u[member(u, z) (-) (member(u, x) and atom (u))]. Another way of encoding this information is to say that
If not (x =nil) and not (atom (car(x))) and R(cdr(x), u) then R(x, u)
~TRUE
(F2)
and if not (x =nil) and atom (car(x)) and R(cdr(x), u) then R(x, cons(car(x), u))::? TRUE
(F3)
All of these forms will be used in the examples below. The careful reader may object to synthesising programs from information as specific as the axioms given above. They are in some sense already executable in their current form and are thus programs as they stand. For example, the latter forms are almost identical to the following PROLOG program. R(nil, nil) (R(x, y) (- R(cdr(x), y), not(atom(car(x))),
not(atom(x)) R(x, cons(car(x), u)) (- R(cdr(x), u),
atom(car(x)), not(atom(x)) Thus one can compute f(x) = z by proving the theorem R(x, z) on a PROLOG system. However, the synthesised programs given below are deterministic and thus compute much more efficiently than one can expect to execute specifications. The theorems implicit to the programs are already proved and there is no uncertainty related to their execution. The interpretation of specifications is dependent on the nature of the interpreter, the ordering of the axions, and other extraneous factors. The fact that specifications can be executed does not necessarily obviate the need for generating deterministic code. 3. Synthesis from Formal Specifications Many methodologies have been developed in recent years for the generation of programs from specifications. Five of them will be described here: the strategical approach of Bibel & Hornig (1984) which has been embedded in the LOPS system, the divide and conquer methodology of Smith (1985), the transformational technique as developed by Bray (1983), the deductive sequent method of Manna & Waldinger (1980), and the synthesis from equational specifications as described by Prywes et al. (1979).
3.1.
A STRATEGICAL APPROACH
Bibel & Hornig (1984) have constructed the logical program synthesis system LOPS which has a variety of facilities for acquiring specification information, manipulating domain knowledge, proposing critical theorems and proving them, and constructing code. We will follow their methodology as it solves the synthesis problem posed above. The system searches for relationships between the input and output and attempts to guess a portion of the input which can be selected out to begin computation of the output. If this is successful, it then attempts to find a recurrence of the original specification in the reduced form of the problem with part of the input already processed. If the recurrence
122
Alan W. Biermann
can be found, a loop is constructed to process the rest of the input and complete the synthesis. Occasionally, the synthesis may be blocked because needed theorems are not available. Then the methodology invokes a model exploration capability to generate examples related to the unknown phenomena, to seek a generalisation of the examples observed, and to prove the generalisation if possible. Thus the approach attempts to include a capability similar to that of humans to find restatements or new relationships in the domain that can be key steps in the synthesis. The methods begin with a dialogue with the user. INITIALISE PROBLEM
f INPUT VARIABLE X
INPUT CONDITION
list(x) OUTPUT CONDITION
if x =nil then fix)= nil otherwise f{x) = y where for all u[member (u, y) (-) (member(u, x) and atom(u)] Since the nil case is trivial, it can be handled immediately and all concerns can be transferred to the more general case . .f(x) = if x = nil then nil else g(x) The function g(x) needs to be built to process all other inputs. g(x) = y where not(x =nil) and list (y) and for all u[member(u, y) (-) (member(u, x) and atom(u))] At this point, the processor attempts to decompose the problem in such a way that part of the calculation can be done immediately and the rest can be done later by a recursive call to g. Bibel & Hornig argue that there are relatively few practical recursion schemes and that their system needs only to examine those few. To initiate this loop finding behaviour, the system "guesses" what the output might be and which piece of the input should be processed first. In the current example, we assume it selects the first entry in x. Since the only processing done in this example problem is the transfer of items from input to output, the only question is whether this first entry is in or not in the output. g(x) = y where not(x =nil) and list(y) and for all u[member(u, y) (-) (member(u, x) and atom(u)] and [not(member(car(x), y)) ear member (car(x), y)]
Here ear means "exclusive or". This can be rewri ften to consider the two cases separately, not (member(car(x), y)) and member(car(x), y). g(x) = y where not(x =nil) and list(y) and [(for all u[member(u, y) (-) (member(u, x) and atom(u))] and (not(member(car(x), y)))) ear (for all u[member(u, y) (-) (mem ber(u, x) and atom(u))] and member(car(x), y))]
Automatic Programming: A Tutorial on Formal Methodologies
123
Next, the theorem prover invokes the fact that if car(x) is not a member of the output, then one can construct y without using it, i.e. use cdr(x) instead of x. If car(x) is in y, then it must be added to the front of y. g(x) = y where not(x = nil) and list(y) and [(for all u[member(u, y) (-) (member(u, cdr(x)) and atom(u))] and (not(member(car(x), y)))) eor (there exists y' (for all u[member(u, y') (-) (member(u, cdr(x)) and atom(u))] and y = cons(car(x), y') and member(car(x), Y)))]
Loop finding has, in fact, succeeded at this point because copies of the original specification for f can be found. Thus g can now be written in terms of the function f g(x) = y where not (x =nil) and list(y) and [(y = ftcdr(x)) and not (member(car(x), y))) ear (y' = ftcdr(x))and y = cons(car(x), y') and member(car(x), y))]
(At each step, of course, many details have been omitted.) This can be rewritten as g(x) = y where not(x =nil) and list(y) and [(y =.f{cdr(x)) and not(member(car(x), y))) ear (y = cons(car(x),Jtcdr(x))) and member(car(x), Y))]
Finally, the system needs to be able to find property p such that p(car(x)) (-) member(car(x), y). It is possible that the knowledge base and theorem prover will be adequate to discover that p is the predicate atom. If the theorem prover cannot discover this fact, the model generator is invoked to generate typical cases. Then a generalisation is attempted to hypothesise what key property controls membership in y. Then if the theorem prover confirms the hypothesis, the predicate p can be used in the program. The final version of g IS
g(x) =if atom (car(x)) then cons(car(x), f(cdr(x))) else ftcdr(x))
Of course, from earlier considerations it was decided that ftx) =if x =nil then nil else g(x). An important point about this approach is that it attempts to avoid dependence on axioms that already specify the target loop through their embedded recursions as appear in F2 and F3. The methodology depends on theorem proving methodologies and the strategy of generalising from examples to obtain this level of performance. 3.2.
DIVIDE AND CONQUER
Software engineers have often advocated that programs be constructed in a "top down" manner. The original specifications for a program are broken into parts which
124
Alan W. Biermann
may be simple enough to solve directly or which may become non-trivial subtasks to be solved individually. The subtasks may be similarly decomposed into even smaller tasks and so forth until all parts are primitive enough for solution. Then the individual parts are recomposed beginning at the bottom of the tree until a complete solution is assembled. The divide and conquer methodology of Smith (1985) follows this strategy by partitioning the problem on the dimension of the data being processed. That is, iff is to be constructed which has input x, the methodology first checks to see whether the result can be directly computed. If not it divides x into parts and operates on the parts of x individually. Then the results of the individual calculations are assembled to produce the result off Symbolically, this idea can be expressed as follows:
fix) = if primitive(x) then directly solve (x) else compose. (/1 x/2 ). decompose(x) Here the result of decompose is a vector of length two and the periods indicate function composition. The ith entry of the decomposition is operated on by fi for each i = 1, 2 resulting in another such vector. Then compose assembles the parts of the vector to yield the output for f This methodology is interesting because of its structural simplicity, because it often leads to efficient programs, and because of its ubiquity in practical situations. We will examine its application in solving the problem posed in the previous section. The synthesis begins with the primitive case which appears in the specifications as Fl.
fix) = if x = nil then nil Then the method of decomposition must be selected. Many choices may be suggested, and in practice the synthesis process may be forced to try them all. For brevity here, we will examine a choice that leads to a successful synthesis, decompose= (car x cdr). That is, the input list will be broken into two parts, the first item and the rest of the list, and the computation will be dependent on processing them separately and assembling the solution. In the case where x is not nil, our definition states
f(x) = z where for all u[member(u, z) (-) (member(u, x) and atom(u))]. The above decomposition suggests a partition on the values of u.
f(x) = z where for u = car(x) and for all u in cdr(x) [member(u, z) (-) (member(u, x) and atom(u))] Thus the output z has two parts, that part coming from u = car(x) and that from u in cdr(x).
f(x) = z where z =append ( z 1 such that u = car(x)[member(u, z d
;;;::I
~ til
;;· .., 3
,
Table 1. A summary of ten synthesis methodologies
::I ::I
Name
Reference
Synthesis method
Class of programs
Input information for sample program
Strategic approach
Bibel & Hornig (1984)
Heuristic search
General
Specification
Divide and conquer
Smith (1985)
Input decomposition, computation and composition
Divide and conquer programs
Specification
Transformational methods
Broy (1983)
Search for successful sequence of transformations
General
Specification
j(x) =if x =nil then nil else a ppend(f, (car(x)), j{cdr(x))) / 1 (x) =if atom(x) then list(x) else nil
A deductive method
Manna & Waldinger (1980)
Search for successful sequence of transforms and resolutions
General
Specification
Equational specification
Prywes et al. (1979)
Compilation
General
MODEL
j(x) = if x = nil then nil else if not(atom(car(x))) then j{cdr(x)) else cons(car(x), j{cdr(x))) (0 bject code)
program
Synthesised program j(x) =if x =nil then nil else g(x) g(x) =if atom(car(x)) then cons(car(x),JT..cdr(x))) else f{cdr(x)) j{x) = if x =nil then nil else append. (fxf). (car x cdr)x / 1 (x) =if atom(x) then list(x) else nil
Function merging
Biermann ( 1978)
Decomposition into primitives and merging
Regular LISP programs
(A (B) C) yields (A C)
From recurrence relations
Summers (1977)
Discovery of recurrence relations. Generalisation
Single loop LISP programs
Five examples
A production rule methodology
Biermann & Smith (1979)
Diagnosis and application of production rules
LISP
scanning programs
One example
Generalisation on logical statements
Cohen & Sammut (19&4)
Sequential generalisation and specialisation on concept model
General
Several exam pies
Natural language programming
Biermann (1983)
Parsing and interpretation of natural language
General
Two English sentences
,f(x) = cond(atom(x) x) (atom( car(x)) cons(/2(x), j3(x))) ( T fi cdr(x))) .f2(x) = _f(car(x)) .f3(x) = _f(cdr(x)) fix)= if atom(x) then nil else if atom(car(x)) then cons(car(x), f(cdr(x))) else ficdr(x)) flx2) = cond(atom(x2) nil) (T jl(x2, x2)) fl (xI, x2) = cond(atom( car(x I)) JO(x1, x1, x2)) (T ficdr(x2))) JO(xO, x1, x2) = cons(car(xO), _f(cdr(x2))) delete(x, z) = (x =nil and x = z) or (not atom(car(x)) and delete(cdr(x), z)) or (atom(car(x)) and car(z) = car(x) and delete(cdr(x), cdr(z))) Semantic representation of sentences
140
Alan W. Biermann
(atom (car(x)) and car(z) = car(x) and delete (cdr(x), cdr(z))) While this relationship is not a deterministic program of the style we seek, it is executable in the sense of PROLOG. Thus, it can be used as a synthesized program, or it could serve as a basis for a Manna-Waldinger derivation of a deterministic program. Shapiro (1981) has given an elegant technique for doing learning of the kind described above and includes a proof that it converges on the correct target program if one exists. 5. Natural Language Programming
Rather than furnishing a formal specification or examples of the desired behaviour, a user might type or speak a description of the computation in natural language. For example, the user might say "Read in an input list." "Delete its nonatomic entries and return the result." Natural languages may be thought of as set manipulation languages in the programming environment. Processing generally begins at the head noun of the noun phrase where a set of objects within the area of focus for the dialogue are specified. Then modifiers to the head noun perform subsetting operations on the original set until a possibly complex subset is constructed. In the imperative sentence environment, such subsets are then passed to the execution routines for the imperatives for appropriate manipulation. In the above two sentence sequence, the noun group in the first sentence is indefinite meaning in this environment that an object is being created conceptually. In English conversation, it is quite common to create conceptual objects with indefinite noun groups and then subsequently reference them with definite noun groups. The "read" imperative then seeks an object via a read operation to insert into the newly originated slot. The head noun "entries" in the second sentence finds all objects in focus which are entries. If other entries had been mentioned earlier in the conversation, it would probably still select the entries in the recently read list, because that list does ordinarily have entries and it is the primary object in focus. The modifier "nonatomic" selects out only a portion of the set of all entries and the resulting set is passed to the "delete" routine. The final clause addresses any singular object which can be designated a "result" which is in focus and outputs that object. Biermann (1983) has described a theory of natural language processing of the type explained here appropriate for programming applications. Instead of stating the task in sequential imperative sentences, the user might have a conversation with the machine. "Please write a delete routine for me." WHAT WILL BE ITS NAME?
"Call it "delete".'' DESCRIBE ITS INPUTS.
and so forth. Several such systems for interviewing the user about the target program and then doing the coding have been constructed by Balzer (1973), Green (1976), Heidorn (1972), and
Automatic Programming: A Tutorial on Formal Methodologies
141
Martin eta/. (1974). These processors include natural language interfaces, knowledge bases for their respective domains, mechanisms for following conversation, code generation facilities, and numerous other features. 6. Conclusions Table 1 gives a summary of the ten program· synthesis methods discussed in this paper with their major characteristics. All of these approaches continue to be active research areas up to the present time. Automatic programming is an important area of research both because it is a needed aid for people who want help in programming machines and because intelligent machines of the future should be programming themselves to better cope with their environments. Thus research in this field is fundamental to progress in artificial intelligence and will remain central to it for years to come. Some additional readings on this subject can be found in Barr & Feigenbaum (1982), Biermann (1976), Biermann & Guiho (1983), and Biermann et a/. (1984).
References Balzer, R. M. (1973). A Global View of Automatic Programming. Proc. of Third Joint Conference on Artificial Intelligence, pp. 494-499. Barr, A., Feigenbaum, E. A. (eds) (1982). Handbook of Artificial Intelligence, Vol. 2. Los Altos: William Kaufmann, Inc. Bibel, W ., Hornig, K. M. (1984). LOPS, a system based on a strategical approach to program synthesis. In: (Bie1man, A., Guiho, G. & Kodratoff, Y ., eds) Automatic Program Construction Techniques, pp. 69-89. New York: Macmillan. Biermann, A. W. (1972). On the inference of Turing machines from sample computations. Arti/. Intel/. 3, 181-198. Biermann, A. W. (1976). Approaches to automatic programming. In: Adv. Comput., 15, pp. 1-63. New York: Academic Press. Biermann, A. W. (1978). The inference of regular LISP programs from examples. IEEE Trans. Systems, Man, Cybem. Vol. SMC-8, pp. 585-600. Biermann, A. W. (1983). Natural language programming. In: (Biermann, A. & Guiho, G., eds) Computer Program Symhesis Methodologies, pp. 335-368. Dordrecht: Reid!. Biermann, A. W., Baum, R. I., Petry, F. E. (1975). Speeding up the synthesis of programs from traces. IEEE Trans. Comput. C-24. Biermann, A. W., Guiho, G. (eds) (1983). Computer Program Synthesis Methodologies. Dordrecht: Reidel. Biermann, A. W ., Guiho, G., Kodratoff, Y. (eds) (1984). Automatic Program Construction Techniques. New York: Macmillan. Biermann, A. W., Krishnaswamy, R. (1976). Constructing programs from example computations. IEEE Trans. Software Eng. SE-2. Biermann, A. W., Smith, D. R. (1979). A production rule mechanism for generating LISP code. IEEE Trans. Systems, Man, Cyber. SMC-9, pp. 260-276. Bray, M. (1983). Program construction by transformations: a family tree of sorting programs. In: (Biermann, A. & Guiho, G., eds) Computer Program Symhesis Methodologies, pp. 1-49. Dordrecht: Reidel. Burstall, R. M., Darlington, J. (1977). A transformation system for developing recursive programs. J. Assoc. Camp. Mach. 24, 44-67. Cohen, B., Sammut, C. (1984). Program synthesis through concept learning. In: (Biermann, A., Guiho, G. & Kodratoff, Y., eds) Automatic Program Construction Techniques, pp. 463-482. New York: Macmillan. Gerhart, S. L. (1976). Proof theory of partial correctness verification systems. SIAM J. Camp. 5, 355-377. Green, C. (1976). The design of the PSI program synthesis system. Proceedings of the Second lntemational Conference on Sojiware Engineering. Heidorn, G. ( 1972). Natural Language Inputs to a Simulation Programming System. Monterey, California: Technical Report, Naval Postgraduate School. Kodratoff, Y., Jouannaud, J.-P. (1984). Synthesizing LISP programs working on the list level of embedding. In: (Biermann, A., Guiho, G. & Kodratoff, Y., eds) Automatic Program Constmction Techniques, pp. 325-374. New York: Macmillan.
142
Alan W. Biermann
Manna, Z., Waldinger, R. (i 979). Synthesis: dreams=> program. IEEE Trans. Sojiware Eng., SE-5, 294-328. Manna, Z., Waldinger, R. (1980). A deductive approach to program synthesis. ACM Trans. Progrmnming Languages and Systems 2, 90-121. Martin, W. A., Ginzberg, M. J., Krumland, R., Mark, B., Morgenstel'll, M., Niamir, B., Sunguroff, A. (i974). Internal Memos, Automatic Programming Group. Cambridge, Mass.; Massachusetts Institute of Technology. Michalski, R. S. (1980). Pattern recognition as rule-guided inductive inference. IEEE Trans. Pal/ern Analysis Machine Intel/. Pnueli, A., Prywes, N. S., Zarhi, R. (I 984). Scheduling equational specifications and non-procedural programs. In: (Biermann, A., Guiho, G. & Kodratoff, Y., eds) Automatic Program Construction Techniques, pp. 273-288. New York: Macmillan. Prywes, N. S., Pnueli, A., Shastry, S. (i 979). Use of a non-procedural specification language and associated program generator in software development. ACM Trans. Programming Languages and Systems 1, 196-217. Shapiro, E. Y. (i 981). Inductive inference of theories from facts. Report 192. New Haven: Department of Computer Science, Yale University. Smith, D. R. (i 985). Top-down synthesis of simple divide and conquer algorithms. Artif Intel!. (in press). Summers, P. D. (i 977). A methodology for LISP program construction from examples. J. Assoc. Comp. Mach. 24, 161-175.
J. Symbolic Computation (1985) 1, 143-157
Effective Computation with Group Homomorphisms GREGORY BUTLER Basser Department of Computer Science, University of Sydney, Sydney 2006, Australia
Algorithms for effectively computing with group homomorphisms are presented. Particular emphasis is given to those homomorphisms induced by invariant subsets and systems of imprimitivity of a permutation group, and by the right cosets of a subgroup in an arbitrarily represented group. The algorithms allow the computation of images and preimages of elements and subgroups, as well as the computation of the image and kernel of the homomorphism. A discussion of coset enumeration in permutation groups is included.
1. Introduction There are several classes of homomorphisms that arise naturally in the study of finite groups. Each of these homomorphisms is induced by the action of a group G on a finite set X. An action is defined by specifying for each pair (x, g) EX xG an element x * g of X such that x *identity= x, for all x EX, and (x *g)* h = x * (gh) for all x EX, g, hE G. Let I:(X) denote the set of all permutations on X. There is a homomorphism ¢: G--+ I:(X) induced by the action of G on X given by x(ol
= x *g.
Three important examples of actions and the induced homomorphisms follow. Let G be a permutation group acting on a set 0. Given a G-in variant subset .1 of 0, the transitive constituent homomorphism sends each g in G to its restriction on .1. If B is a system ofimprimitivity (or block system) for G, the blocks homomorphism sends each gin G to the permutation it induces on B. Let G be an arbitrary group with a subgroup H. The coset homomorphism sends each g in G to its induced action on the right cosets of H in G. The aim of this paper is to present methods of effectively computing with these naturally arising mohomorphisms. We also offer some comments on computing with more general classes of homomorphisms. We shall take the notion of effective computation with a homomorphism ¢: G--+ G to mean the ability to perform the following tasks.
1. Construct the image im¢ of G. 2. Construct the kernel ker¢. 3. Given an element g of G, construct ¢(g). 4. Given an element h of im¢, construct an element g of ¢-I (h). This work was partially supported by ARGC of Australia, NSERC of Canada, and FCAC of Quebec. 074 7-717lj85j020143
+ 15 $03.00/0
© 1985 Academic Press Inc. (London) Ltd.
144
Gregory Butler
5. Given a subgroup H of G, construct f/J(H). 6. Given a subgroup fl of im¢, construct ) forms a strong generating set of im¢ relative to JJ. Note that the restriction of an element of s is the identity. Furthermore, the set ¢(S-s) may contain redundant strong generators. Some redundancies may be eliminated by an algorithm of Sims (1971b). 2. Constructing the kernel. The kernel of¢ is Ga,,a,,. ... a, which has generating set relative to this base.
[/3 1 , /3 2 ,
•.• ,
/3.]
as a base and s {3 2, . .. , f3k] be a base for G. Order the points of 0 so that the first k points are f3t> {3 2, .. ., f3k respectively. There is an induced lexicographical order on G, which corresponds to the induced lexicographical order on the base images B0 , for g in G. For an element g of G define the canonical representative g of the coset Hg to be the first element in the coset under this induced order on G. Since the image of the base completely determines the element of the group, and since the order on G corresponds to the order on base images, this means that g has the minimal base image of all elements in Hg. As Sims (1971b) puts it, the element g is the first element in Hg if and only if, for all i, 1 ~ i ~ k, and for all a in /3{1. such that
ct1{
is the first point in (/Jf10>y;
W i..-all· - i'
trace the Schreier vector of Heel to determine u1 : = uUl(ct 1);
g:=ueg; end; end. (*canonical_ representative*) Some remarks about algorithm canonical l'i!p!'esentative are in order. First, the algorithm could return the element g:= ukuk_ 1 · · · u 1?J, however, only the base image [w 1 , w 2, . .. , wk] is required for the formation of a coset table. The reader will also note that uk is never required (if g is not required) and so in the last iteration of the loop there is no need to trace the Schreier vector. Second, there are two strategies available for finding the point ct 1• One could consider 0 each point of f3fc , form its image under u 1_ 1 u 1_ 2 • • • u 1 g, and keep track of the current 0 minimum image until all points of f3f > have been considered. This strategy always 1 requires the formation of lf3t >1 images. Alternatively, one could consider the points of n in order as a possible choice of We. If the image ct; of the point under (u 1_ 1 u 1_ 2 • • • u 1 g)- 1 1 lies in the orbit f3fc >, then the search is over. This strategy requires between 1 and IOI-If3fcql images to be formed. Third, there is the possibility of representing g and u 1_ 1 u 1_ 2 • • • u 1 g as either an explicit permutation or as a word in terms of some generating set, since the Schreier vectors of H naturally determine each ue as a word in the strong generators of H. To analyse both situations, let m be the number of operations required to trace a point under the action of g, let m1 be the length of ue as a word in the strong generators of H, and let p1 be the number of images formed (under ui_ 1u 1_ 2 · · · u 1g or its inverse) while determining ct; and We. If ue_ 1ue_ 2 · · · u 1 is represented as an explicit permutation, then the algorithm requires Pe(1 + m) operations to determine w1, and (3 + IOI)m 1 operations to trace the
Effective Computation with Group Homomorphisms
Schreier vector and form u1uc-t · · · ut from u1-tu 1_2
• • •
ut. Hence, the total cost is
k
k
k- t
k- t
t=t
l=t
c~t
/>=t
L P1+m L Pc+3 L mi+IOI L me.
If u1_ t u1_ 2
153
(1)
'LJ::
u t is represented as a word, then it has length mi. The algorithm requires p 1 (L~:,~ m1+m) operations to determme w1, and 4m 1 operations to form u1uc-t · · · u 1 from u1-tu 1_ 2 • • • ut. Hence, the total cost is • · :
itt (Pi
Ct:
mi+m)) +4
:t:
(2)
mi.
Replacing L~:, ~ m1 by 2:~:: mi, we see that equation (2) is less than or equal to
mitt Pi+3
:t:
mt+ ( 1 +itt Pt)
:t:
m;,
(3)
which is less than equation (1) whenever k
1+
L Pi~ 101.
i= t 11
Now p 1 is bounded by the minimum of l/3f >1 and 101-1/3~ >1, if we allow a flexible choice of strategy when finding ct1• Define the length of H by 0
k
len(H) =
L min(lf3tnl, IOI-1/3~ >1). i"' 11
1
Our conclusion is that u1_t u1_ 2 • • • ut should be represented as a word whenever len(H) ~ 101. It is now a simple matter to compute a coset table. The necessary list of coset representatives should be stored as base images, if space is an important consideration. Sims and Leon have observed that, providing an entry and its inverse are filled at the same time, the initial segment of the coset table may be kept on secondary storage as we only alter entries below the current coset representative being processed.
8. Homomorphism Induced by the Cosets of a Subgroup Let G be a group and let H be a subgroup of G. In theory, G may have an arbitrary representation. However, if the methods of this section are to perform efficiently, then G should either be a permutation (or matrix) group or have very small order. Let [g] denote the coset Hg where g E G, and let cos(G, H) be the set of all right cosets of H in G. There is an action of G on cos(G, H) defined by
[g tJ 02
=
[g tg2]
for all g 11 g 2 E G. Let :L(G, H) denote the symmetric group on cos(G, H). The above action defines a homomorphism ¢: G - t :L(G, H). In the image, the stabiliser of [identity] is ¢(H). Therefore the stabiliser of [g] is ¢(H)Col since [g] = [identity]
... , bk in K and integers k
and
[ L : K] =
PRooF. This follows from repeated application of Lemma 3.
D m;.
i= 1
o
5. (Abel (Schinzel, 1982, p. 91)). Let L be a real extension of the rationals, pan odd prime, b a rea/number, and bP an element of L. Then, provided b ¢ L, [L(b): L] = p.
LEMMA
Any irreducible factor of xP- bP over the reals is x- b or of the form 2 x -(w+w)bx+b 2, where wand ware complex conjugates. (This is because the complex roots of xP- bP = 0 are of the form wb, where w is a pth root of 1, and because (x-wb)(x -wb) = x 2 - (w+w)b+ b2). PROOF.
Decreasing the Nesting Depth of Expressions Involving Square Roots
175
Suppose xP- bP could be factored over L. Since Lis a real extension, any proper factor of xP -bP over L must be a product of some proper subset of its factors over the reals, and hence have a constant term of the form b1, 1:::; i < p. Since pis prime, b1 E L implies bEL, a contradiction. Thus we conclude that xP-bP is irreducible over L and hence [L(b): L] = p (see Herstein, 1975). o As an example of the importance of the real assumptions, let
and p = 3. Then bP = -1, but Q(b) = Q(j=3), so [Q(b): Q] = 2. THEOREM 3. Let K be a real extension of Q and let a, b, r E K with JT ~ K. Let 11 1 , •.. , Ilk~ 1 and al> .. ., ak E K be positive. If Ja+bJrEK(zya;, ...
then
,zya;:)
J a+ byr,. K(i"i, jP;, .. ., jP:) E
for some positive P1> ... , Pk in K.
PROOF. Let n 1 , . . . , nk be minimal such that J a+ bJT is in K(a~ 1 " 1 , ... , af 1"k). Suppose nk were divisible by an odd prime p. Let L = K(a~ 1" 1 , ... , af!.'Y 1 ). By the minimality of nk, L(afl"k) ~ L(afl"k, J a+ bj;) c L(afl"k).
But [L(af 1'1k, .Jr-a_+_b_Jr~r): L(af1"k)] is 2 or 4 and [L(af 1"k): L(af1"k)] = p (by Lemma 5), a contradiction (see Herstein, 197 5). Thus each n1 is a power of 2. Now let L = K(a~1" 1 , .. ., afl"k). By Lemma 4 there exist positive bl> .. ., bk in K and integers m11 ••• , mk> each a power of 2 and each at least 2, such that L = K(b~ 11111 , .. ., bfimk) and k
[L: K]
=
f1 m1•
i= 1
Assume m1 , • . . , mk are the least powers of 2 such that ~ is still in K (b~i'" 1 , ... , bfi 111 k); if not, decrease them accordingly and redefine L. Since j-; E L, Lemma 1 states that = cJb 1 · · · b1 for some c E K. Assume that m1 :::; m2 :::; .•• :::; mi, possibly renumbering the b1• Let r 1=b 1 ···b1. Now L=K(d 11111 ,b~ 1111 1, ... ,bflmk). Suppose by way of contradiction that m1 ~ 8, or i > 1 and m1 ~ 4, and denote rl 11111 (in the first case) or b[i 111' (in the second) by p 11111 • Let L= K(b~ 1111 1, .. ., bf 1111k) (in the first case) and bl/1111-1 blfmt+t bl/lllk) L~ = K(rl/1111 1 , . . . , 1-1 ' 1+1 , . . . , k
Jr
(in the second). Observe that JT = cjr; is in L(p 41111 ). By the minimality ofm, Ja+bJT is in L(p 11111 )-L(p 21111 ). That is, Ja+bJr = c+dpli 111 , where c and d are in L(p 21111 ) and d i= 0. By squaring, a+bJT . c2+d2p2/m+2cdpllm.
176
A. Borodin, R. Fagin, J. E. Hopcroft and M. Tampa
Since all but the last term 2cdp 11 '" are in L(p 21 "'), it follows that cd = 0, so c = 0. Write
Ja+bJr = dp1fm
= (e+Jp2fm)plfm,
where e and fare in L(p 41"'). Again, by squaring,
a+bJr
=
(e2 +f2p4i'")p2/m +2efp4i"'.
All subformulas of this equation are in L(p 4 i"') except for p 2 1'", since II
[L:K] =
f1 m1•
i= 1
Thus e +j2p 4 i'" = 0 implying that e = f in {2, 4} and m1 = 2 fori> 1, i.e. 2
Since
= 0 or p 4 i"' = - e2 J.l 2 , a contradiction.
J a+by0- E K(ytr;,
i'i = Jc ytr;, J
Thus, m1 is
.jb;_, .. ., fi).
a+bJr E K(~,
Jc, jb;, .. ., Jb,c).
D
2. Denesting Using Square Roots Only The goal of the remaining sections is to present new algorithms that, whenever possible, rewrite a given formula with positive radicands as one that has a lower nesting depth over Q. (The algorithms will sometimes, but not always, denest formulas that have negative radicands.) Consider the following tower of fields: K0 = Q
and, for all i ~ 0, K 1+ 1
= K 1(;-;;),
Jr:.,
where r1 E K 1• Every element of K 1 has depth at most i over Q. Consider where r" E K 11 • This section presents an algorithm, based on Theorem 1, that rewrites .jr, as a formula of depth at most n over Q involving only square roots, whenever such a formula exists (even if the formulas have negative radicands). Although the fundamental ideas appear in this algorithm, it is incomplete in three respects. Firstly, it does not permit the fourth roots of Theorem 2; this is rectified in Section 4. Secondly, the algorithm denests only single radicals from Ku+ 1 rather than arbitrary elements of K 11 + 1 ; this is rectified in section 5. Finally, not every formula of depth n over Q can be expressed in the form of elements of K,; in particular, elements of K" can be written using only n distintt radicals. Section 6 rectifies this only partially, by describing how to denest arbitrary formulas of depth 2 over Q, and explaining why this technique does not generalise to depths greater than 2. Let r11 =a+ b~, where a, b, 1'11 - 1 E K,_ 1 • There are two ways in which might denest using square roots only. The first way is that ~ might denest. The second possibility is to find some field K containing only elements of depth n- 1, containing a, b, and 1'11 _ 1 , and in which a2 -b 2 t 11 _ 1 is a perfect square. Then F., denests by Theorem 1. In order to find the K in which a 2 - b 2 r,_ 1 is a perfect square we attempt to denest a2 - b 2 r 11 _ 1 • If we are successful we will find a field K., all of whose elements have depth at most n-2 and an element sin K such that Ja 2 -b 2 1·,- 1 is in K(Js, ~).The desired K is then K(jS, .;;:::;_). Since Jr::~ and J"{iCb 2 1"11 _ 1 each have depth less than J,, this suggests a recursive 2 algorithm: to denest try to denest each of ~ and r,_ 1 • If either
Jr:,
J
yr:,,
.J'T-b
Decreasing the Nesting Depth of Expressions Involving Square Roots
A
177
A
succeeds, then can be denested. If neither succeeds, cannot be denested usmg square roots alone. This algorithm has a serious shortcoming: it requires exponentially many recursive invocations. However, closer inspection reveals that there are not 2 1 distinct arguments at the ith level of recursion, but only i + 1, as Jr:~~ recurs repeatedly. Continuing the previous discussion of denesting 0,., the first level of recursion attempted to denest
~and
Ja
2
-b 2 r,- 1 • Each of these radicands is in K,_ h so
for some c, d, e,j, r,_ 2 E K,_ 2 . Thus, the only formulas that need be denested at the 2 second level of recursion are ~. -d 2 2 , and ~f 2 r,_ 2 • In general, only one more argument will be added at each level of recursion. This motivates the algorithm of this section. We assume for the remainder of this paper that there is an appropriate data type /onnula for representing formulas. The recursive algorithm takes as input 2 integers, nand m, and a list of m formulas, each of depth n over Q. The algorithm attempts to denest each of these, returning for each input formula either a denested version, or the input formula itself if it was unsuccessful. Notice in the algorithm that it is assumed that each input formula shares the same value of J,- if ~ 2; that is, the ith formula is of the form 1 +b 1
Jc
r,_
n
.ja
.j,:.
function DENEST (integer, n, m, array [1 ... m] offormula nested) returns array [1 ... m] of.formula; begin declare N, d: array [1 ... m + 1] of formula; declare s: formula; i(n = 1 · then for i from 1 to m do
!f nested[i] =
P
for some positive x E Q
then DENEST[i] f- X else DENEST[i] f- nested[i] else begin assume nested[i] = a;+ b 1 ~, 1 ~ i ~ m; for i from 1 to m do N[i] f- af- brr; N[m+ 1] f - J r ; d 1): Let.fc= a 1 +b 1 ~, where ac. b1, r,_ 2 E K,- 2, and suppose be denested to depth n -1 over Q using square roots only, that is,
.j}; can
Jai+b 1Jr,-2 EK(Ft,JG., · · .,)0,), for some K all of whose elements are of depth at most n- 2 over Q, such depth achieved using only square roots, and some ell c 2 , •.. , ck E K. We can assume that K,_ 2 ~ K. By Theorem 1, either~ EK or Jaf-b[r,- 2 EK, that is, one of these two formulas denests. Each of these two radicands is in K.- 2 , and each of these two formulas is passed in the recursive invocation so, by the induction hypothesis, DENEST will denest one or both of them correctly. If r,_ 2 is denested to r E K, then surely J a1+b1r is a correct denesting of a1 +b 1 r,_ 2 . Otherwise, suppose J a[ -bfr,_ 2 is denested to d1 E K. Then the correctness of the denesting
J
1 ~ s + 2b Jr,~ r::- ,ys), ~ a1+b r,_ = r:. EK(yr,_
1
2
2-vs
2
where s=2(a 1+d1) is supplied in the proof of Theorem 1, part (3)'*(1).
o
What remai11s is a discussion of the running time of the procedure DENEST. Inspection of the procedure reveals that, as long as the formulas have size polynomial in n, the number of arithmetic operations will also be polynomial in n. Unfortunately, in general the formulas have size exponential in n, as is clear from the last two lines of the procedure: s depends on d[i], the result of the recursive invocation, and there are two occurrences of s in DENEST[i], the result of the current invocation. We alleviate this problem in an (unfortunately) asymmetric way: although we require the inputs to be represented as trees, we represent the outputs as acyclic directed graphs (i.e. straight-line programs). This is unfortunate in the sense that the output cannot be given as an input for another level of denesting. Notice also that, unlike the arithmetic complexity, the bit complexity is not polynomially bounded, as the number of bits doubles at each recursive call due to the squaring involved in
Ja
2
-
b2 r.
3. Finding a Perfect Square Among Products of a Set of Numbers Before proceeding with the next algorithm we present a straightforward technique for finding a perfect square among all possible products of a set of rational numbers. The result is used as the basis for the recursive algorithm in the next section. Let r1 , ••• , r, be rational numbers. Let I\= r1d?, where d1 is the denominator of r1• (Nate that ri is the product of the numerator and denominator of ri .) Then TileS ri is a perfect square if and only if flies r1 is a perfect square. Thus, without loss of generality, let rb ... , r,. be integers. In order to find a perfect square among products of r 1 , r 2 , ••• , 1'11 the greatest common divisor of each pair is determined, resulting in a set of integers Pi that are pairwise relatively prime and for which each r1, 1 ~ i ~ n, can be written as a product of p/s. Remove any P; that is a perfect square. Next, for i = 1, 2, ... , n, replace r1 by p1aio where a1 is a product of p/s, j > i. (This may involve renumbering the p/s.) In order to do this, if 1·1 contains Pi• j < i, then for the least such j replace r 1 by r 11j, remove any pf from this product, and iterate the process until ~'1 contains Pi only for j ~ i. (At this point renumber one such Pi to be P~> if P1 does not
180
A. Borodin, R. Fagin, J. E. Hopcroft and M. Tompa
already occur in r1.) It is straightforward to verify that such a replacement does not change the existence of a subset whose product is a perfect square, and that such a subset exists if and only if some r1 eventually takes on the value 1. The subset can be identified easily by retracing the steps. The following application of this algorithm will be used in section 6. In the case where all r1 > 0 we can determine if is in Q(.jG, ... , ~) by locating perfect squares among products of r 1 , ••• , r,. On encountering a perfect square, if r11 is involved, then fi, is in Q(JG, ... , ~). Otherwise delete some r; from the product, and repeat the process until .;-;:: is discovered to be in Q(Ft, ... , ~) or there are no perfect squares remaining. In the latter case is not in Q(jG", ... , ~) by Lemma 1.
A
A
4. Denesting Using Arbitrary Roots Consider again the tower of fields presented in section 2 (but in this section restricted to be subfields of the reals) Ko = Q, and for all i ~ 0, Ki+ 1 = K 1 (~). where r1 E K 1 is positive. The goal of this section is to generalise the algorithm of section 2 so that it rewrites its input F, as a formula of depth at most 11 over Q, whenever such a denesting is possible, yet still has arithmetic complexity polynomial in 11. By Theorem 3, the only useful additions to the algorithm of section 2 are the fourth roots of Theorem 2 (provided all subexpressions that arise are real). Let r, =a+ b)r:";, where a, b, r,_ 1 E K, _ 1 • By Theorems 1-3, 0,; denests if and only if (i) (ii) (((i)
~ denests, or a2 - b2 r,._ 1 denests, or -r 11 _ 1 (a 2 -b 2 r,-d denests.
J
J
Unfortunately, the obvious generalisation of the algorithm of section 2 has exponential complexity, since each formula a+ b~ in the input list gives rise to two formulas, Ja 2 -b 2 r,_ 1 and -r,_ 1 (a 2 -b 2 r,_ 1 ) in the recursive input list, in addition to the one
extra formula ~· The solution is to deal with the formulas of the form -r,_ 1 (a 2 -b 2 r,-d implicitly, rather than generating them explicitly, by observing that the radicand can be expressed as the product (with a possible sign change) of the radicands of and a2 - b2 r, _ 1 • Thus, the algorithm of this section will invoke itself with exactly the same lists of formulas as the one of section 2, but rather than trying to denest each individually, it will determine whether there is a subset of the formulas whose product (with a possible sign change) denests. The justification for looking at all subsets is given below in Lemma 6, which states that a product
J
;r:::;
J
k
fi
t=1
Jat+btJr
of input formulas denests if and only if Jr denests, or the corresponding product k
TI Jaz-bfr
I= 1
Decreasing the Nesting Depth of Expressions Involving Square Roots of formulas denests, or
181
k
~
fi Jaf-bfr
i~ 1
denests. In the basis, when all formulas have depth 1 over Q, the algorithm applies the procedure of section 3 to determine whether any subset of its input radicands has a product (with a possible sign change) that is a perfect square. If it finds such a subset it will identify it in the global array factor by setting
. f actor [ z] =
{1,
if the ith formula is in the subset
0, otherwise The pending invocations will then use Theorems 1 and 2 and Lemma 6 to denest the product specified in the array factor.
function DENEST (integer n, m, array [I ... m] of formula nested) retums formula; begin declare N: array [1 ... m + 1] of formula; declare d, a, b, s: formula;
if' 11 =
1
then Use the procedure of section 3 to find a perfect square x2 among products of the m input radicands. Before entering the radicand of nested[m] into any product with at least one other radicand, it should be multiplied by -1. Record the formulas entering into the product by placing 1's into the appropriate cells of the array factor. Return the formula x. If no such perfect square is found, set factor [i] = 0 for all i and return the formula nested[m]. else begin assume nested[i] = a1+ b1 1 ~ i ~ m; for i fi'om 1 to m do N[i] a~o b1, E K for 1 ::;;; i::;;; h, with a1 + b 1.}r; > 0. (In fact, this last condition turns out to be unnecessary: although we need it in order to apply Lemma 1 in what follows, a weaker version of Lemma 1 involving only square roots could have been used.) Suppose that the linear combination
vfrt
h
L ltJat+btj;;
i='l
denests in K. Then it can be denested as follows. First denest any individual radical that denests. As we shall see, it suffices to determine, for each pair of remaining radicals a 1+ b1Jr; and a1 + b r, if their product denests in K. If the procedures of sections 2-4 show that a1 + bi r 1 a1 + b1:}":; denests as k E K, then replace
j
J
j
l1 a 1+ b1Jr; + 11 a1 + br/;:; by
J
( 11+ ai+ kli~) b1 r1
J a1+b1ylr;
E
K(Jai+b 1Jr;),
Decreasing the Nesting Depth of Expressions Involving Square Roots
185
and iterate the process of looking for a pair of radicals that denests. If at some point no product of a pair of radicals denests, then we claim that the entire linear combination could not denest. For let I= {it> i 2 , ••• , im} be a maximal set that satisfies
[K(J a;, +be,
A ....,J
a;, +b1,Jr1,): K] = 2"'.
By Lemma 1, for every j in {1, 2, ... , h}- I,
J a. +b.ry'jr;:. = a f1 Ja· + b.fi:. J
I
ie11
l'\j
1
i•
for some I1 c I and some a E K. But the 2m distinct products are linearly independent, so the linear dependence can occur only if I1 = Ik for some j =F k, in which case a1+ b1.j"i; ak + bkj;;, denes ts in K. Nate that linear combinations of radicals is as general as rational combinations, since a product of radicals is itself a radical, and quotients of radicals can be eliminated using coT': ...gates. Consider the example
J
J
The product expression to
J1 +J3+J3+3J3-J10+6J3. J,_l+_J3.,...3J3+3J3 denests as J30+J3).
Thus we simplify the
Jt +J3(1 +J3)-J10+6J3. Next the product .j,.-1-+-J3-----=3 J10+6J3 denests as 4+2J3. Thus we can simplify further. Jt+J3+J3+3J3-J10+6J3 = =
4 2 JT+73[1 +J3- 1: $]
Jt +J3[(4+2J3)-(4+2J3)] 1+J3
-0 - . 6. Denesting Arbitrary Formulas of Depth 2
In this section we consider a slightly different tower of fields
Qo = Q, and
for i ~ 0, Qc+ 1 = Q 1 (~),
where r1 E Q is positive. Using the procedure of section 3, we can assume that Jr; ¢:. Q1 for all i. What makes the field Qh different from the field Kh considered in section 4 is that any element of Q1, has depth at most 1 over Q, for all h. Let f E Qh. In this section we describe an algorithm that denests using square roots only, whenever such a denesting is possible. As a formula over Q, f is the linear combination of as many as 2h different square roots, so the algorithm of section 2 ts inapplicable to As a formula over Qh- 1, however, f can be written as
.Jf
JJ.
f=a+b~, where
a, bE Qh _ 1 . Thus, we can use the algorithm
of section
2
to denes t
186
A. Borodin, R. Fagin, J. E. Hopcroft and M. Tampa
.Jj = J a+ b~ over Q 1, _ 1 • (The reader is referred back
to page 170 for a reminder of
the definitions of"depth over Q1,_ 1 " and "denest over Q1,_ 1 ".) Since~ is not an element of Q11 _ 1 , a+ b~ has depth 2 over Q11 - 1 • When the algorithm of section 2 denests a+ b~ over Q11 _ 1 , it will be rewritten as a formula of depth 1 over Qh _to that is
Ja+bJrh-1
E
Qh-I(~,Ja;,Ja;, · · ·• J{4),
J
for some a 1 , a 2 , . .. , ak E Qh-t· Notice that this "denested" version, like a+ bjr1,- 1 , still has depth 2 over Q, since a 1 , a2 , •• • , akin general have depth 1 over Q. The progress we have made is that we have eliminated one radical, ~. from all depth 2 subformulas, since a 1 , a 2 , . . . , ak are elements of Q11 _ 1 , but ~is not. Thus, we can denest .}a;, .ja;, ... , .j';;, recursively. over Q will return dE Q1, and Given a positive fe Qh, the procedure that denests positive sEQ satisfying .jj = The procedure itself is as follows:
JJ
d.JS.
1. If h =0, then return d iff= d2 for some dE Q, and fail otherwise. If h > 0, then write f= a+b~, where a, bE Q11 - 1 • 2. Compute a 2 - b2 r 1,- 1 E Q11 _
Ja
1.
J]
2 3. Recursively denest -b 2 r11 _ 1 over Q. If this fails to denest, then fails to denest. Otherwise, the recrusive invocation returns e E Q1, _ 1 and s E Q satisfying
Ja
2
-b 2 rh-l = e.Js.
4. Use the procedure of section 3 to determine whethef ~; E Q, _ 1 . If not, denest. If so, the procedure expresses .Js as an element of Q1,- 1 • 5. Let d=e.JseQ 11 _ 1 , and t=2(a+d)eQ 11 - 1 • Then
; b~ y a+ I h-I If t
E
=
t+2b~ 2Jl
Jf' fails to
.
Q, then return 1 -21 + bvi111t f E Q and II
t
'
and halt. 6. Recursively denest jt over Q. If this fails to denest, then fails to denest. Otherwise, the recursive invocation returns j E Q,_ 1 and u E Q satisfying jt =
JJ
7.
v I a+b ~ r1,_ 1 = t+2b~ . r:. , so 2].._; u
return
t+2b~ . E Qh 2uJ
jJu.
an d ue Q.
Unlike all of the previous procedures, this one has exponential arithmetic complexity (measured as a function of h). Notice, though, that some formulas fin Q11 may have size 2 11 ; for these, the arithmetic complexity is polynomial in the length off. The correctness of the procedure is the subject of the next theorem.
6. Given a positive fe Q11 , the procedure will denest .jj over Q correctly whenever .J] can be de nested using square roots only. Furthermore, when it succeeds will be expressed as .jj = d.jS, for some de Q1, and positive s E Q. THEOREM
JJ
Decreasing the Nesting Depth of Expressions Involving Square Roots PROOF.
187
The proof is by induction on h.
J]
JJ'
Basis (h = 0): has depth 1 over Q, so can be denested if and only iff= d2 for some dE Q, (In this case, s = 1 in the statement of the theorem.)
Induction (h > 0): Letf= a+b~, where a,
JJ
Q11 _ 1 and r11 _ 1 E Q. Suppose can be denested over Q using square roots only. Then certainly JJcan be denested over Q11 _ 1 using square roots only, that is, bE
Ja+bJr 1,- 1 EQII-I(~.Ft. · · ·· JCl,),
Jr;:;
for some a 1 ,a 2 , . . . ,akEQ 11 _ 1 • Take K=Q 11 _ 1 in Theorem 1, and recall that ¢ Q11 _ 1 • Hence, applying Theorem 1, Ja 2-b 2rh-l E Q1,_ 1 • Since _,J;;r: b2r 11 _ 1 has depth over Q one greater than any element in Q 11 -u Ja 2 -b 2 r 11 _ 1 denests over Q using square roots only. By the induction hypothesis, the recursive invocation in step (3) will denest this correctly as a 2 - b2r 11 _ 1 = e.Js, for some e E Q11 _ 1 and positive s E Q.
J
J
Si nee eJs = a2 - b 2 r11 _ 1 E Q11 _ 1 and e E Q1,_ 1 , . ; ; E Q1,- 1 . The procedure of section 3 will succeed in expressing .Js as an element of Q1,_ 1 . The correctness of
J a+
_t+2b~ r.
bJ·
'h-1 -
2-y t
JJ
in step (5) is as in Theorem 4. If t E Q, then the right-hand side has depth 1 over Q, so has been denested over Q. In this case, the only point to verify is that tis positive. But this follows from the fact that
is real. Assume, then, that t completed. Note that
E
Q1,_ 1 - Q, that is,
Jt has depth 2 over Q, so the denesting is not '
Jt-
t+2b~
t- 2J a+bJr1, - 1 •
Since by hypothesis Ja+bJr 1,_ 1 can be denested over Q using square roots only, and since t+ 2b~ E Q1, has depth 1 over Q, can be denested over Q using square roots only. By the induction hypothesis, the recursive invocation of step (6) will return j E Q1,_ 1 and positive u E Q satisfying =jJu. The correctness of step (7) is then simple to verify. 0
Jt
Jt
Consider the example of denesting
Ja+b)f; = J012+70Jl)+(46+34j2)Js. Here h = 2, a= 112 +70-fi, b = 46 +34)2, and r1 = 5. Q1 = Q(j2), and Q 2 = Q(.j2, jS). The first task is to denest
Ja 2 -b 2 r1
=
JC112 +70.j2) 2 -(46+3 2 over Q? The problem is that computed in step (5) in general has depth n-1 over Q1,_ 1 , which in turn will have elements of depth n- 1 over Q. Hence, will have depth 2n- 2 over Q, so the formula's depth over Q actually increases if n > 2.
Jt
Jt
The authors are indepted to Clifford Earle and Oscar Rothans for the proof of Lemma 5.
References Besicovitch, A. S. (1940). On the linear independence of fractional powers of integers. J. London Math. Soc. 15, 3-6. Caviness, B. F., Fateman, R. J. (1976). Simplification of radical expressions. Proc. SYMSAC 77. New York. Herstcin, I. N. (1975). Topics in Algebra. New York: John Wiley & Sons, Inc. Richards, I. (1974). An application of Galois theory to elementary arithmetic. Adv. Math. 13, 268-273. Richardson, D. ( 1968). Some unsolved problems involving elementary functions of a J'eal variable . .!. Symbolic Logic 33, 514-520. Schinzel, A. (1982). Selected Topics on Polynomials. Michigan: The University of Michigan Press. Zippel, R. E. B. (1977). Simplification of Radicals with Applications to Solving Polynomial Equations. M.Sc. thesis, Massachusetts In st. of Technology.
J. Symbolic Computation (1985) 1, 189-210
Simplification of Expressions Involving Radicals RICHARD ZIPPEL Laboratory for Computer Science, Massachusetts Institute of Technology, Cambridge, Massachusetts 02139, U.S.A.
Algebraically dependent expressions arise in a large variety of symbolic computations. People seem to have the best intuition about expressions involving radicals. Symbolic computations with simple, non-nested, radicals is relatively straightforw while the resultant is fl G1 2·2·16; we need to iterate i times such that 2i ~ (2R -1) = 3 or i = 2. The iterations are as follows: 1]-l = [ 51 2 -51
AB 1 =[3+x 1+x][ 51 2+x 2+x -51 (21- ABl) = [1
0
25] 26 25] = 26
[1
0
- 51x] 1- 51x 25+63x] 26+ 63x
II
51x] 1 + 51x
278
E, V, Krishnamurthy
=
[~
(21 -AB 2 ) =
[~
AB 2
which in Hensel code form is
B =[(51; 0) (25, 63, 19, 41; 0)]· 4 (50; 0) (26, 63, 19, 41; 0) On conversion to P(1/1, F 101 (x)) (section 4) B4 becomes
lA _ 11
101
=[51 (25 +25x)/(1 +51x)J 50 (26+76x)/(1+51x) ·
Each one of the coefficients in lA - 1 1101 on conversion gives
1/2 -1/2
-
12 /
-(1/4+ 1j4x) (1 + 1j2x) (3/4+ 1j4x) (1 + 1j2x) -(1 +x) 4+2x (3 +x)
E
P(1/l, 4, x).
- 1/ 2 4+2x
(i) When the coefficient size N is large we can choose a set of s distinct primes P1• P2• ... , Ps (or their powers P'i') such that REMARKS.
s
M =
f1 i=
1
p';' ~ 2N 2 R + 1.
The computation is carried out independently (and in parallel, if speed is needed) with each p1• The resulting entries of lA -liP, are then combined using the Chinese remainder theorem (Gregory & Krishnamurthy, 1984) to obtain lA -liM; these would then be the Hensel codes H(M, r, a(x)). Using the method of section 4 these are converted to numerator and denominator polynomials in /M[x]. The coefficients in the numerator and denominator polynomials which belong to IM are then converted to rationals. Let
A= [3+x 2+x where au
E
Q(x).
1 +x] 2+x
Symbolic Iterative Algorithm for Generalised Inversion of Rational Polynomial Matrices
279
We now illustrate the use of three different primes 3, 5, 7. Here,
IAI3 =
[~2 +x)
lA -11 3 = [(2; 0) (2,
(1 +x)J
(2 +x) '
IAI 5 = [(3+x)
(1; 0)
IA-11 5 =[(3;0) (1, 3,
(1 +x)J
(2 +x) '
(2+x)
1, 1, 1; 0)] (0, 1, 1, 1; 0)
(2; 0)
A _ [(3+x) (1 +x)l I 17- (2 +x) (2 +x) '
1, 2; 0)] (2, 3, 1, 2; 0)
IA-11 7 =[(4;0) (5, 6, 4, 5; O)J (3; 0)
(6, 6, 4, 5; 0)
Using Chinese remainder theorem and combining, we obtain:
lA _11
105
= [(53; 0) (26, 13, 46, 82; 0)] (52; 0) (27' 13, 46, 82; 0)
which on conversion to P(l/1, F 105 (x)) results in
lA
_ 1
1105
[53 (26+26x)/(1 +53x)J = 52 (27 + 79x)/(1 + 53x) ·
The coefficients of the entries in Euclidean algorithm. Thus
IA- 1 105 1
are now converted to rationals using the
-(1/4+ 1j4x) (1 + lj2x) (3/4+ 1j4x) -1/2 (1 + 1/2x) 112
A -1 =
7. Extension to Multivariable Polynomial Matrices The algorithm described in section 3 can be extended to invert (or g-invert) a multivariable matrix polynomial. The resulting formal power series representation of the rational polynomials (Hensel Codes (Krishnamurthy, 1985)) can be converted to Pade rational polynomials by using Toeplitz matrix method (Chisholm, 1977; Baker & GravesMorris, 1981). Let A= a;j(x 1 , •• •, Xn) be an (m x m) matrix whose elements are n variable rational polynomial functions over IP. Let us assume that the reflexive inverse Ai exists and its elements belong to P(R -1, ... , R- 1/R- 1, ... , R- 1, Fp(x 1, x 2 , ••• , Xn)). We also define the notion of ord thus; let M by any n-variable rational polynomial matrix over IP; then M ord (k) denotes the matrix derived from M by retaining only those terms xq' ... xf." for which
fJ 1 + fJ2 + • • •+ fln ••• , x,). At this point we need only to factor each B 1 over K(x 1 , ••• , xk _ 1 , xk+ 1> ••• , x,) and examine these factors and multiplicities to determine if ci> has a decomposition over K. Also this decomposition is unique since equation (4.1) is unique and each factorisation of B1 is unique. 5. Proof of the Main Theorem We shall use the following notation throughout this section. Let F denote the subfield C(x, e 1 , . . . , e,,_ 1) of E. Thus, E = F(e 11 ). Let
e = {i 1e 1 is an exponential monomial in F}
and
= {i 1e 1 is a logarithmic monomial in F} monomials in F. Let e; = e1a; for all i in e u l
be indexing sets for the { n}, and let (}; = a;ja 1 for all i in 1. We shall use the notation [m] for the integer part of m. Notice that the conditions on the rank of 11 and the rank of 1, 1 :::::; i < n, imply the existence of a monomial, say SO that a11 involves and the other arguments aj, j E e U 1, are free of e. We shall denote the subfield of E containing expressions which are free of both e11 and e by D. Thus F = D(e). Finally, let
e
e,
l' = {i
e
e
10 1 is a logarithmic monomial in D}.
The proof of Theorem 2.2 will be broken down into a sequence of lemmas. Lemma 5.1 will provide a thorough analysis of the structure of the integral (provided, of course, the integral exists). The next three lemmas form a set of three mutually exclusive cases depending on whether is exponential (Lemma 5.2) or logarithmic (Lemmas 5.3 and 5.4). Finally, the proof of Theorem 2.2 is presented.
e
5.1. Let Ae 11 be as in Theorem 2.2. If Ae 11 has an antiderivative in some elfelementary extension of E, then there exists B in F = C(x, e1 , . . . , e,._ 1 ), d 1 in C, and elements u1 and v1 algebraic over E such that LEMMA
AO,. = (BO,.)' + l:,J;u;v;,
(5.1)
where vj = (- u1)'v 1• Furthermore, for each i, there exist rational numbers ru where 2ru is an integer, and a constant r 1 so that the following hold: -u1 = a11+ :Lr;1a1+ :Lr;A+ri, e i
(i)
IT a~ij n enJ1 e'" (fl aJ"u -2[rij] fl eJru-2[rul)(a,. + L rijaj+ I
(ii)
V· = '
cuo
i
e
I
J
(5.2) (5.3)
e
e
r;A + rJ
(5.4)
i
is a pelfect square in F. PROOF. If
Ae 11
has an antiderivative in some erf-elementary extension of E, then from
Integration with Special Functions
Theorem 2.1 there exist constants c1 and d1, elements w1 m E, and elements algebraic over E such that
H 1•
291
and v1 (5.5)
where v; = ( -u'f)'v1 and u'f, vf and u[v1 are in E. Since v1 is an algebraic exponential over E, we have by Theorem 3.1 of Rothstein & Caviness (1979), that there exists rational numbers r1 and r11 and a constant r 1 so that
- uf
r;,a, + 2>"uai+ 2>uei+"~·
=
e
and so
v = I
11.
'"
I
TI a~ij1 n e~IJ 8"• n •
(5.6)
J
e
I
where 1'/; is in C. t We may assume, since 17 1 is a multiplicative constant in u; v1, that 17; = 1 (i.e. absorb 17 1 into d1). Next notice that u;v 1 is of the form j;8~'" for some/; in F and compare coefficients with respect to en in equation (5.5). This yields rin = 1,t Wo =Ben for some B in F, and w1 = 0 for i ~ l. Also, since E is factored, all of the factors in equation (5.6) are pairwise relatively prime elements of C[x, 8 1 , . . . , 8,]. This coupled with the fact that vt is in E implies that 2ru is an integer for all j. Thus equations (5.1), (5.2) and (5.3) have been proven. Consider now the expression u1v1 and write
u.v . = I
I
2ur(uf)'v 1 2U;(t1f) 1
2ufu;v 1
= ---::--',--'. (
Uf)'
Since the expression on the right is in E we have u1v1 in E. Hence -u'fvf is a perfect square in E. (- ufd = (j=lu 1v1) 2 ). Combining this with equations (5.2) and (5.3) yields
(a,+ I r1A+ :L r;A+r;)(IT aJ''J IT eylje;) = sre;, e
I
I
e
where S1 is some element of F. We now divide both sides by
e; and by IT aJ[rul f1e
8J[r,Jl
1
still leaving a perfect square on the right. That is
(an+ L ruaJ + L riA+ "C l)(fl aj''r 2[rij] IT erij- 2[r1Jl) = R'f, e
i
i
e
where R; is some element in F. This completes the proof.
f1 I
At this point we introduce the abbreviated notation II; for the power product 2 2 aJ"J- [r;J] 8J"r [rij] and observe that, for each i and j, the exponent 2rij-2[rij] is
f1 e
either 0 or 1 (since 2rij is always an integer). This implies, since E is factored, that II1 is always a squarefree product of exponential monomials and logarithmic arguments. Therefore, by examining only the field E and its generators (but not the integrand), one can construct a finite set of possible candidates for II;. The perfect square in statement (5.4) is an important key to the proof, for it allows us (in Lemmas 5.2 and 5.3, below), to reconstruct the elements u 1 and v1 which appear in t Although not explicitly stated in Rothstein & Caviness (1979), the uniqueness of r,, riJ, and r 1 follows easily from their Theorem 3.1 (see also Cherry, 1984). t We are assuming here, as we may, that no subset of the terms in I, sum to a function with an elementary integral, for such a subset could be absorbed into the elementary part of the Integral. Thus =I for all i.
d,u;v,
r,.
292
G. W. Cherry
equation (5.1). This will be accomplished with the corollaries of Theorem 3.1. Once these elements are known the Main Theorem part (b) in Risch (1969) can be applied. This theorem reduces the calculation of the element B and the constants d; to the solution of system of linear equations with coefficients in C. There is one case (Lemma 5.4, below), where this approach will not work. This case will be reduced to the decision procedure for 1:-decompositions (Theorem 4.2).
a
e
e
e
Let A8"' E, F, D, and be as above and suppose =X or that is an exponential monomial over D. Then one can determine in a .finite number of steps if A8, has an antiderivative in some erf-elementary extension of E and if so can find an element B in F, constants d; and elements u,. and V; algebraic over E sati~(ying equation (5.1). LEMMA 5.2.
Writing a, as p(8)/q(8) where p and q are relatively prime and q Js momc, statement (5.4) of Lemma 5.1 yields PROOF.
II;
(:i~~ + ~ ruaJ+ ~>iA+r;) =
Rf
where R; is in F. Recall from the proceeding discussion that there is only a finite set of possible values for Il1 and that they can be enumerated. Also notice that, in this case, the rua1+ riJ81+ri are in D. We may therefore take each candidate IT 1 and by terms
L
L
e
i
Corollary 3.3 find all values of {31 for which
Ill (
:i ~~ +
{Ji)
is a perfect square. In each case we determine if {J; can be written (uniquely) as
L rua1 + L ru8j + r; for some ru and r;. Now for each set of ru and ri which are determined e
i
in this manner we check whether
IT{ =
IT aJ''Ji
2[rij]
IT ej'•J-
2[rtJI,
e
If this equality holds, then u1 and vi can be determined from equations (5.2) and (5.3). Thus we have reconstructed all the possible elements u1 and vi which could occur in (5.1). Risch's Main Theorem part (b) from Risch (1969) can now be applied to calculate Band the constants di or to determine that they do not exist.
Let A8., E, F, D, and 8 be as above and suppose that 8 is a logarithmic monomial over D. Let a11 = p(8)/q(8) where p and q are relatively prime and q is monic, and assume that either q(8) # 1 or that deg (p(8)) > 2. Then one can determine in a .finite number of steps if A8., has an antiderivative in some erf-elementary extension of E and if so can .find an element Bin F, constants di and elements u1 and V; satisfying equation (5.1). LEMMA 5.3.
PROOF.
Applying Lemma 5.1, rewrite statement (5.4) as
rri(:i~~ +r;8+ ~rijaj+ fr;A+ri) = Rf,
(5.7)
where I'; is a rational number and R 1 is in F. Note that in this case II; is in D. We can again complete squares and calculate all values r;, ru, r 1 and Ri satisfying
Integration with Special Functions
293
equation (5.7). This is done as follows: For each candidate II; apply Corollary 3.2 to find a and fJ such that Ilip( 0)/q( 0) + aO + fJ is a perfect square. Let r1 =a/IIi and check if 2r 1 is an integer. Next, find ru and r 1 such that
If such ru and r 1 exist and
II;= fla2rij-2[r;Jlf1 O]';j-2[r;Jl, e
i
then u1 and v1 are determined from equations (5.2) and (5.3). Once all terms, u;vi> which can occur in (5.1) have been generated, we again apply the Main Theorem part (b) from Risch (1969).
Let AOII, E, F, D, and 0 be as above and suppose that 0 is a logarithmic monomial over D. Further, assume that a11 = r0 2 +sO+ t, where r, s, and tare in D and r #- 0. Then one can determine in a .finite number of steps if A011 has an antiderivative in some erfelementary extension of E and !f so can find an element B in F, constants d1 and elements ui and V; satisfying equation (5.1). LEMMA 5.4.
PROOF.
From statement (5.4) we have
Rf,
l1 1(t0 2 +sO+ t +riO+ {31) =
where
and Ri is in F. Setting R 1 =~(gt0+h 1 ) for some g; and h1 in D yields
II 1(r(J2+s0+t+r;O+flt)
and so
=
-(gt0+h 1) 2
(5.8) (5.9)
Equating the coefficients of 02 and 0 in equation (5.8) we have IJ.r = -g~I I
and
(5.10) (5.11)
From equation (5.10) we see that Il 1 may be uniquely determined by examining the multiplicities of the factors of r (and so Il 1 does not depend on i). This now allows us to determine g; = (- Il 1r) 1 i 2 • Note that the positive square root can be taken for by equation (5.9), a sign change in g; can be replaced by a sign change in U;. This will only change the sign of the constant di in equation (5.1). From now on we will drop the subscripts on Il 1 and g 1 since these values are known and do not depend on i. Writing tt; as in equation (5.9) and observing that vi can be written as Vj = IJl/2
TI aY'Jl TI oyiJl, i
e
rewrite equation (5.1) as 12 AO,, = (BO II )' + "\' d (gO+ht)' L, i II 1/2 11 1 f1 i
al!'J] J
f1 Ol"J] )
•
e
The remainder of the proof is broken down into the following four stages: 12
(5.12)
294
G. W. Cherry
Stage (i): B is calculated by considering the partial fraction decomposition of A. This reduces equation (5.12) to
( A 1 e +A 0 )eII
=" d (ge + h;)' [Jl/2
i
£_,
[1 112
f1 a[.'tJl f1 e~ruJ } } ' i
(5.13)
e
where A 1 and A 0 are in D. If equation (5.12) is not reduced to this form, then A 8, cannot be integrated in terms of elementary functions and error functions.
Stage (ii): An expression, , depending only on the known quantities A 1, A 0 , g, IT and
s is calculated such that
=
I d; TIi a)'ij] TI e~''il.
(5.14)
e
Stage (iii): The unknown quantities d1 and [rt] are determined by calculating the ~-decomposition
in equation (5.14). We show that the decomposition is restricted by a computable function and that the degree of the decomposition is 2. If the }:-decomposition does not exist, then A8,. cannot be integrated in terms of elementary functions and error functions.
Stage (iv): Conclude the algorithm by calculating, for each term in equation (5.14), a term d;u;vi in equation (5.1).
Stage (i): To show that the element Bin (5.1) can be calculated using an undetermined coefficients scheme, first decompose A and B into partial fractions to obtain: [
Am+2e"'+ 2+ ...
K
+ Ao+ L
1=1
=
k,-1
L
j=l
A _!:!.
p{
Jell
K
k;
Bm8m+ ···+Eo+ .L ,L [(
•=1 ,=1
X (
B )' Y +(re 2+se+t)' Pt
K k, B )] + h )' V;. Bm8m+ . .. +Bo+ i~1 j~1 ~ e,+ Ldt (gen1t2i
(5.15)
We solve for E 1 k,, ... , BKkx• ... , B 11 as follows: Differentiating and comparing terms yields A 1 k,+ 1 = -k 1 B 1k,P'1 (modulo p 1 ). Now proceed as in Risch (1969), page 180: calculate polynomials R and S so that Rp 1 + Sp'1 =A 1k, + 1 and deg(S) < deg(p 1 ). Then, B 1k, = -S/k 1. In this way we also determine B2k,, .. ., BKkK· Now replace Ae11 with
Ae _ II
[(ElP1'k, + ... + BKk") e ]' p~K
II
and repeat this process. Eventually, B is reduced to a polynomial and equation (5.15) becomes
(Am+2em+z+ ... +Ao)e, =[(Em em+ ... +BoY+ (re 2+ se + t)'(Bm em+ ...
+ Bo)] ell+ L di (g~~:i) Vt·
In a similar manner we may solve for Bm, .. ., E 1 until we have
(A2 82 +A 1 e+ Ao)e, = [Eo+ (re 2+se +t)'Bo]e/1+ L d;
(g~t:i) Vt.
Integration with Special Functions
295
At this point there are two possibilities. If r' #- 0, then B 0 = A 2 /r'. Otherwise, r' = 0 and so by equation (5.10) we have g' =0 and IT= l. Therefore,
L di ( g8+ht)' [11/2 V; is in D and B =
A!
2r8' + s''
0
e
Note that 2r8'+s' #-0, since is a monomial over D. Thus we have determined Band reduced equation (5.15) to equation (5.13). This completes stage (i).
Stage (ii): Consider now equation (5.13). Performing the differentiation and collecting terms yields
A 1 8+ Ao
= [
J
L d1 ( g'- ~~) r;I a~''J 1 I) 8)''J1 e + [L d1 (g8' +hi-
h·IT') ~IT If ay•Jl I) 8)''ilJ.
(5.16)
Again, we examine two cases: r' #- 0 and r' = 0. First assume that r' #- 0 and suppose that
giT' - 0
I
g- 2IT -
Then
2g' g
and so where
.
IT' IT
g 2 =ciT
c is some constant. This
contradicts the fact that IT is squarefree. Thus,
giT' g ' - - #- 0 2IT and we have _A_!-=-:-I = "\' d f._, {
giT g-2IT
f1 a[!tJl f1 8[''Jl
,
)
i
}
'
e
Now assume that r' = 0. By equation (5.10) we have g' = 0 and IT= l. This along with equation (5.11) implies that
s' 2g.
h~=--
'
With these simplifications, equation (5.16) implies that
Ao
g e'- 2g S
where
l
= "\'
f....,
di f] a~ul f] J i
s'
g8'- 2g #- 0, since
eis a monomial over D.
e
8(ruJ J
,
296
G. W. Cherry
Thus in both cases we have calculated an element of D which satisfies equation (5.14) concluding stage (ii). The analysis of this !:-decomposition is carried out in stage (iii). Stage (iii): First rewrite equation (5.14) as =
L di a[rl] IT a~'IJ] f1 erul
(5 .17)
e
i"
and recall that {a} u { a1h, u { 81} e is a set of pairwise relatively prime, irreducible elements of C[x, 81> ... , 8"_ 1]. Thus, equation (5.17) is a L-decomposition of over C, where
L =(a, a!> ... , ai, .. ., 811 ... , 81, .. .), i E
[',
j
E
e.
We claim that this decomposition is restricted by a computable function and that the degree of the decomposition is less than or equal to two. From equations (5.8), (5.10) and (5.11) we have 2
(s+r 1) -t 4r
=
fJ1
and so (5.18) Therefore for each i the values riJ are uniquely determined by r 1• This observation essentially shows that equation (5.17) is a restricted L-decomposition which we now formally show. First recall that each [ru] is either ru or r;1-1/2 depending on the factors of IT and let J = {j in l'ia1 divides IT} u {j in ei 81 divides 0}. Notice that given [rtJ we can compute
[rtJ + 1/2 if a divides
rt = { [r tJ
n
otherwise.
Then compute ru from (5.18) and finally ru- 1/2 [riJ] = { r 11
if j is in J
.
otherwzse.
We therefore define a function 4>: T--+ Qltl +lei as follows: For iX. =
{a+
1/2
if a divides
tY.
in Z let
IT
a otherwise, and let T be the set of all integers, a, for which (s +iX.)2
2>A+r
-'----'---t = ~>JaJ+ ~· e i'
(5 .19)
for some rational a1 and r in C. Now for each j in equation (5.19) form
_ {ar
a}=
a1
1/2
if j is in
J
otherwise,
and let ¢(a)= (a, ii 1 , ii 2 , . . . ). Finally, denote the preimage of ztn +lei by f and let (/i = ¢17' Then equation (5.17) is a L-decomposition of restricted by ({).
Integration with Special Functions
297
In order to show that the degree of equation (5.17) is less than or equal to two, we first prove the following claim: Let K be the number of terms in equation (5.17). Then, for each j, there exists a quadratic polynomial, p1(rx), such that rij = pj(r;), i = 1, ... , K. This is certainly true if K < 3. Therefore let K ~ 3 and suppose equation (5.18) holds for distinct rl> r 2 and r 3 . Now define the set S as the collection of all elements in D which can be written as L r1a1+) r1 81+, for some constant' and rational numbers r1. Notice that Sis e
7'
closed under addition, subtraction and multiplication by a rational number. From equation (5.18) we have
s2+ 2r 1 s+ r21 - t 4r s2+2r 2 s+r 22 -t 4r
and
(5.20)
inS. Subtracting and multiplying by 4/(r 1 -r 2 ) we find that
2s r + r -r +1-r -2
(5.21)
is in S. Similarly we have
in S. If we now subtract these two expressions and multiply by 1/(r2 - r 3), we have that 1/r is inS and, therefore, 1/4r is inS. Now work backwards: Since 1j4r is inS we have from equation (5.21) that sj2r is inS. Then, from equation (5.20) we have (s 2j4r)-t inS. Therefore there exist constants w; and rational numbers wiJ such that
1
- = L W21a1+ L w2A+w2 4r e i'
Substituting these into equation ( 5 .18) and collecting terms yields
L (wz.trf+w 11 r1+w 0 .)a1 + L(w 2Jrf+w 1jr;+w 0 j)81 +(w 2rf+w 1 +w 0 ) e
J
i'
= Le ruai+ Li' rtA+';· · Therefore for each j, and hence proving the claim. Now consider again two cases. If a divides IT, define
_ ( ) _ {pj(rx+ 1/2)-1/2 ifj is in J pj(rx + 1/2) otherwise,
Pi rx -
298
G. W. Cherry
and if a does not divide II, define
_ ) {pj(rx) -1/2 PJ(rx = pj{rx)
We then have for each j,
[ru] = PJ([r1]),
if j is in J otherwise.
i = 1, ... , K,
proving that the degree of the I:-decomposition in equation (5.17) is less than or equal to two. We can now apply Theorem 4.2 (actually the multivariate generalisation), to determine in a finite number of steps if there exist constants di and integers [ru] satisfying equation (5.17). This completes stage (iii). Stage (iv): In this final stage we generate, for each i, a term d 1u!vi in equation (5.1) from 1lf1 8~''Jl in equation (5.13). Fix i. The notation d;, of the corresponding term d1
f1i ar'
e
course, refers to the same constant in equations (S.l) and (5.13). We let r 1 = [ri] + 1/2 if a divides II and let r1 = [ra if a does not divide II. The ru are obtained in the same manner. That is, _ {[rl}] + 1/2 if j is in J ru-
[riJ]
otherwise,
where J is the indexing set for the factors of II defined in stage (iii). Next, calculate ri from equation (5.18). Finally, equations (5.2) and (5.3) yield u1 and v1• This completes the case where r' = 0. If r' =/:- 0 we need only to check that the expression A 0 in equation (5.16) also agrees with these values for dt> rt> rl} and r;. PROOF oF THEoREM 2.2. Follows directly from Lemmas 5.2, 5 .3, 5.4 and the observation that the linear case, where an is linear in cannot involve error functions. For assume otherwise and let an= r8 + s for rands in D. Then statement (5.4) yields
e,
II 1(r8+s+r 18+ {J;) = Rf,
where R; is in F and
Therefore, r+r; = 0 which implies that r is rational. But this contradicts the assumption that en is reduced. We conclude that no error functions can occur in this case and proceed as in Risch (1969).
6. Examples
s
6.1. Consider e-elx dx. Here the field E = C(x, el = e2 x, e2 =ex- e'") satisfies the hypotheses of Theorem 2.2 and, in the proof of this theorem, we apply Lemma 5.2 with = 81, p(8)/q(8) = - +X and flt = ril (2x) +r;. Given the possible values for IT{: Il 1 = 1 and IT 2 = 81, we determine all values {3 1 such that IT 1(p(8)/q(8) + {3 1) is a perfect square. This yields Il 1 = 81 and {3 1 = -x. Thus, r11 = -t, r 1 = 0 and, from equations (5.2) and (5.3), u 1 =ex and v 1 = e-e 2". An application of the Main Theorem, part (b), from Risch (1969) yields Jex-e•" dx = erf(ex). EXAMPLE
e
EXAMPLE
e
6.2. Consider
f(
1 2log (x)
--:--:-~,..----
1 ) x log 2 (x)
-x
etogl(x) -tlog(X)
dX.
Integration with Special Functions
Here
-x E = C(x, log (x), etog'<xl -ttos<x>),
and the possibilities for IT 1 are IT 1 = x and IT 2 becomes ITi
p(8) _ -X q(8) - log2 (x)
e=log (x),
299
1
-"I log (x)
= l. We apply Lemma 5.3. Equation (5. 7)
Co~ ~x) -!log (x)+ ri log (x) + r) = Rf.
The only solution is IT 1 =x, r 1 =! and r 1 =0, which yields u 1 =Jxjlog(x) and -x
v1 = etog 2 <xl. We again apply (Risch, 1969), part (b), yielding
I(
1 1 _ ) 2 2log (x) x log (x)
ExAMPLE 6.3. Consider
eto;2~xl -ttog(x) dx = erf (
Jx ). log (x)
I
Cog2(x) + 1) e-xlog2(x)-tlog(x) dx.
We apply Lemma 5.4 withe= log (x), r = -x and s= -t. From equation (5.10) we have IT= x and g=x. Since log (x) A = A 1 + A0 = +1
e
2
e,
is linear in there is no elementary part (i.e. B = 0). Hence, we move to stage (ii), apply the subcase where r #- 0 and consider the corresponding L-decomposition A!
gII'
I
= 1 = '1\' d.x[r;l L., ' .
g--
2IT
This yields [r 1] = 0, d 1 = 1 and, since x divides IT, r 1 = (5.3), u 1 = log (x) and v 1 = e-xlog•<x>. Thus,
Jx
I
Cog2(x) + 1) e -xlog2(x) -tlog(xl dx
=
t.
Now, by equations (5.2) and
erf(Jx log (x)).
EXAMPLE 6.4. Consider
I
3x6 + 1 e -tog•(xl d x. 5 X
This is also an example of Lemma 5.4. This time r = - 1, s = 0, t = 0 and so IT= 1 and g = 1. The corresponding L-decomposition is
A0
-~- -
s'
3x 6 + 1 = L d .x[r;l x4 ' '
g8'- 2g which yields r 1 = -4, d 1 = 1, r2 = 2 and d2 = 3. From equation (5.18) calculate r 1 = -4 and r 2 = -1. Then, u 1 =log (x) +2,
u 2 =log (x)-1,
300
G. W. Cherry
and
Finally, following the notation of section 2, we let e -tog 2 (x)-4
-
v1
=
--x-4,----~,
-v = x e - log2 (x)- 1 , 2
and we have
3x 6 +l , x 5 e-tog <xldx= e4 erf(log(x)+2)+3eerf(log(x)-l).
f
I would like to thank Bob Caviness, Michael Singer, David Saunders and James Davenport for many helpful suggestions.
References Bateman, H. (I 953). Higher Transcendental Functions. New York: McGraw-HilL Cherry, G. ( 1983). Algorithms/or Integrating Elementary Functions In Terms of Error Functions and Logarithmic Integrals, Ph.D. Thesis, University of Delaware, 1983. Also available as a University of Delaware Computer Science Department Technical Report 83-2. Cherry, G. ( 1984). Integration in finite terms with special functions: the logarithmic integraL SIAM J. Comp. (in press). Cherry, G., Caviness, B. F. (1984). Integration in finite terms with special functions: a progress report. In: (Fitch, J ., eel.) Proceedings Eurosam 1984. Davenport, J. H. (I 981). On the Integration of Algebraic Functions. Springer Lee. Notes Camp. Sci., 102. Berlin: Springer-Verlag. Kaplansky, L ( 1957). An Introduction to Differential Algebra. Paris: Hermann. Mack, C. ( 1976). Integration of affine forms over elementary functions. Computer Science Department, University of Utah, Technical Report, VCP-39. Moses, J. (I 971). Symbolic integration, the stormy decade. Commun. ACM 14, 548-560. Moses, J. ( 1972). Towards a general theory of special functions. Commun. ACM 15, 550-554. Moses, J., Zippel, R. (1979). An extension of Liouville's theorem. In (Ng, E. W., ed.) Symbolic and Algebraic Computation, pp. 426-430. Berlin: Springer-Verlag. Norman, A. C., Davenport, J. H. (1979). Symbolic integration-the dust settles? In: (Ng, E. W., ed.) Symbolic and Algebraic Computation, pp. 398-407. Berlin; Springer-Verlag. Risch, R. H. ( 1969). The problem of integration in finite terms. Trans. Amer. Matlr. Soc. 139, 167-189. Ritt, J. F. ( 1948). Integration in Finite Terms, Liouville's theory of Eleme~ttary Methods. New York: Columbia University Press. Rothstein, M., Caviness, B. F. (1979). A structure theorem for exponential and primitive functions. SIAM J. Comp. 8, 357-367. Rosenlicht, M. (1976). On Liouville's theory of elementary functions. Pacific J. Matlr. 65, 485-492. Singer, M. F., Saunders, B. D., Caviness, B. F. (1981). An extension of Liouville's theorem on integration in finite terms, extended abstract. In: (Wang, P. S., ed.) Proceedings of the 1981 ACM Symposium on Symbolic and Algebraic Computation. Singer, M. F., Saunders, B. D., Caviness, B. F. ( 1984). An extension of Liouville's theorem on integration in finite terms. SIAM J_ Comp. (in press). Trager, B. (1984). Integration of Algebraic Functions. Ph.D. Thesis, M.I.T. Trager, B. ( 1979). Integration of simple radical extensions. In (Ng, E. W., ed.) Symbolic and Algebraic Computation, pp. 408-414. Berlin: Springer-Verlag. Van der Waerden, B. L. (!950). Modern Algebra, 2nd edition. New York: Fredrick Ungar Publishing Co. Zwillinger, D. (1984). Completing the L-th power in Z[xJ- Sigsam Bulletin, 71, pp. 20-22.
Integration with Special Functions
301
Appendix To state the mam theorem on error functions from Cherry (1983 ), we need the following definitions. Let F= C(x, 1 , . . . , en) be an elementary extension of C(x), where C is the field of constants and x is a sol uti on to x' = l. Rearrange the 8's into a tower
e
C(x) = F0 c F 1 !:;;;;
where
F1
=
• • •c
F, = F,
Ft-1(et1• ... , eik)
for i = 1, ... , r, and where one of the following holds for each
e
1/
(i) eu is algebraic over F 1_ 1 and transcendental over F1_ 2 • (ii) e;1 = aVa 11 for some non-zero au in F1_ 1, where aiiis not in F1_ 2 • (iii) e;j = euai1 for some au in F1_ ~> where au is not in F1_ 2 • The rank of a tower of elementary fields F = C(x, e1, ... , e11 ), denoted rank(F), is defined as the tuple (m., .. ., ml> 1), where m1 is the transcendence degree of F 1 over F 1_ t> for 1 ~~~r. An element a in F has rank kif a is an element of Fk and a is not an element of Fk_ 1. Of course, if 81 is transcendental over F = C(x, e1, . .. , 1_ 1) for 1 ~ i ~ n, then this definition reduces to the definition given in section 2. Given two sequences (m., .. ., mt> 1) and (in., ... , mt> 1), we say that (m,, .. ., m~> 1) < (fh •... ., fizt. 1) if r < s or if r = s and (m., .. ., m~> 1) < (m., .. ., fizt. 1) in the usual lexica graphic ordering. Finally, we say that F is reduced if for all elementary extensions, F, of C(x), which are algebraic over F, with the same set of constants, we have rank (f);::: rank(F).
e
A.l. The field F = C(x, log (x), exp (!log (x)+x)) is not reduced since rank(F)= (1, 1, 1) and P= C(x, log (x), exp (x)), which is algebraic over F, has a EXAMPLE
Jx,
rank of (2, 1). The next theorem, which is a generalisation of Proposition 5.2 from Singer et al. (1983) gives an effective means for determining whether a given transcendental elementary field is reduced. The proof can be found in Cherry ( 1983), (Theorem 3.1 ). We shall denote the indexing set for the exponentials of rank i in F, {jleu = exp (au)}, by e1 and shall denote the union of these by e. The indexing for the logarithmic monomials will be handled similarly.
A.l. Let F = C(x, ej, .. ., ell) be a transcendental elementary extension of C(x) and in addition assume that F is factored. Then F is reduced if and only if for each k = 2, 3, ... , r the following holds:
THEOREM
L ak1ak1+ L {Jk _ 1,1ek _ 1,1 E Fk- 2 for rational numbers rxkl• flk- 1,1 implies rxk1 = {Jk _ 1,1 = 0. ek
lk -l
The main theorem on error functions from Cherry (1983) follows. As we have already indicated, the proof of this theorem is essentially a series of reductions to Theorem 2.2
A.2. Let E = C(x, e1, .. ., e11 ) be a differential field of characteristic zero with algebraically closed subfield of constants C. Assume x is transcendental over C and a
THEOREM
302
G. W. Cherry
solution to x' = 1, ei is a monomial over C(x, ej, .. ., ei_ 1) for each i, and E = C(x, 81 , •.• , en) is factored and reduced. Given yin E, one can decide in afinite number of steps if y has an antiderivative in some erf-elementary extension of E, and if so, find constants ci and dt> elements w; in E and ut> v1 algebraic over E such that
where
v; = (- ur)'vi.
J. Symbolic Computation ( 1985) 1, 303-315
Theory of Summation in Finite Terms MICHAEL KARR
Software Options Inc .. Cambridge. Massachusetts 02138, USA (Received 7 November 1984)
This paper discusses some of the mathematical aspects of an algorithm for finding formulas for finite sums. The results presented here concern a property of difference fields which show that the algorithm does not divide by zero, and an analogue to Liouville's theorem on elementary integrals.
1. Introduction A decision procedure for the problem of determining the existence of a "formula" for a given summation has appeared in the computing literature (Karr, 1981). The purpose of this paper is to discuss some mathematical aspects of the problem which were suppressed in the presentation of the algorithmic aspects of the solution. We consider summations in which the limit of the summation is not involved in the summand. Given such a sum Lift, the problem of finding a formula g is that of inverting the formula !lg =f. This in turn suggests using difference fields (or rings) to study the problem. Indeed, the very definition of "finite terms" is made precise for this problem by requiring that g lie in a certain difference field. This paper has two major results. The first is a remarkable property of the class of difference fields in which the decision procedure applies. This property is necessary only to show that at a certain point, the decision procedure does not divide by zero. Even the definitions are suppressed in Karr (1981). The second result is the difference field analogue to Liouville's theorem on elementary integrals (Rosenlicht, 1968). Its importance is more mathematical than algorithmic, although it does say "where to look" for a formula_ All fields in this paper have characteristic 0. We do not define difference fields in terms of !l; rather, following the usual convention (Cohn, 1965):
difference field is a field F together with an automorphism constant field K c F is the fixed field of (J _ DEFINITION- A
(J
of F. The
One thinks of (J as a shift operator-(J(f(x))=f(x+1)-so that !l with the right algebraic properties may be defined as /),.f= (Jf~f But (J is easier to work with, and/),. is seldom mentioned in what follows. 2. Extensions Throughout this paper we shall consider extensions of the following kind. 0747-7171/85(030303+ 13 $03.00(0
© 1985 Academic Press Inc. (London) Ltd.
304
Michael Karr
DEFINITION.
Let F(t), (J be an extension difference field of F, (J, This extension is {irstder
order-linear
(a) (Jt = rx · t + {3, where rx, fJ E F. (b) t is transcendental over F. (c) K(F(t)) = K(F) (i.e. the constant field is not extended). By condition (a), we think oft as a solution to the first order linear difference equation (Jt- rx · t = fl. Using first-order-linear extensions, it is possible to model formal sums and products. If we let rx= l, then t behaves like the indefinite sum 1f3 1 • If we let fJ = 0, then t behaves like the indefinite product fltrx 1• It is of special interest to know when an extension can be written with fJ = 0. The intrinsic property is this:
'L
Let E, (J be a difference field extension of F, (J, We say that {] E E is def ,!. b I . . h def homogeneous over F {] 'F F u t (Jg/{1 E F. We say t 1e extensiOn IS omogeneous over F there exists a {] which is homogeneous over F. DEFINITION.
2.1. Let F(t), (J be a difference .field extension ofF, (J in whiclz (Jt = rx · t + [3. The following are equivalent. THEOREM
(a) The extension is homogeneous. (b) There exists {] E F[t], g ¢ F, with (J{f/{f E F. (c) The equation (JW -rx · w = fJ can be solved for
wE
F.
Assume (a), and obtain g0 E F(t), g0 ¢ F, with (J{Jo/Oo E F. If t is algebraic, then F(t) = F[t], so we can prove (b) by letting{]= Oo· If tis transcendental, we write Oo as the quotient of relatively prime polynomials, Oo = g d02· Then PROOF.
(J{fo/Oo = (o2 · (J{J1)/(01 · (J02) =>odo2 · (Jg1 and (J02Ig2 · (Jgl
=> od(Jo 1 and (J{J 2Io 2 (because gcd ((J{f~> (J{f 2) = 1). Thus (J{fi/{] 1 E F and similarly (J{J 2 /o 2 E F. Now {] 1 ¢ F for either i = 1 or 2; otherwise Oo E F. Letting{]= {] 1 completes the proof that (a)=>(b). We next show that (b)=>(c). Write{] of part (b) as{]= 1w/, and let u = (J{f/{f E F. The degree m of{] is ~ 1, and we equate coefficients of tm and t"'- 1 in (J{f = u · o: (J..m' (JW = U • Wm and 111' (J..m- 1 '{J' (JWm +rx"'- 1 '(JWm-1 = Ll' Wm-1
'L
111
=>m· {3/rx+(J(Wm-dwm)/rx = w,-1/wm.
Letting w = - w, _ d(m · w,.) shows that - fJ + (JW = rx · w, proving (b)=> (c). Finally, assume (c), and subtract (JW-rx· w = fJ from (Jt-rx · t = fJ to obtain (J(t-w)/ (t-w)=rxeF, and we let o=t-w, which is clearly not in F, so the extension is homogeneous. This completes the ring of implications. The proof of (c)=>(a) in this result shows how to change the basis so that any homogeneous extension can be written with fJ = 0. We hereafter consider only the following type of homogeneous extension.
Theory of Summation in Finite Terms DEFINITION.
We say that F(t, ) (J
305
,IS a f] -extenszon , ofF, (J._ def
(a) The extension is first-order-linear. (b) (Jt=rx·t. We want to know when homogeneous extensions are also first-order-linear. This leads to: DEFINITION.
Given a difference field F, (J, the homogeneous group, def
H(F, (J) = {(Jgfg I 0 #- g E F}. If (J is understood, we write H(F); ifF also is understood, we write H. The following is easily verified. PROPOSITION.
The elements of H, with multiplication from F, form a group.
We can now simply state the desired characterisation. 2.2. Let F(t), (J be a difference field extension of F, (J with t #- 0; let (Jt = rx · t, rx E F. This extension is first-order-linear.- rx" ¢ H(F), for all n > 0.
THEOREM
PROOF.
First, suppose rx"
E
H(F); let
wE
a(t"jw)
F satisfy (JW/w = rx". Then:
=
rx"· t"j(Jw
=
t"jw
(since it is left fixed by (J)
=>
t"jw
E
K(F(t))
=>
t"fw
E
K or the constant field is extended.
Thus, t is algebraic over F or the constant field is extended, proving that if the extension is first-order-linear, rx" ¢ H(F) for n > 0. For the converse, assume that the extension is not first-order-linear. Suppose first that t is algebraic over F, say of degree m > 0. Let g(z) = w1t1 E F[z] be the monic irreducible polynomial oft. Then g(t) = 0, and
Lt
0 = (J(g(t)) =
L (Jw 1
1•
rx1 • t1•
If we let h(z) = L1((JW; · rx 1) • z1, we see that h(t) = 0, so h must be a multiple of g. Since g is monic, we conclude
By the irreducibility of g, either g(z) = z, contradicting t #- 0, or, there is some i for which w1 ,PO, and then rx'"- 1 =(Jwtfw1 eH, so letting n=m-i>O completes the proof in the algebraic case. The remaining possibility is that tis transcendental over F, but that the constant field is extended. Let g0 E F(t), g0 ¢ F with (Jg 0 = g0 . Write g0 as the quotient of relatively prime polynomials, gtfg 2. Then: (Jgtf(Jg2 = gtfg2 => (Jgtfgt E F, because gcd ((Jg 1 , (Jg 2) = 1. One of the g1 must have positive degree. We may assume it to
306
Michael Karr
be monic, and if it has more than one non-zero coefficient, we may argue as for the irreducible polynomial above to produce rx" E H. Otherwise, that g1 is of the form t"' for m > 0. The constant term w of the other g1 must be non-zero (else gcd (g 1 , g 2 ) #- I), and matching coefficients, we have ow= rx"'w. Letting n = m completes the proof. The corresponding result for inhomogeneous extensions is much simpler. THEOREM 2.3. Let F(t), (J be an inhomogeneous extension of F, Then the extension is first-order-linear.
(J
in which at= rx · t + p.
PROOF. If the constant field is extended, there exists g E F(t), g ¢ F with ag/g = I E F. Hence the extension is homogeneous, contrary to assumption. Suppose that t is algebraic over F, and let g(z) = L w1z1 its irreducible polynomial. We argue as in Theorem 2.2 to find that h(z) = L (JW 1 • (rxz + fJY is a multiple of o(z), match coefficients of z"' and z"'- 1, and then argue as in Theorem 2.1 to discover that the extension is homogeneous, a contradiction. Thus t is indeed transcendental. This paper considers a slightly restricted class of inhomogeneous extensions. DEFINITION. We say that F( t),
,
(J
'1\'
f
,
1s a L..-extenswn o F,
(a) The extension is inhomogeneous. (b) For n #-0, rx" E H =>rx E H where (Jt
de[
(J
= rxt+ {3.
We can now characterise the fields studied in this paper. DEFINITION. An extension F(t),
(J
is a ITL: -extension of F, a~ it is a [}extension or a
L:-extension. Given a constant difference field K, we say that F,
(J
is a IT}::field over K~
(a) there is a tower of fields K = F 0 c · · · c F,. in which F1, (J is a lll:-extension of F 1_ 1 , (J, for i = I, ... , n, or (b) F, (J is an infinite union of ascending IT:L-fields over K. 3. Regularity
We define functions arising from iterated applications of (J_ DEFINITION. Let k E 7L,jE F. def
fi.k. a) =
def
Ji.k, a] =
IT O~i
=>(am-J.O"vjv)1k) =>
=
f
has a non-zero coefficient
v1 from j < m.
= u · v1 => ~(vmfv1) · a(L) 1 = v,.;v1, 1 (Let v = vmfv1 and use Identities 1, 5)
a<m-JH = (O"vjv)-k
E
H ([}regularity, His a group).
By Theorem 2.2, we do not have a IT-extension, contradiction. This shows that in a -extension,/ is a monomial in t. We show that O""jjfe F leads to a contradiction in a I-extension. We match coefficients of tm and t"'- 1 in O"kf= J, and perform the same manipulation as in the proof of Theorem 2.1 but with a and f3 replaced by a1kl and f3k. This leads to:
n
O"kv- a(kl · v =
fh
where v =- v,,. _ d(m · v,).
Using Identities 6 and 7 we conclude that ((O"z/z)/a)(kl = 0,
where z = O"V -a· v- fl.
Note that z cannot be zero, or the extension would be homogeneous, by Theorem 2.1. By L:-regularity, (O"Z/z)/rx is a root of unity other than l. But if it is a root of unity, it can be shown to be equal to 1:
((O"zjz)jal
= 1 =>alE
H =>IX E H => (O"zjz)ja = l.
The second implication is part (b) of the definition of '2::-extension, and the last implication follows from the torsion-free-ness of Hand the fact that (O"zjz)ja E Hand is a root of unity. The contradiction shows that O"kf!frl= Fin a 2:-extension. The proof of 02:-regularity proceeds by induction on TI:L-extensions. The following result provides the lift for 11-regularity. LEMMA 3.3. PROOF.
Let F(t) be a [12:-extension ofF, O". IfF is [1-regular, then so is F(t), O".
See that for Theorem 5 in Karr (1981 ).
The proof of Lemma 3.3 is not difficult. But the lifting of :L-regularity becomes quite
Theory of Summation in Finite Tenns
309
involved, because it seems necessary to generalise it to a property which is stable in the lifting process. DEFINITION. Given ( 1 ,
C. E K,
.•• ,
we use the convention: der 1
(iJ =
f1=I ( fori ~j+ l. 1
l
Given a positive integer k, we say that ( 1 ,
••• ,
(.forms a (-set (fork)~
(a) (f = 1, i = 1, ... , s. (b) (I}# 1,alli~j. Associated with ( P
are the recursively defined functions:
. . . , (.
def
'Yo 1 = 1 for all 0 ~
def
'Yri =
~
i< k .
i< 0 and any (-set for k:
Finally, a difference field is
L
O"'l C1, · · ., (.,/is a (-set.
By setting s = 0 in the definition of (-regularity, we see PROPOSITION.
If a difference field is (-regular, it is I-regular.
Unlike :L-regularity, there is no algorithmic variant of (-regularity, and in fact, even the definition of (-regularity is suppressed in Karr (1981). However, it plays a major role in the theory, and of the two major results of this paper, we may now state the first. RESULT.
Any 02:-field is (-regular.
This is not obvious even in a constant field. To start the induction, we require the following:
FoRMULAE.
Let ( 1 ,
be a (-set. Then for any f # 0:
••• , (.
k 1 L 'Ysi 'f = o.;;l 0, and that the result holds for s- l. Using the recursive definition of y, completely expand the left-hand expression as a nested sum (with obvious omissions if s = 1 or 2):
PROOF. For s
k-1
I=
io
k-1
)
0 i 1 =To'+ I
.. ·
k-1
I
Is= Is- I
+1
C'i · · · c;· ·J'o
Lo.;;z 0 it is non-zero. We thus conclude ( 13 ·f#- l. Hence the second of the Formulae applies, from which we deduce Jk- 1 = 0. The rest of the (-set conditions for ( 1 , ••• , (.,/follow from those for ( r. ... , ( •. The following result is used in the lifting of (-regularity, and will eventually provide us with the result that ifF, (J is a TI:L-field over K, so is F, (Jk fork #-0. PROOF.
LEMMA 3.5. Let E, (J be TI- and 2:-regular; suppose H(F) is torsion-free. If F(t), (J is a TI-extension (resp. 2:-extension), then for k #- 0, F(t), (Jk is a f1-extension (resp. :L-extension) ofF, (Jk, Parts (a) and (b) of the definition of first-order-linear are clear. Suppose part (c) is false, i.e. Je F(t), f¢ F with (Jkf= f By Lemma 3.1, the extension is a f1-extension and f=u·t"for n#-0, ueF. Then: PROOF.
1 = (Jkf/f= ((Jf/f)ckl =(a"· (JUju) an·k E H =>a E H
==> 3 v with a = (JV/V => a 0. Looking at the partial fraction expansion of the left-hand side of this equation (and using t not dividing h in a fl-extension), we see that t occurs to the power r · p in the denominator, where r is as above. But since the right-hand side is zero, we seer· p = 0, whence r = 0. In this case, the above simplifies to 'Yso · h = (- 1)• · h = 0, a contradiction proving p = 0 in all extensions. Lemma 3.6 provides the final contradiction. Since we have occasionally used torsion-free-ness of H in lifting, we must also lift torsion-free-ness. The relevant result is: LEMMA 3. 8. Let F(t), (J be a [12:-extension ofF, (J and suppose F, (J is [1-regular and H(F) is torsion-free. Then H(F(t)) is torsion-free. Let/E F(t), ((Jf/f)k = 1 with k #- 0. Assume thatfhas an irreducible factor f, i.e. f divides num(f) or den(/). We first consider the case in which (Jf/f ¢F. Without loss of generality, we may assume that (Jkflf =>k): 0. Since (Jf will contain factors (J 1f only when l > 0 we conclude f is a factor of (Jf/f, and thus of ((Jf/f)k, so that this quantity cannot be equal to 1. Thus, (Jf/f E F. By Lemma 3.1, we know that we can write/= u · t", with ll #- 0 only in a f]-extension. But in a IT-extension, PROOF.
1 = ((Jf/J)k = rxn-k. (JUk/uk => rx•·k E H => n = 0. The last implication is by Theorem 2.2. In all extensions, then, je F, and we conclude f = 1 by torsion-free-ness of H(F). The proof of the following result is by now a technical exercise.
314
Michael Karr
THEOREM. Let F, (J be a TII:·field over K. Then:
(a) F, (J is [1-regular and s-regular. (b) H is torsion-free. (c) F, (Jk is TI:I:-field over K for k #- 0.
4. Solutions
In this section, we shall study the solution to (Jg-a·g=fwhere aJe F. In particular, we want to understand in which TI:I:-fields the equation can be solved, if it cannot be solved for g E F. DEFINITION. A basis for the TI:I:-tower F = F 0 c ... c F, = E is a tuple t 1 , . . . , t, where F1 ::::: F1_ 1 (t;). We define rx1, {31 E F 1_ 1 by (Jt;= rx1 • t 1+f31 (not by iterated applications of cr). Given an equation (Jg- a· g =f with a,f E F, it is helpful to adjust a basis relative to a and F. DEFINITION. Given a tower and its basis as above, and a E F, we say that the basis is
normalized wrt (with respect to) a~ {31 #- 0 and
ajrx 1 E H(F1_ 1 )=>rx1 =a,
fori= 1, ... , n.
The basis is reduced wrt F~ for i = 1, ... , n: {31 #- 0 and
3 hE F 1_ 1 with (Jh-rx 1 • h+ {J E F=> {31 E F.
PROPOSITION. For any finite TI:I:-tower, and a E F, there exists a basis which is Jwrmnlised wrt rx and reduced wrt F. PROOF. A procedure for normalising and reducing a basis is given in Karr (1981). We can state the second major result of this paper. RESULT. Given a TI:I:-field F, (J with non-zero a,Je F, let t 1 , . . . , t, be a basis for a TI:I:-tower Fe ... c E, where the basis is normalized wrt a and reduced wrt F. The equation (Jg-a · g =/has a solution forgE E 3 veF,c 1 eK
where
with f= (JV-rx·v+ i
LS c ·{3 1
1,
E
S = {iiO #- {J1 e F and rx 1 =a}.
One direction of the equivalence is trivial. Iff has the required form, a solution is g
=
v+
LS c1 ·t1•
j E
The interesting part is that solutions always have this form. LEMMA 4.1. Let F(t), (J be a [1-extension ofF, (J, Suppose that a,fe F and that (J{] -a· g =.f has a non-zero solution in F(t) but not in F. Then f = 0 and afa"' E H(F) for some m #- 0.
Theory of Summation in Finite Terms
315
By results in Karr (1981) we may conclude that if g exists, it is in F[t, 1ft], i.e. 1 g= 1t where i ranges over 7L. Examine the constant term in ag-a · g === j; namely av 0 - a· v0 =f Iff#- 0, then v0 #- 0, but then v0 is a non-zero solution in F. Thus, f = 0. And if v0 "¢ 0, v, #- 0 for some m #- 0, and by looking at the coefficient oft'" in ag- a· g, we see ajrx"' E H (F).
PROOF.
2>'
4.2. Let F(t), a be a 'L-extension ofF, (J with basis normalised wrt a E F; let fe F. If ag- a·g =f has a solution in F(t) but not in F, then f ;f 0, a= rx and there exists v E F, and non-zei"O c E K wirh f= av -a· v + c · (3. LEMMA
If ag- a· g = 0 with g E F(t) but g ¢ F, then the extension is by definition homogeneous, contradicting the definition of a -extension. Thus f #- 0. By methods of Karr ( 1981 ), we can prove that if g exists, it is in F[t], and further, that deg(g) ~ 1. Thus we may write y = v1 · t + v0 with v 1 #- 0. Looking at the coefficient oft in the equation, we learn that afrx avdv 1 E H, whence a= rx by the normalised property, and v1 E K since avdv 1 = 1. The c and v in the statement of the Lemma may be obtained by c = v1 and v = v0 , and substituting these in the equation for the constant term of ag- a· g = f PROOF.
L
=
There is nothing to prove if n = 0. Inductively assume t for n- 1, and apply it to the tower F 1 c ... = F,. This yields:
PROOF OF RESULT.
f = ah-a· h +
L
2~i~n
ct'f31 with
h E F 1 and [c1 = 0 or (0 #- {31 E F 1 and rx 1 = a)]. Suppose there is a j such that c1 #- 0, rx 1 =a, 0 #- {3,
C}'fJj+ah-a·h+
L
2~1
E
F 1 but {Jj E F. Let j be maximal. Then
c1 ·fJ1 =.f-
{Jj+ah 0 -~· h0 = 1/cl· (.f-
L
jstitution of the solutions il 0 , 0 , I:J 0 and i/ 0 , 0 , 80 into the general expressions. In order to integrate these expressions, which contain only simple trigonometric functions, a careful substitution technique has been used.
v
v
6. Conclusions As a final result we have obtained a parametric solution, so retaining the possibility of dealing with a variety of cases simply performing numerical substitutions. For instance we can evaluate the solutions corresponding to different values of the arch length and the elastic constants A, G and B. An interesting problem is how to perform numerical evaluations. The expressions for A0 , for instance, turns out to be very long and, in some cases, very sensitive to rounding errors. Arranging the arithmetic operations in order to avoid disastrous cancellation errors would be a crucial point. An algorithm performing numerical evaluations in floating point representation, but able to follow the "best" path, would be a valuable tool. As a final remark on our experience, we can say that the use of a symbolic computation system has given evidence of how even a cumbersome analysis, as was carried out, can be reduced to defining simple procedures, easy to check, which take on the task of constructing the perturbation equations and solving them. Nevertheless we should be aware of the fact that the second task cannot possibly be performed in general for problems more complex than that just examined. But even in such cases the perturbation equations, which can always be generated using the procedures above, could be the starting point for a numel'ical approach leading to an approximate solution.
References Budiansky, B. (1974). Theory of buckling and postbuckling behaviour of elastic structures. In (Chia Shun, ed.) Adl'ances in Applied Mechanics 14. New York: Academic Press. Griss, C. ( 1979). Using REDUCE on UNIVAC II 00, University of Utah Symbolic Computation Group, Technical Report TR-4. Hearn, A. C. (1971 ). REDUCE-2 A system and language for algebraic manipulation. ACM, Proc. Seco11d Symp. on Symbolic and Algebraic Manipulation. Los Angeles. Noor, A. K., Andersen, C. M. (1979). Computerized symbolic manipulation in structural mechanics-progress and potential. Comput. & Struct. 10, 95-118. Noor, A. K., Balch, C. D. (1984). Hybrid perturbation(Bubnov-Galerkin technique for nonlinear thermal analysis. AIAA J. 22, 287-294. Rizzi, N., Tatone, A. (1985). Symbolic manipulation in buckling and postbuckling analysis. Comput. & Struct. (in press).
J. Symbolic Computation (1985) 1, 323-328
A Selected Bibliography on Constructive Mathematics, Intuitionistic Type Theory and Higher Order Deduction THIERRY COQUAND AND GERARD HUET INRIA, Dumaine de Voluceau, 78150 Rocquencourt, France (Received 2 Apri/1985)
Introduction -
We present a selection of articles dealing with constructive mathematics, from the point of view of the computer-aided synthesis of provably correct computer programs. Among the topics covered we find: -typed A.-calculus, where types obey the Curry-Howard isomorphism between propositions and proofs -higher-order intuitionistic logic -compllter-aided proof-checking and theorem-proving in type theory -functional programming languages. There would be no point in attempting a complete bibliography of such an interdisciplinary area. Our aim is rather to provide the researcher with an up-to-date selection of work relevant to the current stream of research on de Bruijn's Automath languages, Girard's second-order types, and Martin-Uifs intuitionistic type theory.
List of Papers Andrews, P. B. (1965). Tranifmite Type Theory. Amsterdam: North-Holland. Andrews, P. B. ( 1971 ). Resolution in Type Theory. J. Symbolic Logic 36, 3, 414-432. Andrews, P. B., Miller, D. A., Cohen, E. L. & Pfenning, F. (1983). Automating higher-orda logic. Dept of Math., University Carnegie-Mellon. Backhouse, R. (1984). Algorithm development in Martin-Lof's type theory. Colchester: University of Essex. Back house, R. & Khamiss, A. (1984). The while-rule in Martin-L.Of's theory of types. Colchester: University of Essex. Barendregt, H. (1980). The Lambda-Calculus: Its Syntax and Semantics. Amsterdam: NorthHolland. Benabou, J. (1983). Fibered categories and the foundations of naive category theory. Paris: Universite Paris Nord. Bishop, E. (1967). Foundations of Constructive Analysis. New-York: McGraw-Hill. Bishop, E. (1970). Mathematics as a numerical language. In: (Myhill, J., Kino, A., Vesley, R. E., eds) Intuitionism and Proof Theory. pp. 53-71. Amsterdam: North-Holland. Bohm, C. & Berarducci, A. (1983). Toward an Automatic Synthesis of Polymorphic Typed Lambda Terms. Unpublished manuscript. 0747-7171(85(030323 +06 $03.00/0
©1985 Academic Press Inc. (London) Ltd.
324
T. Coquand and G. Huet
Bohm, C. & Berarducci, A. ( 1984). Automatic Sy11thesis of Typed Lambda-Progmms on Term Algebras. Unpublished manuscript. Boyer, R. & Moore, J. (1977). A Lemrna Driven Automatic Theorem Proverfor Recursive Function Theory. 5th International Joint Conference on Artificial Intelligence, pp. 511-519. Boyer, R. & Moore, J. (1975). Proving Theorems About LISP Functions. J. Assoc. Comp. Mach. 22, 129-144. Boyer, R. & Moore, J. (1982). A mec·hanical proof of the unsolvability of the halting problem. Report ICSCA-CMP-28, Institute for Computing Science-University of Texas at Austin. Boyer, R. & Moore, J. (1982). Proof Checking the RSA Public Key Encryption Algorithm. Report ICSCA-CMP-33, Institute for Computing Science-University of Texas at Austin. Boyer, R. & Moore, J. (1983). Proof checking theorem proving and program verification. Report ICSA-CMP-35, Institute for Computing Science-University of Texas at Austin. Boyer, R. & Moore, J. (1983). A mechanical proof of the Turing cornpleteness of pure LISP. Institute for Computing Science-University of Texas at Austin. de Bruijn, N. G. (1968). The mathematical language AUTOMATH, its us is compatible with E if s"'Es' > t',...,Et implies s > t. A term rewriting system R over F is any set {(11, r 1): 11, r1 E T, V(r 1) c V(/ 1)}. The pairs (/ 1, r 1) are called rewriting or reduction rules and written 11 -t r1 • If all the left-hand sides 11 are linear, then R is called a left-linear rewriting system. The reduction relation -tR on Tis defined as being the smallest relation containing R that is closed under monotonicity and substitution. We say that s reduces to t (in one step) if s-+Rt. Occasionally we will abbreviate -tR by -t and write t+-Rs instead of S-tRt. The symbols -+ +, -t* and ++denote the transitive, transitive-reflexive, and symmetric closure of -t, respectively. An equational term rewriting system is a tuple (R, E), also written R/E, where R is a term rewriting system and E an equational theory. The reduction relation -R!E is defined by "'Eo -+R o '"'"'£• where a denotes composition of relations. Let R be a term rewriting system and E be an equational theory. A term rewriting system R is £-terminating if there is no infinite sequence t 1 , t 2 , t 3 , · · · such that t 1 -+R 1Et 2 -+R/Et 3 -tR!E · · ·. Note that R is £-terminating if and only if -+~IE is a wellfounded partial ordering on T. We say that R is terminating or noetherian if it is £-terminating for E = @. A term t is R-reducible if there is a term t' such that t-tR t'. Otherwise, tis said to be R-irreducible or in R-normalform. If t' is irreducible and t-t~t', then t' is called an R-normalform oft, written t-+~t'. We will omit the prefix R if it is clear from the context. R is Church-Rosser modulo E if, for all terms sand t, S"'RuEt implies that there exists a term u such that S-t~ 1Eu+-~ 1 E t. We say that two terms s and t converge modulo E, written slR. Et, if there exist terms s' and t' such that S-t~s' "'Et'+-~ t. If E =@we say that sand t converge and write sh t. R is called confluent modulo E if whenever s+-~u-+~t, then sh.Et. R is locally confluent modulo E if whenever s+-Ru-+Rt, then slR.Et. R is (locally) confluent if it is (locally) confluent modulo E forE= 0. Note that confluence of R/E and confluence modulo E of Rare two different conditions. R/E is confluent if and only if R is Church-Rosser modulo E. R is called coherent modulo E if s+-~u..., Et implies sh.E t. R is locally coherent modulo E if s'+-RsHEt' implies s'h,Et'. Coherence is vacuously true if E is empty. The following theorem shows how these properties are connected. THEOREM 1 (Jouannaud & Kirchner, 1984). Let (R, E) be an equational term rewriting
system. If R is £-terminating then the .following conditions are equivalent: (a) R is Church-Rosser modulo E.
332
Leo Bachmair and David A. Plaisted
(b) R is confluent modulo E and coherent modulo E. (c) R is locally c01ifluent modulo E and locally coherent modulo E. (d) For all terms s, s', t and t', s'-r- 1Rs"'RuEt-t 1Rt' implies s',..,Et'. Confluence is decidable for finite noetherian term rewriting systems. A decision procedure based on critical pairs was given by Knuth & Bendix (1970). Let 1-tr and l'-+r' be two reduction rules and p be a position in l such that f/p is not a variable and 1/p and l' are unifiable, and let 8 be the most general unifier of ljp and 1'. The superposition of l-tr onto l'-tr' determines a critical pair (s, t) = (8(r), 8(l)[p-r-8(r')]). The terms s and t are the two outcomes of reducing 8(1) by l-tr and 1'-tr', respectively. A critical pair (s, t) converges if s and t converge, otherwise it diverges. The following lemma holds: LEMMA I (Knuth & Bendix, 1970; see also Huet, 1980). Let R be a noetherian term
rewriting system. R is confluent diverges.
if and only if no critical pair (s, t) between rules in R
Knuth & Bendix (1970) partially solved the problem of constructing, for a given nonconfluent term rewriting system, an equivalent confluent one, by designing a so-called completion method. The basic idea of completion is, to add, for every diverging critical pair (s, t), a new reduction rule s'-tt' or t'-ts', where s' and t' are normal forms of sand t, respectively. The method is not guaranteed to succeed and need not terminate. It may also abort when s' and t' are incomparable and cannot be made into a directed rewrite rule without violating termination. Both the critical pair lemma and the completion method have been generalised to rewriting modulo equations. In the general case additional critical pairs between rules in R and equations in E have to be considered. These results are discussed in detail in Jouannaud & Kirchner (1984). Termination is a prerequisite for the completion method. Techniques for proving £-termination are therefore of great importance in practice. Although various powerful methods have been developed for proving termination when E = @, very little is known about the more general problem of £-termination for non-empty equational theories E. In this paper we address the latter problem. Since our approach is based on and extends techniques for proving ordinary termination (E = 0), we give a brief review of such methods in the next section.
3. Termination Orderings Proving termination of term rewriting systems is a non-trivial task, in general, and the uniform halting problem for term rewriting systems is undecidable, even though it is decidable for ground systems, i.e. systems where the reduction rules consist of ground terms only (see Huet & Lankford, 1978). A survey of various techniques for proving termination of term rewriting systems is given in Dershowitz (l985a). We will briefly describe several important techniques in this section. We will assume from now on that F, the set of operator symbols, is finite, and G, the set of ground terms, is non-empty. Let R be a term rewriting system over T. First note that R is noetherian if and only if there is no ground term t having an infinite sequence of reductions. In other words, R is noetherian if and only if -tji defines a well-founded partial ordering on G. Therefore R is noetherian, if we can find a well-founded partial ordering > on G such that, for all ground terms s and t, S-tRt implies s > t. The problem with this method is that it quantifies over all possible reductions (on ground terms) S-tRt. An important refinement
Termination Orderings for Associative-commutative Rewriting Systems
333
is based on the concept of simplification orderings, which was introduced by Dershowitz ( 1979). DEFINITION 1. A partial ordering > on G is called a simplification ordering if it is monotonic and has the following subterm property: f( · · · t · · ·) > t, for all terms t and f( · · · t · · · ). We say that a terms =f(s 1 , · · · , sm) is homeomorphically embedded in a term t = g(t 1o • • ·, t,), written s ~t, if and only if (a) /= g and, for some permutation n, s1 ~tn be a simplification ordering on G and let s and t be ground terms. Then s~t implies s :j> t. Non-termination may be characterised as follows: THEOREM 2 (Kruskal, 1960). In any infinite sequence of ground terms t 1 , t 2 ,
• • •
over afinite
set of function symbols there exist i and j, i <j, such that t1 ~ t1. The following termination theorem is based on Kruskal's Theorem: THEOREM 3 (Dershowitz, 1979). A term rewriting system R terminates if there exists a simplification ordering > on G such that (J(l) > (J(r),for all reduction rules 1-+ r in R and for
every ground substitution (J with V(l) c: D((J ). PROOF. Let > be a simplification ordering satisfying the stated requirements. It can easily be proved that > contains -+ ~- Suppose that R does not terminate. Then there is an infinite sequence of ground terms t 1 -+Rt 2 -+Rt 3 • • •• By Theorem 2 there exist t andj, i<j, such that t 1 ~t1 , and therefore, by Lemma 1, t1 :j>t1- But since> contains-+~ we may also infer t1 > t1, which is a contradiction. An important class of simplification orderings are recursive path orderings (see Dershowitz, 1982), which extend a given partial ordering >, also called a precedence ordering, on the set of operator symbols F to the set of ground terms G. DEFINITION 2. Let > be a partial ordering on F. The recursive path ordering >rpo corresponding to > is defined recursively as follows:
s = f(sb ... 'sm) >rpot = g(tp ... 't,) if and only if (a)/= g and {sl> · · ·, sm} »rpo{t 1 , · · · , t,}, or (b) /> g and s >rpoti> for all i, 1 :::; i:::; n, or (c) f~ g and s1 rpo to multisets and s ~rpot means s >rpat or s~ t, where the permutation equivalence "' is defined by
s = f(sl> .. ., s,) ~ t = f(t 1 ,
.• • ,
t,)
if and only if for some permutation n:, s1""'tn(i)• for all i, 1 ~ i :!S n.
334
Leo Bachmair and David A. Plaisted
A multiset is an unordered collection of elements, where elements may appear more than once. For any partial ordering > on a setS, the multiset ordering » on the set of all finite multisets over S, defined by M
» N if and only if, M #- N and, for every yEN- M, there exists x EM- N, such that X>
y,
is also a partial ordering. If M(x) and N(x) denote the number of occurrences of x in M and N, respectively, then the number of occurrences (M- N)(x) of x in M- N is defined as max (0, M(x)- N(x)). The ordering » is well founded if and only if > is well founded. For details see Dershowitz & Manna (1979). THEOREM 4 (Dershowitz, 1982). Any recursive path ordering is a simplification ordering. The ordering, as given above, is defined on ground terms, but can be extended to nonground terms by including the following clause: s = f(s 1 ,
... ,
s,.) >rpoX if and only if x E V(s).
This means that variables are treated as constants that are unrelated to other operator sym bois in the precedence ordering >. LEMMA 3 (Huet & Oppen, 1980). Let s and t be terms in T. Then s >,P,t implies
a(s) >rpo(J(t), for every ground substitution (J. Simplification orderings are discussed in detail in Dershowitz (1979, 1982). Extensions of the recursive path ordering that incorporate the semantics of operators were proposed by Kamin & Levy ( 1980). Other simplification orderings include the "path of subterms" ordering (Plaisted, 1978a, b), the recursive decomposition ordering (Lescanne, 1981, 1982; Jouannaud et al., 1983), and another path ordering similar to the (extended) path of subterms ordering (Kapur et al., 1985). The recursive path ordering is used in the RRL rewrite rule laboratory, along with the lexicographic recursive path ordering by Kamin & Levy, see Kapur & Sivakumar (1983). It was also used in the first version of the REVE rewrite rule laboratory (Lescanne, 1983). In recent versions of REVE the recursive decomposition ordering is used as the main tool for proving termination. All these orderings have in common that they extend a precedence ordering > on function symbols to an ordering on terms. Dershowitz (1982) remarks that whenever >is a total ordering then the recursive path ordering is essentially the path of subterms ordering, and whenever > is a partial ordering, then the recursive path ordering is contained in an obvious extension of the path of subterms orderings. The recursive decomposition ordering also contains the recursive path ordering, but both orderings are the same when the precedence ordering is a total ordering. A detailed analysis of the relationship between these orderings may be found in Rusinowitch (1985). Manna & Ness (1970) (see also Lankford, 1979) proposed a differe1;1t technique that is based on the idea of associating with every n-ary operator fan n-ary function r y then r(f)( · · · x · · · ) > r(f)( · · · y · · · ). The function r can be extended to terms in the obvious way. A term rewriting system R is noetherian if r(a(/)) >r(a(r)) for every rule 1--tr in R and every ground substitution (J whose domain contains all variables in l. Usually this method is applied with polynomials over the non, negative integers as interpretations for the operators in F.
Termination Orderings for Associative-commutative Rewriting Systems
335
4. Equational Term Rewriting Systems A basic idea underlying the concept of rewriting systems is that of reducing a given term to a simpler one. An equation is converted into a directed rewriting rule in such a way that the right-hand side of the rule is "simpler" than the left-hand side. However, there are equations where left-hand side and right-hand side are intrinsically incomparable. For example, using the commutativity axiom x + y = y +z as a directed rewriting rule results in a non-terminating term rewriting system. One way to handle theories that contain such equations is to partition the given equational theory in two sets Rand E, where E is used as a set of equations and R as a set of directed rewriting rules. The reduction relation -+RIE corresponding to the equational term rewriting system R(E allows reductions modulo the equations in E. The classical Knuth-Bendix completion procedure has first been extended to rewriting modulo equations by Lankford & Ballantyne (1977), for the case of sets of equations that consist of permutati vity axioms, for instance, associativity and commutativity. A different approach by Huet (1980) deals with left-linear rewriting systems. The method by Peterson & Stickel ( 1981) may be applied to linear theories E with a finite and complete unification algorithm. These approaches have been unified in a more general framework by Jouannaud & Kirchner ( 1984). E-tennination is a prerequisite for all these methods. The termination orderings described in the previous section are not directly applicable to the problem of proving E-termination, however. Polynomial interpretations may be used for proving termination of associative-commutative rewriting systems, provided the proposed interpretation is compatible with the given associativity and commutativity axioms. The class of polynomials that satisfy these conditions consists of all polynomials p(x, y) of the form axy + b(x + y) + c, where ac + b = b2 . For example, the polynomials p(x, y) = x + y + c and p(x, y) = cxy are associative and commutative in x and y, but p(x, y) xy + 1 is not. In the following sections we introduce a new class of orderings that are also applicable to associative-commutative rewriting systems, but provide a conceptually simpler alternative to polynomial interpretations. Before we formally describe the ordering we adapt the general results on termination from the previous section to the case of equational tenn rewriting systems.
=
THEOREM 5. An equational term rewriting system R/ E terminates if there is a simplification ordering > on G such that s-+RIEt implies s > t, for all ground terms s and t. The proof of the theorem is similar to the proof of Theorem 3. The theorem quantifies over all possible reductions s__.,RIEt on ground terms. This requirement can be refined. If > is compatible with E, then > contains -+~IE if and only if it contains -+ ~. To see this assume that > contains -+ ~. i.e. U-+R v implies u > v, for all terms u and v. Let s, s', t and t' be such that S"-' Es'-+ Rt' "'Et. Then s' > t' and therefore, since > is compatible with E, also s > t. Thus > contains -+~IE· This suggests the following theorem: THEOREM 6. An equational term rewriting system R/E terminates if there exists a simplification ordering > on G that is compatible with E, such that (J(l) > (J(r),for every rule 1-+ r of R and every ground substitution (J with V(l) c D((J). PROOF. Let > be a simplification ordering satisfying the stated requirement. By Theorem
336
Leo Bachmair and David A. Plaisted
5 and the remarks above it suffices to show that S-+Rt implies s > t, for all ground terms s and t. But this can be proved easily under the given assumptions. Our approach to the problem of £-termination is based on this theorem. A different approach, based on the following theorem, has been suggested by Jouannaud & Munoz (1984). THEOREM 7 (Munoz, 1983). Let R/E be an equational term rewriting system and let -+ be a
reduction relation with R c-+ £-terminating.
c R/E.
If -
terminates and is £-commuting then R is
A reduction relation -+ is £-commuting if and only if for all terms s, s' and t with s'~Es-++t, there exists a term t' such that s'-++t'---Et. If a reduction relation is not £-commuting it can sometimes be extended to an £-commuting relation by adding appropriate rules to R. This process is similar to the completion process for term rewriting systems and need not always terminate. The termination property of the extended (£-commuting ) set of rules can be proved using existing methods for proving termination of -+. Candidates for -+ are -R and -+R.E· The reduction relation -+R,E is defined as follows: s-+R Et if and only if there exist an occurrence p of s, a rule 1-+ r in R, and a substitution (J, s~ch that sjp is not a variable, sjp ~E(J(l) and t = s[prpot. But the recursive path ordering cannot handle associative operators. For example, if a> b > c then f(a,f(b, c))"' Acf(f(a, b), c) >,pof(a,.f(b, c)). Therefore the recursive path ordering is not compatible with AC and not well-founded for R/ A C-reductions, in general. Since s"' Act implies that s and I are permutationally equivalent, we might try to apply the recursive path ordering to flattened terms. Let A be the transform given by A(t) =I. We define the associative path ordering >rpo by: s >apot if and only if A(s) >rpoA(t). But this ordering is not monotonic, as the following counterexample illustrates. Let f and g be AC operators with .f> g, and let a be a constant. Then f(a, a) >apog(a, a), but .f(a,f(a, a)) >avof(a, g(a, a)) is false. In fact, we even have f(a, g(a, a)) >rpof(a, a, a)
Leo Bachmair and David A. Plaisted
338
= f(a,j(a, a)), and therefore fta, g(a, a)) >apof(a,.f(a, a)). Thus the monotonic extension of >. 1, 0 is not well founded. The example above indicates that monotonicity is violated for those terms in which an AC operator is embedded within a larger AC operator. We will design a transform that maps T into a subset T' c T that contains no such "critical" terms. For example, we will transform the term f(a, g(a, a)) to g(f(a, a),f(a, a)). This transformation process can be conveniently characterised using a rewriting system. In order to simplify the presentation we will assume from now on that every associative operator in F is commutative, and every commutative operator is associative, that is, FAc =FA =Fe. Our results can easily be adapted to the case where F also contains functions that are associative but not commutative. Let > be a precedence ordering on the set of operator symbols F. The set of distributivity rules D corresponding to > consists of all reduction rules of the form f(g(x, y), z)-+ g(j(x, z),f(y, z)) or f(x, g(y, z))- g(.f(x, y),f(x, z)), where f and g are AC operators with.f> g. In order to be able to compute with D, we have to prove that D/AC is terminating and confluent. Then D-normal forms exist and are unique up to associativity and commutativity. Confluence is not satisfied for sets of distributivity rules, in general, but we can enforce it by properly restricting the precedence ordering >. We say that > satisfies the associative path condition if for all AC operators f either
f
is minimal in F, or (b) there exists an AC operator f/ such that f is minimal in F- {~/ }.
(a)
For example, let f and g be AC operators. Then the precedence ordering >, defined by f> g and h > g, where h may be any operator, satisfies the associative path condition, whereas a precedence ordering with f> y and f> h does not (see Figs 1 and 2). The ordering >, defined by h > f> g, only satisfies the condition if h is not an AC operator (see Fig. 3). LEMMA
4. Let > be a precedence ordering that satisfies the associative path condition, and
D be the corresponding set of distl'ibutivity rules. Then D/ A C is confluent and terminating. AC-termination of D can easily be proved by using the following polynomial interpretation:
PROOF.
r:(f) = Ax y. x x y, iff is a non-minimal AC operator, r:(g) =Ax y.x+Y+l, if g is a minimal AC operator, and r(x) = 2, if x is a variable.
f
h
f
h
f
g
Fig. I
g
h
Fig. 2
g
Fig. 3
Termination Orderings for Associative-commutative Rewriting Systems
339
Given that D is AC-terminating, by Theorem 1, D/AC is confluent if it is locally confluent modulo AC and locally coherent modulo AC. To prove local confluence modulo AC and local coherence modulo AC we use the following results by Huet (1980) for left-linear rewriting systems: a rewriting system R is locally confluent modulo E if, for every critical pair (s, t) between rules in R, sh.Et; it is locally coherent modulo E if, for every critical pair (s, t) between a rule in Rand an equation in E, s~R.Et. We first prove local confluence modulo AC. The only non-trivial critical pairs result from superposing the rules f(g(x, y), z))--. g(f(x, z),f(y, z))
and f(x, g(y, z))--. g(f(x, y),f(x, z)).
The corresponding critical pair is (s, t), where
= g(f(x, g(x', y')),f(y, g(x', y')))
s
and
t = g(f(g(x, y), x'),f(g(x, y), y')).
We may reduce s and t as follows: s-.ng(g(f(x, x'),f(x, y')), g(f(y, x'),j(y, y'))) = s'
and
t-.ng(g(f(x, x'),j(y, x')), g(f(x, y'),j(y, y'))) = t'.
Obviously, s'~Act', therefore s~n.Act. _ For local coherence we have to consider critical pairs between rules in D and equations in A C. A typical critical pair results from superposing f(x, g(y, z))--. g(f(x, y),j(x, z))
and
f(f(x, y), z) = f(x,f(y, z)).
The corresponding critical pair is (s, t), where s = g(j(f(x, y), x'),f(f(x, y), y'))) and t === f(x,J(y, g(x', y'))). We may reduce t as follows: t-.vf(x, g(f(y, x'),j(y, y')))-.vg(f(x,f(y, x')),f(x,j(y, y')))
We see that
s~Act',
therefore
s~n.Act.
= t'.
Other critical pairs are handled similarly.
We may define now the transform A by A(t) = t', where t' is a D-normal form oft. We will define associative path orderings in a slightly more general way than we indicated above. Namely, if two terms have the same transform we may still compare them using some given partial ordering [> that is monotonic, compatible with AC, and well founded on every set [t] = { sl A(s)....., A(t)}. We call such a partial ordering admissible for the transform A.
3. Let > be a precedence ordering on F that satisfies the associative path condition and [> be a partial ordering that is admissible for the transform A associated with >. The corresponding associative path ordering > apo on G is defined by DEFINITION
s >apat if and only if A(s) >,poA(t) or A(s),...,A(t) and s [>t. EXAMPLE
2. Let f and g be AC-operators with f>g, and let s and t be the terms
340
Leo Bachmair and David A. Plaisted
f(a,f(a, a)) and f(a, g(a, a)), respectively. Then A(s) = f(a, a, a) >rpogapat. Comparing terms by the inverse of their sizes transform. More precisely, let [> be defined by
IS
an admissible ordering for our
s [> t if and only if lsi-< ltl and no variable appears more often in s than in t. (Here -< is the natural order on integers.) The ordering [> is monotonic and compatible with AC. Furthermore, there is a bound on the size of the terms in [t], i.e. there is a constant k such that s E [t] implies lsi -< k. As a consequence, there can be no infinite sequence t 1 [> t 2 [>· · · with A(t 1 ) ~ A(t 2 ) ~ ···.The ordering [>is therefore admissible. For example, lets and t be the termsf(a, g(a, a)) and g(f(a, a),f(a, a)), respectively. Then A(s) = A(t), but s [> t, and therefore s >apo t. The use of distributivity rules for transforming terms was proposed by Plaisted (1983). The termination orderings in Dershowitz et al. (1983) are also based on the idea of transforming terms. Here terms are transformed into multisets of terms and no requirement is imposed 011 the precedence ordering >. Our ordering is conceptually simpler and more efficient, since we transform terms into terms. But the advantage of our ordering lies not only in the improved efficiency (at the cost of imposing restrictions on the precedence ordering), more important, our ordering can be lifted to non-ground terms, which was not possible for the ordering in Dershowitz et al. (1983). This is of course crucial for practical applications of the Knuth-Bendix completion procedure. We will sketch now another way to characterise the transform A. Again let > be a precedence ordering that satisfies the associative path condition. Let D V be the set of all reduction rules (on varyadic terms) of the formf(X, g(Y))-tg(N), where/and g are AC operators with f> g, X= {x 1, ... , X 11 } and Y are disjoint sets of distinct variables, and N = f(x 1 , •.. , X 11 , Y). An instance of a rule in D Vis, for example,
f(x, y, g(z, z')) - t g(f(x, y, z),f(x, y, z')). The rewriting system DV contains all rules in D and the reduction rules in DV may be viewed as "generalised distributivity rules". A term t is D V-irreducible if it contains no subterm](N), where/is an AC operator andf>op(u) for some term u inN. The combined system DVu Fl is terminating, since for every rule l-tr we have l >rpor, where >rpo is the recursive path ordering corresponding to >. The rewriting system D Vu Fl is also confluent (modulo the permutation equivalence "'), as can be seen by checking all possible critical pairs. (This can be done in a way similar to the proof of Lemma 4). The following lemma can easily be proved: LEMMA
5. Lett be a term in T and t* its (DVu Fl)-normalform. Then
A(t)~
t*.
Lemma 5 allows us to extend the transform A to varyadic terms by defining A(t) = t*, where t* is a (D V u Fl)-normal form oft. We will state now our main results on associative path orderings. We assume from now on that > is a precedence ordering that satisfies the associative path condition, and that [> is an admissible ordering for the transform A. LEMMA 6.
Any associative path ordering is compatible with A C.
Termination Orderings for Associative-commutative Rewriting Systems
PROOF. Follows from the fact that s ""ACt implies forms of s and t, respectively.
sr"" 7,
341
where s' and t' are D-normal
THEOREM 8. Any associative path ordering is a simplification ordering. The proof of the theorem is given below. We combine Theorems 6 and 8 and Lemma 6 to get the following termination theorem: THEOREM 9. A term rewriting system R is AC-terminating if there exists an associative path ordering >apo on G such that a(l) >apoO'(r), for each rule 1-+r of R-D and every ground substitution a whose domain contains all variables in l. The following lemmata are needed for the proof of Theorem 8. LEMMA 7. Lets, t,f( · · · s · · ·) andf( · · · t ···)be DV-irreducible terms such that s>apat. Thenf( · · · s · · ·) >apof( · · · t · · · ). PROOF. Suppose s >apo t, that is s>,1101. Let u and v be such that u = f( · · · s · · ·) and v = f( · · · t ···).We have to prove ii >rpov. The only problematic case is when s has toplevel AC operator symbol/ and the operator symbol h oft is different from f We observe that in this casef:j> h. This is vacuously true if/is a minimal operator. It is also true if/is minimal in F- {g}, because if t has top-level operator g then v would be D V-reducible, which would contradict our assumption. But f:j> hands= f(s 1, .. ., s,) >rpat imply that there is a sub term s1 of s such that s1 >rpo t. Therefore ii = /( · · '
S 1, · · · , St, • • • , S11
• ' • )
> rpof( · · · t · · · ) = ii.
As an immediate corollary we get: COROLLARY 1. The associative path ordering restricted to D-irreducible terms is monotonic. The next lemma characterises transforms of certain terms. LEMMA 8. Let t 1 and t 2 be D-irreducible terms and f be an AC operator. Then the term t = f(t 1, t 2 ) is either D-irreducible or A(t) = g(N), where g is an AC operator with f> g, N = f(Tb T2 ), and r; (i = 1, 2) is such that r; = {ft}, if f:j> op(t 1), and ft = g(1(), if/> op(t 1). ~
PROOF. Suppose t is reducible. Then t 1 or t 2 has top-level operator g, where f> g. Without loss of generality we may assume that op(t 1) =g. Let T1 be such that~= g(T1). Now, s = f(t 1, t 2) -+}zf~. t;) = f(g(t1), t;) ..... tvg(M), where M = f(T1, T2) and T2 is such that T2 = {G}, if op(t 2 ) # g, and t2 = g(T2 ), if op(t 2 ) =g. Finally, g(M) -+1ovuFlg(N) = A(s), where N = f(T1, T2 ). This proves our assertion. EXAMPLE 3. Lets be /(t 1, t2), where t 1 = g(g(a, a), a), t 2 = b, and/> g. Then
7J. = {a, a, a},
342
Leo Bachmair and David A. Plaisted
T2 = { b }, and s has D-normal form u = g(g(f(a, b),f(a, b)),f(a, b)). We see that, in fact, A(s) = g(f(a, b),f(a, b),f(a, b))= g(fJ). where We will next prove Theorem 8. PROOF OF THEOREM 8. Let > be a precedence ordering that satisfies the associative path condition and [> be an admissible ordering. We have to show that the corresponding associative path ordering is a monotonic partial ordering and has the subterm property. Irre.flexivity and transitivity follow immediately from the corresponding properties for the recursive path ordering and the ordering [>. Sub term property. We have to shows=/(· · · t · · ·) >apat, for all terms s and t. We may assume, without loss of generality, that all top-level subterms of s, including t, are D-irreducible. If s is D-irreducible, then obviously s >rpo 7, and thus s > apo t. Otherwise, s has to be of the formf(u, t) (orf(t, u)), wherejis a non-minimal AC operator. Let g be an AC operator such that/> g. By Lemma 8, A(s) = g(N), where N = f(U, T) and Tis such that 7 = g(t), if t has top-level operator g, and T = {I}, otherwise. It can easily be seen that in either case A(s) >rpot = A(t), and therefore s >apot. Monotonicity. We have to prove that s >apat implies j( · · · s · · ·) >apof( · · · t · · · ), for any operator symbol f and terms s, t, u = /( · · · s · · · ) and v =f( · · · t · · · ). If A(s)~A(t) and s[>t, then A(u)~A(v) and the assertion follows from the monotonicity of C>. Let us therefore assume A(s) >,paA(t), that is, s >rpat. We show A(u) >rpoA(v). Without loss of generality we may assume that all top-level subterms of u and v, including s and t, are D-irreducible. If u and v are both D-irreducible then the assertion follows from Corollary 1. Otherwise u or vis reducible andjis a non-minimal AC operator. Let g be a minimal AC operator with f> g and suppose that u is of the form f(w, s) and v of the form f( w, t). We consider first the case that v only is reducible. Then w cannot have top-level operator symbol g because otherwise u would be reducible. By Lemma 8, A(v) = g(N), where N = f(w, T) and t = g(T). From Lemma 7 and s >rpat we may conclude that, for all terms t; in T, f(w, s) >rpofCw, t,.). This implies /(w, s) »rpof(w, T) = N and, since f> g, also A(u) = ii = f(w, s) >rpog(N) = A(v). Next suppose that u only is reducible. Then A(u) = g(M), where M = f(w, S) and s = ?J(S). Since g is a minimal operator and s >rpai, there must be some term si in S such that s; >,pot. Then, by Lemma 7, f(w, s1) >rpof(w, t), and therefore A(u)
=
g(M) >,pJ(w, s1) >rpof(w, t) = A(v).
Finally, let us assume that both u and v are reducible. Then A(u) = g(M) and A(v) = g(fJ), where M = f(W, S), N = f(W, T), and the multisets S and T depend on s and t, respectively, as described in Lemma 8. It can easily be shown that S » rpo T holds. This implies S' = f(W, S) »,pJ(W, T) = T' and, as a further consequence, A(u) >rpoA(v). To proveS' »rpo T' we assume thatj(wi, ti) is some element in T'- S'. Then t1 is contained in T-S, and therefore, since S»rpo T, S-T must contain an element sk such that sk >rpot1. From Lemma 7 we obtainf(wi, sk) >rpof(wi, tj), wheref(w1 , sk) is inS'- T'. In summary, S' » T'. This completes the proof of monotonicity and of Theorem 8.
Termination Orderings for
A~sociative-commutative
Rewriting Systems
343
7. Lifting the Ordering to Non-Ground Terms We will next give a method for comparing terms with variables in the associative path ordering. When applying Theorem 9 we have to compare, for given terms s and t, u(s) and u(t), for every ground substitution u whose domain contains all variables in s and t. We will generalise the associative path ordering in such a way that only a finite number of the potentially infinitely many ground substitutions O" have to be checked. In the recursive path ordering terms that contain variables are compared by treating variables like constants. The equivalent of Lemma 3 does not hold for the associative path ordering, however. The corresponding method for associative path orderings is more complicated since the result of transforming a term may depend on the particular substitution and, in general, A(u(t)) ;/; u(A(t)). For example, given a term f(x, c), where c is a constant, we may substitute g(c, c) for x to obtain f(g(c, c), c), a term that can be reduced to g(f(c, c),f(c, c))(assuming f and g are AC operators with f> g). However, if we substitute c for x we get the irreducible term g(c, c). When comparing g(x, c) with some other term we have to consider both cases. In general, we say that a variable x has a critical occttl'rence for a (minimal) AC operator gin a terms if s contains a sub term of the form f(u, x) or f(x, u), where .f is an AC operator with f> g. Note that a variable may have critical occurrences with respect to more than one AC operator. A substitution u is called normalised for a rewriting system R (orR-normalised) if u(x) is R-irreducible, for all x. Let s and t be terms and u be a substitution. The substitution uL associated with u, s, and t is defined as follows:
uL(x) = g(x 1, x 2 ), if op(u(x)) = g and x has a critical occurrence for gins or t, uL(x) = x, otherwise. The following lemma shows why we are interested in associated substitutions. LEMMA
9. Lets and t be terms, u a D-normalised ground substitution whose domain contains
all variables ins and t, and uL its associated substitution. Then A(uL(s)) >rpoA(uL(t)) implies A(u(s)) >rpoA(u(t)). u and v beD-normal forms of ui(s) and uL(t), respectively. Then A(uL(s)) = ii and A(u 1_(t)) = v. We have to show that u >,p0 V implies A(u(s)) >,poA(u(t)). Let p be a substitution such that O" = uL o p. Then
PROOF. Let
u(s) = p(uL(s))-+'tp(u)-}tp(u), and similarly
u(t)
=
p(uL(t)) -+!,p(v) -+~tp(v).
Let p'(x) = p(x) and let u' and v' be (DV- Fl)-normal forms of p'(u) and p'(i!), respectively. Obviously, A(u(s)) = A(p(u)) = u' and A(u(t)) = A(p(v)) = v'. Therefore, A(u(s)) >rpoA(u(t)) if and only if u' >rpov'. In order to show that U>rpoV implies u' >rpaV' we first analyse the connection between ii and u' and between v and v', respectively. Suppose w = f(M, x) is some subterm of ft or v and p'(x) = g(fJ), where N = {t 1 , . . . , t11 }. (a) Ifjis an AC operator andf=g, then p'(w)=f(M,f(N))-+Fd(M, fJ). (b) Iff is an AC operator and f> g, then w must be embedded in u or w' = g(P, w). Then
p(w') = g(P,f(M, g(N)))-+vvg(P, g(f(M, t1), ... ,f(M, t11 ))) -+vvo(P,f(M, t 1),
.. . ,f(M,
t,)) = g(P,f(M, N)).
v in
a term
344
Leo Bachmair and David A. Plaisted
(c) In any other case, no reduction rule in DV or Fl is applicable to p'(w) at the position of p'(x). To summarise, u' and v' may be obtained from u and i!, respectively, by replacing each occurrence of a variable x either by p'(x) or, depending on the particular context, by N or N, where p'(x) = g(N). Using these facts we may prove that u>rpov implies u' >rpov'. This part of the proof is similar to the proof of Lemma 3 (induction on the size of terms) and is omitted here. EXAMPLE 4. Let s = /(x, a),
t
=
g(x, a)
O'(X) = g(b, g(c, c)).
and
Using the same notation as above, Now,
O'J.(x) = g(x 1 , x 2 ),
and, in fact,
p(x 1 ) = b = p'(xl),
and
p(x 2 ) = g(c, c)= p'(x 2 ).
A(O'L(s)) = A(j(g(x 1 , x2), a))= g(f(x 1 , a),f(x 2 , a)) >rpog(xl,
X 2,
a)= A(g(g(x 1 ,
A(O'(s)) = A(f(g(b, g(c, c)), a))
=
X 2 ),
a))= A(O'L(t))
g(f(b, a),f(c, a),f(c, a))
>rpog(b, c, c, a)= A(g(g(b, g(c, c)), a)) = A(O'(t)).
We see that g(f(b, a),f(c, a),f(c, a)) may be obtained from g(ftx 1 , a),.f(x 2 , a)) by replacing x 1 by {b} and replacing x 2 by {c, c}. Let A(s, t) denote the set of all substitutions 0' such that O'(X) = x or O'(X) = g(x 1 , x 2 ), if x has a critical occurrence for g in s or t. Clearly, for any ground substitution 0', the substitution O'L associated with 0', s, and t is contained in A(s, t). We require that the ordering [>, which is used for comparing terms s and t with A(s) ~ A(t), can be extended to non-ground terms and is compatible with substitution: whenever A(s)"' A(t) and s [> t then O'(s)[>O'(t), for all ground substitutions 0', We assume from now on that [>is an admissible ordering that is compatible with substitution. The ordering given in Example 3 is compatible with substitution. THEOREM 10. An AC rewriting system R/AC terminates if there exists an associative path ordering >apo such that,for every rule l--tr in R-D, either (a) A(l)~A(r) and l[>r, or (b) A(O'L(l)) >apoA(O'L(r)),for every substitution O'L in A(l, r).
PRooF. Let R/AC be an AC rewriting system and let >apo be an associative path ordering that satisfies the given conditions. By Theorem 9, R/ AC is terminating if 0'(/) >apo O'(r) for every rule l--tr in R but not in D and for every ground substitution 0'. Let[....,.,. be a rule in R- D and 0' be a ground substitution. If A(l) ~ A(r) then, by our assumption, l [> r. and therefore, since [> is compatible with substitution, O'(l) [> O'(r). This, together with A(O'(l)),.., A(O'(r )), implies 0'(/) > apo O'(r). Suppose next that A(l) and A(r) are not permutationally equivalent. Let O''(x) be the D-normal form of O'(X), and let O'L be the substitution associated with 0' l and r. The substitution O'L is contained in A(/, r) and therefore, by our assumption, A(O'L(l)) >rpoA(O'L(r)). By Lemma 9, A(O''(l)) >rpoA(O''(r)), which implies A(O'(l)) >rpoA(O'(r)). 1
,
EXAMPLE 5. Suppose s is f(x, Y) and t is g(x, y), where f> g. Both x and y have critical
Termination Orderings for Associative-commutative Rewriting Systems
345
occurrences for gins. Therefore A(s, t) contains the substitution u with rr(x)= g(xp x 2) and a(y) = g(y 1, y 2 ). Then
A(u(s))
= g(f(xl, Y1),f(x1, Y2),f(x2, Y1),f(x2, Y2)),
A(a(t))
=
g(xl, X2., Y1• Y2),
and we see that A(a(s)) >rpaA(a(t)). Terms may be compared more efficiently in the associative path ordering if we replace x by g(Sx) instead of g(x 1, x 2 ), where the symbolic multiset Sx represents {x 1 , x 2 }. For instance, in the example above, we have a(x) = g(ffx) and u(y) = g(ff;,), and obtain
A(a(s))
=
A(f(g(Sx), g(§;,)))
=
g(fJ),
where N = f(Sx, Sy), and
A(u(t)) = A(g(g(Sx), g(§;,)))
=
g(Sx,
§';,).
Theorem 10 provides the basis for our method of proving termination of AC rewriting systems. In the next section we will demonstrate the method with several examples.
8. Examples EXAMPLE
6. Abelian group theory. Let AC be the set of equations {x+ y = y+z, (x+ y)+z = x+(y+z)}
and let R consist of the following rules: (Rt) (R2) (R3) (R4) (RS)
x+O-+x, x+l(x)-+0, /(0)-+0, /(J(x)) -+X,
l(x+ y)-+l(x)+l(y).
Rf AC is a confluent equational rewriting system for abelian group theory. In this example the associative path ordering reduces to the recursive path ordering since there is only one AC operator and all terms in R are already flattened. Rules (Rl), (R3) and (R4) are ordered correctly by the sub term property. For rule (RS) we need I>+. Rule (R2) is ordered correctly since 0 is a minimal constant. The resulting ordering > satisfies the associative path condition, therefore R is A C-terminating.
7. Boolean algebra. The following confluent equational rewriting system for Boolean algebra is taken from Hsiang ( 1985). R contains the following rules:
EXAMPLE
(R1) (R2) (R3) (R4) (RS) (R6) (R7) (R8) (R9) (RIO) 15
x+O-+x,
x · 0 -+ 0, x·1-+x,
X· X -+X, (x+y)·z-+x·z+y·z, x+x-+0, XV y-+(X · y)+(x+ y), X::::> y -+(X· y) + (x+ 1), XEY-+(x+y)+1, -x-+x+ l.
346
Leo Bachmair and David A. Plaisted
AC consists of the associativity and commutativity laws for · and +. 0 and 1 are constants, they stand for FALSE and TRUE, respectively. The operators ·, +, v, ::::>, = and - denote conjunction, exclusive disjunction (EXCLUSIVE-OR), disjunction, implication, equivalence and negation, respectively. We have to construct an appropriate precedence ordering. Rules (R1)-(R4) can be ordered correctly by the subterm property. Rule (RS) is a distributivity rule corresponding to · > +. For rule (R6) we need 1 > 0; for rules (R7) and (R8) v > · and => > ·;for rule (R9) > + and > 1; and for rule (RIO) - > + and - > l. The ordering > in fact satisfies the associative path condition, therefore RjAC is terminating.
=
=
EXAMPLE 8. The following example is taken from Huet (1980). F consists of operators 0, 1, e, +, *,where 0 and 1 are constants, e is unary, and + and * are binary. Let AC be the set of equations
{(x+y)+z = x+(y+z), x+y = y+x, (x*y)*z = x*(y*z), x*y = y*x} and let R consist of the following rules: (Rl) (R2) (R3) (R4)
X
+0 -+X,
x*1-+x, e(O)-+ 1, e(x + y)-+ e(x)*e(y),
The associative path ordering corresponding to the following precedence ordering on F can be used to prove termination: e > * and e > 1. A different termination proof, based on extending the set of reduction rules rather than on transforms, is given by Jouannaud & Munoz (1984). They have to design a rather complex ad hoc ordering for proving termination of -+R',E• where R' is a certain extension of R. EXAMPLE 9. Rings. The following example is taken from Hullot (1980). Let R be the following set of rules: rules (R1)-(R5) for abelian group theory from Example 6 and the following additional rules: (R6) (R 7) (R8) (R9) (R10) (Rll)
x*(y + z)-+ (x*y) + (x*z), (x + y)*z-+ (x*z) + (y*z), x*O-+ 0, O*x-+0, x*l(y)-tl(x*y), I(x)*y-d(x*y).
AC contains the associativity equational rewriting system for path ordering corresponding interpretation can also be used
and commutativity axiom for +. Rf A C is a confluent rings. AC-termination may be shown using the associative to >, where * >1 > +. The following polynomial for proving termination:
r(O) = 2, r(-) = A.x . 2 x (x + 1), T( +) = AX y. X+ y + 5, r(*) = A.x y. x x y + 1.
It clearly requires more expertise to find an appropriate polynomial interpretation than to find a suitable precedence ordering >.
Tennination Orderings for Associative-commutative Rewriting Systems
347
10. The following is a confluent equational rewriting system R/AC for associative-commutative rings with unit. AC consists of the associativity and commutativity axioms for + and *. R consists of the following rules: EXAMPLE
(Rl) (R2) (R3) (R4) (RS)
x+O-+X, x+I(x)-+0, I(O)-+ 0, I(l(x))-+x, I(x+y)-+I(x)+I(y), x*(y + z)-+ (x*y) + (x*z), x*0-+0, x*I(y)-+l(x*y),
(R6) (R7) (R8) (R9) x*l-+x.
We cannot use the ordering > given above, since now both + and * are AC operators, and therefore the associative path condition is not satisfied anymore. We introduce a different confluent equational rewriting system for the same structure. The idea is to introduce a new constant c which represents I(l). Using AC completion we obtain the following system:
(RO) (Rl) (R2') (R2") (R4') (R6) (R7) (R9)
I(x)-+c*x, X +0-+X,
x+(c*x)-+0, 1 + C-+0, c*c-+ 1, x*(y + z)-+ (x*y) + (x*z), x*O-+ 0, x*1-+x.
Termination of this equational rewriting system can be proved using the associative path ordering corresponding to the precedence ordering >, with I>*>+, I> c > 0, and c> l.
11. Let us consider the standard confluent equational term rewriting system R for associative-commutative rings again. We cannot use an associative path ordering since the AC operator * has to be greater than both I and +, which violates the associative path condition. One way to deal with this situation is to consider the operators I and + as being equivalent. That is, we preprocess R by introducing a new operator f that replaces both I and +. Let R' denote the resulting rewriting system, AC' denote the AC theory corresponding to the new set of operator symbols, assuming/is an AC operator, and let t' denote the term resulting from t by replacing all occurrences of I and + by f Then s~Act implies s'.....,Ac·t' and s-+Rt implies s'-+R.t'. Therefore, for any infinite sequence of terms t 1-+RtAct 2 -+RtAct 3 • • • there is an infinite sequence of terms t'r-+R'tAc·t2-+R'tAc·t3 · · ·. Thus AC'-termination of R' implies AC-termination of R. For our example we get the following set of rules R':
EXAMPLE
(Rl ') (R2') (R3 ') (R4')
j(x, 0)-+ x, f(x,f(x))-+ 0,
/(0) -+ 0, j(f(x))-+ X, (RS') f(f(x, y))-+ f(f(x),f(y)),
348
Leo Bachmair and David A. Plaisted
(R6') (R 7') (R8') (R9')
x*f(y, z) -+f(x*y, z*z), x*O ~ 0, x*f(y)-+ f(x*y), x*l-+x.
Rules (R 1'), (R3'), (R4'), (R 7') and (R9') can be ordered correctly by the subterm property, (R2') if 0 is minimal among all constants, that is, if 1 > 0. Rules (R6') and (R8') are distributivity rules for * > f Finally, in (RS') both terms are transformed to f(x, y), but they may be ordered by inverse of size. The resulting precedence ordering satisfies the associative path condition. This proves that R'/ A C' and therefore R/ AC is terminating. The technique outlined in the last example is applicable in general, subject to the restriction that any newly introduced operator f that replaces an AC operator has to be an AC operator too. The new operator f may be of variable arity, as in the example above. In general, if Fn denotes the set of operators that occur in one of the distributivity rules in D, then FAc must be a subset of FD in order to ensure that the corresponding associative path ordering is compatible with AC. But Fn may also contain other operators that are not in FAc·
9. Summary We have introduced a class of termination orderings for associative-commutative term rewriting systems, called associative path orderings, that are based on the idea of transforming terms. Associative path orderings extend the well-known recursive path orderings and provide a conceptually simpler alternative to polynomial interpretations. They may be applied in any con text in which a precedence ordering that satisfies a certain condition, the associative path condition, can be specified. The precedence ordering can often be derived from the structure of the reduction rules. We have shown how to compare non-ground terms in this ordering and have demonstrated the usefulness of the ordering with a number of examples. In addition, we pointed out ways to deal with situations where the associative path condition is too restrictive. We believe that our approach of using transforms for termination orderings is also applicable to equational theories other than associativity-commutativity. Transforms should also be applicable in connection with orderings other than the recursive path ordering: the recursive decomposition ordering or a semantic path ordering, for instance. For example, if we include an associativity rule in R rather than in E, this rule cannot be ordered using a recursive path ordering, although it can be ordered using the lexicographic path ordering of Kamin & Levy (1980). Some of these problems are explored in Bachmair & Dershowitz (1985). We would like to thank Nachum Dershowitz for his valuable suggestions and are also thankful to the referees for their comments.
References Bachmair, L., Dershowitz, N. ( 1985). Commutation, transformation, and termination, (Submitted). Dershowitz, N. (1979). A note on simplification orderings. Inf Proc. Leii. 9, 212-215. Dershowitz, N. (1982). Orderings for term-rewriting systems. Tlreor. Co1np. Sci. 17,279-301. Dershowitz, N. (1985a). Termination,, Proc. First Int. Conf. olr Rewriting Techniques alrd Applications, Dijon, France, Lect. Notes in Camp. Sere., Springer. Dcrshowitz, N. (1985b). Computing with rewrite systems. Inf Cmrtro/ (to appear).
Termination Orderings for Associative-commutative Rewriting Systems
349
Dershowitz, N .. Manna, z. (1979). Proving termination with multiset orderings. Commun ACM 22,465-476. Dershowitz, N., Hsiang, J., Josephson, N. A., Plaisted, D. A. (1983). Associative-commutative rewriting, Proc. Btlr /JCAI, pp. 940-944. Karlsruhe. Guttag, J. V., Kapur, D., Musser, D. R. (1978). Abstract data types and software validation. Commun. ACM 21, I048-1064. Hsiang, J. (1985). Refutational theorem proving using term-rewriting systems. Artif. Intel!. 25, 255-300. Huet, G. (1980). Confluent reductions: abstract properties and applications to term rewriting systems. J. Assoc. Comp. Mach. 27, 797-821. Huet, G., Lankford, D. S. (1978). On the uniform halting problem for term rewriting systems. Rapport Laboda 283, !RIA. Huet, G., Oppen, D. C. (1980). Equations and rewrite rules; a survey. In.: (Book, R. ed.) Formal Languages: Perspectives and Open Problems, pp. 349-405. New York: Academic Press. Hullot, J.-M. (1980). A catalogue of canonical tem1 rewriting systems. Technical Report CSL-113, SRI International, Menlo Park, Calif. Jouannaud, J.-P., Kirchner, H. ( 1984). Completion of a set of rules modulo a set of equations. I lth A CM Symp. 011 Principles of Programming Languages. Salt Lake City, Utah, January 15-18, pp. 83-92. JouanmtUd, J.-P .. Lescanne, P., Reinig, F. (1983). Recursive decomposition orde1·ing. In: (Bjorner, D., ed.) IFIP Working Conj: 011 Formal Description of Programming Concepts II. Amsterdam: North-Holland. Jouannaud, J.-P., Munoz, M. (1984). Termination of a set of rules modulo a set of equations. In: (Shostak, R., cd.) Proc. 7th Int. Conf. on Automated Deduction. Springer Lee. Notes Comp. Sci., 170, 175-193. Kamin, S., Levy, J. J. (I 980). Tll'o Generalizations of tlw Recursive Path Ordering. Unpublished memo, Univ. of Illinois m Urbana-Champaign. Kapur, D., Narendran, P., Sivakumar, G. (1985). A path ordering for proving termination of term rewriting systems. Proc. lOth Colloquium Oil Trees in Algebra and Programming. Kapur, D., Sivakumar, G. ( 1983). Architecture of' and experiments with RRL, a rewrite rule laboratory. Proc. NSF. Works/rap on the Rewrite Rule Laboratory, pp. 33-56. Rensellaerville, New York. Knuth, D., Bendix. P. ( 1970). Simple word problems in universHI algebras. In: (Leech, J.. ed.) ComputatiOilal Problems in Ab.1·tmct Algebra, pp. 263-297. Oxford: Pergamon Press. Kruskal, J. B. ( 1960). Well-quasi-ordering, the tree theorem and Vazsonyi's conjecture. Tram. Amer. Math. Soc. 95, 210-225. Lankford, D. (1979). On Proving Term Re11•1'iting Systems are Noethetian. Memo MTP-3, Mathematics Department, Lousiana Technical University, Ruston, LA. Lankford, D., Ballantyne, A. (1977). Decision Procedures for Simple Equational Theories with Associatil•e Commuwtive Axioms: Complete Sel.l' of Associative Commutative Reductions. Technical Report, U niv. of Texas at Austin, Dept. of Math. and Comp. Scie. Lescanne, P. (1981). Decomposition ordering as a tool to prove the termination of rewriting systems. Proc. 7th IJCAI, pp. 548-550. Vancouver, Canada. Lescanne, P. ( 1982). Some properties of decomposition ordering, a simplification ordering to prove termination of rewriting systems. R.A.I.R. 0. Informatique Theoreiique/Theoretical Informatics 16, 331-347. Lescanne, P. (1983). Computer experiments with the REVE term rewriting system. Pl'oc. lOth A CM Symp. on
Principles of Programming Languages. Manna, Z., Ness, S. (1970). On the termination of Markov algorithms. Proc. 3rd Hawaii flU. Conf. on System Science, pp. 789-792. Honolulu, Hawaii. Munoz, M. (1983). Prob/eme de Tel'minaison Finie des Systemes de Rel!criillre Equ01ionnels. Thesis, Universite · Nancy I. Peterson, G. E., Stickel, M. E. (1981 ). Complete sets of reductions for some equational theories. J. Assoc. Conrp. Mach. 28, 233-264. Plaisted, D. A. ( 1978a). Well-founded Orderings for Provh1g Termination of Systems of Rewrite Rules. Dept. of Computer Science Report 78-932, Univ. of Illinois at Urbana-Champaign. Plaisted, D. A. ( I978b). A Recursively Defined Ordering for Proving Termination for Term Rewriting Systems. Dept. of Computer Science Report 78-943, Univ. of Illinois at Urbam1-Champaign. Plaisted, D. A. ( 1983). An associative path ordering. Proc. NSF Workshop Oil the Rewrile Rule Laboratory, pp. 123-126. Rensellaerville, New York. Rusinowitch, M. (1985). Plaisted ordering and recursive decomposition ordering revisited. Proc. First Int. Conf. 011 Rewriting Techniques and Applications, Dijon, France. Springer Lee. Notes Camp. Sci. (in press).
J. Symbolic Computation (1985), 1, 351-361
The Mechanical Computation of First and Second Cohomology Groups D. F. HOLT Mathematics Institute, University of Warwick, Coventry CV4 7AL, Great Britain (Received 30 October 1984)
We describe the theory and implementation of computer algorithms designed to compute the dimensions of the first and second cohomology groups of a finite group G, acting on a finite module M defined over a field K of prime order. Presentations of extensions of M by G can also be computed. The method is to find a Sylow p-subgroup P of G, where p = \K\, to compute If•(P, M) first, using variants of the Nilpotent Quotient Algorithm, and then to compute H"(G, M) as the subgroup of stable elements of H"(P, M).
1. Introduction In this paper, we describe the theory and implementation of computer algorithms designed to compute the dimensions of the first and second cohomology groups of a finite group G, acting on a finite module M defined over a field K of prime order. This work is a continuation of work described in two earlier papers of the author (Holt, 1984, 1985), which described algorithms for the computation of the Schur Multiplier of a finite group, and of presentations for the corresponding covering groups. The programs described in these earlier papers were originally written in ALGOL60 and implemented on the Burroughs B6700 machine at Warwick University. During the past year, they have been translated (with a few improvements) into the "C" programming language, and the programs described in this present paper have also been written in this language. Together, they now form a self-contained package designed for implementation under the "Unix" Operating System. They were originally implemented on a small ALTOS machine at Aachen, West Germany, and have now been successfully transported to a VAX 11-750 computer in the Mathematics Department at Warwick. The work described here was carried out whilst the author was supported by a Humboldt Research Stipendium at the Lehrstuhl D fi.ir Mathematik, RWTH Aachen. I am grateful to Professor J. Neubi.iser, and to all other members of this department for their help and encouragement, and for providing me with unlimited access to good computing facilities. I know no details of any other work on the mechanical computation of cohomology groups, although there is a reference to a work by N. M. Glazunov (1978) in Russian, which I have not been able to locate. In addition, a student at Aachen, Klaus Lux, has independently implemented a FORTRAN version of a similar algorithm for computing Schur Multipliers. The input required for the algorithms consists of generating permutations for the group G, together with the matrices which give the actions of these generators on the module M. 0747-7171(85/040351
+ 11
$03.00(0
© 1985 Academic Press Inc. (London) Ltd.
352
D. F. Holt
The group-theoretical computations in G that are required are similar to those described in Holt (1984), and they are discussed briefly in section 2 of the present work. The principal algorithm is that for the computation of Hx(P, M) (x = 1 or 2), where P is a Sylow p-subgroup of G, and p is the characteristic of the field over which M is defined, and this will be described in section 3. The computation of Hx(G, M), which is isomorphic to a subgroup of Hx(P, M), is explained in section 4. In the case of H 2 (G, M), presentations of specific extensions can be computed from the corestriction of stable elements of H 2 (P, M). This differs only in minor details from the corresponding algorithm for central extensions, which is described fully in Holt (1985), and so we shall give only a brief summary of this in section 5. Finally, in section 6, we give some numerical details of some successful computations, and discuss some possible future developments and improvements.
2. Group and Matrix Theoretical Computations The computations within the group G are carried out by means of permutation group algorithms, using bases and strong generating sets. The principal algorithms required are Schreier-Sims (for the order of G), Sylow subgroup, Normalizer of subgroup, Coset and double coset representatives, Intersection of sub groups, and an algorithm for computing a power-commutator presentation (PCP) of a p-group given as a permutation group. A few others are also useful, such as Commutator subgroups, and the Core of a subgroup in a group. These were described in Holt (1984) (see also Butler (1983)), and they form a small subset of the algorithms of this type which are available in the group-theory package CAYLEY (see, for example Cannon (1984)). In addition, the standard matrix functions, including products, transposition, and inversion, are required for matrices over a prime field. Let p be the characteristic of the field K over which M is defined. Then M is an elementary abelian p-group. The idea is to find P E Sy1p(G), and then to find a chain of subgroups P c N (P) = H 0 c H 1 c H 2 c ... c H" = G. The choice of these subgroups is the only non-mechanical part of the whole computation, and it is left to the user to construct them, using the group theoretical algorithms provided. As a general rule, it is most efficient to make the chain as long as possible, with the indices IH;+ 1 : Hi I as small as possible. Hx(P, M) (x = 1 or 2) will be computed first, followed by the members of the descending chain A 0 :::> A 1 :::> A 2 :::> ••• :::>A, in turn, where A; is isomorphic to Hx(H 1 , M), and is defined to be the subgroup of Hx(P, M) which consists of those elements of Hx(P, M) which are stable with respect to Hi. If ¢ E H"(P, M) is stable with respect to H;_ 1 , for some i > 0, then, to test stability with respect to Hi, it suffices to check its stability with respect to each g ED;, where D1 is a set of representatives of the double co sets H;- 1 gH; _ 1 of Hi-! in Hi. There is an additional restriction that g must be chosen such that g - l Pg n P E Sylp(g - 1 H; _ 1 g n H 1_ 1 ). For i = 0, it suffices to choose D 0 to be any set such that (P, D 0 ) = N(P). By definition, cp is stable with respect to g if (¢)ResP,Q = (¢)ResP,RCon~.R· 1
where Q = P n P0 - and R = Q0 = P n P0 • (The details of the theory that we have just summarised can be found in Section 10, Chapter XII of Cartan & Eilenberg (1956)".) In order to apply these conditions to concrete computations, we need to compute the
Computation of Cohomology Groups
353
sets D 1, and all of the corresponding intersections Q and R. Now every finite p-group has a particular kind of presentation known as a ''power-commutator presentation" (abbreviated as PCP), which will be defined in section 3. In order to provide input for the cohomology algorithms described in the following two sections, we need to compute a PCP for P and for each subgroup Q, together with words for the generators of Q and R expressed in the PCP generators of P. The matrices for these generators of P, and for the elements g ED i are also required. This, in itself, presents no problem, since the permutation group algorithms allow all elements of G to be expressed as words in the generators, and then matrices can be computed by using these words. There are two complications. The first is that most of the cohomology computations in fact work with the dual M* of M rather than with M itself, and so all matrices are first inverted and transposed. The second, and more serious, is that the action of P on M* will ultimately be defined by storing a PCP for the semidirect product P ~ M*. To achieve this, we require a central series for P ~ M*, and so a preliminary basis change on M* must be carried out, in order to triangularise the action of P. Furthermore, a second basis change may then be necessary, in order to be able to specify the definitions in the PCP of P ~M*. (This will be explained in the next section.) These basis changes will be maintained during all subsequent computations, and the user must reverse them again himself at the end, if he needs to. If presentations of extensions of M by G are to be computed by using the corestriction map, then some further information is required. This includes sets C1 of (left) coset representatives of Hi_ 1 in Hi, together with all of their rna trices, and also matrices for the elements of the strong generating sets si of Hi' In addition, for each g E si and c E Ci, we must store the elements h such that gc = dh, where dE C 1 and hE H 1_ 1 • Since there is potentially an enormous amount of data to be stored here, the computation of corestrictions is only feasible for relatively small indices IH1 : Hi- 11 (at most a few hundred). For the cohomology computations themselves, however, which merely describe H·~(G, M) as being isomorphic to the group of stable elements of H"(P, M), these indices can be much larger, and, particularly in the case x = 2, it is more likely to be the computation of W'(P, M) itself which determines computational feasibility in terms of storage requirements.
3. The Computation of Hx(P, M)
All of the cohomology computations described in this and the next section are concerned with the manipulation of p-groups IT defined by a power-commutator presentation (PCP). The generators of such a presentation are elements xi generating the terms of a maximal central series 1 c (x,.) c (x11 , x,._ 1 ) c ... (x 11 , •• • , x 1 ) =IT of IT. This provides a convenient normal form x~' x~2 •• • x~" (with 0 of IT. The relations of the presentation have the form [ x1, xi] = w (1 ~ i < j ~ n)
and
~
a1 < p) for the elements
xf = w (1 ~ i ~ 11),
where w is a word in the xi in normal form. These relations enable the collection process to be carried out, for putting arbitrary words in the x 1 into normal form. This seems to be by far the most efficient method of performing mechanical computations on finite p-groups.
354
D. F. Holt
The principal algorithm on p-groups that we require is that for the computation of the p-m ultiplicator pM(IT) and the p-cover pD(IT) of IT. This forms part of the now widely available Nilpotent Quotient Algorithm (NQA), of which the most recent version is described by Havas & Newman (1980). The relevant parts of this program (written in FORTRAN), including the collection subroutine, have been taken over by the author (with minor modifications and translation into "C"), for use in the cohomology algorithms. For the convenience of the reader, we shall now summarise the computations performed by the NQA. In its standard form, the input is a group G defined by any finite presentation, and the aim is to compute, successively, the factor groups Pc = G/Gc (c = 1, 2, ... ), where the groups Gc are the terms of the lower exponent p central series of G. They are defined by G0 = G and Gc+ 1 = [G, GcJG~, for c > 0. Thus Pc is a finite p-group and Gc!Gc+ 1 is elementary abelian. Furthermore, GtfGc = (Pc) (the Frattini subgroup), for each c > l. The NQA computes a PCP for each Pn with the following important additional property: for each generator xk E G dGc, there is one specific relation in the PCP that is called the definition of xk, and it has the form [x1 , x 1] or xf = x~' x22 • • • x%".:l xk. (In the version described in Havas & Newman (1980), it is always the case that cx 1 = ... = cxk_ 1 = 0, which is convenient, but not really necessary, and we cannot always achieve this simplification in the applications described here.) It is essential that the PCPs that we construct in our own computations should have this property. In the NQA, the construction of Gc+ 1 from Gc =IT is carried out in two stages. (i) pM(IT) and pD(I1) are constructed; (ii) Gc+ 1 is defined as a quotient of pM(I1), by enforcing the relations in the given presentation of G. We shall only be requiring the first of these stages, and so we shall say no more about the second. In fact, we are effectively intercepting the NQA in the middle, and then leaving before the end, since we are substituting our own groups 11 (with PCP) for G" whereas, normally, Gc would have been defined by the NQA itself. To define pM(I1) and pD(IT), we let 11 = F/R, where F is a free group on d generators, and d is the order of a minimal generating set for 11, and then pM(I1) = R/[F, R]RP and pD(IT) = F/[F, R]RP. (It is not hard to show that they are essentially independent of the choice of F.) The NQA computes these groups from 11, as follows. For each relation in the PCP of IT that is not a definition, the corresponding relator is a generator of R/[F, R]RP. We therefore replace the relation [x1, x 1] = w or xf = w by [x1, X;]= wy11 or xf = wy1, respectively, where y11 or y1 is a new generator, lying in pM(I1). In fact, this relation becomes the definition of the new generator in pD(I1). In addition, pD(I1) has the appropriate power and commutator relations which make the new generators central and of order p. This process results in a presentation of pD(IT), but unfortunately it may not be a PCP, since the new generators may not be linearly independent. The final, and most time-consuming step is to enforce the associative law on the generators of IT in the new group pD(I1). This results in the elimination of redundant new generators, and we end up with a consistent PCP for pD(I1). After these preliminaries, we can now turn to the computation of Hx(P, M), for x = 1 and 2. To compute H 1 (P, M), we actually compute a factor group L = L(P ~ M*) = pM(P ~ M*)/Z of pM(P ~ M*), where M* is the dual module of M. To apply the NQA, we first require a PCP for 11 = P ~ M*, but, since we chose the basis of M* with this in mind, this presents no problem. We apply the NQA with the extra condition that we only introduce new generators y11 for x1 e M* and x 1e P, and we introduce no y; for the
Computation of Cohomology Groups
355
pth powers. From a theoretical viewpoint, this means that, if IT = F / R and P and M* are the complete inverse images in F of P and M*, then we are computing pD(D)jZ, where
z = (R n [P, P]PP)(R n [M*, M*J(M*)P) is generated by the new generators that we have not introduced. Hence the extension of L by IT that we are computing splits when restricted to either of the subgroups P and M* of IT. It is therefore isomorphic to the semidirect product of a KP-module A by P, where A is a KP-module extension of L by M*. (Lis of course trivial as a KP-module.) To justify this computation, we will prove the following two statements. (i) The dual L* = Hom(L, K) of Lis naturally isomorphic to ExtKp(M*, K). (ii) ExtKp(M*, K) ""H 1 (P, M).
To prove (i), first let E be any group extension of K by 11 with K c Z(E). Then, since F is free, we have a diagram 1-+ pM(IT)--+ pD(IT) -+IT- 1. ~¢ . ~l/1 /' 1-+
K
--+
E
Let Q be the restriction of E to P (i.e. the complete inverse image of P in E). Then the extension Q of K by P splits if and only if K rj;. CI>(Q), which is the case if and only if R n CI>(P) c Ker(l/1). Similar reasoning applies toM*. Thus E splits when restricted to both P and M*, if and only if Z c Ker(l/J). This is the case if and only if E has the form P ~ N, where N is a KP-module extension of K by M*. So, given such a module N, and using L= pM(IT)/Z, we get an induced map (/) eL*. Conversely, given(/) eL*, the "push-out" construction results in such a diagram, with E = P ~ N, where N is a KP-module extension of K by M*. Furthermore, if ¢ is non-trivial, then the image of ¢ lies in the commutator subgroup of P ~ N, and so this module extension cannot split. Hence (i) is true. To prove (ii), we give an explicit isomorphism in terms of matrices. All matrices are to be regarded as acting from the right. Given ¢ e Z 1 (P, M) (the crossed homomorphisms from P to M), we construct a module extension of K by M* as follows. Let bt. ... , bn be a basis of M, and let Fill ... , Fin be the corresponding dual basis of M*. Let M*(g) be the matrix of g with respect to this basis, and let (g - 1 )¢ = LXc b1• Then the action of g on the extension, with respect to a basis b1 , . . . , bn, bn + 1 is given by the matrix
M*(g)
o ... o
1
t
Conversely, given an element of ExtKp(M*, K), we can find a basis such that the matrices for geP have the above form, and this defines the map¢. It is straightforward to check that ¢ being a crossed homomorphism ((gh)¢ = (g)¢ 1' +(h)¢) is equivalent to the above matrices defining a representation of P over K, using the fact that M*(g) is the inverse transpose of M(g). To complete the proof that this correspondence defines an isomorphism as in (ii), observe that ¢ is principal if and only if there is a fixed element
356
D. F. Holt
m = 'L u1b1 of M such that (g)¢ == m- m0 for all g E G, and that this is the case precisely when the representation above splits with respect to the basis {br + u1b,. + 1 , b" + 1 \l :::;; i.:::;; n}. The computation of H 2 (P, M) is rather more complicated, and requires considerably more time and storage space. Choose P = ll = F(R, and define FE= F([R, R]RP and FM = Rj[R, R]RP. We will call these the Frattini Extension and Frattini module of P, respectively, since FE is the (unique) largest group with the property that F M is an elementary abelian p-group with FM £ CI>(FE), and FEjFM ~ P (see Gaschutz (1954)). Now any group extension E of a KP-module M by P gives rise to a diagram 1-+ FM-+
1¢ 1-+
M -+
E
where ¢eHomKp(FM, M). Conversely, given such a ¢, we can construct E as the pushout, and the extension splits if and only if rf; extends to a crossed homomorphism in Z 1 (FE, M), where the action of FE on M is induced by that of P. These facts were proved by MacLane (1949). Thus H 2 (P, M) is isomorphic to the cokernel of the map Z 1 (F E, M)-+ HomKp(FM, M). In fact, since FM acts trivially on M, all principal crossed homomorphisms in Z 1 (FE, M) are trivial on FM, and so we can write H 2 (P, M)::::::: Coker(H 1 (FE, M)-+ HomKp(FM, M)), and it is the right-hand side of this isomorphism that we shall compute. More precisely, we compute its dual, which can be written as
X= Ker(FM ®KP M* -~o L(FE ~ M*)) where L(FE ~ M*) is the factor group of pM(FE ~ M*) that we defined above. The advantage of using the dual is that both terms in this expression can be computed with the NQA. It is also important to observe, from a. computational viewpoint, that all of the isomorphisms given so far can easily be defined explicitly. The first problem is to compute FE and FM. From the theory of free groups, we know immediately that IFMI = p", where n = (d- l)IPI + 1, which grows unpleasantly rapidly with the order of P. Fortunately, we do not usually need to compute the whole of FM. We compute FE by applying the NQA repeatedly to P, to produce the sequence F/W[R, F; 1], F/W[R, R][R, F; 2], F/RP[R, R][R, F; 3], ... , where [R, F; 1] = [R, F], and, fori> l, [R, F; i] = [[R, F; i-1], F]. The only modification to the NQA is that, a.t each stage after the first, all generators other than the original generators of P must commute with each other and have order p. In other words, we introduce new generators y11 and y1 only for x1 f. R. Clearly each group in the sequence is a factor group of FE, and, since FE is a finite nilpotent group, the sequence must eventually become constant at FE. Now, for a given KP-module M, we have [M, P; n]:::::: 0 for some n, and we shall call the minimal such n the depth of the action of P on M. Clearly, for any ¢eHomKp(FM, M), we have [R, F; n] c Ker(¢), and so, in practice, we need only compute FM to depth n; that is, we need only a.pply the NQA n times. Given a PCP of FE to the required depth, the next problem is to compute FM ®KPM*. To apply the NQA to this and the following computations, it is convenient to work in the semidirect product FE ~ M*, and so we must first compute a. PCP for this group. Once again, this presents no problems, due to our choice of basis for M*. If we now apply the NQA to this group, and introduce new independent generators Ylk for
Computation of Cohomology Groups
357
x1EM* and xkEFM, then these generators obviously generate FM ®KM*. For x 1E FE- F M, and xk, x 1 as above, the associativity condition (x 1xk)x 1 = x 1(xkxi) reduces to xk ® x 1 = x:' ® xf', and so enforcing these associativity conditions for all appropriate i, k and l produces FM ®xpM*. Let us call this Stage 1 of the computation of X. Next, to compute L(FE ~ M*), as we have already seen, we need to introduce Yzk for all x1 EM* and xkEFE, and to enforce the appropriate associativity conditions. So, during this next stage, Stage 2, we introduce all such Ytk that were not introduced during Stage 1 (i.e. for x 1 EM* and xkEFE-FM). We then compute all remaining associativity conditions. However, according to the formula(*), we are trying to compute the kernel of the map from FM ®KPM* to L(FE ~M*), rather than L(FE ~ M*) itself. We therefore enforce only those resulting relations which involve some of the generators introduced during Stage 2. For the remainder, which involve only Stage 1 generators, we store these relators (after suitable echelonisation) without enforcing them, and finally these stored relators will generate the required kernel X. 4. The Computation of Actions
The next problem is, given g E G, to compute the subgroup of Hx(P, M) consisting of those elements which are stable with respect to g. 1 We begin by computing Hx(Q, M), where Q = P n P0 - • exactly as in section 3, with Q in place of P. An additional complication here is that, although the action of Q on M* will already be triangular, in order to produce a PCP of Q ~ M* together with definitions, we may require a further temporary basis change forM*. In the case x =I, we compute the factor group L(Q ~ M*) of pM(Q ~ M*). There is then a natural induced map i 1 : L(Q ~ M*) -+L(P ~ M*) which can be computed immediately (although the basis change mentioned above must be taken into account), which is the dual of the restriction map H 1(P, M)-+H 1(Q, M). Furthermore, the isomorphism Q-+ R defined by conjugation by g, together with the action of g on M*, induces an isomorphism c: L(Q ~ M*)-+L(R ~ M*), which is the dual of the conjugation map Con°: H 1 (R, M)-+ H 1 (Q, M). Hence we explicitly compute i 1 and ci 2 , where i2 is the natural induced map L(R ~ M*)-+L(P ~ M*), and for each generator x of L(Q ~ M*), we factor out the element (x)i 1 - (x)ci 2 of L(P ~ M*). The resulting factor group is then isomorphic to the dual of the required subgroup of stable elements of H 1 (P, M). Once again, the case x = 2 is somewhat more complicated. Firstly, there is a natural mapping of the Frattini Module FM(Q) of Q to FM(P) which is induced by the injection Q-+P, and which we can compute explicitly by working in FE(P). The resulting induced map Hompp(FM(P), M) -+ HompQ(FM(Q), M) induces the restriction map H 2 (P, M)-+H 2 (Q, M). In fact, since we are working in the dual situation we actually compute the map i 1 : FM(Q) ®FQ M* -+ FM(P) &;ppM* (again taking any basis change on M* into account). Conjugation by g induces an isomorphism FM(Q)-+FM(R), and hence, using the action of g on M*, we get an isomorphism c:FM(Q)®FQM* -+FM(R)®FRM*. We can now explicitly compute ci 2 :FM(Q)®FQM* -+ FM(P) ®FP M*, where i 2 is the natural map induced by the embedding R -+P. Finally, for each generator x of the subgroup of FM(Q) ®FQ M* which is isomorphic to the dual of H 2 (Q, M), we compute (x)i 1 - (x)ci 2 (which must lie in the subgroup X of FM(P) ®FPM* defined in(*) in section 3). Factoring these elements out for each such x results in the factor group of X that is isomorphic to the dual of the subgroup of stable elements of H 2 (P, M).
358
D. F. Holt
5. Computation of Extensions In this section, we assume that the reader is familiar with the author's earlier paper (Holt, 1985) since the algorithm we use for computing presentations of extensions is almost identical to that described there. The first stage is to find presentations for each of the subgroups P, H 0 , •• • , H, = G, using the known strong generating sets for these subgroups as generators. The relators found in this presentation must form a strong set of relators, which means that they include relators for each of the subgroups in the stabiliser chain of Hi. Such presentations can be found mechanically, by using the Leon-Sims algorithm (Leon, 1980). Given such a presentation (Sil Ri) for Hi, the computed presentation for the extension of M by H 1 will have the form E 1 = (SiuXIR 1 u YuZ) where (i) there is a one-one correspondence¢: §i....,.S 1 , such that, for seS1 , ¢(s) is the image of sunder the projection Ei....,.Hi; (ii) X is a generating set for M as a vector space; (iii) there is a one-one correspondence l/J: Ri....,.R.i such that, for reRi, l/J(r) has the form 1 , where r is the word in S that is mapped onto the word r by ¢, and me M is a word in X; (iv) Y contains relators giving the action of Si on M; (v) Z consists of relators in X that force M to be an elementary abelian p-group.
rm-
'
The only unknowns that need to be computed are the elements m in (iii). In practice, if the user already knows a presentation for G that he would prefer to use to obtain the presentation of E, then it is always possible to add his preferred generators and relators to the given presentation of G, since redundant generators and relators do not disturb anything. The idea is to start with a presentation of an extension E of M by P that is stable with respect to G, and then to compute the extensions E 0 , E 1 , ••• , E 11 by computing the co restrictions from E to E 0 , E 0 to E 1 , etc. First of all, we must compute E. We recall, from sections 3 and 4, that the group of stable elements of H 2 (P, M) was defined as the dual of a quotient group X/Y of a subgroup X of FM ®FPM*. We therefore must select an element of X*= Hom(X, K) which acts trivially on Y, and extend this in an arbitrary manner to an element ¢eHom(FM ®KPM*, K). (The extension chosen will not affect the element of H 2 (P, M) that it defines.) ¢ corresponds to the element ¢* e HomKP(FM, M), defined by (x)¢* = L. a1b1 for xe FM, where a. = (x ® b1)¢. Thus, for a relator r in the PCP of P, if the word corresponding to r in FE takes the value x E F M, then we have r = 'L aibi in the extension that we are defining. Hence we can compute a PCP for E. Finally, if we know the normal form expressions in the PCP generators of P for the elements in the strong generating set of P (which we can calculate easily during the group-theoretical part of the computation), then we can compute the required elements m, by working in the PCP for E. Exactly as in Holt (1985), the computation of the corestriction map from E 1 to Ei+l (or E to E 0 ) consists of two stages. In the first, we carry out a modified Todd-Coxeter coset . enumeration on the presentation of E1, in order to produce a normal form for the elements of E1, and to compute the necessary information for putting arbitrary words in the generators of E1 into this normal form. This is precisely as described in section 3 of Holt (1985), except that the action of the generators of H; on M must be taken into account at various places, and we shall not give any details here. In the second stage, as in section 2 of Holt (1985), we use the formula(***) derived there to compute the required
Computation of Cohomology Groups
359
elements rn in the extension Ei+l· The only difference is that, in each of the formulae(*), (**) and(***) of that paper, in the case of non-trivial action of H;+ 1 on M, we must replace the right-hand side by .l:ker(¢[- ])k- 1 , where Tis a left transversal of H; in H;+ 1 • This is the reason why it is necessary to compute and store the matrices for k- 1 , for all
k
E
T. 6. Some Results and Possible Further Developments
In the case of H 1 (G, M), the cohomological computations do not seem to require any more time or space than the group-theoretical ones, and so we shall confine our discussion to H 2 (G, M). We first describe some numerical details of the successful computation of H 2 (G, M), where G = L(5, 2) and M is the natural five dimensional module for G in characteristic 2. This was about the largest example that could be handled on the ALTOS in Aachen, although the VAX in Warwick, by making use of virtual memory, will hopefully be able to cope with bigger examples. It requires about 90 minutes process time on the ALTOS, and 40 minutes on the VAX. Of this, less than a minute is used for the group-theoretical calculations, and the time is roughly evenly divided between the computations of H 2 (P, M) and H 2 (Q, M) for four values of Q. Of this, more than half of the time is spent computing the Frattini Extensions FM(P) and FM(Q). G is represented on 31 points, with order 31.30.28.24.16. In their actions on M*, we take 1
1 1 1
P= 0
*
1
*
H1
0
""
*
1
1 0
1 1 * 0 1
1I *
H3=
H2= 0
*
0
*
*
and H 4 =G. (N(P) = P, and so there is no H 0 .) Then P, H 1 , H 2, H 3 , and H 4 have orders 2.4.8. 16 = 2 10 , 2.4.24.16 = 3.2 10 , 2.28.24.16 = 7.3.2 10 , 30.28.24.16 = 15.7.3.2 10 , and 31.30.28.24. 16 = 31.15.7.3.2 10 , respectively. The sets D 1 , D2, D3 and D4 all contain one element only, and these are respectively 1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 0 1
~\
b)
1 0 0 0 0
0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0
1 0 0 0 0
0 0 1 0 0
0 1 0 0 0
0 0 0 1 0
0 0 0 0 1
,and
0 1 0 0 0
1 0 0 0 0 0 0 1 0 0 0 1 0 0 0
0 0 0 0 1
The four corresponding Sylow intersections Q1 , Q2 , Q3 and Q4 all have order 2 9 . P acts with depth 5 on M, and each Q1 acts with depth 4. We find that FM(P) to depth 5 has dimension 303 (note that the full Frattini module has dimension 3073), and FM(Q 1) to depth 4 has dimension 174,304,304 and 174, for
360
D. F. Holt
i= 1,2,3,4, respectively. FM(P) ®FPM* has dimension 25, and the subgroup X isomorphic to H 2 (P, M) has dimension 13. The corresponding dimensions for FM(Q 1) ® FQ,M* are 25,33,31 and 31, and for their subgroups X 1 are 13,18,14 and 21, for i = 1,2,3 and 4, respectively. Finally, the quotients of X which are isomorphic to H 2 (H;, M) have dimensions 10,4,2 and 1, respectively. In the example above, the computation of the corestriction map requires relatively little time. An example in which this situation is reversed is H 2 (G, M) for G = L(3, 9) with M the natural module over GF(9), regarded as a six-dimensional module in characteristic 3. Here, G is represented on 91 points with order 91.90.81.8.8, IPI=9.81 =3 6 , H 0 =N(P) has order 9.81.8.8, H 1 (the point stabiliser) has order 90.81.8.8, and H 2 =G. Again, D1 and D 2 consist of single elements. Pacts to depth 3 on M, and Q1 and Q2 act to depth 2. To these depths, FM(P) and FM(Q;) have dimensions 102,34 and 34, respectively, FM(P) @ppM* and FM(Q 1) ®Q, M* have dimensions 32,36 and 42, and their subgroups X, X 1 have dimensions 20,26 and 34. In fact, we find that H 2 (H 1, M) has dimension 2 for i = 0,1 and 2. These computations require only a few minutes process time on the VAX, but computing the corestriction of a stable element of H 2 (P, M) up to G requires about two hours, largely because of the relatively large indices in the stabiliser chain, and in the chain of subgroups P c H 0 c ... c G. With regard to future improvements, the most obvious possibility for increasing the range of applicability of the H 2 (G, M) algorithm is the following. In many examples, P acts to a relatively large depth on M, but P has fairly large subgroups S which act to a considerably smaller depth d(S) on M. In the computation of FM(P), it should not be too difficult to impose the extra conditions [FM(P), S; d(S)] = 0, which would hopefully decrease the final dimension of FM(P) considerably. The same technique could be used for each Sylow intersection Q. Of course, it is difficult to predict how big an improvement this would really achieve. Some possible future developments are the following. Firstly, a corestriction algorithm for H 1 could be implemented, so that crossed homomorphisms from G to M could be computed explicitly. Secondly, it would be desirable to have an algorithm for the computation of ExtKa(M, N), for KG-modules M and N. This can, in fact, already be computed as H 1 (G, M* ® N), but this requires storing matrices of relatively large dimension. A better method would probably be to generalise the algorithm for H 1 (G, M), using the fact that it is actually computing ExtKa(M*, K). If Pacts to depth donN, then the computation of L(P ~ M) described in section 3 could be repeated d times, to produce an extension of a module F L by P ~ M, which is centralised by M, and which splits over P and over M, on which Pacts to depth d. Then ExtKp(M, N) is isomorphic to a subgroup of HomKP(F L, N), and the subsequent computations would be similar to those for H 2 (G, M). Other useful algorithms to implement would be those which determine whether a given group or module extension splits.
References Butler. G. ( 1983). An Implementation and Proof of Holt's Algorithm. Unpublished manuscript, Univ. of Sydney. Cannon, J. J. (1984). An introduction to the group theory language, Cayley. In: (Atkinson, M .. ed.) Computational Group Theory (Proc. of LMS Meeting, Durham, 1982), pp. 145-183. London: Academic Press. Cart an, H., Eilenberg, S. ( 1956). Homological Algebra. Princeton: Princeton University Press. Gaschiltz, W. (1954). Dber modulare Darstellungen endlicher Gruppen, die von freien Gruppen induziert werden. Math. Zeit. 60, 274-286.
Computation of Cohomology Groups
361
Glazunov, N. M. (1978). Algorithms for calculations of cohomology groups of finite groups. In: Computations in Algebra and Combinatorial Analysis (Russian), pp, 208-218. Akad, Nauk. Ukrain. SSR lnst. Kibemet, Kiev. (Math. Reviews 82f 20080). Havas, G., Newman, M. F. (1980). Applications of computers to questions like those of Burnside. In (Mennicke, J. L., ed.) Burnside Groups. Lecture Notes in Mathematics, vol. 806, pp. 211-230. Berlin: Springer-Vcrlag, Holt, D. F. (1984). A computer program for the calculation of the Schur Multiplier of a permutation group. In: (Atkinson, M., ed.) Computational Group Theory (Proc, of LMS Meeting, Durham, 1982), pp. 307-319. London: Academic Press. Holt, D. F. ( 1985). A computer program for the calculation of a covering group of a finite group. J. Pure Applied Algebra 35, 287-295. Leon, J. S. ( 1980). On an algorithm for finding a base and strong generating set for a group given by generating permutations. Math. Camp. 35, 941-974. MacLane, S. (1949). Cohomology theory in abstract groups III. Ann. Math. 50, 736-761.
16
J. Symbolic Computation (1985) 1, 363-381
A General Backtrack Algorithm for the Isomorphism Problem of Combinatorial Objects t G. BUTLERt AND C. W. H. LAM§ :j: Basser Department of Computer Science, University of Sydney, Sydney 2006, Australia, and §Department of Computer Science, Concordia University, Montreal H3G IM8, Canada
(Received 22 February I 985)
Our aim is to present a practical algorithm for the isomorphism problem that can be easily adapted to any class of combinatorial objects. We investigate the underlying principles of backtrack algorithms that detennine a canonical representative of a combinatorial object. We identify the parts of the algorithm that are dependent on the class of combinatorial objects and those parts that are independent of the class. An interface between the two parts is developed to provide a general backtrack algorithm for the isomorphism problem of combinatorial objects that incorporates the technique of branch-and-bound, and that also uses the automorphisms of the combinatorial object to prune the search tree. Our general algorithm incorporates from computational group theory an algorithm known as the base change algorithm. The base change algorithm allows one to recover as much information as possible about the automorphism group when a new branch of the search tree is processed. Thus, it can lead to greater pruning of the search tree. This work is intended to lead to a better understanding of the practical isomorphism algorithms. It is not intended as a contribution to the theoretical study of the complexity of the isomorphism problem.
1. Introduction For most classes of combinatorial objects such as graphs, latin squares, Hadamard matrices, block designs, and error-correcting codes, there is a notion of isomorphism that may be expressed as a permutation mapping one object to the other. This raises the problem: Given two combinatorial objects A and B in a particular class of combinatorial objects, does there exist a permutation p mapping A to B? This problem is called the isomorphism problem for the class of combinatorial objects. The isomorphism problem is of particular interest in complexity theory (Garey & Johnson, 1979; Booth & Colbourn, 1979) where there is a class of problems, called isomorphism complete problems. These are the problems which are polynomially equivalent to the graph isomorphism problem. They include the isomorphism problem for most other classes of combinatorial objects. The importance of the graph isomorphism problem has made it the subject of extensive research. Two surveys are Read & Corneil (1977) and Corneil & Kirkpatrick (1980), while the book of Hoffman (1982) examines the
t
This research was partially supported by NSERC of Canada and FCAC of Quebec.
0747-7171/85(040363+19 $03.00/0
© 1985
Academic Press Inc. (London) Ltd.
364
G. Butler and C. W. H. Lam
recent applications of group theory that have lead to polynomial algorithms for some special types of graphs. It is still unknown whether there exists a polynomial-time algorithm to solve the graph isomorphism problem in general. We are concerned with practical algorithms for the isomorphism problem that are effective for a large proportion of present real-world problems even though their worstcase or asymptotic behaviour may be poor, or may not be well understood. Again, there has been extensive work in this area for graphs (Read & Corneil, 1977; McKay, 1976) with the notable success in the case of planar graphs (Hopcroft & Wong, 1974). To the best of our knowledge, the most powerful general program for graph isomorphism at the moment is the program of Brendan McKay (1981). There has also been practical work on the isomorphism problem of Hadamard matrices by Leon (1979) and McKay (1979), special block designs by Colbourn & Colbourn (1979), latin squares by Brown (1968), and error-correcting codes by Leon (1982). The published algorithms generally use a backtrack algorithm. They are of two types. The algorithms of the first type, for example, Leon (1979, 1982) and Brown (1968), are specifically tailored to the particular class of combinatorial objects. Those of the second type, such as McKay (1979) and Colbourn & Colbourn (1979), transform the isomorphism problem of the class of combinatorial objects into the isomorphism problem for graphs. Then they apply an algorithm for determining graph isomorphism. There are drawbacks to both types of algorithms. An algorithm specifically tailored to the class of combinatorial objects requires more time to develop as it must start from scratch. An algorithm which transforms the problem to the graph isomorphism problem either increases the complexity of the object by a polynomial factor, or forgoes utilising the specific properties of the object by applying a general-purpose graph isomorphism program. Both degrade performance. We aim to provide the best of both worlds by identifying the parts of the backtrack algorithm that are dependent on the particular class of combinatorial objects and by providing a convenient interface with the parts that are independent of the class. By this means, an algorithm for the isomorphism problem of a specific class of combinatorial objects can be quickly developed and implemented. Development can be concentrated on the class-dependent parts rather than the classindependent parts-hopefully leading to a more powerful algorithm. Reliability can be improved by the availability of error-free code for the class-independent parts. The approach to the solution of the isomorphism problem that we adopt is to determine a canonical representative, which we denote by Amaxo of the isomorphism class of the object A. Two objects, A and B, are isomorphic if and only if Amax = Bmax· The canonical representative is very useful when a large set of objects is being classified into their isomorphism classes. Instead of testing the objects pairwise for isomorphism, one only needs to determine their canonical representatives and then sort the canonical representatives. Symmetry is an important tool in pruning the search tree of the isomorphism algorithm. The automorphism group, Aut(A), of the object A represents the symmetry of A in a convenient form. Previous algorithms of McKay (1976, 1977, 1978, 1981) and Leon (1979, 1982, 1984) have used the automorphisms that the algorithm discovers to prune the search tree, but not to the fullest extent possible. We use the base change algorithm of Sims (197lb) in order to recover as much information as possible from the automorphisms that the algorithm has already found. Thus, our algorithm will sometimes prune the search tree to a greater extent than previous isomorphism algorithms, but at some overhead. The overall gain (or less) this gives is not known. However, we will
Isomorphism of Combinatorial Objects
365
discuss what is known of the implications of the base change algorithm in the relevant section. The automorphism group is a useful by-product of the isomorphism algorithm and is an invariant of the isomorphism class. Therefore it is useful in classifying objects. The information it contains about the symmetry of the object allows one to reduce the number of cases to be considered when one is investigating the structure of the object or when one is investigating extensions of the object. The remainder of the paper is set out with section 2 introducing the notation and concepts. Section 3 identifies the class-dependent and class-independent parts of the general algorithm and presents the interface between them. Section 4 is concerned with the use of automorphisms. Section 5 presents the base change algorithm. Section 6 examines the effect of the base change algorithm on the backtrack search. Section 7 presents the class-dependent part for two simple examples-graphs and latin squares. Section 8 outlines a proof of correctness of the general algorithm. When we present an algorithm we use the control structures of the language Pascal (Jensen & Wirth, 1974).
2. Basic Concepts This section discusses the two central concepts of combinatorial object and permutation, as well as the concepts associated with them and their interaction. The objects such as graphs, Hadamard matrices, and latin squares encountered in combinatorics fall into classes. A class, A(P), of combinatorial objects is determined by a defining property P, which specifies precisely those objects in the class. For example, one possible defining property for the class of all undirected labelled graphs with n vertices is
P: An object is a pair ( V, E) with V = relation.
{
1, 2, ... , n} and E c V x V a symmetric
The backtrack algorithm presented in section 3 is divided into two parts. One part is common to all classes of combinatorial objects, and the other part depends on the particular class (or, equivalently, defining property) under investigation. These are called the class-independent and class-dependent parts respectively. This paper concerns itself with a fixed, but arbitrary, class of combinatorial objects. We use the letters A and B to denote combinatorial objects in this class. In order to discuss isomorphism of combinatorial objects, there must be some notion of permutations acting on the combinatorial objects. Let n be a set and let Sn denote the symmetric group on Q. That is, Sn is the set of all permutations on Q. Permutations will always act on the right, so the image of wEn under p E Sn is denoted wP. For the action on elements of 0, We compose permutations SO that w hqjbsk) if o(q;. sk) = (qj, L) (hq,h, 11lJJbh) if o(q1, b)= (q1, L)
(7) (8)
(9) (lJaSt, lJa) (10)
(StlJah, lJah)
(11)
(hqah,q)
} for every s1 EE 1 u {b}
A configuration uq'v of M(m) is described by words of the form hbkuq'vb 1h with k, l;::::. 0, where bk and h1 represent that portion of the tape of M(m) that, although being empty now, has already been visited by the head of M(m). The rules of the form ( 1) to (8) allow T(m) to simulate M(m) step by step. Notice that when M(m) reads a tape square
containing the blank symbol "b'', then T(m) needs a rule with "h" as well as one with "h" to be able to simulate the next step of M(m). Finally, the rules of the form (9) to (11) allow T(m) to derive the letter "q" from each word describing a halting coniiguration of M(m). Now the following lemma is an easy consequence of the construction given above. LEMMA
6.1. For each wE A*, w '1'(111) H q ij' ami on/u if one ol' the }Wowing three conditions is • .T • 'J
sati~fied:
(i) w = q, or (ii) 3u,ve(E 1 u{b})*:w=huqavh,or (iii) 3 u, v E (E 1 u { b} )*, q' E Q1 - { lJa}: w
=huq'vh,
and when starting with the con-
.figuration uq'v, M(m) halts eventually. From the properties of M(m) we thus get that T(m) satisfies the following three conditions: 1. For all wE A*, w H q if and only if w = q or w ==: huq' vh for some u, v E(I: 1 u { b} )* T(lll) and q' E Q1 .
2. There exists a function gT<ml E E111 (N) such that for all wE A*, if wT(m) H q, then there exists a derivation of q from win T(m) of length i~gn 1111 (/w/). 3. For all weE*, hq 0 wh T(rll) H. q, but there is no derivation of q from hq0 wh in T(m) of length less than /A~,(w, w)/. Condition 1 shows that the special word problem for T(m) with respect to the letter q is easily decidable, while conditions 2 and 3 imply that the derivational complexity of T(m), when restricted to instances of the form (w, q), is bounded above by a function in the Grzegorczyk class E111 , but it is not bounded above by any function in the class E11,_ 1 . Finally, let S:=E 1 u{b,h} and Q:=Q 1 u{q}. Then the Tlme system T(m) can be written as T(m) = {(F;q 1, G;, H 1q12 K 1)/ i = 1, 2, ... , N}, where F1, G1, f/ 1, K 1 E S* and
q,,. lJ~z E Q.
Now the group G(m) is constructed as top of a Britton-tower of groups. Here a Brittontower is a finite sequence F0 , F 1 , . . • , Fk of groups such that for each ie{1, 2, ... , k}, F1 is an HNN-extension of F;_ 1 .
406
K. Madlcner and F. Otto
G0 = (x; ~), S 0 : = {x}, where xis a new letter;
G1 =(Go, S; SXS = x 2 (sE S)), s1: =Sou S; G2 = (G 1 , Q; ~), S 2 := S1 u Q;
G3 = (G 2 , R; P;F1q11 G/ 1 = H1q1,K;, r;sxr 1 = sx (se S, i = 1, 2, ... , N)), S3 : = S2 u R, where R = {r 1, r 2, ... , rN} is a new alphabet, and -: S*- S* is the homomorphism induced by s - t s for all s E S;
Irt = r (reR)), s4 := s3 u {t}; G 5 = ( G4 , k; kak = a (a E Rx u {qtq} )), S 5 : = S4 u {k }, Rx: = R u {x}.
G4 = (G3, t; txt=
X,
Finally, we take the group G5 for G(m). For i= 1,2, ... , 5, G1 is written as an HNN-extension of G1 _ following result holds.
1,
and m fact, the
THEOREM 6.2 (Rotman, 1984). For all ie{1, 2, ... , 5}, G1 is an HNN-extension of G1_ 1
with stable letters and associated subgroups according to the presentations given above. The construction given above "embeds" the monoid presented by (S u Q; T(m)) in the group G(m). Since the special word problem for T(m) with respect to the letter q is easily decidable, the results of A venhaus & Madlener (1977, 1978a) imply the following. THEOREM 6.3 (Avenhaus & Madlener, 1977, 1978a). The intrinsic complexity of the word problem for G(m) is bounded above by afimction in the Grzegorczyk class E 2 , and therewith, this
problem is decidable in polynomial time. It remains to investigate the derivational complexity of G(m). We will do so by exploiting the results presented in the previous section. According to the definition given in section 4 the group-presentation (S 0 ; 0) stands for the monoid-presentation (S 0 ; T0 ), where T0 = {(xx, e), (xx, e)}. Obviously, the derivational complexity 10 of this presentation satisfies 10 (w)::::; \w\/2 for all wE S~. Hence, the derivational complexity of the group G0 is bounded above by a function in the Grzegorczyk class E0 • In fact, for every free group F the derivational complexity is bounded above by a function in the Grzegorczyk class E0 • Here a group F is a free group, if it has a presentation of the form (f; ~). The function p : r* -t r* that cancels all occurrences of the words ss and ss (s E r) is called the free reduction on r. It is not hard to see that p E E 1 (r). The subgroups (x) and (x 2 ) of G0 are easily decidable, and the free reduction on S 0 is a rewriting function for (x) as well as for (x 2 ). Further, G 2 is the free product of the group G 1 and the free group generated by Q. Hence, the remarks above together with Corollaries 5.3 and 5.8 imply the following. LEMMA 6.4. The derivational complexities of G1 and G2 are bounded above by functions in the Grzegorczyk class E 3 . According to Avenhaus & Madlener (1977, 1978a; Lemmas 4.2 and 4.3) the subgroups (A 1) and (B1) of G2 that are generated by A,.:={F1 q 11 G;,sx(seS)} and B1 := {H 1%K 1, sx (sES)}, respectively, are E 3 -decidable, and there exist' rewriting
Algorithms for Monoids and Groups
407
functions for these subgroups that are bounded above by linear functions. Thus, we get the following from Corollary 5.8. 6.5. The derivational complexity of G3 is bounded above by a function in the Grzegorczyk class E 3 .
LEMMA
Our next goal is to prove that also the derivational complexity of the group G4 is bounded above by a function in the Grzegorczyk class E 3 • By Corollary 5.8 it is sufficient to show that the subgroup (Rx) of G3 generated by the set Rx = R u {x} is £ 3 -decidable, and that there exists a rewriting function r E EiS 3) for this subgroup. In order to do so we need additional information on the structure of the group G3 , which we will derive in the following. Let D1 = (R,,; 0), and let D2 == (D 1 , S; sxs== x 2 , srs = xrx (reR, seS)), where RandS are the corresponding alphabets defined above. LEMMA
6.6. The group D2 is an E3 -admissible HNN-extension of D1 with stable letters S.
The subgroups (A) and (B) of D1 generated by the sets A:= Rx and B:= {x , xrxlreR}, respectively, are easily decidable, and the free reduction is a rewriting function for (A). By using the free reduction also a linearly bounded rewriting function for (B) can be constructed. Hence, the isomorphism¢: (A) - t (B) and its inverse can be realized by linearly bounded functions. PROOF.
2
Since the word problem for the free group D1 is easily decidable, Lemma 6.6 implies that there exists an $-reduction function PD 2 ,sEE 3 (Su R_,) for D2 .
6. 7. The group D2 is an E3 -admissible H N N-extension of the group G1 with stable letters R. LEMMA
By using Tietze transformations (Magnus, Karrass & Solitar, 1976) the given presentation of D 2 can be transformed into (x,S,R;sxs=x 2 ,rsxr==sx(SeS,reR)). The subgroups (A) and (B) ofG 1 generated by A:={sxlseS} and B:={s.XIsES} are freely generated by these sets (Rotman, 1984, Corollary 13.11, p. 365). Since there is an $-reduction function Pa,.sE E 3 (S 1 ) for G1 , it is straightforward to prove that the subgroups (A) and (B) of G 1 are £ 3 -decidable, and that the isomorphism¢: (A) - t (B) and its inverse can be realized by linearly bounded functions. PROOF.
Thus, there exists an R-reduction function PDz, R E E 3 (S u Rx) for D2 . For the following lemma we need a slight generalization of the operation of HNN-extension. So let G = (1:; L), let P = {p;/ i E I} be a set of additional letters, and let A={u1 /jeJ} and B={vNeJ} be two subsets of l:* such that the mapping ¢(u1): v1 (j E J) induces an isomorphism between the subgroups (A) and (B) of G. Further, let a, p: J - t I be two mappings such that p = p' holds for all p, p' E P, where K is
=
K
the group given through the presentation (P; {PauJPPUl/j E J} ). Then the generalized H N N -extension G* of G relative to (A), (B) and ¢ with stable letters P is the group given through the presentation (1: u P; L u {Paul u1ppUJ v1- 1 /j E J} ). So instead of a single stable letter, G* contains a set of stable letters all interacting with the subgroups (A) and (B) of G. Obviously, by applying the mapping s-ts (se.l:) and
408
K. Madlener and F. Otto
P;--+ p (p; E P) to G*, we get an HNN-extension of G with stable letter p and associated subgroups (A) and (B). Actually, the definition given above is a special case of the definition of generalized HNN-extension as given by Miller (1971). LEMMA 6.8.
The group G3 is a generalized H N N-extension of the group D2 with stable
letters Q. PROOF.
The group G3 is also given through the presentation
(x, S, R, Q; sxs = x 2 , srs = xrx (re R, s E S), i'Ji)'1- 1 r;H 1% = G;r;K;- 1 (1 ~ i ~ N)). Let K be the group given through the presentation ( Q; {ij;, q1,/I ~ i ~ N}). Since the Thue system T(m) = {(F 1q1, G;, H 1q12 K;) i = 1, 2, ... , N} satisfies w 1
WE
rf:,l q for all
{IJ} · (1: 1 U {b})* · Q1 · (1: 1 U {b})*" {h},
the "state" q can be reached from each "state" q' E Q1 u {q} = Q. Thus, we have p = p' K
for all p, p' E Q. Now consider the subgroups (A) and (B) of D2 that are generated by the sets A={F1- 1r 1H;/i=1,2, ... ,N} and B={G 1r 1K1- 1 /i=1,2, ... ,N}, respectively. Obviously, a word we(AuA- 1 )*, where A- 1 ={u- 1 jueA}, is reduced with respect to the stable letters R of D2 if and only if w is freely reduced over A u A- 1 • Hence, the subgroup (A) of D2 is freely generated by A. Analogously, the subgroup (B) of D 2 is freely generated by B. Thus, the mapping ¢(F1- 1 r1H;): G1r1K 1- 1 (i = 1, 2, ... , N) induces an isomorphism between these subgroups, and so G3 is indeed a generalized HNN-extension of the group D 2 with stable letters Q.
=
Since there is an R-reduction function PD,,Re E 3 (S u R.J for D 2 , the subgroups (A) and (B) of D2 are £ 3 -decidable, and the isomorphism of G4-. By Corollary 5.8 this upper bound induces an upper bound for the derivational complexity of the group G(m). LEMMA
6.11. The derivatiollal complexity of the group G(m) is bounded above by a jimction
in the Grzegol'czyk class E,..
Algorithms for Monoids and Groups
411
In particular, this implies the following. CoROLLARY
6.12. The word problem/or G(m) can be solved by a pseudo-natural algorithm,
which is in the Grzegorczyk class E,. We now complete the proof of Theorem 4.1 by establishing the lower bound for the derivational complexity of the group G(m). 6.13. The derivational complexity of the group G(m) is not bounded above by any function in the Grzegorczyk class E111 _ 1 . LEMMA
Assume to the contrary that there exists a function g E E111 - 1 (N) such that / 5 (w) ~ g(lwl) for all words wE S~. Here /5 denotes the derivational complexity of the presentation (S 5 ;L 5 ) given for G(m). Recall that S 5 =={x}uSuQuRu{t,k}, where S = L 1 u {b, h}, Q= Q 1 u {q} and L s; L 1• Let wE L*. Then according to the construction of the Th ue system T(m) we have PROOF.
hq 0 wh:.., q, and hence by Rotman (1984, Lemma 13.8), the word T(m) --
1
-
-
1
-
y:=khw- q0 hthq 0 whkhw- q0 lifhq 0 wh satisfies y = e. Thus, e can be derived from yin (S 5 ; L 5 ), and 15 (y) ~ g(lyl). Let 1: = l 5 (y), G(m) and let y=w 0 +-tW 1 +-t ••• +-*w1 =e be a shortest derivation of e from yin (S 5 ;L 5 ). During this derivation the occurrences of the letters k and k in y must be cancelled out. The
only
way
of
doing this is by using the relations from the set {(kaka- ,e)jaeR,,u{Zjtq}}. Hence, the subword z:=hw- 1 Zj 0 hthq 0 wh of y must be transformed into a word u E (Rx u {qtq, Zjtq} )*, i.e. there are words Vt. v2 E R~ such that z = v1 Zjtqv 2 , which in turn implies that z= v1 qtqv 2 • Obviously, once the first letters of v1 G(nzl a. _ have been generated, relations involving occurrences of the letter k can be applied. However, by changing the order of applications of relations if necessary, we may assume without loss of generality that wj = kv 1 qtqv 2 kz- 1 for some j E {1, 2, ... , 1-1 }. Since z = v1 qtqv 2 , we have a. v1 1 liw- 1 Zj 0 hthq 0 whvi 1 Zjfq v1 1 zv; 1Zjtq a. =e. Thus, the word thq 0 whv; 1 qt must be a t-pinch, i.e. there is a word v3 E R~ satisfying hq 0 whv2 1 ij = v 3 . This in turn implies that v3" 1 hq0 whv2 1 = q. According to Rotman ( 1984, al al Lemma 13.14), this means that the word TIR(v2 1), where Tia:S~--+R* denotes the projection from S~ onto R*, describes a derivation of q from hq 0 wh in T(m). Thus, we can conclude that IA;(w, w)l ~ lrcml(hqo wh, q) ~ ITIR(v2)1 ~ lv2l· 1
=
Hence, within j ~ /- 1 < g(l yl) = g( 4 ·lwl + 16) steps, the word
wj
of length
lwJI > lv2l:;;: IA;,(w, w)l has been derived from the word y, which is of length lyl = 4 ·lwl + 16. Obviously, this contradicts our assumption that g E Em_ 1(N). Again this proof clearly indicates how the lower bound for the derivational complexity of the Thue system T(m) induces a lower bound for the derivational complexity of the group G(m). Combining all our results obtained in this section we get the following.
4 I2
K. Madlener and F. Otto
6.14. For every m:;;: 3, there exists a finitely presented group G(m) the following conditions:
CoROLLARY
sati~f'ying
(a) The intrinsic complexity of the word problemfor G(m) is bounded above by afimction in the Grzegorczyk class E 2 • (b) The word problem for G(m) can be solved by a pseudo-natural algorithm in the Grzegorczyk class E,, but no pseudo-natural algorithm fn the class E111 _ 1 can solve this problem.
7. Proof of the Embedding Theorem To complete this paper it remains to prove Theorem 4.2 and Theorem 4.3. Actually Theorem 4.2 is an easy consequence of Theorems 4.1 and 4.3. So after establishing this fact we will turn to the proof of the Embedding Theorem (Theorem 4.3). 4.2. For every n, mEN with 3 ~ n < m, there exists a .finitely presented group G(n, m) satisfying the following conditions:
THEOREM
(a) The intrinsic complexity of the word problem for G(n, m) is bounded above by a function in the Grzegorczyk class E11 • (b) The intrinsic complexity of the word problem for G(n, m) is not bounded above by any function in the Grzegorczyk class E11 - 1 . (c) The derivational complexity of G(n, m) is bounded above by a function in the Grzegorczyk class Em. (d) The derivational complexity of G(n, m) is not bounded above by any jimction in the Grzegorczyk class Em_ 1 • Let n, mEN with 3 :::;:; n < m. According to Theorem 4.1 there exists a finitely presented group G1 = (L 1 ; L 1 ) such that the word problem for G1 is E 2 -decidable, while the derivational complexity of G1 is bounded above only by a function in the Grzegorczyk class Em, but by no function in the class Em- 1 . In addition, the results of Avenhaus & Madlener (1977, 1978a) imply that there exists a finitely presented group H = (.1; M) such that the intrinsic complexity of the word problem for His bounded above only by a function in the class E 11 , but by no function in the class E,,_ 1 , Now the Embedding Theorem yields that the group H is E11 -embedded, via a renaming qJ of its generators, in a finitely presented group G2 = (L 2 ; L 2 ) such that the intrinsic complexity of the word problem for G2 and the derivational complexity of G2 are bounded above by functions in the Grzegorczyk class E11 • In particular, we have w = e if and only if qJ(w) = e for all words wE A*. Since as a renaming of the letters of LlqJ fs easily computable, Gthis shows that the word problem for H is easily reducible to the word problem for G2 • Thus, with the intrinsic complexity of the word problem for H, also the intrinsic complexity of the word problem for G2 is bounded above by no function in the Grzegorczyk class E 11 _ 1 . Now let G(n, m) be the free product G1 * G2 of G1 and G2 . Then G(n, m) is finitely presented, and the intrinsic complexity of the word problem for G(n, m) is bounded above by a function in the Grzegorczyk class £ 11 , but it is not bounded above by any function in the class £ 11 _ 1 , By Corollary 5.3 the derivational complexity of G(n, m) is bounded above by a function in the class £,11 , and since the derivational complexity of G1 is not bounded above by any function in the class Em_ 1 , neither is the derivational complexity of G(n, m). PROOF.
Algorithms f'ol' Monoids and Groups
4!3
Now we turn to the proof of Theorem 4.3. THEOREM 4.3 (Embedding Theorem). Let n ~ 3. Then .for each finitely generated group G with an E11 -decidable word problem, there exists a finitely presented group H satisfying the .foil owing conditions:
(a) The word problem .for H is E11 -decidable. (b) 171e derivational complexity of H is bounded above by a fimction in the Grzegorczyk class E,.. (c) G is E,.-embedded in H via a renaming of its generators. The proof of Theorem 4.3 is divided into a whole sequence of lemmas. For the remainder of this section let n denote a fixed integer satisfying n ~ 3, and let G =(I:; L) denote a fixed finitely generated group with an E11-decidable word problem. Without loss of generality we may assume that L = {wE I:* Iw = e}. Then the set Lis E,'"decidable, and G the derivational complexity lL of the presentation (I:; L) satisfies 1L(w)::::; I for all words wei:.*. Now lett be another alphabet in 1-to-1 correspondence withE satisfying tn I:=~, and let I:: 0 =I: u t. Deflne a homomorphism