This bug is a side effect of r2102, "Unify associative and
nonassociative categories", in that commit,

-SemiRng() : Category == Join(AbelianSemiGroup, SemiGroup)
+SemiRng() : Category == Join(NonAssociativeSemiRng, BiModule(%, %), SemiGroup)

Together with

LeftModule(R : SemiRng) : Category == AbelianSemiGroup with
      if R has AbelianMonoid then AbelianMonoid
      if R has AbelianGroup then AbelianGroup

and in DirectProduct:
         if R has SemiRng then SemiRng

So for T==DirectProduct(3,NNI), "T has SemiRng" leads to
"T has LeftModule(T)", the whole (not part of) T is passed to
LeftModule, and the query for "if T has AbelianGroup" leads
back to itself.

This commit also causes "SemiRng has AbelianGroup" bug that
I reported in March 10.

Also, this bug is similar in nature with "add Algebra Integer to DivisionRing"
that I posted in February 22, both invloes "self reference has test", but that
happens at compile time, this happens at run time.

As you can see in the patch, the code I removed is an attempt
to catch this kind of self reference, but it did this at only one
level, can't capture deeper reference.  I use a 'substitute'
to capture them all.

https://github.com/oldk1331/fricas/commit/a921542e64ac768de66d4e20d10e61f1739f5149.patch

All tests passed: https://travis-ci.org/oldk1331/fricas/builds/273754359

diff --git a/src/interp/i-funsel.boot b/src/interp/i-funsel.boot
index 543400e8..087fdb17 100644
--- a/src/interp/i-funsel.boot
+++ b/src/interp/i-funsel.boot
@@ -1477,13 +1477,7 @@
     atom x => SL
     ncond := subCopy(x, constructSubst d)
     ncond is ['has, =d, =cat] => 'failed
-    if ncond is ['OR, :nconds] then
-        nnconds := nconds
-        for nc in nconds repeat
-            if nc is ['has, =d, =cat] then
-                nnconds := delete(nc, nnconds)
-        ncond := ['OR, :nnconds]
-    hasCaty1(ncond, SL)
+    hasCaty1(substitute('failed, ['has, d, cat], ncond), SL)
   'failed

 mkDomPvar(p, d, subs, y) ==
@@ -1502,9 +1496,11 @@
   subCopy(arg, SL2)

 hasCaty1(cond,SL) ==
-  -- cond is either a (has a b) or an OR clause of such conditions
+  -- cond is either a (has a b) or an OR/AND clause of such conditions,
+  --     or a special flag 'failed to indicate failure
   -- SL is augmented, if cond is true, otherwise the result is 'failed
   $domPvar: local := NIL
+  cond is 'failed => 'failed
   cond is ['has,a,b] => hasCate(a,b,SL)
   cond is ['AND,:args] =>
     for x in args while not (S='failed) repeat S:=

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to