--* From BMT%WATSON.vnet.ibm.com@yktvmh.watson.ibm.com  Fri Oct 15 11:35:55 1993
--* Received: from yktvmh.watson.ibm.com by radical.watson.ibm.com (AIX 3.2/UCB 5.64/900524)
--*           id AA21425; Fri, 15 Oct 1993 11:35:55 -0400
--* Received: from watson.vnet.ibm.com by yktvmh.watson.ibm.com (IBM VM SMTP V2R3)
--*    with BSMTP id 3586; Fri, 15 Oct 93 11:42:22 EDT
--* Received: from YKTVMH by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id <A.BMT.NOTE.VAGENT2.9344.Oct.15.11:42:21.-0400>
--*           for asbugs@watson; Fri, 15 Oct 93 11:42:22 -0400
--* Received: from YKTVMH by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id 9342; Fri, 15 Oct 1993 11:42:20 EDT
--* Received: from cyst.watson.ibm.com by yktvmh.watson.ibm.com (IBM VM SMTP V2R3)
--*    with TCP; Fri, 15 Oct 93 11:42:20 EDT
--* Received: from spadserv.watson.ibm.com by cyst.watson.ibm.com (AIX 3.2/UCB 5.64/900528)
--*   id AA46001; Fri, 15 Oct 1993 11:41:47 -0400
--* Received: by spadserv.watson.ibm.com (AIX 3.2/UCB 5.64/900524)
--*           id AA25765; Fri, 15 Oct 1993 11:43:40 -0400
--* Date: Fri, 15 Oct 1993 11:43:40 -0400
--* From: bmt@spadserv.watson.ibm.com
--* X-External-Networks: yes
--* Message-Id: <9310151543.AA25765@spadserv.watson.ibm.com>
--* To: asbugs@watson.ibm.com
--* Subject: asharp -Wcheck -Mno-warnings gives assertion failed in tform.c line 1865 abSyme(id) [fix210.as][current]

--@ Fixed  by:  SSD   Wed Nov 2 15:15:43 EST 1994 
--@ Tested by:  none 
--@ Summary:    Assertion failed message no longer appears. Error messages appear justified. 


--* From bmt@spadserv.watson.ibm.com  Sat Apr  3 12:18:01 1993
--* Received: from spadserv.watson.ibm.com by radical.watson.ibm.com (AIX 3.2/UCB 5.64/900524)
--*           id AA25674; Sat, 3 Apr 1993 12:18:01 -0500
--* Received: by spadserv.watson.ibm.com (AIX 3.2/UCB 5.64/900524)
--*           id AA27528; Sat, 3 Apr 1993 12:19:19 -0500
--* Date: Sat, 3 Apr 1993 12:19:19 -0500
--* From: bmt@spadserv.watson.ibm.com
--* X-External-Networks: yes
--* Message-Id: <9304031719.AA27528@spadserv.watson.ibm.com>
--* To: axc-bug@radical.watson.ibm.com, sutor@watson.vnet.ibm.com
--* Subject: compiler gets segmentation violation from macros in where clause [gb2.as][27.5 (current)]

--@ Fixed  by:  SSD   Wed Nov 2 15:15:43 EST 1994 
--@ Tested by:  none 
--@ Summary:    Assertion failed message no longer appears. Error messages appear justified. 
-- PI: not riproducible. I get only an error msg

#include "aslib.as"
#library DemoLib       "asdem"
import from DemoLib

macro
  Void == ()
  Arithmetic == Ring
  Ordered == Order
  Object == BasicType
  GcdDomain == with
     Object
     Arithmetic
     *: (%, %) -> %
     gcd: (%, %) -> %
     /: (%, %) -> %
  OrderedAbelianMonoidSup == with
     Object
     Ordered
     Arithmetic
     sup: (%, %) -> %
  OrderedSet == with
     Object
     Ordered
  PolynomialCategory(R,E) == with
     Object
     Arithmetic
     *: (R, %) -> %
     *: (%, %) -> %
     degree: % -> E
     totalDegree: % -> NonNegativeInteger
     monomial: (R, E) -> %
     reductum: % -> %
     leadingCoefficient: % -> R
     primitivePart: % -> %
  PositiveInteger == Integer
  NonNegativeInteger == Integer
  SmallInteger == SingleInteger
  NNI == Integer
  null xx == empty? xx

messagePrint(s: String):Void == print(s)()
import with (string: Literal -> %) from String

(GroebnerPackage(Dom, Expon, Dpol): T == C) where
 default Dom:   GcdDomain
 default Expon: OrderedAbelianMonoidSup
 default Dpol:  PolynomialCategory(Dom, Expon)
 T ==>
   with
     groebner: List(Dpol) -> List(Dpol)
       ++ groebner(lp) computes a groebner basis for a polynomial ideal
       ++ generated by the list of polynomials lp.
     groebner: ( List(Dpol), String ) -> List(Dpol)
       ++ groebner(lp, infoflag) computes a groebner basis
       ++ for a polynomial ideal
       ++ generated by the list of polynomials lp.
       ++ Argument infoflag is used to get information on the computation.
       ++ If infoflag is "info", then summary information
       ++ is displayed for each s-polynomial generated.
       ++ If infoflag is "redcrit", the reduced critical pairs are displayed.
       ++ If infoflag is any other string, no information is printed during computation.
     groebner: ( List(Dpol), String, String ) -> List(Dpol)
       ++ groebner(lp, "info", "redcrit") computes a groebner basis
       ++ for a polynomial ideal generated by the list of polynomials lp,
       ++ displaying both a summary of the critical pairs considered ("info")
       ++ and the result of reducing each critical pair ("redcrit").
       ++ If the second or third arguments have any other string value,
       ++ the indicated information is suppressed.

--     if Dom has Field then
     normalForm: (Dpol, List(Dpol))  -> Dpol
          ++ normalForm(poly,gb) reduces the polynomial poly modulo the
          ++ precomputed groebner basis gb giving a canonical representative
          ++ of the residue class.


 C ==>
    add
      import from Dpol
      import from Expon
      import from Dom
      import from ListSort(Dpol)
      import from GroebnerInternalPackage(Dom,Expon,Dpol)
      normalForm(p:Dpol,l:List Dpol):Dpol ==
        redPol(p,l)$GroebnerInternalPackage(Dom,Expon,Dpol)
      groebner (Pol:List Dpol):List Dpol ==
        import from Boolean
        import from Integer
        Pol = [] => Pol
        Pol := [x for x in Pol | not (x = 0)]
        Pol = [] => [0]
        minGbasis
          sort(((%1:Dpol,%2:Dpol):Boolean) +-> degree %2 < degree %1,
            gbasis(Pol,0,0))
      groebner(Pol:List Dpol,xx1:String):List Dpol ==
        import from Boolean
        import from Integer
        import from PositiveInteger
        Pol = [] => Pol
        Pol := [x for x in Pol | not (x = 0)]
        Pol = [] => [0]
        xx1 = "redcrit" =>
          minGbasis
            sort(((%1:Dpol,%2:Dpol):Boolean) +-> degree %2 < degree %1,
              gbasis(Pol,1,0))
        xx1 = "info" =>
          minGbasis
            sort(((%1:Dpol,%2:Dpol):Boolean) +-> degree %2 < degree %1,
              gbasis(Pol,2,1))
        messagePrint "   "
        messagePrint "WARNING: options are - redcrit and/or info - "
        messagePrint "         you didn't type them correct"
        messagePrint "         please try again"
        messagePrint "   "
        []
      groebner(Pol:List Dpol,xx1:String,xx2:String):List Dpol ==
        import from Boolean
        import from Integer
        import from PositiveInteger
        Pol = [] => Pol
        Pol := [x for x in Pol | not (x = 0)]
        Pol = [] => [0]
        xx1 = "redcrit" and xx2 = "info" or xx1 = "info" and xx2 = "redcrit" =>
          minGbasis
            sort(((%1:Dpol,%2:Dpol):Boolean) +-> degree %2 < degree %1,
              gbasis(Pol,1,1))
        xx1 = "redcrit" and xx2 = "redcrit" =>
          minGbasis
            sort(((%1:Dpol,%2:Dpol):Boolean) +-> degree %2 < degree %1,
              gbasis(Pol,1,0))
        xx1 = "info" and xx2 = "info" =>
          minGbasis
            sort(((%1:Dpol,%2:Dpol):Boolean) +-> degree %2 < degree %1,
              gbasis(Pol,2,1))
        messagePrint "   "
        messagePrint "WARNING:  options are - redcrit and/or info - "
        messagePrint "          you didn't type them correctly"
        messagePrint "          please try again "
        messagePrint "   "
        []

--critPair ==> Record( lcmfij: Expon, totdeg: NonNegativeInteger,
--                      poli: Dpol, polj: Dpol )
critPair(Expon:with Object, Dpol:with Object):with
   Object
   bracket: (Expon, NNI, Dpol, Dpol) -> %
   apply: (%, Enumeration(lcmfij)) -> Expon
   apply: (%, Enumeration(totdeg)) -> NNI
   apply: (%, Enumeration(poli)) -> Dpol
   apply: (%, Enumeration(polj)) -> Dpol
 == add
   Rep ==>  Record( lcmfij: Expon, totdeg: NonNegativeInteger,
                      poli: Dpol, polj: Dpol )
   import from Expon
   import from NNI
   import from Dpol
   import from Rep
   (c1:%) = (c2:%):Boolean ==
     rep(c1).lcmfij = rep(c2).lcmfij and
      rep(c1).poli = rep(c2).poli and rep(c1).polj = rep(c2).polj
   (c1:%) ~= (c2:%):Boolean == not(c1=c2)
   apply(c:%, tag:Enumeration(lcmfij)):Expon == rep(c).lcmfij
   apply(c:%, tag:Enumeration(totdeg)):NNI   == rep(c).totdeg
   apply(c:%, tag:Enumeration(poli)):Dpol    == rep(c).poli
   apply(c:%, tag:Enumeration(polj)):Dpol    == rep(c).polj
   [e:Expon, d:NNI, p1:Dpol, p2:Dpol]:% == per [e,d,p1,p2]
   apply(p: Outport, c: %): Outport ==
      import from String
      p("(")(rep(c).poli)(",")(rep(c).polj)(")")

--sugarPol ==> Record( totdeg: NonNegativeInteger, pol : Dpol)

sugarPol(Dpol:with Object): with
   Object
   bracket: (NNI, Dpol) -> %
   apply: (%, Enumeration(totdeg)) -> NNI
   apply: (%, Enumeration(pol)) -> Dpol
 == add
   Rep ==> Record( totdeg: NonNegativeInteger, pol : Dpol)
   import from Rep
   import from Dpol
   (p1:%) = (p2:%):Boolean == rep(p1).pol = rep(p2).pol
   (p1:%) ~= (p2:%):Boolean == not(p1=p2)
   apply(p:%, tag:Enumeration(totdeg)):NNI   == rep(p).totdeg
   apply(p:%, tag:Enumeration(pol)):Dpol     == rep(p).pol
   [deg:NNI, p:Dpol]:%                       == per [deg,p]
   apply(p: Outport, spol: %): Outport ==
       p(rep(spol).pol)


Prinp    ==> Record( ci:Dpol,tci:Integer,cj:Dpol,tcj:Integer,c:Dpol,
                tc:Integer,rc:Dpol,trc:Integer,tF:Integer,tD:Integer)
Prinpp   ==> Record( ci:Dpol,tci:Integer,cj:Dpol,tcj:Integer,c:Dpol,
                tc:Integer,rc:Dpol,trc:Integer,tF:Integer,tDD:Integer,
                 tDF:Integer)

GroebnerInternalPackage(Dom:GcdDomain, _
                        Expon:OrderedAbelianMonoidSup, _
                        Dpol:PolynomialCategory(Dom,Expon)):with

     redPol:   (Dpol, List(Dpol))  -> Dpol
     gbasis:  (List(Dpol), Integer, Integer) -> List(Dpol)
     minGbasis: List(Dpol) -> List(Dpol)

  == add

      import from Dpol
      import from VarSet
      import from Expon
      import from Dom
      import from ListSort(Dpol)
--      if Dpol has totalDegree: Dpol -> NonNegativeInteger then
      virtualDegree (p:Dpol):NonNegativeInteger == totalDegree p
--      else
--         virtualDegree (p:Dpol):NonNegativeInteger == 0
      critpOrder(cp1:critPair(Expon, Dpol),cp2:critPair(Expon, Dpol)):Boolean ==
        import from NonNegativeInteger
        import from Enumeration(totdeg)
        import from Enumeration(lcmfij)
        cp1 totdeg < cp2 totdeg => true
        cp2 totdeg < cp1 totdeg => false
        cp1 lcmfij < cp2 lcmfij
      makeCrit(sp1:sugarPol(Dpol),p2:Dpol,totdeg2:NonNegativeInteger):critPair(Expon, Dpol) ==
        import from Union(Expon,"failed")
        import from Enumeration(pol)
        import from Enumeration(totdeg)
        p1 := sp1 pol
        deg := sup(degree p1,degree p2)
        e1 := (deg - degree p1)::Expon
        e2 := (deg - degree p2)::Expon
        tdeg :=
          max(sp1 totdeg + virtualDegree monomial(1,e1),totdeg2 +
            virtualDegree monomial(1,e2))
        [deg,tdeg,p1,p2]$critPair(Expon, Dpol)
      gbasis(Pol:List Dpol,xx1:Integer,xx2:Integer):List Dpol ==
        import from Boolean
        import from NonNegativeInteger
        import from ListSort critPair(Expon, Dpol)
        import from List sugarPol(Dpol)
        default D,D1:List critPair(Expon, Dpol)
        import from critPair(Expon, Dpol)
        Pol1 := sort(((%1:Dpol,%2:Dpol):Boolean) +-> degree %2 < degree %1,Pol)
        basPols := updatF(hMonic first Pol1,virtualDegree first Pol1,[])
        Pol1 := rest Pol1
        D := nil
        while not(null Pol1) repeat
          h := hMonic first Pol1
          Pol1 := rest Pol1
          toth := virtualDegree h
          D1 := [makeCrit(x,h,toth) for x in basPols]
          D := updatD(critMTonD1 sort(critpOrder,D1),critBonD(h,D))
          basPols := updatF(h,toth,basPols)
        D := sort(critpOrder,D)
        xx := xx2
        import from sugarPol(Dpol)
        import from Enumeration(pol)
        import from Enumeration(totdeg)
        redPols := [x pol for x in basPols]
        while not(null D) repeat
          D0 := first D
          s := hMonic sPol D0
          D := rest D
          h := hMonic redPol(s,redPols)
          if xx1 = 1 then prinshINFO h
          h = 0 =>
            if xx2 = 1 then
              prindINFO(D0,s,h,#basPols::Integer,#D::Integer,xx)
              xx := 2
            " go to top of while "
          degree h = 0 =>
            D := nil
            if xx2 = 1 then
              prindINFO(D0,s,h,#basPols::Integer,#D::Integer,xx)
              xx := 2
            basPols := updatF(h,0,[])
            break
          D1 := [makeCrit(x,h,D0 totdeg) for x in basPols]
          D := updatD(critMTonD1 sort(critpOrder,D1),critBonD(h,D))
          basPols := updatF(h,D0 totdeg,basPols)
          redPols := concat(redPols,h)
          xx2 = 1 =>
            prindINFO(D0,s,h,#basPols::Integer,#D::Integer,xx)
            xx := 2
        Pol := [x pol for x in basPols]
        if xx2 = 1 then
          prinpolINFO Pol
          messagePrint "    THE GROEBNER BASIS POLYNOMIALS"
        if xx1 = 1 and not (xx2 = 1) then
          messagePrint "    THE GROEBNER BASIS POLYNOMIALS"
        Pol
      critMonD1(e:Expon,D2:List critPair(Expon, Dpol)):List critPair(Expon, Dpol) ==
        import from critPair(Expon, Dpol)
        import from Enumeration lcmfij
        null D2 => nil
        x := first D2
        critM(e,x lcmfij) => critMonD1(e,rest D2)
        cons(x,critMonD1(e,rest D2))
      critMTonD1 (D1:List critPair(Expon, Dpol)):List critPair(Expon, Dpol) ==
        import from NonNegativeInteger
        import from Boolean
        import from critPair(Expon, Dpol)
        import from Enumeration lcmfij
        null D1 => nil
        f1 := first D1
        s1 := #D1 :: Integer
        cT1 := critT f1
        s1 = 1 and cT1 => nil
        s1 = 1 => D1
        e1 := f1 lcmfij
        r1 := rest D1
        e1 = (first r1).lcmfij =>
          cT1 => critMTonD1 cons(f1,rest r1)
          critMTonD1 r1
        D1 := critMonD1(e1,r1)
        cT1 => critMTonD1 D1
        cons(f1,critMTonD1 D1)
      critBonD(h:Dpol,D:List critPair(Expon, Dpol)):List critPair(Expon, Dpol) ==
	import from critPair(Expon, Dpol)
        import from Enumeration lcmfij
        import from Enumeration poli
        import from Enumeration polj
        null D => nil
        x := first D
        critB(degree h,x lcmfij,degree x poli,degree x polj) =>
          critBonD(h,rest D)
        cons(x,critBonD(h,rest D))
      updatF(h:Dpol,deg:NNI,F:List sugarPol(Dpol)):List sugarPol(Dpol) ==
	import from sugarPol(Dpol)
	import from Enumeration pol
        null F => [[deg,h]]
        f1 := first F
        critM(degree h,degree f1 pol) => updatF(h,deg,rest F)
        cons(f1,updatF(h,deg,rest F))
      updatD(D1:List critPair(Expon, Dpol),D2:List critPair(Expon, Dpol)):List critPair(Expon, Dpol) ==
        null D1 => D2
        null D2 => D1
        dl1 := first D1
        dl2 := first D2
        critpOrder(dl1,dl2) => cons(dl1,updatD(rest D1,D2))
        cons(dl2,updatD(D1,rest D2))
      gcdCo(c1:Dom,c2:Dom):Record(co1:Dom,co2:Dom) ==
        d := gcd(c1,c2)
        [c1/d, c2/d]
      sPol (p:critPair(Expon, Dpol)):Dpol ==
        import from Union(Expon,"failed")
        import from Enumeration lcmfij
        import from Enumeration poli
        import from Enumeration polj
        Tij := p lcmfij
        fi := p poli
        fj := p polj
        cc := gcdCo(leadingCoefficient fi,leadingCoefficient fj)
        import from Record(co1:Dom,co2:Dom)
        reductum fi * monomial(cc co2,(Tij - degree fi)::Expon) - reductum fj *
          monomial(cc co1,(Tij - degree fj)::Expon)
      redPo(s:Dpol,F:List Dpol):Record(poly:Dpol,mult:Dom) ==
        import from Boolean
        m:Dom := 1
        Fh := F
        while not(s = 0 or null F) repeat
          f1 := first F
          s1 := degree s
          e:Union(Expon,"failed")
          (e := s1 - degree f1) case Expon =>
            cc := gcdCo(leadingCoefficient f1,leadingCoefficient s)
            import from Record(co1:Dom,co2:Dom)
            s := cc co1 * reductum s - monomial(cc co2,e::Expon) * reductum f1
            m := m * cc co1
            F := Fh
          F := rest F
        [s,m]
      redPol(s:Dpol,F:List Dpol):Dpol ==
        import from Record(poly:Dpol,mult:Dom)
        credPol((redPo(s,F)).poly,F)
      critT (p:critPair(Expon, Dpol)):Boolean == p lcmfij = degree p poli + degree p polj
      critM(e1:Expon,e2:Expon):Boolean ==
        en:Union(Expon,"failed")
        (en := e2 - e1) case Expon
      critB(eh:Expon,eik:Expon,ei:Expon,ek:Expon):Boolean ==
        critM(eh,eik) and not (eik = sup(eh,ei)) and not (eik = sup(eh,ek))
      hMonic (p:Dpol):Dpol == if p = 0 then p else primitivePart p
      credPol(h:Dpol,F:List Dpol):Dpol ==
        import from Boolean
        null F => h
        h0:Dpol := monomial(leadingCoefficient h,degree h)
        while not ((h := reductum h) = 0) repeat
          hred := redPo(h,F)
          import from Record(poly:Dpol,mult:Dom)
          h := hred poly
          h0 := hred mult * h0 + monomial(leadingCoefficient h,degree h)
        h0
      minGbasis (F:List Dpol):List Dpol ==
        null F => nil
        newbas := minGbasis rest F
        cons(hMonic credPol(first F,newbas),newbas)
      lepol (p1:Dpol):Integer ==
        import from Boolean
        n:Integer
        n := 0
        while not (p1 = 0) repeat
          n := n + 1
          p1 := reductum p1
        n
      prinb (n:Integer):Void ==
        import from SmallInteger
        import from NonNegativeInteger
        import from Segment Integer
        for x in 1..n repeat messagePrint "    "
        never
      prinshINFO (h:Dpol):Void ==
        import from Integer
        prinb 2
        messagePrint " reduced Critpair - Polynom :"
        prinb 2
        print (h)()
        prinb 2
      prindINFO(cp:critPair(Expon, Dpol),ps:Dpol,ph:Dpol,i1:Integer,i2:Integer,n:Integer):
        Integer
           ==
            import from PositiveInteger
            import from NonNegativeInteger
            a:Dom
            ll:Prinp
            cpi := cp poli
            cpj := cp polj
            if n = 1 then
              prinb 1
              messagePrint "you choose option  -info-  "
              messagePrint "abbrev. for the following information strings are"
              messagePrint
                "  ci  =>  Leading monomial  for critpair calculation"
              messagePrint "  tci =>  Number of terms of polynomial i"
              messagePrint
                "  cj  =>  Leading monomial  for critpair calculation"
              messagePrint "  tcj =>  Number of terms of polynomial j"
              messagePrint "  c   =>  Leading monomial of critpair polynomial"
              messagePrint "  tc  =>  Number of terms of critpair polynomial"
              messagePrint
                "  rc  =>  Leading monomial of redcritpair polynomial"
              messagePrint "  trc =>  Number of terms of redcritpair polynomial"
              messagePrint "  tF  =>  Number of polynomials in reduction list F"
              messagePrint "  tD  =>  Number of critpairs still to do"
              prinb 4
              n := 2
            prinb 1
            a := 1
            ph = 0 =>
              ps = 0 =>
                ll :=
                  [monomial(a,degree(cpi)),lepol(cpi),monomial(a,degree(cpj)),
                    lepol(cpj),ps,0,ph,0,i1,i2]$Prinp
                print (ll)()
                prinb 1
                n
              ll :=
                [monomial(a,degree(cpi)),lepol(cpi),monomial(a,degree(cpj)),
                  lepol(cpj),monomial(a,degree(ps)),lepol(ps),ph,0,i1,i2]$Prinp
              print (ll)()
              prinb 1
              n
            ll :=
              [monomial(a,degree(cpi)),lepol(cpi),monomial(a,degree(cpj)),
                lepol(cpj),monomial(a,degree(ps)),lepol(ps),
                  monomial(a,degree(ph)),lepol(ph),i1,i2]$Prinp
            print (ll)()
            prinb 1
            n
      prinpolINFO (pl:List Dpol):Void ==
        import from Integer
        import from PositiveInteger
        n:Integer
        n := #pl::Integer
        prinb 1
        n = 1 =>
          messagePrint "  There is 1  Groebner Basis Polynomial "
          prinb 2
        messagePrint "  There are "
        prinb 1
        print (n)
        prinb 1
        messagePrint "  Groebner Basis Polynomials. "
        prinb 2
      fprindINFO(cp:critPair(Expon, Dpol),ps:Dpol,ph:Dpol,i1:Integer,i2:Integer,i3:Integer,n:
        Integer
          ):Integer ==
            import from PositiveInteger
            import from NonNegativeInteger
            ll:Prinpp
            a:Dom
            cpi := cp poli
            cpj := cp polj
            if n = 1 then
              prinb 1
              messagePrint "you choose option  -info-  "
              messagePrint "abbrev. for the following information strings are"
              messagePrint
                "  ci  =>  Leading monomial  for critpair calculation"
              messagePrint "  tci =>  Number of terms of polynomial i"
              messagePrint
                "  cj  =>  Leading monomial  for critpair calculation"
              messagePrint "  tcj =>  Number of terms of polynomial j"
              messagePrint "  c   =>  Leading monomial of critpair polynomial"
              messagePrint "  tc  =>  Number of terms of critpair polynomial"
              messagePrint
                "  rc  =>  Leading monomial of redcritpair polynomial"
              messagePrint "  trc =>  Number of terms of redcritpair polynomial"
              messagePrint "  tF  =>  Number of polynomials in reduction list F"
              messagePrint "  tD  =>  Number of critpairs still to do"
              messagePrint "  tDF =>  Number of subproblems still to do"
              prinb 4
              n := 2
            prinb 1
            a := 1
            ph = 0 =>
              ps = 0 =>
                ll :=
                  [monomial(a,degree(cpi)),lepol(cpi),monomial(a,degree(cpj)),
                    lepol(cpj),ps,0,ph,0,i1,i2,i3]$Prinpp
                print (ll)()
                prinb 1
                n
              ll :=
                [monomial(a,degree(cpi)),lepol(cpi),monomial(a,degree(cpj)),
                  lepol(cpj),monomial(a,degree(ps)),lepol(ps),ph,0,i1,i2,i3]$Prinpp
              print (ll)()
              prinb 1
              n
            ll :=
              [monomial(a,degree(cpi)),lepol(cpi),monomial(a,degree(cpj)),
                lepol(cpj),monomial(a,degree(ps)),lepol(ps),
                  monomial(a,degree(ph)),lepol(ph),i1,i2,i3]$Prinpp
            print (ll)()
            prinb 1
            n




 
