login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for #83 Bug 5977 1::DMP([x],FRAC INT)::POLY FRAC INT ==> 0 revision 6 of 13

1 2 3 4 5 6 7 8 9 10 11 12 13
Editor: gdr
Time: 2008/05/21 08:40:05 GMT-7
Note:

added:

From gdr Wed May 21 08:40:05 -0700 2008
From: gdr
Date: Wed, 21 May 2008 08:40:05 -0700
Subject: 
Message-ID: <20080521084005-0700@axiom-wiki.newsynthesis.org>

Status: fixed somewhere => open 

Not really fixed.  sorry.

Submitted by : (unknown) at: 2007-11-17T23:03:08-08:00 (17 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

William Sit wrote:

 > Martin wrote:
 > 
 > Thanks for investigating further.
 >  
 > > it might be that there is an error in mainVariable$SMP, but more likely, the
 > > bug is earlier in the history. mainVariable<img alt="SMP is called from coerce" title="SMP is called from coerce" class="equation" src="images/5955511306385491609-16.0px.png" align="bottom" Style="vertical-align:text-bottom" width="171" height="16"/>POLY,
 > > interestingly without checking that the result of mainVariable might be
 > > "failed".
 > 
 > Shouldn't that mean coerce$POLY should be fixed to check the "failed" case?

Sorry, my mistake. coerce$POLY checks itself whether there is a variable or not:

 > Which coerce$POLY is that?

the coerce operation in the POLY domain:

 > > (66) -> 1::DMP([x],FRAC INT)::POLY FRAC INT
 > > 
 > >    coerce$POLY
 > >    mainVariable1$SMP
 > >    mainVariable3$SMP
 > >    mainVariable4$SMP
 > >  LISP output:
 > > 1
 > >    coerce4$POLY
 > >    1
 > >    coerce5$POLY
 > >    coerce6$POLY
 > >    (66)  0
 > >                           Type: Polynomial Fraction Integer

 > > Is there a way to find out what exactly the variable p in mainVariable
 > > contains?
 > > 
 > use p$Rep  ? or trace boot.

I'm pretty sure that the coercion to from DMP to POLY fails, without signalling an error, just like you could always do a "pretend". This would also explain (66)

Note that it is not possible to coerce a DMP or a UP or anything the like to a POLY in compiled code! Unfortunately I don't know where these interpreter coercions are coded. In any case, I'm convinced that they should be coded in the Algebra, not in the interpreter:

 > Now p is declared in multpoly.spad as Union(R, VPoly).
 > So the code mainVariable p seems to be correct, but your debug info
 > 
 > > (65) -> 1::DMP([x],INT)::POLY INT
 > > 
 > >    coerce$POLY
 > >    mainVariable1$SMP
 > >    mainVariable3$SMP
 > >    mainVariable4$SMP
 > > 
 > >    >> System error:
 > >    Caught fatal error [memory may be damaged]
 > > 
 > > protected-symbol-warn called with (NIL)
 > 
 > suggests that when 1<img alt="DMP([x], INT) is passed on to coerce" title="DMP([x], INT) is passed on to coerce" class="equation" src="images/4935871849813661108-16.0px.png" align="bottom" Style="vertical-align:text-bottom" width="245" height="18"/>(POLY INT) and then 
 > to
 > mainVariable$SMP as p, it is recognized as "case VPoly". So that must be where
 > the bug is, in coerce$(POLY INT).

Note that coerce$POLY only coerces to OutputForm?... No internal stuff done there. That's why I'm sure that it is an interpreter bug.

the original complaint --Tim Daly, Tue, 15 Feb 2005 20:39:05 -0600 reply
Problem:
 (1) -> a:=1::DMP(['x],INT)

   (1)  1
               Type: DistributedMultivariatePolynomial([x],Integer)
 (2) -> a::POLY INT

   >> System error:
   Caught fatal error [memory may be damaged]

 protected-symbol-warn called with (NIL)
 (2) -> variables(a)

   (2)  []
                                           Type: List OrderedVariableList [x]
 (3) -> a::INT::POLY INT

   (3)  1
                                Type: Polynomial Integer

 (4) -> 1::DMP([x],INT)::POLY INT

   >> System error:
   Caught fatal error [memory may be damaged]

 protected-symbol-warn called with (NIL)

 (5) -> 1::DMP([x],INT)::DMP([y],INT)

   <a href="#eq5">(5)</a>  1
               Type: DistributedMultivariatePolynomial([y],Integer)

 and 

 1::POLY INT :: DMP([x],INT) 
 x::DMP([x],INT)::POLY INT
 1::DMP([x,y],INT)::POLY INT 
 1::EXPR INT:: POLY INT 
 1::UP(x,INT)::POLY INT

 and (surprise!) even

 1::DMP([x],INT)::POLY FRAC INT

 all worked!

This bug also exists in the NAG version, where the first (2) would give "Memory access violation detected". Two observations: (a) the coercion in (2), shows the interpreter does not follow the two steps in (3); and (b) the problem is specific to POLY INT. It may also have to do with the second (2), and my suspicion is that it has to do with a combination of the interpreter, POLY, DMP, INT, no variables, and may be POLYLIFT or MLIFT.

Tim: can you do a boot trace of (4) and compare that with any of the others that work?

fixed in FriCAS? --kratt6, Thu, 20 Dec 2007 01:45:47 -0800 reply
Status: open => fix proposed

Status: fix proposed => fixed somewhere

no patch available

fricas
(1) -> a:=1::DMP(['x],INT)

\label{eq1}1(1)
Type: DistributedMultivariatePolynomial?([x],Integer)
fricas
a::POLY INT

\label{eq2}1(2)
Type: Polynomial(Integer)
fricas
variables(a)

\label{eq3}\left[ \right](3)
Type: List(OrderedVariableList?([x]))
fricas
1::DMP([x],INT)::POLY INT

\label{eq4}1(4)
Type: Polynomial(Integer)
fricas
1::DMP([x],INT)::DMP([y],INT)

\label{eq5}1(5)
Type: DistributedMultivariatePolynomial?([y],Integer)

fricas
1::POLY INT :: DMP([x],INT)

\label{eq6}1(6)
Type: DistributedMultivariatePolynomial?([x],Integer)
fricas
x::DMP([x],INT)::POLY INT

\label{eq7}x(7)
Type: Polynomial(Integer)
fricas
1::DMP([x,y],INT)::POLY INT

\label{eq8}1(8)
Type: Polynomial(Integer)
fricas
1::EXPR INT:: POLY INT

\label{eq9}1(9)
Type: Polynomial(Integer)
fricas
1::UP(x,INT)::POLY INT

\label{eq10}1(10)
Type: Polynomial(Integer)
fricas
1::DMP([x],INT)::POLY FRAC INT

\label{eq11}1(11)
Type: Polynomial(Fraction(Integer))

Status: fixed somewhere => open

Not really fixed. sorry.