Is %i an integer? - Adding more facts to the database



Am Dienstag, den 30.06.2009, 08:36 -0600 schrieb Robert Dodier:
> On 6/28/09, Dieter Kaiser <drdieterkaiser at web.de> wrote:
> 
> > I have added the following facts to the database:
> >
> >    (kind $%i $imaginary)
> >    (kind $%pi $real)
> >    (kind $%gamma $real)
> >    (kind $%phi $real)
> 
> OK by me. But in addition perhaps %pi, %gamma, and %phi
> should be declared irrational. (Or maybe transcendental for
> %pi and %gamma, but I don't remember if featurep and kindp
> handle that correctly.)

Up to now we had a longer discussion about this topic. Most confusing is
the way, the actual implementation of Maxima handles the different types
of a symbol.

With the implementation we have it is not possible to define a symbol at
the same time an imaginary and an irrational.

(%i1) declare(%i,imaginary);
(%o1)                                done
(%i2) declare(%i,irrational);
declare: inconsistent declaration declare(%i,irrational)
 -- an error.  To debug this try debugmode(true);

> > Next I have improved the function NONINTEGERP.
> >
> > ;	  ((atom e) (kindp e '$noninteger))
> >           ((atom e) (or (kindp e '$noninteger)
> >                         (kindp e '$rational)
> >                         (kindp e '$real)
> >                         (kindp e '$complex)))
> 
> I don't think this is right. NONINTEGERP should return T when
> E is demonstrably noninteger. Some rationals, reals, and
> complex numbers are integers, right? So it can't use those
> declarations to determine noninteger-ness.

The implementation of nonintegerp as above is a consequence of the
strange implementation we actual have.

Therefore, in one of my last postings I have suggested to remove the
inferences for the different types completely. The testsuite will have
no problems and the routine nonintegerp must not be changed.

When we remove the inferences between the different types, the function
kindp respectively featurep gives the answer of the question "Is the
symbol declared to be of the type e. g. complex?" and not more.

We can do the following:

1. Remove the inferences that is
   
  (kind $integer $rational)

  (par ($rational $irrational) $real)
  (par ($real $imaginary) $complex)

2. Add the inference

   (kind $imaginary $complex)

3. Add e.g. the following for a symbol:

   (kind $%i imaginary)
   (kind $%i noninteger)
   (kind $%i irrational)

Dieter Kaiser