Is the Domain Expert Module for Expression Manipulation Exercises Ready?
Rein Prank, Eno Tõnisson
prank@cs.ut.ee, eno@math.ut.ee
Tartu University 
Institute of Computer Science
Liivi Str 2, 50409 Tartu, Estonia
Tel: + 372 7 375484, Fax: + 372 7 375468
Abstract. The paper investigates the possibility of using the existing Computer Algebra Systems (CAS) as the kernel of Domain Expert Module of an Intelligent Tutoring System (ITS) for solving expression manipulation exercises. As a basis we describe a possible operating scheme and working modes (two modes for subexpression location and three modes for subexpression replacing) of an ITS for expression manipulation. From this description we single out the most important classes of syntactical and mathematical functions that must be available in the Domain Expert. Evaluation of commonly used Computer Algebra Systems in the role of Domain Expert gives the following results. The CAS give the programmer good tools for checking the syntax and checking the completion of particular steps. The functions for the work with the parts of expressions need rewriting because of several reasons: preprocessing the expressions, using restricted set of arithmetical operations (only addition and multiplication). Preprocessing also makes questionable the use of existing expression conversion functions (main part of CAS) in basic expression manipulation exercises where the student can be unable to understand the changes made in the structure of expression. The systems fail on many equation solving exercises where their output contains extraneous solutions that are important objects of teaching. The biggest problem for builders of ITS is absence of reliable expression equality checking functions. 
Keywords: Computer Algebra Systems, Expression Manipulation modes, Equivalence Checking
1 Introduction
School and university mathematics curricula contain a great number of different expression manipulation exercises (for instance, computing the value of numerical expressions, operations with fractions and polynomials, equations and systems of equations, trigonometry, differentiation, integration and different algebraic systems) that have different signatures and rules of conversion but in general the same processing scheme for expressions. When we think about a possible use of computers in teaching mathematics expression manipulation would probably seem one of the most appealing domains. Nevertheless, we cannot yet claim that we have succeeded in implementing computers in the teaching of this topic. 
A large number of enthusiastic school and university teachers have invented hundreds of sophisticated methods for doing reasonable work with the existing non-educational computer algebra systems (CAS). However, the use of these requires additional efforts and presupposes a better understanding of CAS and mathematics than we can expect from an average teacher. The majority of teachers seem to reject the use of CAS by a very simple reason: they are afraid of “the calculator effect," amplified by the far greater capacity of the increasingly powerful computer systems of today. CAS is an expert system for providing assistance in performing some or even all the steps in solving a mathematical problem; yet it is not a tutoring system. On the other hand, the commercial tutoring software for expression manipulation currently available seems to be too trivial in mathematical terms. The programs assign the tasks and check the answers but do not support free and stepwise conversion of the expressions. The main reason seems to be the fact that their authors have not been able to implement enough mathematics.
A synthesis of these two almost antagonistic trends in the computerized teaching of expression manipulation would give us just Intelligent Tutoring. The tasks containing a long stepwise solution, with many different paths to choose from in between, should be a good practice base for an Intelligent Tutoring System (ITS). There is also a special reason to anticipate success in creating ITS for expression manipulation. It seems to be the field where the Domain Expert is implemented already. 
In this paper we investigate the possibility of using the existing computer algebra systems as the Domain Expert Module of an Intelligent Tutoring System for solving expression manipulation exercises. In Section 2 we describe a possible operating scheme and working modes of an ITS for expression manipulation. For every working mode we describe what the program must be able to do to support the expression manipulation environment and give feedback. In Section 3 we single out from the description the most important classes of syntactical and mathematical functions that must be available in the Domain Expert. In Section 4 we describe the results of our research on using the functions of the existing CAS in role of the functions of Domain Expert. The following versions of CAS were used in our experiments: 
DERIVE for Windows. Version 4.11 (1996)
Maple V Release 5. Student Version 5.00 (1998)
Mathematica for Students. Version 3.0 (1996)
MuPAD Light. Version 1.4.1 (1998)
2 A Prototype 
What could be the operating scheme of a reasonable environment for learning expression manipulation skills? Obviously, in order to be understandable for the learner the system must emulate the traditional work with paper and pencil, i.e., record the stages of solution line by line. The program must be able to inspect the syntactical correctness of the expressions, check the equality against the previous line, understand whether a particular part of the solution algorithm is already completed or not, and, desirably, grade the appropriateness of the step made by the student. The student must have the possibility to move on with shorter or longer steps. If the student asks for a hint the program must be able to suggest one or more ways to go ahead and sketch the whole solution along with comments. 
The decision to emulate the general visual scheme of “the solution script” does not necessarily mean that the student must repeatedly enter long lines of symbols from the keyboard. The key here lies not in writing the right symbols but in making the decisions. At the different stages of the learning process the degree of sophistication of the decisions can be different and thus the degree of sophistication of the input must be tunable. The most detailed working mode seems to be direct input. But even this can be combined with the possibility to copy the unchanged part of the expression from the previous line. Another mode option must be that the student has the possibility to mark a subexpression and choose a conversion rule for this subexpression from the menu. It is noteworthy that the last principle is also used in the traditional paper-and-pencil technology. At school explanations about a subexpression or a rule are usually added orally to the written solution or used for explaining error diagnosis. 
About ten years ago the first author led a project of computerising exercises for an introductory course of Mathematical Logic for first-year students of Mathematics (Prank, 1991). We designed and implemented a package for Truth-Table, Formula Manipulation, Formal Proof and Turing Machine exercises. This package has been used by our students for ten years already. In our opinion the interface of our Formula Manipulation Assistant (for the tasks of expressing propositional formulas through {, &}, {, }, {, } and for normal forms) may serve as a prototype for far more general ITS for expression manipulation. In this paper the work of the Assistant is described only as much as is needed to single out the main functions of the Domain Expert to guarantee the functionality of the program. A more detailed description is given in (Prank&Viira, 1991) and (Prank, 1997) 
In working with the Assistant, every step consists of two substeps. In the first substep the student marks the subterm to be changed and in the second substep he defines the string to replace the subterm. The rest of the left and right sides of the formula will automatically be copied to the next line. The Assistant has two modes for the localisation of subterm and three modes for the replacement of subterm. 
The modes of subterm localisation are as follows: 
1a) TREE - the active part of the formula highlighted on the screen can be moved up, down, left and right on the syntax tree of the formula by using the arrow keys, 
1b) LINEAR - the left and right ends of the active part can be moved by the arrow keys. 
Mode 1a) is used in many interactive programs. In this mode it is the computer that decides in what order the operations should be performed, and the user has no possibility to make mistakes. 
In mode 1b) it is the student who decides what part of the string he wants to select as a subformula. He has the possibility to make arbitrary mistakes. If the selected substring is not a syntactically correct formula (for example, the brackets are not balanced) or if it is a formula but not a subformula of the original row (since the order of operations was misunderstood by the student) an error message is issued. 
For the second part of the step there are three modes in the program: 
2a) IMMEDIATE - entering the string replacing the active subformula immediately from the keyboard, 
2b) RULE - selecting the conversion rule from the menu, 
2c) INPUTRULE - entering the conversion rule. 
In IMMEDIATE mode the student enters the string replacing the selected subformula from the keyboard. The program first checks the syntax of the entered formula. If the syntax is correct the program further checks whether the entered formula and the highlighted subformula are equivalent (and issues an error message, if applicable). If the formulas are equivalent the program additionally checks whether the new subformula needs to be enclosed in brackets. 
It is not easy to design an adequate RULE mode for expression manipulation. We cannot implement all the menu items in the rewrite-rule style. In actual mathematics we do not apply the commutative and associative rules twenty times when we want to change the order of the members of a polynomial. In propositional logic our menu for Disjunctive Normal Form exercises looked like the following 
1.	
1.	X~Y = X&YX&Y
2.	XY =XY
3.	X = X
4.	(XY)=X&Y
5.	(X&Y) = XY
6.	X&(YZ) = X&YX&Z

7.	Xf = X
8.	XX&Y = X
9.	X = X&YX&Y
10.	(X) = X
11.	X*X = X
12.	X*Y = Y*X
13.	X*(Y*Z) = (X*Y)  
Rules 11-13 were applicable to both & and . Only some items functioned in the purely rewrite-rule style (1, 2, 3, and 10). Rules 4-6, 7-8 and 11-12 were applicable to n-ary junctions. Most of the items in the right column worked in the dialog. 
INPUTRULE mode is an intermediate one between those of IMMEDIATE and RULE. The student manipulates the formula as in the RULE mode, using the rules in the menu. At the beginning only some rules (for instance, 10-13) are displayed on the screen. The student can add new rules. The program accepts them only if their left and right sides are equivalent. 
If the Domain Expert is a CAS the manipulation menu could include an additional level in which automatically performed operations are more abstract than in our RULE mode i.e. a palette of functions/commands/utilities of the underlying CAS. If we want to concentrate the attention of the student to the main algorithm of the task, then the use of commands for automatic execution of some subconversions could be allowed. For instance, an ITS for integration should include the command FACTORIZE for polynomials. For getting a general idea about the algorithm the menu containing just the commands for the steps could be appropriate.
3 What Functions Must Be Included In The Domain Expert Of Expression Manipulation ITS 
The syntax of propositional formulas is fairly regular and the semantics of Boolean algebra very simple. The Formula Manipulation Assistant was written from scratch. To do the same for a domain of Calculus would mean to replace the LINEAR mode with a PLANAR analog and implement the arithmetic of integers, real numbers and fractions as well as different areas of elementary algebra, trigonometry, sequences and series, derivatives and integrals, etc. Exercises on polynomials alone would require the introduction of a fair amount of the mathematics described in the previous chapters of the syllabus of junior high school. However, all the above already exists in CAS, in some form or another. Therefore it seems only natural to take over part of the contents of the Domain Expert from CAS and write additional programs only for those functions that are missing in CAS or unsuitable for our work. 
Let us now try to analyse the operating schemes presented in Section 2 and single out a set of functions that could be called from the Domain Expert by our hypothetical ITS. 
1. The preparation of each expression manipulation exercise for the solution dialog starts with loading or entering the initial expression and checking its syntax. When the student enters the expressions in IMMEDIATE or INPUTRULE mode or selects a substring in LINEAR mode, the syntax of the respective term should be checked. This means that ITS must have the syntax check feature. In many cases it is sufficient to check an “all-purpose mathematical syntax” using an ordinary set of constants and function symbols for elementary functions. However, there are many types of problems that have their own restrictions on the permitted signature. A typical example of this are polynomials with only integer coefficients or the terms allowing the use of only decimal numbers or fractions. For instance, it is fair to write sin x according to one textbook while it must be written as sin(x) according to another. An ideal Expert might be able to check the syntax that is defined by certain structure of input parameters. 
2. To build a user interface in TREE mode and to evaluate the correctness of an option in LINEAR mode an ITS programmer will need many syntactic functions for work with parts of an expression, such as Main Operator, Left/Right Argument, Superterm, FirstSubterm, and many others. 
3. A wide range of functions for expression, equation and equation systems manipulation is necessary in order for the program to find solutions to problems and present example solutions itself. 
4. A very important function for a tutoring system is checking the equivalence of two expressions. We need it in IMMEDIATE and INPUTRULE modes. Ascertaining equivalence by converting one expression into another is generally a hopeless task as far as solving time is concerned. Some classes of expressions (for instance, polynomials) have canonical forms and the problem of their equivalence can be solved by finding these forms. If a signature contains all the elementary functions studied at school, however, the problem of expression equivalence is algorithmically unsolvable. Apart from the equivalence of expressions it is also necessary to check the equivalence of equations and equation systems. 
5. When it comes to a problem that requires a particular algorithm to be taught for solution an ITS must be able to check what steps of the algorithm have already been completed, and give a hint for making the next step. In many cases the expressions to be obtained after making a step must have a certain form and thus it is necessary to check the requirements for the form of expression. In more simple cases the form to be obtained has been uniquely defined. Then conversion to the required form may be used instead of checking, if the ITS contains commands for that. 
6. Items 1-5 describe the need for tools performing some internal functions of ITS. However, a programmer of an ITS also needs to solve a serious mathematical problem of the external behavior of the program, which actually occurs in computer algebra systems as well. The authors of ITS would be extremely happy if they would be able to use a professionally written expression input interface of a CAS. 
4 A Short Evaluation Of The Situation 
Teachers using computer algebra systems in educational work have written many articles about the fact that each of these systems has an individualised syntax for expressions and solves problems by means of algorithms that differ from those taught for use in manual problem solving. Furthermore, in designing computer algebra systems the objective has so far been to create a tool that would be able to solve difficult problems when handled skilfully, rather than one that would give a guaranteed result in a particular elementary domain. Below we try to evaluate to what extent these characteristics prove to be disturbing in the case when the system’s functions are used by an ITS programmer rather than a student. We do not try to describe here the mistakes of different CAS or to compare the systems as in (Wester, 1999). Our aim is to point out the needs of ITS where no any of today’s CAS is able to help us enough. 
4.1 Checking the Syntax 
It is clear that as long as the individualised syntax of an ITS differs from that used in educational work only by the symbols used in, and not the structure of expressions (for instance, when the form Sin[x] is made mandatory; see above) it is possible, prior to checking, to “translate” the expression into the symbols used in the system. In case of general type syntax errors, the error messages of computer algebra systems seem to be sufficiently informative to enable the issuing of an intelligible message to the student. Many special restrictions established in some types of problems can be checked directly by means of CAS commands. 
4.2 Work with Parts of Expression 
Computer algebra systems have tools for handling and decomposing the expression structure. These tools are also available to the user as commands. Unfortunately the systems automatically convert the expression to the internal form before the determination of the structure of the expression. In this internal form the set of permitted operators is different from that included in school math syllabuses. For instance, in the more widespread systems the main operation for the expression a-b is addition, with the second operand being -b, since the system uses only addition and multiplication out of the four binary arithmetic operations. 
A problem in itself is the fact that in comparison with the above-described LINEAR mode Mathematica, for instance, does not handle subterms in an intelligent way. In the equation  x2-4x == 0 we may want to let  x2-4  be the subterm and apply to it the command Factor using the palette. Mathematica then factorises the subterm; however, for some unknown reason it also writes to the next line the rest of the symbols, thus creating a totally different equation  (-2+x)(2+x)x == 0. 
The mechanism for handling subterms in CAS seems to be unsuitable for teaching mathematics, and the simplest solution to it seems to be to reprogram that part of the Expert. Fortunately, the syntactic functions concerned are quite simple to implement. 
4.3 Conversion Of Expressions And Equations 
Computer algebra systems contain a large number of conversion functions having different degrees of detailness and designed for different domains. The existence of these functions is the reason we are actually interested in integrating CAS into the Domain Expert. Some general qualities of CAS may, however, make it complicated to use these functions. Direct experiments may convince us that the application of functions begins with simplifying an expression and converting it to the standard form utilised by the given CAS. As a rule, these standard forms are not suitable for educational work, especially for basic exercises. A tutoring system should adequately handle the cases when a student has applied a technique of manipulation to an expression in which the simplifying manipulations have not been previously performed. The problem, however, cannot be solved by simply leaving out this preprocessing from function algorithms, since the algorithm of the subsequent part has been built on the premise that the input expression satisfies a certain set of initial requirements. In some cases CAS also convert the expression to the form that is not equivalent to the initial one, by reducing out the factors that may equal to zero: x*(x-1)/(x-1) = x. Such manipulations may lead to extraneous solutions, which, however, are issued by CAS as real solutions. They would also go unnoticed for the student when he checks the solutions of the equation with the help of CAS by assigning values to variables, since CAS simplify expressions before assigning values to variables and thus repeat the same mistakes. The incorporation of the expression manipulation functions implemented in CAS into an intelligent tutoring system apparently requires close cooperation between the programmers of ITS and the authors of CAS. The cooperation would probably lead to the need to rewrite a number of existing functions. 
4.4 Checking the Equivalence 
The majority of CAS apparently do not have any equivalence check devices that could be taken seriously. In some cases the difference between the expressions under scrutiny is converted to zero by running simplification commands; however, this device is far from functioning perfectly. Even the basic equivalencies of algebra and trigonometry taught at the junior high school level include those that cannot be determined by any of the more widespread CAS by means of simplifying the difference. Unlike other systems, Maple has a command for checking the equivalence of expressions, testeq. This checks the equivalence probabilistically, trying the values. This command can identify almost all the known equivalencies as well as the equations presented for proof in textbooks. Only in the case of a few expressions containing roots and logarithms it issues the message FAIL instead of the solution (for instance, log a(xb) = b loga x ). Of course, the examples of the type provided under Item 4.3 will be pronounced equal by it. It would be interesting to use in the school the equivalence checker that tries simultaneously to prove the equivalence by converting one expression to another and to reject it probabilistically. It should be possible to “justify” a correct step made by the student, at least in the modes that expect the student to make fairly short steps. 
Checking of the equivalence (= equality of the sets of solutions) of equations and systems of equations is not implemented in CAS. They also do not check the correctness of the solutions found by themselves and they can output the extraneous solutions already in quite simple situations. For example (Mathematica): 
In[1]:= Solve[2x+1/(x-1) == 3x-1+1/(x-1)]
Out[1] = {{x->1}}
Moreover, if the student uses a CAS by checking of the correctness of the solution, then in many cases the CAS simplifies the equation before substituting the values of the variables and repeats the mistake made during the solution process.
4.5 Checking the Completion of Steps 
Usually the goals of the steps are defined in syntactic terms. This makes checking of completion quite easy.  In many algorithms the check of the results of the steps simply means the running of an existing function of CAS, or the application of some simple utilities composed from these functions. Undoubtedly, there are also cases in which the check feature needs to be programmed additionally but it is not very hard. 
4.6 Expression Input Editor 
The expression input editors of different CAS are quite different from each other. Clearly, there is no sense to use at school an editor that only allows entering the linear form of an expression. However, it seems possible to learn to use the editor of Mathematica at school. Also acceptable in an educational setting (Fuchs&Dominik, 1999) is the possibility provided in Mathematica of designing a palette of tools to meet some particular needs. 
5 Some Concluding Remarks 
In reply to the question raised in the title of this paper, it must be said that the Domain Expert for expression manipulation exercises is not yet ready. Due to the fact that CAS were originally designed to meet a different kind of needs the suitability of the functions available in them for expression manipulation needs a more detailed study. However, it is clear that some of the functions are fairly difficult to use in their existing form. This holds true even for many of those functions that have been specifically designed for expression conversion. It would be highly necessary to redesign these functions so that they do not require a strictly defined form for an input expression. To satisfy some other needs, however, it is necessary to add new functions to CAS. A necessity of particular urgency seems to be a well-functioning equivalence check. Also, a tutoring system, as well as CAS themselves, would benefit much from a well-designed expression input editor. 
Thus the creation of a good tutoring system also depends on cooperation from the authors of CAS. When using CAS in educational work in their existing form teachers have been forced to regard the systems as absolute entities - as they are. Further, teachers have often been accused of being too conservative and reluctant to implement new devices. The authors of this article hope that the next stage will see the conservatism of the authors of CAS relented, thus leading to the birth of a new generation of tutoring programs. There are people out in the wide world who have no possibility to write a new Maple or Mathematica yet have sufficient knowledge about mathematics, formal languages and programming to write, on the basis of the existing Expert, a new and interesting tutoring system suited to the needs of a particular domain in mathematics. 
References
Fuchs, K., Dominik, A. (1999). MATHEMATICA palettes – a methodical way to provoke students into using mathematical strategies. In ICTMT4. The International Conference on Technology in Mathematics Teaching. University of  Plymouth,  30
Prank, R. (1991).  Using Computerised Exercises on Mathematical Logic. Informatik-Fachberichte.  Springer-Verlag. 292, 34-38 
Prank, R., Viira, H.(1991). Algebraic Manipulation Assistant for Propositional Logic.  Computerised Logic Teaching Bulletin.  St Andrews Univ. 4, 13-18. 
Prank, R. (1997). Good diagnostics = adequate stepwise solution interface? In Proc.  International Conference on Technology in Mathematics Teaching. Koblenz, 1997.  CD- and WWW-publication.
<http: //euler.uni-koblenz.de/ictmt3/cd-rom/pdf/prank.pdf >
Wester, M. J. (Ed.) (1999) Computer Algebra Systems. A Practical Guide. J.Wiley & Sons, Ltd.