Bug report ID: 643254 "orderlessp([rat(x)], [rat(x)])"



We have the open bug report ID: 643254 "orderlessp([rat(x)],
[rat(x)])". 

We have the three special representations: CRE, taylor, and Poisson
representation. The main problem is that the function great can not
handle any of these special representations:

(%i6) a1:rat(x)$
(%i7) a2:rat(y)$
(%i8) b1:taylor(x,x,0,3)$
(%i9) b2:taylor(y,y,0,3)$
(%i10) c1:intopois(x)$
(%i11) c2:intopois(y)$

(%i12) ?great(a1,a2);
Maxima encountered a Lisp error:

 The value #:|t^(1/2)1884619| is not of type LIST.

Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.

(%i13) ?great(b1,b2);
Maxima encountered a Lisp error:

 The value #:X1892991 is not of type LIST.

Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.

(%i14) ?great(c1,c2);
Maxima encountered a Lisp error:

 The value 554189328 is not of type LIST.

Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.


Therefore, a specrepcheck is needed to remove the special representation
when we call great. But we know that specrepcheck does not remove the
special representation if we have a list like [rat(x)] as an argument.

I think we have four options:

1. Use $totaldisrep in the functions $orderlessp and $ordergreatp.

This works for CRE and taylor representations, but not for Poisson
representations. $totaldisrep has no code to remove a Poisson
representation. Therefore, this is not a complete solution of the
problem.

2. Use a modified $totaldisrep.

This is a modification of $totaldisrep which handles Poisson
representations in addition:

(defmfun $totaldisrep (l)
   (cond ((atom l) l)
	((not (amongl '(mrat mpois) l)) l)
	((eq (caar l) 'mrat) (ratdisrep l))
        ((eq (caar l) 'mpois) ($outofpois l))
	(t (cons (delete 'ratsimp (car l) :test #'eq) 
	         (mapcar '$totaldisrep (cdr l))))))

3. Use a new function like $completedisrep.

We do not modify $totaldisrep, but introduce a new function like
$completedisrep for the use in $orderlessp and $ordergreatp with the
code from above.

4. Modify great to handle special representations.

The check for special representations can be added at the beginning of
the routine:

(defmfun great (x y)
  (setq x (specrepcheck x)
        y (specrepcheck y))
...

With this change all cases of special representations are handled
correctly. A function which calls great no longer has to do a
specrepcheck itself. The disadvantage is that we have a lot of more
calls to specrepcheck, because great is called a lot from the core
simplifier.

Dieter Kaiser