4.4 Kernels, kernel order

Kernels are the “unknowns” in a polynomial. A kernel can be an

It is essential for the operation of REDUCE that kernels are unique. This is no problem for id’s as these are unique by LISP definition. For composite kernels REDUCE ensures that these are made unique before they enter a standard form. Never construct a composite kernel by hand. Instead use the function *a2k for converting an algebraic expression into a kernel or use simp (see below). On the other hand, the uniqueness of kernels is of big advantage for comparisons: the equality can be tested with eq instead of = and faster memq and atsoc can be used instead of member and assoc.

The set of all kernels is totally ordered by the kernel order. REDUCE has by default some ordering which is roughly based on lexicographic comparison. The ordering can be changed internally by calling setkorder (corresponding to the algebraic statement korder) with a list of kernels as argument. These kernels precede all other kernels in the given sequence .Setkorder returns as result the previous order and it is a good policy to restore the old order after you have changed it:

     begin scalar oldorder, ....;  
       oldorder:=setkorder ’(x y z);  
        ....  
       setkorder oldorder;  
        ....  
     end;

The current kernel order list is the value of the variable kord*. The value nil signals that the default ordering is active.

To check the system order of two algebraic expressions use the function ordp with two arguments, which returns true if the first argument is lower in the ordering sequence as the second one. This check does not consider the actual kord*. For kernels there is an extended order check function ordop which does consider the actual kord*. However, you need to call these functions only rarely as the algebraic engine of REDUCE maintains a proper order in any context.