====================================================================
LazardSetSolvingPackage examples
====================================================================

The LazardSetSolvingPackage package constructor solves polynomial
systems by means of Lazard triangular sets.  However one condition is
relaxed: Regular triangular sets whose saturated ideals have positive
dimension are not necessarily normalized.

The decompositions are computed in two steps.  First the algorithm of
Moreno Maza (implemented in the RegularTriangularSet domain
constructor) is called.  Then the resulting decompositions are
converted into lists of square-free regular triangular sets and the
redundant components are removed.  Moreover, zero-dimensional regular
triangular sets are normalized.

Note that the way of understanding triangular decompositions is
detailed in the example of the RegularTriangularSet constructor.

The LazardSetSolvingPackage constructor takes six arguments.  The
first one, R, is the coefficient ring of the polynomials; it must
belong to the category GcdDomain.  The second one, E, is the exponent
monoid of the polynomials; it must belong to the category
OrderedAbelianMonoidSup.  the third one, V, is the ordered set of
variables; it must belong to the category OrderedSet.  The fourth one
is the polynomial ring; it must belong to the category
RecursivePolynomialCategory(R,E,V).  The fifth one is a domain of the
category RegularTriangularSetCategory(R,E,V,P) and the last one is a
domain of the category SquareFreeRegularTriangularSetCategory(R,E,V,P).  
The abbreviation for LazardSetSolvingPackage is LAZM3PK.

For the purpose of solving zero-dimensional algebraic systems, see
also LexTriangularPackage and ZeroDimensionalSolvePackage.  These
packages are easier to call than LAZM3PK.  Moreover, the
ZeroDimensionalSolvePackage package provides operations to compute
either the complex roots or the real roots.

We illustrate now the use of the LazardSetSolvingPackage package 
constructor with two examples (Butcher and Vermeer).

Define the coefficient ring.

R := Integer
    Integer 

Define the list of variables,

ls : List Symbol := [b1,x,y,z,t,v,u,w] 
    [b1,x,y,z,t,v,u,w]

and make it an ordered set:

V := OVAR(ls)
    OrderedVariableList [b1,x,y,z,t,v,u,w]

then define the exponent monoid.

E := IndexedExponents V

Define the polynomial ring.

P := NSMP(R, V)

Let the variables be polynomial.

b1: P := 'b1

x: P := 'x

y: P := 'y

z: P := 'z

t: P := 't

u: P := 'u

v: P := 'v

w: P := 'w

Now call the {\tt RegularTriangularSet} domain constructor.

T := REGSET(R,E,V,P)

Define a polynomial system (the Butcher example).

p0 := b1 + y + z - t - w

p1 := 2*z*u + 2*y*v + 2*t*w - 2*w**2 - w - 1

p2 := 3*z*u**2 + 3*y*v**2 - 3*t*w**2 + 3*w**3 + 3*w**2 - t + 4*w

p3 := 6*x*z*v - 6*t*w**2 + 6*w**3 - 3*t*w + 6*w**2 - t + 4*w

p4 := 4*z*u**3+ 4*y*v**3+ 4*t*w**3- 4*w**4 - 6*w**3+ 4*t*w- 10*w**2- w- 1

p5 := 8*x*z*u*v +8*t*w**3 -8*w**4 +4*t*w**2 -12*w**3 +4*t*w -14*w**2 -3*w -1

p6 := 12*x*z*v**2+12*t*w**3 -12*w**4 +12*t*w**2 -18*w**3 +8*t*w -14*w**2 -w -1

p7 := -24*t*w**3 + 24*w**4 - 24*t*w**2 + 36*w**3 - 8*t*w + 26*w**2 + 7*w + 1

lp := [p0, p1, p2, p3, p4, p5, p6, p7]
   [b1 + y + z - t - w, 2v y + 2u z + 2w t - 2w  - w - 1,
      2      2         2           3     2
    3v y + 3u z + (- 3w  - 1)t + 3w  + 3w  + 4w,
                  2                3     2
    6v z x + (- 6w  - 3w - 1)t + 6w  + 6w  + 4w,
      3      3       3            4     3      2
    4v y + 4u z + (4w  + 4w)t - 4w  - 6w  - 10w  - w - 1,
                  3     2            4      3      2
    8u v z x + (8w  + 4w  + 4w)t - 8w  - 12w  - 14w  - 3w - 1,
       2          3      2             4      3      2
    12v z x + (12w  + 12w  + 8w)t - 12w  - 18w  - 14w  - w - 1,
          3      2             4      3      2
    (- 24w  - 24w  - 8w)t + 24w  + 36w  + 26w  + 7w + 1]

First of all, let us solve this system in the sense of Lazard by means
of the REGSET constructor:

lts := zeroSetSplit(lp,false)$T
   [{w + 1,u,v,t + 1,b1 + y + z + 2}, {w + 1,v,t + 1,z,b1 + y + 2},
    {w + 1,t + 1,z,y,b1 + 2}, {w + 1,v - u,t + 1,y + z,x,b1 + 2},
    {w + 1,u,t + 1,y,x,b1 + z + 2},

          5       4      3     2
     {144w  + 216w  + 96w  + 6w  - 11w - 1,
          2                 5       4      3     2
      (12w  + 9w + 1)u - 72w  - 108w  - 42w  - 9w  - 3w,
          2                 4      3      2
      (12w  + 9w + 1)v + 36w  + 54w  + 18w ,
          3      2             4      3      2
      (24w  + 24w  + 8w)t - 24w  - 36w  - 26w  - 7w - 1,

                     2                 2                        4      3     2
         (12u v - 12u )z + (12w v + 12w  + 4)t + (3w - 5)v + 36w  + 42w  + 6w
       + 
         - 16w
       ,
                             2
      2v y + 2u z + 2w t - 2w  - w - 1,
                    2                3     2
      6v z x + (- 6w  - 3w - 1)t + 6w  + 6w  + 4w, b1 + y + z - t - w}
     ]

We can get the dimensions of each component
of a decomposition as follows.

[coHeight(ts) for ts in lts]
    [3,3,3,2,2,0]

The first five sets have a simple shape.  However, the last one, which
has dimension zero, can be simplified by using Lazard triangular sets.

Thus we call the SquareFreeRegularTriangularSet domain constructor,

ST := SREGSET(R,E,V,P)

and set the LAZM3PK package constructor to our situation.

pack := LAZM3PK(R,E,V,P,T,ST)

We are ready to solve the system by means of Lazard triangular sets:

zeroSetSplit(lp,false)$pack
   [{w + 1,t + 1,z,y,b1 + 2}, {w + 1,v,t + 1,z,b1 + y + 2},
    {w + 1,u,v,t + 1,b1 + y + z + 2}, {w + 1,v - u,t + 1,y + z,x,b1 + 2},
    {w + 1,u,t + 1,y,x,b1 + z + 2},

          5       4      3     2                   4      3      2
     {144w  + 216w  + 96w  + 6w  - 11w - 1, u - 24w  - 36w  - 14w  + w + 1,
              4      3      2                  4      3      2
      3v - 48w  - 60w  - 10w  + 8w + 2, t - 24w  - 36w  - 14w  - w + 1,
                  4        3        2
      486z - 2772w  - 4662w  - 2055w  + 30w + 127,
                    4         3        2
      2916y - 22752w  - 30312w  - 8220w  + 2064w + 1561,
                  4        3       2
      356x - 3696w  - 4536w  - 968w  + 822w + 371,
                     4         3         2
      2916b1 - 30600w  - 46692w  - 20274w  - 8076w + 593}
     ]

We see the sixth triangular set is {\em nicer} now: each one of its
polynomials has a constant initial.

We follow with the Vermeer example. The ordering is the usual one
for this system.

Define the polynomial system.

f0 := (w - v) ** 2 + (u - t) ** 2 - 1


      2           2           2    2
     t  - 2u t + v  - 2w v + u  + w  - 1


f1 := t ** 2 - v ** 3

      2    3
     t  - v

f2 := 2 * t * (w - v) + 3 * v ** 2 * (u - t)

          2                   2
     (- 3v  - 2v + 2w)t + 3u v

f3 := (3 * z * v ** 2 - 1) * (2 * z * t - 1)

       2   2             2
     6v t z  + (- 2t - 3v )z + 1

lf := [f0, f1, f2, f3]

     2           2           2    2       2    3       2                   2
   [t  - 2u t + v  - 2w v + u  + w  - 1, t  - v , (- 3v  - 2v + 2w)t + 3u v ,
      2   2             2
    6v t z  + (- 2t - 3v )z + 1]

First of all, let us solve this system in the sense of Kalkbrener by
means of the REGSET constructor:

zeroSetSplit(lf,true)$T
   [
     {
             6           3       2                 4
         729u  + (- 1458w  + 729w  - 4158w - 1685)u
       + 
              6        5        4        3       2                2       8
         (729w  - 1458w  - 2619w  - 4892w  - 297w  + 5814w + 427)u  + 729w
       + 
             7        6        5        4        3        2
         216w  - 2900w  - 2376w  + 3870w  + 4072w  - 1188w  - 1656w + 529
       ,

                  4           3       2                  2        6        5
             2187u  + (- 4374w  - 972w  - 12474w - 2868)u  + 2187w  - 1944w
           + 
                     4        3        2
             - 10125w  - 4800w  + 2501w  + 4968w - 1587
        *
           v
       + 
               3       2  2       6        5        4       3        2
         (1944w  - 108w )u  + 972w  + 3024w  - 1080w  + 496w  + 1116w
       ,
         2                   2                    2  2           2
      (3v  + 2v - 2w)t - 3u v , ((4v - 4w)t - 6u v )z  + (2t + 3v )z - 1}
     ]

We have obtained one regular chain (i.e. regular triangular set) with
dimension 1.  This set is in fact a characterist set of the (radical
of) of the ideal generated by the input system lf.  Thus we have
only the generic points of the variety associated with lf
(for the elimination ordering given by ls).

So let us get now a full description of this variety.

Hence, we solve this system in the sense of Lazard by means of the REGSET
constructor:

zeroSetSplit(lf,false)$T
   [
     {
             6           3       2                 4
         729u  + (- 1458w  + 729w  - 4158w - 1685)u
       + 
              6        5        4        3       2                2       8
         (729w  - 1458w  - 2619w  - 4892w  - 297w  + 5814w + 427)u  + 729w
       + 
             7        6        5        4        3        2
         216w  - 2900w  - 2376w  + 3870w  + 4072w  - 1188w  - 1656w + 529
       ,

                  4           3       2                  2        6        5
             2187u  + (- 4374w  - 972w  - 12474w - 2868)u  + 2187w  - 1944w
           + 
                     4        3        2
             - 10125w  - 4800w  + 2501w  + 4968w - 1587
        *
           v
       + 
               3       2  2       6        5        4       3        2
         (1944w  - 108w )u  + 972w  + 3024w  - 1080w  + 496w  + 1116w
       ,
         2                   2                    2  2           2
      (3v  + 2v - 2w)t - 3u v , ((4v - 4w)t - 6u v )z  + (2t + 3v )z - 1}
     ,

         4     3      2                               2
     {27w  + 4w  - 54w  - 36w + 23, u, (12w + 2)v - 9w  - 2w + 9,
        2          2
      6t  - 2v - 3w  + 2w + 3, 2t z - 1}
     ,

            6         5         4          3         2
     {59049w  + 91854w  - 45198w  + 145152w  + 63549w  + 60922w + 21420,

                            5                  4                  3
             31484448266904w  - 18316865522574w  + 23676995746098w
           + 
                           2
             6657857188965w  + 8904703998546w + 3890631403260
        *
            2
           u
       + 
                        5                  4                  3
         94262810316408w  - 82887296576616w  + 89801831438784w
       + 
                        2
         28141734167208w  + 38070359425432w + 16003865949120
       ,
           2             2         2       3      2                    3     2
      (243w  + 36w + 85)v  + (- 81u  - 162w  + 36w  + 154w + 72)v - 72w  + 4w ,
         2                   2                    2  2           2
      (3v  + 2v - 2w)t - 3u v , ((4v - 4w)t - 6u v )z  + (2t + 3v )z - 1}
     ,

         4     3      2                               2
     {27w  + 4w  - 54w  - 36w + 23, u, (12w + 2)v - 9w  - 2w + 9,
        2          2             2
      6t  - 2v - 3w  + 2w + 3, 3v z - 1}
     ]


We retrieve our regular chain of dimension 1 and we get three regular
chains of dimension 0 corresponding to the degenerated cases.
We want now to simplify these zero-dimensional regular chains by using
Lazard triangular sets.  Moreover, this will allow us to prove that
the above decomposition has no redundant component.  

Generally, decompositions computed by the REGSET constructor do
not have redundant components.  However, to be sure that no redundant
component occurs one needs to use the SREGSET or LAZM3PK constructors.

So let us solve the input system in the sense of Lazard by means of
the LAZM3PK constructor:

zeroSetSplit(lf,false)$pack
   [
     {
             6           3       2                 4
         729u  + (- 1458w  + 729w  - 4158w - 1685)u
       + 
              6        5        4        3       2                2       8
         (729w  - 1458w  - 2619w  - 4892w  - 297w  + 5814w + 427)u  + 729w
       + 
             7        6        5        4        3        2
         216w  - 2900w  - 2376w  + 3870w  + 4072w  - 1188w  - 1656w + 529
       ,

                  4           3       2                  2        6        5
             2187u  + (- 4374w  - 972w  - 12474w - 2868)u  + 2187w  - 1944w
           + 
                     4        3        2
             - 10125w  - 4800w  + 2501w  + 4968w - 1587
        *
           v
       + 
               3       2  2       6        5        4       3        2
         (1944w  - 108w )u  + 972w  + 3024w  - 1080w  + 496w  + 1116w
       ,
         2                   2                    2  2           2
      (3v  + 2v - 2w)t - 3u v , ((4v - 4w)t - 6u v )z  + (2t + 3v )z - 1}
     ,

         2                 2                   2
     {81w  + 18w + 28, 729u  - 1890w - 533, 81v  + (- 162w + 27)v - 72w - 112,
      11881t + (972w + 2997)u v + (- 11448w - 11536)u,

                         2
         641237934604288z
       + 
                 (78614584763904w + 26785578742272)u + 236143618655616w
               + 
                 70221988585728
            *
               v
           + 
             (358520253138432w + 101922133759488)u + 142598803536000w
           + 
             54166419595008
        *
           z
       + 
         (32655103844499w - 44224572465882)u v
       + 
         (43213900115457w - 32432039102070)u
       }
     ,

         4     3      2                           3     2
     {27w  + 4w  - 54w  - 36w + 23, u, 218v - 162w  + 3w  + 160w + 153,
          2      3      2                             3      2
      109t  - 27w  - 54w  + 63w + 80, 1744z + (- 1458w  + 27w  + 1440w + 505)t}
     ,

         4     3      2                           3     2
     {27w  + 4w  - 54w  - 36w + 23, u, 218v - 162w  + 3w  + 160w + 153,
          2      3      2                         3     2
      109t  - 27w  - 54w  + 63w + 80, 1308z + 162w  - 3w  - 814w - 153}
     ,

          4       3        2                   2      2
     {729w  + 972w  - 1026w  + 1684w + 765, 81u  + 72w  + 16w - 72,
                 3       2
      702v - 162w  - 225w  + 40w - 99,
                    3       2
      11336t + (324w  - 603w  - 1718w - 1557)u,

                   2
         595003968z
       + 
                          3             2
             (- 963325386w  - 898607682w  + 1516286466w - 3239166186)u
           + 
                          3              2
             - 1579048992w  - 1796454288w  + 2428328160w - 4368495024
        *
           z
       + 
                     3              2
         (9713133306w  + 9678670317w  - 16726834476w + 28144233593)u
       }
     ]

Due to square-free factorization, we obtained now four
zero-dimensional regular chains.  Moreover, each of them is normalized
(the initials are constant).  Note that these zero-dimensional
components may be investigated further with the 
ZeroDimensionalSolvePackage package constructor.

See also:
o )show LazardSetSolvingPackage
o )show ZeroDimensionalSolvePackage

