<<

ALGEBRAIC SIMPLIFICATION A GUIDE FOR THE PERPLEXED

by Joel Moses

Project MAC, MIT

Abstract and efficiency, a requirement which translates to a desire for a uniform representation of Algebraic simplification is examined first expressions utilizing a minimum number of from the point of view of a user needing to functions. Users tolerate, and in fact prefer, comprehend a large expression, and second from a certain amount of redundancy in an answer. the point of view of a designer who wants to For example, they usually desire to see expres- construct a useful and efficient system. sions containing the twelve trigonometric and First we describe various techniques akin to hyperbolic functions. Designers would prefer substitution. These techniques can be used to giving a user only the exponentials, sines and decrease the size of an expression and make it cosines, or just exponentials with both real more intelligible to a user. Then we deline- and complex arguments, or nothing but rational ate the spectrum of approaches to the design fuDctions. of automatic simplification capabilities in an There is one property of simplification algebraic manipulation system. Systems are about which both users and designers can agre~ divided into five types. Each type provides That is, that simplification changes only the different facilities for the manipulation and form or representation of an expression, but simplification of expressions. Finally we not its value. Changes of representation discuss some of the theoretical results relat~ occur in many problem solving domains. In ed to algebraic simplification. We describe fact, in the field of Artificial Intelligence several positive results about the existence one speaks of the Problem of Representation of powerful simplification algorithms and the which can be stated roughly as "how does one number-theoretic conjectures on which they transform the statement of the problem into a rely. Results about the non-existence of form which is more readily solved." Thus an algorithms for certain classes of expressions ideal, but not very helpful, way to describe are included. simplification is that it is the process which transforms expressions into a form with which Table of Contents the remaining steps of the problem can be taken most efficiently. 1.0 Introduction The Problem of Representation for alge- 2.0 Simplification for the Sake of braic expressions is especially acute because Comprehension - The Needs of Users there are so many equivalent ways to represent 2.1 Conventional Lexicographic Ordering an expression. Frequently one of these of Expressions equivalent forms is much more useful than an- 2.2 Substitution as an Aid to Comprehen- other, and just as frequently, it is a non- sion trivial problem to recognize the equivalence. 3.0 Simplification for the Sake of Effic- For example, it is rare that we do not want to ient Manipulation - What Designers Provide recognize that an expression is equivalent to 3.1 The Politics of Simplification 0. However, many of us have difficulty in 3.1.1 The Radicals recognizing the following identities. 3.1.2 The New Left 3.1.3 The Liberals log(e 2x + 2e x + i) - 2 log(e x + i) = 0 3.1.4 The Conservatives 3.1.5 The Catholics or 3.2 Intermediate Expression Swell 3.3 Canonical Simplifiers and Theoretical (21/3 + 41/3) 3 - 6(21/3 + 41/3 ) - 6 = 0 Results - The Radicals Revisited 3.3.1 Simplification Algorithms for or Expressions with Nested Exponentials 3.3.2 Expressions involving Exponen- log tan(~ + 7) - sinh -I tan x = 0 tials and Logarithms 3.3.3 Roots of Polynomials Consider how much more difficult the problems 3.3.4 Unsolvability Results become when we deal with expressions which are 4.0 Prospects for the Future several pages long. Yet expressions of such References size are quite common in algebraic manipula- Figures tion! An additional difficulty is that the usual manipulatory algorithms can easily 1.0 Introduction magnify a bad choice of representation. For example, the derivative of a product of n Simplification is the most pervasive pro- factors can be a sum of n terms each of n or cess in algebraic manipulation. It is also more factors. Thus a bad representation of the most controversial. Much of the contro- the product or one of its factors is propaga- versy is due to the difference between the ted and magnified n-fold. desires of a user and those of a system design- Another issue which arises in discussions er. The user wants expressions which he can of simplification is related to the local or comprehend, a requirement which usually means global nature of the problem. If expression that the expressions presented to the user A is deemed simpler than its equivalent should be small. The designer wants expres- expression B in one context, then is A to be sions which can be manipulated with great ease considered simpler than B in every context?

Z82 A perfectly strict answer is no. For example, concentrate in section 2 on the users' need for comprehension of expressions, and then in x 7 section 3 on the designers' facilities for 12 manipulating expressions. x + 1 In discussing simplification for the sake of comprehension, we shall describe the is a more compact representation of the ration- technique of substituting labels for subexpres- al it represents than sions in simplifying large expressions. We shall also describe principles of conventional i/4(4x3)x 4 lexicographic ordering of expressions. A (x4) 3 + 1 system can hinder the comprehension of a user by displaying expressions in unconventional The former is usually easier to manipulate and order. Unfortunately, no current system pays comprehend. However, when integrating, the sufficient heed to this point. latter expression indicates a p@ttern which In section 3 we describe five different suggests the substitution y = x ~ which yields approaches to the design of simplification facilities in algebraic manipulation systems. f dy , We describe the facilities which are usually y3+l offered, and indicate the advantages and disadvantages in them. The section ends with a much simpler integration problem than that a discussion of very powerful algorithms based which is posed by the first expression. on formalizations of the concepts of simplifi- Designers would prefer a system in which the cation. simplification steps are the same in every context. Users clearly would prefer a system 2.0 Simplification for the Sake of Compreq which could take contextual information into hension - The Needs of Users account in deriving a simplified expression. Designers can take comfort in the fact that One of the most common complaints of while the simplified form of an expression is users of algebraic manipulation systems is that not the same in every context, it is so in the expressions obtained as results of a calcu- many contexts. Nonetheless, the task of deriv- lation are incomprehensible and therefore ing a compromise between the wishes of users essentially useless. In order to understand and the requirements of an efficient system is the importance of such a complaint we have to likely to keep designers talking to themselves differentiate between two major classes of and to each other for quite some time. users. Some users are only interested in the A related aspect of simplification is the value of a calculation. For example, those extent to which the concept can be formalized. who use symbolic differentiation as a step in The point that we made above is that the simp- a numerical calculation do not care very much lest form of an expression depends on one's about the form of the symbolic derivative.! goals or, in other words, on the context. One For such users the problem of simplification would be hard put to formalize the goals of reduces to keeping the intermediate expressions all potential users. However, one can obtain in a calculation in such a form as to optimize theoretical results for simplification algo- the use of space and time in the calculation. rithms which have usef,11 properties. One such We do not wish to underestimate the difficulties property is that the algorithm simplifies to in the simplification problem for such users. zero any expression equivalent to 0. A stron- However, in this section we will be mainly ger property is that the simplifier reduces concerned with the needs of users who do care all equivalent expressions to a single (canon- about the form of expressions which result from ical) expression. a symbolic calculation. Historically, simplification was required The latter class of users include those in algebraic manipulation systems because the who need to make "physical sense" of an expres- manipulatory algorithms produced sloppy results, sion. Perhaps such a user is studying a pro- For example, the unsimplified result of cess and wants to learn about some property of differentiating the process by symbolically manipulating a model of it. For example, he might be inter- 2 ested in the manner in which the value of an X ax + xe expression varies as one of its variables increases in value. He could, of course, plot with respect to x is an expression such as the value of the expression for several values 2 2 of the variables, but this method may not be 0.x + a.l + l.e x + x-e x -2-x very useful if-there are many variables in the expression. Other users might need to examine Simplifying the derivative above would yield an expression in order to know what the next an expression like manipulatory step should be. A simple instance of such a situation occurs when the next step a + e x2 + 2x 2 e x2 in the calculation depends on whether the expression is linear or quadratic in a given With the ever growing use of algebraic manipu~ variable. lation, it has become increasingly apparent It should be clear that a user is likely that simplification plays a much more complex to comprehend and to answer questions about a role in the way one solves problems with an small expression a lot better than about an algebraic manipulating system. In the remaind- equivalent, but larger one. Thus, a goal of er of this paper our discussion of simplifica- I. Such users should care a little about the tion will range from mundane topics (such as form of the derivative because some forms of whether one writes x+a or a+x) to sublime ones expressions yield a smaller round-off error in (whether e+~ is a rational number). We shall a numerical calculation than other forms. 283 simplification should be to produce small section will be devoted to describing such expressions. In fact, most of the usual machinery. simplification transformations such as collect- A major reason why computers are not as ing terms in sums (x + 2x ~ 3x), collecting good as human users in simplifying an expres- exponents in products sion is that they lack knowledge of the con- text in which the expression was d~rived. To (xy 2 ~1 4 y2) , a physicist subexpressions like mc ~ contain a good deal of information not apparent to an removing 0 terms in sums (x + 0 4 x), and algebraic manipulation system. For example, factors of 1 in products (l-X ~ x), produce a physicist might be tempted to substitute E smaller expressions. In fact, transformations for mc ~ in order to reduce the size of the which produce larger expressions (e.g., expand- expression without destroying its information ing powers of sums content to him. In fact, the major technique for simplifying large expressions is the (x + 1) 3 4 x 3 + 3x 2 + 3x + i) substitution of small expressions (preferably single literals) for large subexpressions are controversial. Many systems will employ which either occur frequently or possess some such transformations only if the user specif- meaning. We shall examine this technique in ically demands them. section 2.2. Of course the prevalence in algebraic Working with an algebraic manipulation manipulation systems of simplification trans- system can frequently be annoying because such formations which produce smaller expressions systems do not display expressions in the way is due mostly to the fact that small expres- to which the user has become accustomed. A sions are usually easier to manipulate than user who is presented with a quadratic in x larger ones. This is an instance where the written as c + x-a + bx is not only annoyed, needs of simplification for the sake of improv- but is incapable of understanding such ed comprehension and simplification for the expressions as well as those written in a more sake of efficient manipulation coincide. conventional form. In section 2.1 we present However, the requirements of simplification an attempt to model the rules which govern the for the sake of comprehension are more subtle conventional ordering of expressions. than we just indicated. It is not so much the small size of the expression which aids in 2.1 Conventional Lexicographic Ordering of comprehension, as the small size of a descrip- Expressions eion of the expression. For example: As noted above, most systems do not make 1 + 2x + 3x 2 + 4x 3 + ... + llx I0 a very satisfying attempt to produce expres- sions in a conventionally ordered form. is a lot less complex for many purposes than Fenichel's FAMOUS [ 14], and PL/i FORMAC [ 44] make some attempt to supply conventional lexi- 1 + 3x + 4x 2 + x 3 - 9x 4 + 5x 5 + x 6 + 2x 7 cographic ordering. However, each system provides an incomplete solution to the problem because one can supply a small description of We have also not encountered in the mathemati- the former (i.e., cal literature an analysis of what constitutes conventional ordering of expressions. The i0 rules that people implicitly use are apparent- E (i+l)x I ) , ly not hard and fast ones. For example, i=0 x + e x seems not much preferable to e x + x. In addition, context plays a role in modifying but not of the latter. The way one usually very strongly held views about ordering of obtains a small description is by recognizing expressions. One writes am rather than ma a repeated pattern in an expression. Unfortun- except in cases like F = ma in which m is ately, computer programs nowadays are not as 2 relatively constant and a varies. good as humans at recognizing useful patterns . We believe that systems should make great- Furthermore, many descriptions which are of er effort to avoid highly unconventional and value to humans are incomplete descriptions therefore confusing ordering of expressions of an expression (e.g., the expression has f's such as in sin(-x + 1)/2. The following whenever a y occurs except for the first term). discussion is presented with that goal in mind. Most programs are unable to deal with incom- We do not claim that our discussion of lexico ~ plete descriptions. Both of these drawbacks graphic ordering is complete, or that a rather mean that we have to depend on the user to different set of rules and principles would obtain a description for his own use. The not serve equally well to describe convention- process of "massaging an expression" which al mathematical notation. If we have done our people use in pencil-and-paper calculations, job well, the reader will not find many sur- can be characterized as a trial-and-error prises in our analysis. attempt to decrease the size of an expression Difficulties in ordering expressions and to transform it into a form for which a arise when one deals with commutative opera- short description is apparent. As we have tions. The sole commutative operators in most remarked, it is not possible now to fully algebraic manipulation systems are PLUS and automate this massaging process. Rather, it TIMES. As a first approximation, the follow- should be the goal of a good system to provide ing principles apply to ordering terms in a machinery which will aid the user in his sum and factors in a product. massaging efforts. The remainder of this Principle for ordering products: Factors increase in complexity in a left-to-right 2. An exception to this rule are programs to scan. recognize the next number in a sequence [ 1 ]. Examples: 2xe x, 2x2y3sin(y) Such programs would, in fact, recognize the pattern in the former expression. 28.4 Principle for ordering sums: Terms read: any function of a given variable, say x, decrease in compiexity in a left-to-right scan. is less complex than any expression containing Examples: 3x 2 + 5x - 6, 2x 2 - 3ax + a + 1 a variable more complex than x. Using the latter convention, the above example would be The principles stated above beg a defin- written ition of complexity. A handle on such a 2 x definition is obtained by classifying expres- x e y sin y. sions into three groups: constants, variables, and functions. Constan%s are less complex Expressions which are more involved than than variables which are in turn less complex the ones we have been examining up to now can than functions of variables. Simple constants be ranked by a recursive test on their most are either numbers or literals, with numbers complex subexpressions. We do not wish to less complex than literals (e.g., 2a, (3/2)~, give a detailed discussion of such a ranking a + 1.4). Functions of simple constants are procedure because there does not seem to be more complex than constants (e.g., 3/2, 3~ea), strong feeling about the ordering of very but less complex than variables (e.g., a3/2x). large or involved expressions except when The usual convention regarding literal patterns clearly appear among the subexpres- constants and variables is that constants sions (e.g., polynomials, power series, Fourier occur early in the alphabet (e.g., a, b, c) series). Most of the common situations should and variables late in the alphabet (e.g., x, be handled correctly by a recursive ranking y, z). Letters in the middle of the alphabet procedure, but the ordering of some expressions play many roles, (e.g., f frequently represents would involve global pattern recognition which a function, and n an integer) but they can be is beyond the capabilities of existing alge- considered, for our purposes, to be intermedi- braic manipulation systems (e.g., ate between constants and variables. Within 1 each class (i.e., constants, intermediates, (a + b)(a + ½b)(a + ~b)(a + ~b) ). and variables) alphabetic ordering appears to determine the complexity. In products, liter- There are additional conventions for als early in the alphabet in each class have ordering expressions which algebraic manipula- the lowest complexity rank. This means that tion systems should follow. One rule involves literals in a product are ordered purely eliminating the leading minus sign in a sum. alphabetically (e.g., abxz, 2amn). The com- Thus given an expression of the form-A + B plexity rank within each class is reversed in one reverses the terms to eliminate the lead- sums. Thus we get x + y rather than y + x, ing minus sign (e.g., 1 - 2x rather than and x + a + b rather than x + b + a. In sums, -2x + i, y - x rather than -x + y). One moreover, the class rank is not adhered to could conceivably extend the rule to include very strictly. Thus, we frequently see sums with two or more terms, but the force of a + b + x rather than x + a + b or 1 + x - y the rule seems to diminish considerably with rather than x - y + i. Since attitudes about an increase in the number of terms (e.g., ordering of products are more strictly held -3x + 4y + 5z rather than 4y - 3x + 5z or than those about sums, we shall confine most 5z + 4y - 3x or 4y + 5z - 3x). of our examples to products. Conventional notation tends to avoid Functions of variables are more complex the use of parentheses in functions of a single than the variables themselves. However, in argument (e.g., sin x, log 2). As a result of products, positive integral powers of an this convention and also in order to avoid expression A possess the same rank as A (e.g., confusion with the scope of special signs such as the square-root, integral and summation 2 2 x y, x sln x). sign, one sometimes reverses the normal order (e.g., 2i/2 rather than 2/2 i, 3y sin a rather In sums, a term having a higher exponent of than 3 sin(a)y). This convention is not the most complex factor of an expression is crucial for algebraic manipulation systems ranked higher than that expression, but since such systems rarely display expressions possesses the same rank relative to different with ambiguous scopes of functions or signs. expressions (e.g., The constant ~ has lower rank in prod- ucts than literals which represent angles 3x 2 + 2x, x sin2x + x sin x). (e.g., 2~8 rather than 28~). However, expres- sions which evaluate to integers or rational One could rank the complexity of the usual numbers rank lower than ~ (e.g., functions 3, but surely any such ranking must 3n+l. ,3n+l, be somewhat arbitrary. It seems that sin x --~---~ rather than ~t-~---) ). cos x is preferable to cos x sin x, but is sin x log x preferable to log x sin x? Few constants lead the charmed life of ~ as Because of our grouping convention, pos- exemplified by the expression 2n~i8. itive integer powers of variables are ranked Frequently, certain literals are used lower than any other functions of variables as implicit functions of other variables. (e.g., Such literals should be ranked as functions. This convention accounts for the subexpression 2 x x ye sln y). y + x + 1 in y' + y + x + 1 = 0. Some systems allow users to declare We believe that this is a better model of con- dependencies such as that of y on x in the ventional notation than an extension of the expression above. One should extend this alphabetic ranking of variables which would machinery to allow users to override the conventional classification of literals. By 3. In PL/i FORMAC [44], the following ranking declaring m constant and a variable, one would is employed in products; eX< erf(x)< log(x) < be able to--obtain the usual formula F=ma. sin(x)< cos(x)< atan(x)< sinh(x)< cosh(x) < Our final remark about conventional atanh(x) < x! ordering regards instances of general patterns. 285 If one is given a general pattern of certain which have been delayed). expressions, such as a + bi for complex A non-artificial example of the use of numbers, then instances of that pattern will substitutions which is borrowed from Hearn follow the order given in the pattern, rather [19 ] is given in figure 2. than the usual rules (e.g., -i + i rather than A technical problem arises when one i - i). Systems should accommodate definitions makes substitutions for expressions other than of such patterns. atomic or literal ones. Consider the problem of substituting a for xy 2 in the expression 2.2 Substitution as an Aid to Comprehension 23 x y . Many symbolic calculations take the following form: One starts with some equations Some possible results of this substitution are such as 23 i) xy y = g (x) 2 ) axy z = h(x) 3) a2/y. f = x 2 + y2 + z 2 One cannot say that there is a "correct" answer, because what is appropriate in one and expressions such as context need not be appropriate in another. 5 i However, no system, until recently, gave the E: ~ c.x user much choice in the result of substitution. i=0 The REDUCE system of Hearn [18 ], has a good Later one substitutes such equations and deal of machinery for making substitutions, expressions into another expression such as but it does not give the user much control over the effects of its substitutions. 51~ 2 + 2E 2 Fateman [26 ] has recently arrived at the following analysis of the problem. For simp- f3 licity, we shall make the analysis for poly- nomials, but it can be easily extended to more Then one attempts to simplify the expres- complex expressions. sion which results. In this section we are Let us suppose we are trying to substi- interested in the process of making intellig- tute A for B in C. We shall consider C to be ible large expressions such as the one which represented as would result if we performed the substitutions and carried out the derivatives and expansions n Bi in the expression above. Frequently, the process of simplifying i=0 large expressions involves a reversal of the process which led to the expression above. Thus the substitution will yield That is, one substitutes small expressions (usually literals) for large subexpressions n i which occur more than once in the expression. c~iA The literals being substituted into the i=0 expression act as names or labels for the expressions that they replace. This is the This representation of C is nonunique. We same function that f, y, and z had in forming can make the representation precise by impos- the expression above. ing constraints on the coefficients ~i. Let An artificial example which points out us assume that the variables in B are ranked the value of substitution to the comprehension in some way. Fateman's substitution programs of an expression occurs in [ 41]. The example usually provide that the degree of the main shows how to obtain a compact description of variable of B is lower in each ~i than in B the matrix in figure i. We obtain a hierarchi- itself. In addition, one can restrict the cal description by recognizing patterns in the coefficients to i) not contain a sum, 2) be matrix and patterns in the matrix of literals polynomials (and not rational), and 3) have that we substituted, etc. We finally reduce lower degree in all of the variables of B than the 64 characters in the original matrix to the degree of those variables in B. 35 characters in the final matrix and all the By varying these and other conditions, associated equations. However, the hierarchi- and by modifying the ranking of the variables, cal description seems to make the simplified one can get a variety of results. One can result much clearer than is implied by the then choose that result which seems most use- ratio 35/64. ful in the computation. The process of finding those subexpres- Some examples of substitution made with sions which are good to replace usually Fateman's routines are given in figure 3. In involves some trial and error. It is useful each case we substitute A for B in C. to replace subexpressions which have some The ability of Fateman's routines to meaning in the context of the problem. In obtain the results in the last four examples such cases we need not require that the sub- is due to the technique of continually divid- expressions being replaced occur more than ing C by B. The last two examples indicate once in the expression. Beyond such general- how this substitution mechanism provides for ities, there does not seem to be much one can the application of the oft-discussed trans- say at present which is frequently useful in formation the massaging process for large expressions. We should note that one often combines sub- sin2(x) + cos2(x) -- I. stitution with other manipulations (e.g., carrying out expansions or differentiations z86 One of the most popular uses of substitu- does not decrease the size of an expression. tion occurs in the differentiation of products. However, it affords a simple way of breaking This kind of substitution really addresses up the large problem of analyzing the whole itself to the problem of decreasing the size expression into a number of smaller problems. of an expression during a computation. How- Success with this technique depends on clever ever, the techniques used can effect an in- decompositions of an expression. Automatic crease in the intelligibility of the final ex- routines for introducing labels into expres- pression. Moreover, these techniques are of sions by Baker [43 ] and Martin [ 24 ] cannot a fairly general nature, and can be used to be considered great successes. At the present improve intelligibility in other cases. time, we require an interacting user to break Consider the general form of the first the expression up into chunks which he can derivative of a product of four factors f, g, conveniently manage and usefully comprehend. h, k: 3.0 Simplification for the Sake of Manipula- (fghk)' = f'ghk + fg'hk + fgh'k + fghk' tion - What Designers Provide

In the general form f, g, h, and k each appear 3.1.0 The Politics of Simplification three times. In certain cases the general form will simplify because f', g', h' or k' Simplification is such a central issue in may be 0. Frequently this situation will not algebraic manipulation that when a designer occur. In cases where f, g, h, and k are has decided how he will represent expressions, complex expressions, considerable savings in what changes of representation his system will space will result if we use labels for the perform automatically, which of these auto- factors which would appear in the derivative. matic transformations he will let the user A disadvantage of labelling the factors is override and modify, and what additional that some simplifications which would occur facilities for simplifying expressions his due to the presence of the factor in the ex- system will have, there are few major decis- pression would not occur when its label is ions remaining. As a result~ one can classify used. For example, the difference of a label algebraic manipulation systems by their and the expression it is labelling is not approach to simplification. zero. Four years ago, when we last surveyed the Problems arise when we have to take der- scene [29 ], we classified algebraic manipula- ivatives of labelled expressions. We can use tion systems into three categories: conserva- the strategy of not evaluating all derivatives tives, liberals, and radicals. In the mean- of labels until some later time. We might time, there has been a slight change in the wish to evaluate certain derivatives of labels characteristics of some systems, and the whenever they occur by replacing the labels characteristics of other systems have stabil- by the expressions they represent. Clearly, ized sufficiently so that we now claim the several strategies are possible. A technical entry of two new parties, namely, the new left problem here involves the ability of a and the catholics. system to produce the labelled expressions on The classification that we make of sys- demand. This can be done by substitutions. tems is based on a single criterion - the However, the following statement in MACSYMA degree to which a system insists on making [ 26] avoids making eyplicit substitutions and a change of representation of an expression is very selective in its effect. The state- given by a user. A system which insists on ment has the general form radically altering the form of an expression in order to get it into its internal form is WHEN conditional DO label = expression called a radical one in our scheme. A system which is so u~lling to make an inappropriate An instance of such a WHEN statement is transformation that it essentially forces a user to program his own simplification rules WHEN SHOWF DO F = SIN(X/CCOS(X) + i). is called a conservative system. A system which will make certain transformations As a result of executing such a statement, the automatically, but will leave others to the variable F will appear as F inside expressions discretion of a user is called a liberal as long as the variable SHOWF is FALSE. When system. The new le~t is mainly composed of SHOWF is changed to TRUE then F will be re- variations of old radical systems which give placed by the expression SIN(X)/(COS(X) + i) certain additional choices to a user. Design- when it is encountered in a computation. When ers of catholic systems see the merit of each SHOWF is changed back to FALSE all remaining of the other approaches for some contexts. F's will appear as F once again. They design systems which offer several sub- In summary, the technique of labelling systems using different simplification tech- can be used whenever an algorithm tends to niques, and let the user switch among them as duplicate expressions. The labelled expres- he pleases. sion yields to structural analysis more easily In the remainder of this section we shall than the expression it replaces. However, the describe the facilities offered by the differ- technique has its drawbacks since it prevents ent systems. We shall then consider a major certain simplifications from taking place. problem in the manipulation of expressions, Another situation where labelling can be that is, the tremendous growth in the size of used occurs when one is unable to display an intermediate expressions in a computation. expression on one page. Suppose the expres- Finally, we shall consider the design of simp- sion is a sum. Then one could replace as many lification algorithms based on canonical forms of the terms in the sum by labels as are need- which is the most theoretical topic in alge- ed to allow the labelled expression to be dis- braic simplification. played in one page. The labelled terms can In reading an essay such as this, the be displayed independently. This technique reader should bear in mind that the author, 287 as an interested party, will tend to bias the should almost never be expanded. For example, discussion toward his point of view. Our the integral of attitude is best described as a catholic one. Such a position means that we see the merit (x + i) I000 in the other approaches for some situations. However, it is probable that our discussion with respect to x is trivially found if the of any view other than our own will be less integrand is not expanded. However, the positive than that of a strong adherent to integral of the expanded expression requires that view. more time and space, and the final result appears atrocious to the human eye unless the 3.1.1 The Radicals pattern is recognized. A similar situation occurs in radical Radical systems can handle a single, rational function systems. The canonical rep- well-defined class of expressions (e.g., poly- resentation in such systems is a quotient of nomials, rational functions, truncated power a numerator written as a polynomial in canon- series, truncated Poisson series). The ex- ical form and a denominator which is likewise pressions in this class are represented in a written in canonical form. One must, for the canonical form. That is, any two equivalent sake of canonicalness, combine sums of quoti- expressions in the class are represented in ents into a single quotient and divide the a unique way internally. This means that the resulting numerator and denominator by their system stands ready to make a major change greatest common divisor. Suppose we wanted in the representation of an expression written the partial fraction decomposition of by a user in order to get that expression into the internal canonical form. The advantage 2x + 3 1 3x of this approach is that the task of the man- x2 + 2x + 5 3x + 2 + x 2 + 2x + 6 ipulatory algorithms is well-defined and lends itself to efficient implementation. Such The problem is straight-forward (in fact, systems do not appear to have specialized solved) if one leaves the expression as it simplification machinery since the process of stands. However, a radical system would first generating expressions in canonical form combine the quotients and proceed to rederive which is automatically employed by the man- the expression above. ipulatory algorithms (e.g., addition, multi- One can claim that radical systems can plication, differentiation) is akin to simp- handle only a small subset of the expressions lification. An expression written in its that are commonly found in applied mathematic~ canonical form is considered simplified, once However, theoreticians have been chipping and for all time. Any attempt to allow the away at this problem so that radical systems user to modify the representation of an ex- can now handle a wide variety of expressions pression for his problem will likely cause a which include exponentials, trigonometric decrease in the efficiency of the manipulatory functions, roots of polynomials, etc. The algorithms and is therefore eschewed or highly idea is to introduce labels for a minimal discouraged by radical designers. number of nonrational expressions in such a Excellent examples of radical systems are way that the labelled expression is in canon- polynomial manipulation systems. One canon- ical form. (See section 3.3). For example, ical representation of polynomials is the in order to deal with rational functions of recursive representation used in Collins' PM in x one can repres- and SAC-I systems [ 9, i0 ]. One assumes a ent sin x and cos x in the complex exponential ranking of the variables such as x>y > z. form (e.g., The polynomial is considered as a polynomial in the major variable with coefficients which ix -ix are polynomials in the other variables and sin X - e - e ). which are themselves represented in this re- 2i cursive form. Thus

3x2y 2 - 2x2yz 3 + 5x2z 2 + 4x - 6y3z + y3 Then substitute y = e ix in the expression to obtain a rational expression in y. Now con- + 3y 2 + z 4 + 1 sider integrating sin x cosl0x with respect to x. This becomes, after appropriate trans- would be represented as lation, (3y 2 - (2z3)y + 5z2)x 2 + (4)x /i 1 71 1 i0 1 TdY + ((-6z + l)y 3 + 3y 2 + z 4 + I) The original problem is trivial to integrate, The other major representation of poly- and produces a concise integral. The trans- nomials, popularized in the ALPAK system of lated problem is more expensive to solve and Brown [ 3 ], is the expanded representation. the solution is not very comprehensible. This The first polynomial is written in expanded technique (or the similar technique of sub- form. stituting Situations in which there is wide-spread disagreement with the radical approach usually 1 y = tan ~x) concern expressions which oontain powers of sums. The radical systems would automatically fits eminently into the radical way of solving expand such expressions in order to put them problems. It has the advantage that it will into the canonical form. Other designers work and give some result when less general, would complain that more heuristic techniques will fail. (x + i) I000 288 Because the expressions and the manipula- to that indicated above, but force expansions tory algorithms of radical systems are so well to be made once the translation pass is over. defined, there is a great likelihood that Such systems should probably be considered to theoretical research will find ways to improve be more canonical than new leftish. Examples the algorithms. This has, in fact, been the of these systems are Hearn's early versions case. Most of the major advances in algorithm of Reduce [ 18 ], MATHLAB's rational function design in the field of algebraic manipulation subsystem [ 23 ], and MACSYMA's rational func- such as in the greatest common divisor algor- tion subsystem [ 26 ]. ithm, polynomial factorization, and integra- tion, have assumed expressions represented in 3.1.3 The Liberals canonical form. As a result, systems which do not transform expressions into a canonical Liberal systems rely on a very general form do not boast algorithms as powerful or represenhation of expressions and use simpli- efficient as those of radical systems. fication transformations which are close in A radical system, in effect, forces a spirit to the ones used in paper-and-pencil user to tailor the problem to fit the system. calculations. Liberal simplifiers perform When such tailoring is clearly out of the the usual simplifications of collecting terms question, the radical solution is to build a in sums and exponents in products, applying new system expressly for the problem or class the rules regarding 0 and i, and removing of problems that the user has. This accounts redundant operators (e.g., a+(b+c)-~a + b + c). for the number of distinctly different radical Frequently such systems will also know simp- systems which have been written for different lification rules for certain arguments of non- problem areas. rational functions. Thus sin 2~ might simp- lify to 0, 3.1.2 The New Left e21Og y+x 2 x The new left arose in response to some of might simplify to y e , and cos(arcsin x) to the difficulties experienced with radical systems such as those caused by the automatic /i-7. expansion of expressions. A new left system is usually a rational function system which Liberal systems differ from radical and does not necessarily expand products or inte- new left systems in several important ways. ' ger powers of sums. A new left system will i) Expansions are carried out only if have all the usual machinery of a radical the user so demands (new left systems, system, but the algorithms will be generalized of course, offer this feature also). to handle unexpanded expressions. The new 2) Sums of quotients are never put over left thus sacrifices canonicalness and some a common denominator unless the user of the well-definedness of the manipulatory forces such a transformation, but even algorithms for the ability to solve some if they were, the gcd cancellations are problems more efficiently than a radical sys- likely to be missed. tem would. The user of a new left system is 3) Expressions can usually be represent- given the ability to decide when expansion is ed in "unsimplified" form. That is, most appropriate, a facility which is, of l-sin(x) + 0.cos(x) can be represented in course, not present i~ a radical system. such systems. This allows patterns to be Systems which allow unexpanded terms in represented. Most manipulatory algorithms an expression are Hearn's latest version of will, however, require that all their Reduce [20 ], and the latest version of arguments be simplified, thus destroying ALTRAN [16 ]. the patterns. A new left system can usually handle a 4) Nonrational terms can be expressed wide variety of expressions with greater ease, with great ease. Terms such as e x, x!, though with less power, than a radical system and using a canonical form. The idea, once again, is to use labels for non-rational expressions. n i Thus c.x x 2 i=0 i xe + x would be explicitly present in the expres- might be rewritten as sion, and would not be replaced by a label whenever they occurred. xy + x2z, where y = e x, and z = sin x. 5) The representation is local in the sense that a term sin(x) appearing in one The expression part of the expression can be modified without affecting a sin(x) appearing in another part of the expression. e 2x + e x The major disadvantage a liberal system x has relative to a radical or new left system e is its inefficiency. The representation of information in a liberal system might require would probably be expressed as two or three times as much space as in a radical system, and manipulations can be a ~ + z 2x x z , y = e , z = e factor of ten slower (of course such figures might increase or decreasedepending on the since no attempt probably would be made to situation). write the expression in canonical form. The advantage claimed for liberal systems Some systems permit one to represent non- is that one can express problems more natura~y rational expressions in a way similar for them than for radical or new left systems.

289 As was indicated in our discussion of radical of it is also used in MACSYMA. The FORMAC systems, certain problems can be solved more system's simplifier is called AUTSIM. The efficiently in the flexible environment provid r philosophy behind AUTSIM is given in [ 45]. ed in liberal systems. A liberal designer Liberal systems offer a user the ability wants to minimize the transition from the to affect the representation of expressions user's usual techniques. He would pay rela- through two kinds of mechanisms. One way of tively great attention to making his displayed changing the expression is by using commands expressions intelligible to a user. Radical (such as EXPAND in FORMAC or MACSYMA) to per- designers are usually interested in solving form the transformation. Another way is to large computational problems of a specialized modify certain switches whose value the simp- nature. New left designers can be said to aim lifier checks to guide its operation. A for a large proportion of the users of both switch might determine if a function such as liberal and radical systems. Such competition log should evaluate to a floating point number should benefit all users. if its argument is a number. Another switch Most liberal systems will reorder terms might determine if certain indicated opera- in sums and factors in products based on tions such as differentiation should, in fact, some lexicographic ordering scheme. As was be carried out. This last example is not mentioned in 2.2, such schemes frequently pro- strictly an example of simplification; however, duce rather unnatural orderings. Thus a user it does point out the fact that a simplifier writing x + y + z + w can expect to get any is close to being the heart of a system. permutation of the terms as a response, depend- ing on the nature of the ordering being used. 3.1.4 The Conservatives Some systems, such as MATHLAB, minimize the use of simplification of expressions partly Designers of conservative systems claim in order to avoid an unnatural ordering as that one cannot design simplification rules much as possible. Other liberal systems do which will be best for all occassions. There- not use a lexicographic ordering at all, and fore, conservative systems provide little prefer to use the ordering originally present- automatic simplification capabilities. RatheD ed by the user. Such an ordering will, of they provide machinery whereby a user can course, be modified when the expression is build his own simplifier and change it when manipulated. Martin [ 25] used a unique hash- necessary. A simplifier written in such a coding scheme with which to tag expressions in way is far slower than a liberal simplifier, order to be able to recognize when to collect and this fact presents a distinct disadvantage terms or factors. Martin's hash-code was for conservative systems. In fact, one can powerful enough to recognize many identities. point to only two major conservative systems, However, the cost of hash-coding, and the fact Fenichel's FAMOUS [ 14 ], and FORMULA ALGOL [34]. that ordered expressions can be manipulated The importance of conservative systems more efficiently than unordered ones, probably lies in the philosophy they represent, which led to some inefficiency in his system. is most clearly given by Fenichel [14 ], and Martin's hash code assigned to an alge- in the technique which they champion of using braic expression an element in the finite rules and advice to describe simplification field formed by the integers modulo some large transformations. Their philosophy presents prime. The prime was chosen so that certain an indictment of all the other systems which elements in the field had useful properties. perform many simplification transformations For example, one element acted like i since automatically, without seriously considering its square was -i. Given random values for the context. Designers of conservative the variables, the hash code assigned numbers systems emphasize that the simplified form of to expressions so that equivalent expressions an expression is determined by context. They usually had the same code. Due to the finite- will point to situations where even the most ness of the field#non-equivalent expressions obvious transformations 0"x ~ 0 and l'x 4 x could be assigned the same code, but the will destroy useful informa%ion as in the probability of this event is extremely low. pattern Martin's hash code was utilized in an experimental program designed to teach 0-sin x + l'cos x + 2-tan x + 3-cot x freshmen how to integrate symbolically [ 31 ]. + 4.sec x + 5.csc x Another technique due to Oldehoeft [ 33 ], was also intended for a CAI environment. Oldehoeft Therefore, they claim that one must be able to examined the problems associated with deter- tune the system to the particular nature of mining the equivalence of expressions by eval- the problem. The preferred technique of uating them at random points. He discusses "tuning" is based on the theoretical concept problems due to round-oft overflow, accidental of Markov algorithms. In a Markov algorithm coincidence and the effects of dealing with one is given an ordered set of rules to apply non-analytic functions (e.g., absolute value). to an expression. Each rule has the form: Simplification in liberal systems is per- formed by a program usually called the simp- Pattern 4 Replacement. lifier. Some of the earliest projects in algebraic manipulation involved the design of For example, one such rule applied to algebraic liberal simplifiers. The earliest simplifier expressions mightbe was written in the LISP Assembly Program by Goldberg in 1959 [ 15 ], and was used in Slagle% A'X + B'X ~ (A + B)-X Symbolic Automatic Integrator (SAINT) [ 42 ]. Other LiSP-based simplifiers were written by To make such a rule correspond to the usual Hart (1961) [ 17 ], Russell and Wooldridge notion of "collecting like terms," one would (1963) [ 47 ], and Korsvold (1965) [ 22 ]. The want to restrict A and B to be numbers, while Korsvold simplifier is used in MATHLAB and in X could represent any product of factors SCRATCHPAD [ 2 ] • A highly modified version other than numbers. The rule just given does z9o not necessarily yield a simplified result in disadvantage of a catholic organization is iS cases such as 2-X + (-i)-X ~ 1-X. One should size. A catholic system is necessarily larger apply a whole set of rules to the replaced than any other type of svstem. The variety of expression. Only when no rule is applicable the services provided by the system may force to a given expression is the algorithm compete. users to learn a larger number of conventions Conservative systems offer variations of than in other systems. A catholic designer the Markov algorithm technique with which a may also impose a number of system-wide con- user can generate his own simplification and ventions (e.g., on the data representation) manipulatory algorithms. Such rules are most which would not be present in a smaller system. easily written when making local transforma- Such conventions might slow down all of the tions of an expression 4. One would not wish component systems. to write a factoring program as a Markov A catholic organization is only one way algorithm. Conservative systems have tended to obtain the advantages of the conservative, to model liberal systems rather than radical liberal, and radical approaches to simplifica- ones, since the latter specialize in global tion. A system such as REDUCE, can be viewed transformation of an expression. as a compromise system offering many of these Several designers have added a capability advantages. REDUCE, however, uses only a for writing Markov algorithms to their systems, single representation. Radical systems, as thus allowing their systems to take on various we noted earlier, use different representations degrees of conservatism. The main use of for expressions which occur in different prob- rules in such systems has been to add new lem areas (e.g., polynomials and truncated simplification transformations (e.g., Poisson series). While it is advisable to cos n~ ~ (-l)n), rather than to override old limit the number of distinct representations transformations. Thus a user of REDUCE can as much as possible, it appears likely that a define the simplification rules relating to system which tries to handle a large number of general exponentiation (e.g., applications efficiently will require several representations. ~ designer of a catholic xY.x z ~ x y+z ), system is willing to accept such a situation. Other designers might not be so willing. although he cannot override x 0 4 i. Korsvold's simplifier and MACSYMA's pattern matching sub- 3.2 Intermediate Expression Swell system [ 13] also allow one to define simplif- ication rules. The latter allows one to over- Users of numerical analysis programs have ride many of the built-in rules. It also learned to anticipate problems due to round- provides for the compilation of new rules off errors. Users of symbolic manipulation which should yield a relatively efficient programs have encountered a corresponding simplifier. problem in the tremendous growth of intermed- iate expressions in some calculations. Such 3.1.5 The Catholics growth has caused many calculations to be aborted because the expressions filled the Catholic systems use more than one repres- available computer memory. Tobey has describ- entation for expressions, and have more than ed this phenomenon with the colorful phrase one approach to simplification. The basic "intermediate expression swell" [43 ]. In idea underlying catholicism is that if one many cases the final result of a symbolic cal- technique does not work, another might, and culation is quite small, but in order to get the user should be able to switch from one that result one finds oneself generating very representation and its related simplification large intermediate expressions. For example, facilities to another with ease. A catholic the eigenvalue of a matrix with polynomial system might use a liberal simplifier for entries can be as simple as a single number. most calculations, and have a radical sub- However, in order to obtain that number, one system in reserve for performing special cal- is forced to factor a polynomial with polynom- culations such as combining quotients, solving ials as coefficients. These coefficients might linear equations with rational coefficients, be obtained from the of the matrix, and factorization. The MATHLAB system is best which can be several pages long. described in this fashion. The MACSYMA Intermediate expressions swell can be system goes further in that it allows the user caused by several different phenomena. In to manipulate entirely with a radical rational some cases, the problem the user is trying to function subsystem, as well as with a liberal- solve is inherently explosive, and it is radical combination as just described. In likely that no general method will decrease addition, MACSYMA, as pointed out in 3.1.4, the size of the intermediate expressions. We has a rule-defining facility which allows it claim that such a situation exists when one to closely approximate a conservative system. tries to solve systems of simultaneous polynom- The SCRATCHPAD system is a conglomerate made ial equations by eliminating variables [28 ]. up of several LISP-based systems. It has a The number of solutions to such systems can total of four simplifiers. be as high as the product of the degrees of Catholic systems emphasize the range of each polynomial. If the intermediate equations problems that can be solved by them. They do not factor, as is likely to be the case, would like to give a user the ease of working one is forced to generate a polynomial of very with a liberal system, the efficiency and high degree which would be very hard to solve power of a radical system, and the attention numerically for all its roots. to context of a conservative system. The In certain other cases, the particular algorithm that the user, in combination with 4. The author begs for forgiveness of the the system, has chosen for solving a problem, reader for not defining "local". That concept is bad and a radically different approach is tends to be as context dependent as the con- necessary. For example, the recently develop- cept of simplification. However, see [ 27 ]. ed modular algorithm for computing the greatest 291 common divisor of two polynomials [ 3 ] is a conjecture were false, the average user will radically different and much more efficient probably never obtain incorrect results from algorithm than any of the previous algorithms. these algorithms. Major changes in algorithm design usually re- All of the results deal with well-defined quire extensive analysis so that one cannot classes of expressions which are extensions of make such modifications on a regular basis. polynomials or rational functions. Some deal Certainly it is not very fruitful to consider with exponentials, others with both exponen- such modifications as a task of algebraic tials and logarithms, and still others with simplification. The final set of cases which we shall roots of polynomials. We shall also discuss consider is when small changes in the sequence a negative result, due to Richardson, which of steps cause a nontrivial improvement in the says that when one deals with expressions in- utilization of space and time. We have al- volving the exponential and absolute value ready mentioned the idea of labelling subex- functions, then one cannot, in general, tell pressions which would tend to be repeated in whether such expressions are equivalent to a calculation. Sometimes one can apply one's zero. knowledge of subsequent steps in a calculation in order to keep expressions in a form which 3.3.1 Simplification Al~orithms for Expres- will maximize utilization of space and time. sions with Nested Exponentials At the heart of Collins' first improvement In [ 4 ] Brown describes a simplification to the Euclidean GCD algorithm [ ll] was the algorithm for a class of expressions he calls idea that one could predict how certain terms Rational EXponential (REX) expressions. REX were automatically introduced into the inter- expressions are obtained recursively from the mediate expressions, and therefore these terms rational numbers, i, and n, and the variables could be cancelled without affecting the final result. Before the appearance of this algor- Xl,X2, ... ,x n by the rational operations of addition, subtraction, multiplication and ithm, several people, including this author, division and by forming exponentials of exist- thought that the size of the coefficients in the intermediate steps of the algorithm had ing REX. Thus the expression to grow exponentially. Collins showed that they need grow only linearly! Of course, results such as Collins' would e ~ not be expected from the average user; how- 5x 3e2X 4el+l ever, improvements of a similar nature can be e + + xe made in many applications of algebraic manipu- lation. For example, consider is a REX expression if we agree to write x for x I when only one variable occurs. Brown's n i algorithm makes use of the technique frequent- y = ~ x , ly mentioned in this paper of substituting i=l labels for exponentials in order to reduce an REX expression to a rational expression in x which is an approximation for i-~ " Suppose the variables and the labels. The major simp- you wanted lification work in the algorithm occurs when the resulting rational expression is trans- n formed into a canonical form. We shall see, E yJ however, that Brown's algorithm is not canon- j=0 ical (i.e., it does not always reduce equiva- lent expressions into the same form). It is The straight-forward application of expansion powerful, though, since if we assume a certain in the l~tter sum would yield a polynomial of conjecture, then we can prove that the algor- degree n ~. However, since y is only accurate ithm simplifies any REX expression equivalent to degree n, all powers of x greater than n to 0 into 0. Thus the algorithm can determine are worthless. What is called for is a if any two REX expressions are equivalent. It truncation in the expansion of powers greater should be noted that since the constants i and than n. Systems which allow the user to are included, the REX expressions contain specify truncation (e.g., by declaring x m = 0 the trigonometric and hyperbolic functions in for m > n), can probably save factors of i00 exponential form. or I000 in speed for n = 20 [ 12]. In generating labels for the algorithms one must pay great attention not to allow 3.3 Canonical Simplification and Theoretical algebraically dependent exponentials to be Results - The Radicals Revisited assigned to different labels. Two expressions are algebraically dependent (over the rational~ In this section we shall discuss most of if there exists a nonzero polynomial with the theoretical results related to algebraic rational coefficients in these expressions simplification. The algorithms we shall des- which is equivalent to 0. Thus, cribe are either canonical or else possess a x 2x strong property, namely that they can deter- e and e mine if an expression is equivalent to zero. Almost all of the algorithms are incomplete in are algebraically dependent since the sense that they depend on, as yet, unprov- ed conjectures about expressions involving (eX) 2 - e 2x = 0. constants. For example, the conjecture by Brown [ 4 ] has, as a special case, the state- Likewise, ment that e + n is not a rational number. 2 x+x 2 That statement is almost certainly true, but e x , e x , and e no proof of it exists, and certainly none exists of the full conjecture. Even if the taken together are algebraically dependent. 292 Our labelling scheme must be such that if we we had originally. assign Brown's conjecture is that if x y = e , {ql'q2 ..... qk' i~} 2x . 2 then e is assigned y . is linearly independent over the rational The algorithm proceeds by replacing inner- numbers, most exponentials in the expressions by labels, if such exponentials are not algebraically [eql,eq2 qk , ... ,e ,Xl,X2, ... ,Xn,~ } dependent on previously replaced exponentials. The algebraic dependency is determined with is algebraically independent over the ration- the help of the conjecture by testing whether al numbers. Using the conjecture, Brown can the argument (of the exponential function) easily prove that the only simplified REX being examined is linearly dependent on pre- expression equivalent to 0 is 0 itself. Note vious arguments. The following is a simple that since 1 and i~ are linearly independent, example of the procedure, and incidentally the conjecture states that e I and 17 are shows its simplifying power. algebraically independent, a statement which Suppose we are given the REX expression is stronger than the statement "e + ~ is not a rational number." x An important aspect of the algorithm is e + x the retracing of steps one must go through e 2x + 2xe x + x 2 in some cases. Consider Traversing the numerator from left to right, 2x x we first encounter e x. Let e + e X ql x e ql = x and r I = e = e . ql 2x Let ql = 2x, r I = e = e Thus our first label is r i. By substituting it into the expression we obtain Now q2 = x, r 2 = e x, and q2 = 1/2 ql" r I + x We cannot let r^ = r. I/2 since we want to 2x 2 e + 2xr I + x obtaln ratlonal results. So we redefine r I as 2 By treating e 2x as an independent variable r 2 in the expression above, we can try for a simplification by determining the greatest and obtain common divisor of both numerator and denomin- 2 ator. However, that attempt is unsuccessful r 2 + r 2 in reducing the expression and we continue - r + 1 = eX + 1 generating labels. We next encounter the r 2 2 exponential e 2x. Let q2 2x Brown's algorithm is not canonical because q2 = 2x, r 2 = e = e the algorithm does not make an optimal choice for labels. Now check to see if a linear dependence exists Consider between ql and q2 (and also with i~, it turns out). Such a relation does exist, since x+x 2 e X ql - 2q2 = 0. e 2 Therefore, redefine 2 x+x x Let ql = x + x , r I = e ' q2 = x, r 2 = e . 2 r 2 = r 1 Note that {ql' qo, i~} is linearly independent and by substitution obtain over the rational numbers. Thus {rl, r2, x,~] is algebraically independent by the con3ectur~. r I + x Furthermore, 2 2 r I + 2xr I + x r 1

Simplifying the above as a rational r 2 function reduces it to is simplified as a rational expression. Hence, 1 the simplified result is r I + x x+x 2 e Since no more exponentials are to be x found, replace the labels by the exponentials. e The result is which differs from the equivalent expression 2 e x X e + x which is also simplified. So the algorithm is which is indeed simpler than the expression not canonical. Z93 The following exponential polynomial is Brown's algorithm produces different re- in Caviness' form sults when the expressions are reordered. In 5e 0 + (-3+x2)e x + (5+x)e l+x + 3e 3eO+xex 1 1 1 x+x 2 x x+l e + e e In order to guarantee that putting an expression into his form yields a canonical 1 simplifier, Caviness must decide how terms are X e to be ordered in sums. This can be done by some lexical ordering scheme. Given some we can get ordering scheme, Caviness requires that the Si 1 in his form be in increasing order. To prove x+x 2 canonicalness, Caviness assumes that if 2 e 1 Ci,C 2, ... ,C k x e are different constant exponential polynomials using one order of assigning labels, and written in his form (e.g., 3e0+e 5 1 e ), -x+l 2e then using a different order. {eCl ,e C2, ... ,e Ck } The last two examples are intended to show the difficulties that a canonical simpli- is linearly independent over the rational fier for REX expressions has to surmount. There is a simple proof that such a simplifier numbers. The proof makes use of the idea that equivalent expressions are equal for each exists, using Brown's conjecture. A little reflection will show that we can produce a value of the variable x. The conjecture im- function of a single integer which for in- plies, among other things, that the set creasing values of its input will yield syn- e tactically valid REX expressions, and which [e, e e, e e .... } will yield each REX expression for some input. The canonical simplifier will, given a REX contains only transcendental numbers which, expression, get the function to generate REX expressions until one is found which Brown's like the e + ~ conjecture, is unknown at algorithm determines is equivalent to the present. While Caviness' algorithm is quite power- expression to be simplified. The first expres- rul, it suffers from the weakness that it does sion found in this manner is considered the not permit division. Brown's algorithm, simplified result. The algorithm is canonical, while it does permit division, does not yield assuming Brown's conjecture, since all equiva- canonical results. In [30 ] we describe a lent REX expressions would result in the same canonical simplifier for first order exponen- simplified expression. However, the scheme is tial expressions (i.e., no nesting of expon- utterly inefficient. It also suffers from entials) which are REX expressions, but do not the fact that the simplified expressions are involve i or ~. The proof of canonicalness of not describable by some simple pattern. For our simplification algorithm also depends on example, the simplified form of 1 might be a conjecture which is very similar to Brown's quite different from 1 in this scheme. The and Caviness' conjectures. next algorithm produces expressions which do The novel idea in our algorithm is to satisfy general patterns. Such simplifiers use a partial fraction decomposition of the are exceedingly useful since they can help us exponents. The left-hand-side of the equation determine answers to global questions about below is in the usual canonical form for an expression (e.g., Is it a constant? Is it rational functions and the right-hand-side linear in x?). represents a partial fraction expansion of it. In [ 7 ], Caviness describes a canonical simplification algorithm for a class of expres- 1 1 sions related to REX expressions. His expres- x5+x3+l -i -7 + -- siQns admit only one real variable, say x, but 4 2 - x +--~+ no n, and no division at all. Because divis- x -x x x+l x-i ion is not allowed, Caviness' expressions are exponential polynomials. By assuming a con- We require that the terms of the partial frac- jecture similar to Brown's, Caviness shows how tion decomposition be linearly independent exponential polynomials (other than pure poly- (over the rational numbers) of each other. nomials) can be transformed into the form Such partial fraction decompositions lead to yet another canonical representation of ration- S 1 S 2 S k al functions. The simplification algorithm Pl(X)e + P2(x)e + "'" + Pk(X)e , breaks up an exponential of a sum into a pro- duct of exponentials which are replaced by where the S i are distinct exponential polynom- labels in a manner similar to that of Brown's ials which are also in this form, and the Pi algorithm. are non-zero, canonically ordered polynomials. Thus, To get exponential polynomials into this form x2+x one has to apply the usual algebraic trans- e formations (including expansion), and collect x e the exponentials via a b a+b e e 4 e 294 is decomposed into are confident, however, that a fairly efficient exptension of our algorithm to higher order 2 exponentials will, in fact, be found. X X e e X 3.3.2 Expressions Involving Exponentials and e Logarithms

With proper relabelling and simplification of The functions of the calculus include log- the resulting rational expression we obtained arithms as well as rational functions and the simplified result exponentials. Therefore, there is much inter- 2 X est in results involving the logarithm function. e A result close in spirit to those of 3.3.1 was obtained by Richardson [37 ] for a class of Note that expressions which differs from the REX expres- sions in that it involves no i, only a single 1 -i 1 variable x, but allows the functions sine, 2 x x + x x + 1 cosine and loglxl. The three functions in addition to the exponential function of REX Therefore expressions can be nested to any depth. 1 1 -i Richardson was interested in the problem of x2+x e ~ x+l determining whether an expression was equiva- e + e lent to 0 on some interval of the real line. 1 His algorithm for determining the equiva- X e lence involves a reduction process in which one asks whether progressively less complex is transformed into expressions are equivalent to 0. The algorithm is incomplete in that it relies, in some cases, -I 1 1 -i on knowing whether a reduced expression which e x+l e x + e x e x+l involves only constants is equal to 0. This 1 requirement is, of course, similar to the need X for conjectures in the algorithms of 3.3.1. e Richardson's algorithm is, furthermore, only applicable when the expression being examined Then if 1 -i is totally defined everywhere in the interval. 1 e x -i x+l In essence, this requirement is that no sub- ql = ~' rl= ' q2 = x~' r2= e expression could become unbounded in value at some finite point on the interval being we can determine that q2 is linearly independ- examined. ent of ql" In fact, we need not check for a Richardson's measure of the complexity of full linear dependence in our algorithm, but an expression is very lexicographic in nature only for the possibility that a new exponent and relies on very little knowledge of the is a rational number multiple of some previous algebraic properties of the functions involved. exponent. This is a consequence of the linear For example, X independence of our partial fraction decomp- e osition. Our example, therefore, reduces to e -i is considered more complex than e x because of r2rl + rlr2 x+l the greater depth of nesting of the exponen- rl = 2r 2 = 2e tial function, and (e x) 2 Unfortunately, partial fraction decomp- osition must be used with great care in higher order exponentials; for example, is more comples than e x because it is of high- er degree. The complexity measure does not 1 1 ~x 2 presume that 1 ~ -~e + ~- e 2x and (eX) 2 eX+l el~+l e 2/3x- el/3x+ 1 e = e e are algebraically related. In fact, it does Therefore, if we let r I = e x , a partial frac- not matter very much which expression is con- tion decomposition of sidered more complex as long as the ranking is used consistently. 1 The reduction procedure of the algorithm rl+l assumes that the equivalence problem for rational functions is trivial. A more complex is simply expression will force the algorithm to gener- ate subproblems which will either end up as 1 rational functions or constant problems. rl+l , Let us suppose that we wish to determine whether an expression E is equivalent to 0. Let y be the most complex exponential or thus missing the possibility for a decomposi- logarithmic term in E. Let us further suppose tion in terms of that y is a logarithmic term. By multiplying 1/3 out denominators, expanding products of sums, r 1 and collecting like terms, we can get a poly- nomial expression E* in y of the form which might be crucial in some expresion. We

• B95 and the exponential integral an(x)yn + an_l(x)y n-I + ... + a0(x) X E ' (X) _ e which is equivalent to 0 if the original ex- l x pression E is equivalent to 0. Since an(X) does not contain y, it is less complex than can be included in the expressions to be tested E or E* and we can apply the algorithm recur- for equivalence to 0. The key property of the sively in order to determine if it is equiva- exponential function used in the algorithm is lent to 0. If a n is equivalent to 0 then that the derivative of an exponential of de- since the expression E1 gree k is also of degree k in that exponential. Consider rational roots of polynomials which an_l(x)y n-I + ... + a0(x) have the form is of lower degree in y than E*, we can test P (x) n/m, to check if it is equivalent to 0. If it is, E* and therefore E are also equivalent to 0. where P is a polynomial and n and m are inte- If it is not, E* and E are not equivalent to 0. gers. (E.g., If a n is not equivalent to 0, divide E* /x, (x2+2) 2/3) . by it resulting in the expression E2

In general, n an-i (x) n-i a0(x) y + y + ... + -- [P(x)n/m] , = ~ p(x)n/m - 1 p, (x) a (x) a (x) n n m

Now differentiate, resulting in an expression, n P'(x) [p(x)n/m] say E3, of the form = ~

Since n-ly, ana 0 ' - a0a n' ny + "'" + 2 a n P' n m P E3 is of lower degree in y than E* since the derivative of a logarithmic term is of lower is a rational function and of lowest complexity complexity than the term itself. (Note that in Richardson's ranking, we can say that this is essentially the only fact we need to rational roots of polynomials will behave like know about logarithms except for cases where exponentials in Richardson's algorithms. the constant problem arises.) If E3 is not Johnson [21 ], using a somewhat different equivalent to 0, then E2 and therefore E* and approach at deciding equivalence, is also able E are not equivalent to 0. If E3 is equivalent to handle a large class of expressions like to 0, then E2 is equivalent to a constant. To the one we have just indicated. complete the algorithm we must determine if It can further be shown [32 ] that the constant is 0. This is the way in which Richardson's algorithm can be extended to the constant problem arises in Richardson's accept any function defined by a differential algorithm. One could attempt to evaluate the equation of the form y' = P(x,y), where P is expression at a point as Oldehoeft does [ 33 ]. a polynomial in y. When P is linear in y The situation here is simpler than in Olde- the extension is straightforward. P's which hoeft's cases since if the function is equiva- are quadratic in y are of great importance lent to a constant we need not worry about in applied . Unfortunately, when accidental values of 0 arising in the evalu- a function is defined by a quadratic P, then ation. its derivative is more complex than itself. If the most complex term y is an expon- Thus if we are testing E(x,y(x)) for equiva- ential, then Richardson's algorithm involves lence to 0, we shall usually find that division by a 0. Differentiation will then E'(x,y(x)) has a higher degree in y than E yield a low order term equal to 0. Since the does. If E E 0, then E' ~ 0, and therefore, derivative of y~ is of degree k in y, the the greatest common divisor of E and E' is also rest of the derivative can be divided by y to equivalent to 0. Conversely, if the gcd of yield an expression similar to E3 which is of E and E' is equivalent to 0, so is E. Hence, lower degree than E*. we may use the result of the equivalence test At the heart of Richardson's reduction for the gcd. The gcd may, however, not be of procedure is the idea that through differen- lower degree in y than E itself is. In such tiation we can obtain expressions which can cases it must possess the same degree in y as be transformed in such a way as to yield E does. Therefore, we may properly speak of simpler problems whose solution will determine E dividing E' Let us say that the answer to the original equivalence problem. It turns out that this idea can be used to m ! E - Q(x,y) . test expressions which involve functions other than exponentials and logarithms. As we point- Therefore, integrating both sides ed out earlier, the logarithmic case of the algorithm hinges on the fact that the deriva- log E = ~Q(x,y) dx + C 1 tive of a logarithmic term is of'lower rank in complexity than the term itself. Thus func- tions which are defined by such as E = C2efQ(x'Y) dx where Ci, C 2 are constants. the error function 2 Exponentials usually cannot have a zero 2 -x erf' (x) = 7~ e value. In such cases E can only have a zero value if C 2 is identically zero. This deter- mination is another constant problem of a 296 special nature in that we are dealing with a The expression function that is either always 0 or never 0. (x + 31/2 ) 1/3 An exponential can have a zero value when the argument goes to -~. Such cases would be disallowed by Richardson's requirement that is not in this class because it involves expressions be totally defined. nested exponentiation by non-integers. Caviness The canonical simplification algorithms shows that there exists a zero-equivalence represent an extreme in the use of explicit simplification algorithm for this class of knowledge of the simplification rules of a expressions. The algorithm is not canonical. class of expressions. Equivalence matching Unfortunately, it is also very time-consuming since it can easily force one to factor poly- algorithms need not explicitly know these nomials (over the integers) having a high rules. For example, Richardson's alqorithm degree, and factorization is still a very does not explicitly know that loglab] = log lal + log Ibl. As a result, equivalence matching expensive operation. Recently, Fateman [26 ] showed that factor- algorithms are usually poor simplification ization is usually not necessary if we modify algorithms. It is clear that in many situa- the meaning of a radical expression. What tions explicit knowledge of general simplifi- Caviness means by a radical expression such cation rules is valuable in reducing the size as /x is a symbol which represents the general of an expression. In fact, we would also like root of a polynomial having polynomial coef- to know that a given set of simplification ficients (i.e., y~ - x). That is, /x can be rules for a class of expressions is complete either one of the roots normally written as in the sense that no other general rules can +/x and -/x. Fateman's algorithm assumes that be found which cannot be derived from the set the symbol /x represents exactly one of the by rational operations. Risch tackled these roots, and that -/x represents the other. questions for a class of expressions similar Fateman's algorithm, except for even roots to Richardson's [40 ]. His results, in effect, of unity, has the same strong property as state that no general rules exist cther than Caviness', namely the zero-equivalence property. the familiar ones (e.g., However, all he needs to test is whether the integers and polynomials which occur inside e a+b = eae b, em/n log a = am/n , log ca= a, the radicals are relatively prime to each other. He would decompose log ab = log a + log b + 2k~i, where k, m, and n are integers). The method x -l of attack he uses is to ask what relationship into 47=r ,~r must exist between an exponential or a logar- ithmic term and a set of other exponentials if ~ or 4~ occurred elsewhere in the and logarithmics for the former to be expression. However, algebraically dependent on the latter. The proof relies on much of the machinery used in Risch's previous work on integration. As before, Risch's results require the solution would be left unchanged since no other simp- of constant problems. lified radical expression could combine with Thus we may speak of three varieties of it under the rational operations. In both theoretical algorithms. Zero-equivalence Caviness' and Fateman's algorithms the proof algorithms will guarantee that expressions that the simplification algorithm has zero- equivalent to 0 will be identified. Re@ular equivalence property is obtained without resort- algorithms guarantee that the exponential and ing to additional conjectures. Fateman's logarithmic terms in an expression are alge- algorithm will simplify braically independent of each other. Regular algorithms are zero-equivalence algorithms. Canonical algorithms which reduce equivalent expressions to a single form are always zero- equivalence and are usually regular. Caviness' algorithm is an exception to this rule in that to it is not regular.

3.3.3 Roots of Polynomials and incidentally, it will convert j~ to 7/2. The algorithm can be made canonical by remov- In [ 6 ], Caviness discusses a class of ing radicals from denominators in quotients expressions which is obtained from the ration- through a generalization of the process of al numbers, the variable x, the rational opera- "rationalizing the denominator." Thus tions and the operation of exponentiating to a rational number. The exponentiation in this class may not be nested. The following x + /2 expressions are in this class; could be converted to 1 x I/2 + x I/3 x-/2 2 x - 2

(4 - x) 5/3 in order to achieve a canonical form. (x 2 + 2)2/3

297 By adding the absolute value function to this 3.3.4 Unsolvability Results class Richardson was able to modify G to a function F(y,x) such that F(y,x) m 0 could not The earliest of the theoretical results be determined by an algorithm as y varied over which we discuss in this section, and probably the integers. This is Richardson's major the best known one in the field of algebraic unsolvability result. manipulation, is a negative result due to Several corollaries of Richardson's Richardson [35 ]. In 1965 Richardson, Risch theorem were derived by Fenichel [14 ] to show and Moses were all working on integration. that, among other things, one could not deter- Richardson and Moses were pursuing theorems mine the limit of every expression which stating that integration was unsolvable (i.e., possessed a limit. that no algorithm existed for determining Risch [ 38 ] used the fact that whether the integral did or did not exist in closed form), and Risch was examining algorithms log(e x) = x + 2kni , for solving the problem [38,39]. Richardson succeeded in obtaining an unsolvability result for some integer k, to generate an unsolvable for integration by showing that there exists integration problem by using Hilbert's Tenth a class E of expressions for which no algorithm Problem and Richardson's device of integrating exists for deciding whether each expression in a multiple of E was equivalent to 0. If we consider the 2 x class of integrals e

2 In [29 ], we used the fact that the differ- Re x dx, ential equation where R is some specially chosen member of E, y, + y2 = 1 + (~2I) , p a constant, then if R is equivalent to 0, the integral x exists in closed form (in fact, it is a con- stant). If R is not equivalent to 0, then the has a solution which is a rational function in integral cannot be expressed in closed form x if and only if p is an integer. Thus we due to the well-known properties of were able to generate systems of ordinary differential equations for which one cannot 2 x decide whether they possess rational functions e as solutions. and those of the chosen members of E. As it 4.0 Prospects for the Future turns out, Richardson's major result was the demonstration of the existence of the class E, Although the field of algebraic manipula- rather than the application of this result tion can already claim a number of important to integration. advances in the design of algorithms, and a The starting point for most unsolvability significant number of important applications, results in algebraic manipulation is Hilbert's one cannot yet say that the field has stabil- Tenth Problem. This problem, which is also ized. Designers have made substantial improve- known as the Diophantine Problem, asks whether there exists an algorithm for telling whether ments to their systems just in the last year. Much of what we discussed in this paper, the polynomials in several variables with integer conventional lexicographic ordering of expres- coefficients have solutions which are integers. sions, the variety of substitution techniques, This problem has been recently shown to be and canonical simplifiers, is only available recursively unsolvable. In 1965, it was known in systems in an experimental nature. There- that a version of the problem, called the fore, any predictions about the future state Exponential Diophantine Problem, was unsolvable. of algebraic simplification are made on Today, one can use the unsolvability of shaky grounds. Nonetheless, we shall attempt Hilbert's Tenth Problem to claim that there some predictions, albeit fairly consegvative exists a polynomial P(Y,Xl,X2, ... ,x n) ones. such that the question of whether P = 0 had Practitioners in the field of algebraic integer solutions for Xl,X 2, ... ,x n for manipulation, just as in much of computer varying integral values of y could not be science, can be divided into three major cate- solved by an algorithm. One can generalize gories: theoreticians, systems designers, and this problem to determine whether P had real users. Theoreticians tend to design radical roots by asking whether and new left systems since the algorithms in such systems are most easily defined. Users n 2 with substantial problems to solve also tend sin nx i + p2(y,xl,x2, ... ,x n) = 0 to design radical and new left systems since i=l the needs of such users are very special and frequently do not require the flexibility since sinTrxi= 0 forces each x i to be an integer. offered by liberal, conservative, or catholic systems. Systems designers expect a great By manipulating the equation above, Richardson variety of users and therefore tend to build was able to show that there exists a function systems with liberal or conservative components. G(y,x) such that as y varies over the integers We have already witnessed the demise of purely one can not tell whether there exist real conservative systems. In the next few years values of x such that G(y,x) < 0. we may witness the demise of purely liberal At this point we have an undecidability systems. The reason for the diminished import- result for the class of expressions formed by ance of such systems is the efficiency of the the rational numbers and n, the variable x, algorithms provided in radical systems or the operations of addition and multiplication, subsystems. It would not be surprising if and the sine function (which can be nested). Z98 many radical systems mature into new left sys- 9) Collins, G., "PM, A System for Polynomial tems when the disadvantages of canonical forms Manipulation," Comm. ACM, vol.9, no.8, become unbearable. This would leave the new Aug. 1966, pp.578-589. left systems with a single representation which is a compromise between the radical and 10) Collins, G., "The SAC-I System: An Intro- liberal representations, and the catholic duction and Survey," these proceedings. systems with their multiple representations. We believe that the theoreticians and the major ii) Collins, G., "Subresultants and Reduced users will tend to gravitate to the new left Polynomial Remainder Sequences, " systems and the systems designers to the Journal of the ACM, vol.14, Jan. 1967, catholic ones. pp.128-142. We expect to see theoretical results about simplification algorithms encompass in- 12) Engeli, M., "User's Manual for the Formula creasingly larger classes of expressions. Manipulation Language SYMBAL," Univer- Risch's results about relationships of expon- sity of Texas at Austin, Computer entials and logs of different arguments will Center, 1968. probably be extended to a number of other functions. 13) Fateman, R., "The User-Level Semantic The generality of the extensions which Matching Capability in MACSYMA," these can be made to Richardson's zero-equivalence proceedings. algorithm lead one to expect that in the next few years it will be possible for a user to 14) Fenichel, R., "An On-Line System for define a function as a solution to a differen- Algebraic Manipulation," PhD. dissert., tial equation and then employ that function Harvard U., Cambridge, Mass., 1966. immediately in a calculation. One thing that we do not expect is that 15) Goldberg, S.H., "Solution of an Electrical the difficulties of using algebraic manipula- Network Using a Digital Computer," tion systems will disappear completely. Users M.S. Thesis, MIT, Cambridge, Mass.,1959. will continue to complain, and designers will, hopefully, continue to improve their creations. 16) Hall, A., "The ALTRAN System for Rational Function Manipulation - A Survey," Acknowledgements these proceedings.

Work reported herein was supported in 17) Hart, T., "Simplify," Memo.27, Artificial part by Project MAC, an M.I.T. research Intelligence Group, Project MAC, MIT, project sponsored by the Advanced Research Cambridge, Mass., 1961. Projects Agency, Department of Defense, under Office of Naval Research Contract Nonr-4102(01). 18) Hearn, A., "REDUCE: A User-Oriented Inter- active System for Algebraic Simplifica- References tion," In Interactive Systems for Experimental Applied Mathematics, i) Abrahams, P.W., "Applications of LISP to Academic Press, New York, pp.79-90. Sequence Prediction," CACM, vol.9, no.8, p.551, Aug. 1966. 19) Hearn, A., "The Problem of Substitution," in Proceedings of the 1968 Summer 2) Blair, F. et al., "SCRATCHPAD/i: An Inter- Institute on Symbolic Mathematical active Facility for Symbolic Mathematics," Computation, IBM, Cambridge, Mass., these proceedings. pp.3-19.

3) Brown, W.S., et al., "The ALPAK System for 20) Hearn, A., "REDUCE 2: A System and Language Non-Numerical Algebra on a Digital for Algebraic Manipulation," these Computer-II," Bell System Technical proceedings. Journal, vol. XLIII, no.2, pp.785-804, March, 1964. 21) Johnson, S., "On the Problem of Recognizing Zero," these proceedings. 4) Brown, W.S., "Rational Exponential Expres- sions and a Conjecture Concerning 22) Korsvold, K., "An On-Line Algebraic Simp- and e," Amer. Math. Monthly, voi.76, lification Program," Artificial Intel- pp.28-34, Jan. 1969. ligence Project Memo. no.37, Stanford University, Stanford, California, 5) Brown, W.S., "On Euclid's Algorithm and Nov. 1965. the Computation of Polynomial Greatest Common Divisors," these proceedings. 23) Manove, M. et al., "Ratfonal Functions in MATHLAB," in Symbol Manipulation Lan- 6) Caviness, B.F., "On Canonical Forms and guages and Techniques, North-Holland, Simplification," PhD disser., Carnegie- Amsterdam, pp.86-102. Mellon U., Pitts. Pa., Aug. 1967. 24) Martin, W., "Symbolic Mathematical Labor- 7) Caviness, B.F., "On Canonical Forms and atory, "Report MAC-TR-36. Project MAC, Simplification," Journal of the ACM, MIT, Cambridge, Mass., Jan. 1967. vol.17, no.2, April 1970, pp.385-396. 25) Martin, W., "Determining the Equivalence 8) Christensen, C., and Karr, M., "IAM, A of Algebraic Expressions by Hash Coding," System for Interactive Algebraic these proceedings. Manipulation," these proceedings.

299 26) Martin, W., and Fateman, R., "The MACSYMA 43) Tobey, R., "Experience with FORMAC Algor- System," these proceedings. ithm Design," Comm. of the ACM, vol.9, no.8, Aug. 1966, pp.589-597. 27) Minsky, M., and Papert, S., Perceptrons, MIT Press, Cambridge, Mass., 1969. 44) Tobey, R., et al. "PL/I-FORMAC Symbolic Mathematics Interpreter," IBM, 28) Moses, J., "Solutions of Systems of Poly- Cambridge, Mass., 1969. nomial Equations by Elimination," Comm. of the ACM, vol.9, no.8, Aug. 1966, 45) Tobey, R., et al., "Automatic Simplifica- pp.634-637. tion in FORMAC," in Proc of Fall Joint Computer Conference, voi.27, 1965, 29) Moses, J., "Symbolic Integration," Report pp.37-52. MAC-TR-47, Project MAC, MIT, Cambridge, Mass., Dec. 1967. 46) van der Waerden, B., Modern Algebra, vol. I, F. Ungar, New York, pp.77-78. 30) Moses, J., "A Canonical Form for First Order Exponential Expressions," in 47) Wooldridge, D., "An Algebraic Simplify preparation. Program in LISP," Art. Intell. Project Memo. no.ll, Stanford Univ., Stanford, 31) Moses, J., "Sarge - A Program for Drilling Calif., Dec. 1963. Students in Freshman Calculus Integra- tion Problems," Project MAC memo., March 1968.

32) Moses, J., Rothschild, L.P., and Schroeppel, R., "A Zero Equivalence Algorithm for Expressions Formed by Functions Defin- able by First Order Differential Equa- tions," in preparation.

33) Oldehoeft, A., "Analysis of Constructed Mathematical Responses by Numeric Tests for Equivalence," ACM National Confer- ence Proceedings, pp.i17-124, Aug. 1969.

34) Perlis, A., et al., "A Definition of Formula Algol," Computation Center, Carnegie-Mellon Univ., Pitts., Pa., March 1966.

35) Richardson, D., "Some Unsolvable Problems Involving Functions of a Real Variable," PhD dissert., Univ. of Bristol, Bristol, England, 1966.

36) Richardson, R., "Some Unsolvable Problems Involving Elementary Functions of a Real Variable," Journal of Symbolic Logic, voi.33, 1968, pp.511-520.

37) Richardson, R., "A Solution of the Identity Problem for Integral Exponential Func- tions," Z. Math Logik u. Grundlagen Math, to appear.

38) Risch, R., "The Problem of Integration in Finite Terms," Trans. of the AMS, voi.139, May 1969, pp.167-189.

39) Risch, R., "On the Integration of Elemen- tary Functions Which are Built up Using Algebraic Operations," Report SP-2801- 002, Systems Develop. Corp., Santa Monica, Calif., June 1968.

40) Risch, R., "Further Results on Elementary Functions,"Report RC 2402, IBM Corp., Yorktown Heights, NY, March 1969.

41) Simon, H., The Sciences of the Artificial, MIT Press, Cambridge, Mass., 1969.

42) Slagle, J., "A Heuristic Program that Solves Symbolic Integration Problems in Freshman Calculus," PhD dissert., MIT, May 1961. 300 A B M N R S H I

C D O P T U J K

M N A B H I R S

O P C D J K T U

R S H I A B M N

T U J K C D O P

H I R S M NAB

J K T U O P C D

IABI IMN I m, the Let us call the array CD a, the array |OP|

array IRSITU r, and the array IJK HII h. Let us call the array ff I W ~ lmaam I w, and the array Ihrrhl x. Then the entire array is

simply lwxxw I While the original structure consisted of 64

symbols, it requires only 35 to write down its description:

WX S = XW

am rh w = ma x = hr

AB MN RS HI a = CD m = OP r = TU h = JK

FIGURE i.

301 PQ = M**2 - PROPI/2,

PR = QI~ + RT - RS,

PS = QS + RT - PROPI/2,

l°T = QS - PR + RT,

QS = M**2 - PROP3/2,

QT = PS - QR - RT,

PROP2 = PROPi - 2*RT + 2*RS

(b.) Relations Between Variables

((4,~,4 - (PROPI+PROPS)**2)*(- 2*IY~**g*QR - 4*QR*RT

+ 2*RT**2 - RT*(PROPI+PROP3)+(PR*PROPI+RS*PROP3)

+ 2*~*2*PR,RS/RT)

+ 4*IYI~*2*QR*(PR + RS)*(2.~.2 + RT + (PROPI+PROPS))

+ 2*~*2*PR*RS*(2*QR - 6*RT - 5*(PROPI+PROP3))

+ 2*(QR - RT)*((PR*PROPI+RS,PROP$)*(M**2 - (PROPI+PROP3))

+ 2*QR*RT* (PROP I +PROP3 ))

+ 2*(QR**2+ RT**2)*(2*QR*RT - (PR*PROPI+RS*PROP3)

+ RT*(PROPI+PROP~)) + 6*I~*2*RT**2*(PROPI+PROPS))

/ (4*PROPI*PROP3*RT*PR*RS)

(e.) Final Result Produced by Man and Machine

Figure 2

302 ( IY), • 4 *

(2 * PROPI * PR * RS - g • PROPI • PR • RT - 4 * PR**2 • RS - 4 * PR**2 * RT - 4 • PR • RS**2 + 14 • PR • RS • RT + 2 * PR * RS * PROPg - 4 • PR • RS * PS - 4 * PR * RS * PT - 4 * PR * RS • QT - 4 * PR * RS * GIS - 4 * PR * R$ * Q.R. - i0 * PR * RT**2 - 2 * PR * RT * PROP2 + 4 * PR * RT * PS + 4 * PR * RT * PT + 4 • PR • RT • QT + 4 • PR • RT * QS - 4 * PR * RT * QR - 6 * RS**2 * RT - 4 * RS * RT**2 - 6 , RS * RT * QR - 6 * RT**5 + 6 * RT**2 * QR)

+ Y~*2 *

( - PROPI * PR * RS • RT + PROPI * PR * RT**2 + PROPI * P R * RT * PROP2 + PROPI * RS**2 * RT + 2 * PROPI * RS * RT**2 - 2 * PROP1 * RS * RT * PT + PROPI * RT**$ + 2 * PROPI * Rl • *2 ~: PS + 6 * PR~c.~ * RT * QT - 2 * PR**2 * RT * QS + 4 * PR**2 * RT * QR - 4 • PR * RS • RT * PROP2 + 4 * PR * RS • h~ PS + 8 * PR * RS ~ RT • PT + 4 * PR * RS * RT • QT + 2 , PR * RS * RT * QS - 4 • PR * RS * RT * QR + 8 * PR * RS • PS • QT + B * PR * RS * PS • QR - 4 * PR * RT**5 + 2 * PR * RT**g * PROP2 + 4 * PR * RT**2 * PT + 6 * PR * RT**2 * QT - 4 * PR * RT**2 * QS + PR * RT * PROPg**2 - 2 * PR * RT * PEO P2 * PS - 2 * PR * RT * PROP2 * PT - 2 * PR * RT * PROP2 * QT - 2 * PR * RT * PROP2 * QS - 8 * PR • RT • PS * QT - 2 * P R * RT * PS • QR - g * PR * RT * PT • QR + 2 * RS*~*2 * RT • QI + 4 * RS**2 * RT * QR - 4 * RS * RT**5 - 2 * RS * RT**2 * PROPg + 4 • RS * RT**2 * PS - 4 * RS * RT**2 * PT + 6 * R S * RT**2 * QT - 2 * RS * RT**g * QS - g * RS * RT * PROPg * P T + RS * RT * PROP2 * QR + 4 * RS * RT * PS * PT + 2 * RS • RT * PS * QR + 4 * RS * RT * PT**2 + 4 * RS * RT * PT * QT + 4 * RS * RT * PT * QS + 4 * RT**3 * PS - 2 * RT**3 * QS + 4 * RT**3 • QR + 2 * RT**2 * PROPg * PS - RT**2 * PROP2 * QR .- 4 * RT**2 * PS**2 - 4 * RT**2 • PS • PT - 4 * RT**2 • PS • QT - 4 • RT**2 • PS • QS + 4 • RT**2 • PS • QR + 2 • RT**2 • PT • QR)

- 2 * PROPI * RS * RT**2 * PS - 2 * PR**2 * RT * PROP2 * QT + 8 * PR * RS • RT**2 • QT + 2 * PR • RS • RT * PROP2 • QT - B * PR * RS • RT • PS • QT - 8 * PR * RS • RT • PS • QR - 4 • PR • RS • RT • PT • QT - ,4 • PR * RT**2 • PS * QT + 4 * PR • RT**2 • PS • QS + ,,4 • PR * RT * PROP2 • PS • QT + 2 * PR * R T * PROP2 * PS • QR + 4 • RS**2 • RT • PT • QT - ,,4 • RS • RT** 2 * PS • QT - 8 * RS * RT • PS • PT • QT - 4 • RS • RT • PS * P T * QR + 8 * RT**2 * PS**2 • QT) /

4 * PROPI • PR * RS * RT**2 * PROP3)

(a.) Expression Initially Produced by Computer Figure 2, Example of Reducing the Size of Output Expressions by Substitution

303 Alternative A B C Results 2 2 3 a xy x y axy, a2/y,

2 3 x y

a 2x + 3y 3x + 4y + 1 3x + 4y + i,

x 4 i,

_y + 3 ~a + 1

a x + y bx + by + 1 ab + 1

.2 .4 -i 1 1 + 1

2 2 4 4 1 S + C s + 2s2c 2 + c

3 2 2 S - S s + c -S 2 c

Figure 3.

304