====================================================================
SquareFreeRegularTriangularSet examples
====================================================================

The SquareFreeRegularTriangularSet domain constructor implements
square-free regular triangular sets.  See the RegularTriangularSet
domain constructor for general regular triangular sets.  Let T be a
regular triangular set consisting of polynomials t1, ..., tm ordered
by increasing main variables.  The regular triangular set T is
square-free if T is empty or if t1, ..., tm-1 is square-free and if the
polynomial tm is square-free as a univariate polynomial with coefficients 
in the tower of simple extensions associated with t1,...,tm-1.

The main interest of square-free regular triangular sets is that their
associated towers of simple extensions are product of fields.
Consequently, the saturated ideal of a square-free regular triangular
set is radical.  This property simplifies some of the operations
related to regular triangular sets.  However, building square-free
regular triangular sets is generally more expensive than building
general regular triangular sets.

As the RegularTriangularSet domain constructor, the
SquareFreeRegularTriangularSet domain constructor also implements a
method for solving polynomial systems by means of regular triangular
sets.  This is in fact the same method with some adaptations to take
into account the fact that the computed regular chains are
square-free.  Note that it is also possible to pass from a
decomposition into general regular triangular sets to a decomposition
into square-free regular triangular sets.  This conversion is used
internally by the LazardSetSolvingPackage package constructor.

N.B. When solving polynomial systems with the
SquareFreeRegularTriangularSet domain constructor or the
LazardSetSolvingPackage package constructor, decompositions have no
redundant components.  See also LexTriangularPackage and
ZeroDimensionalSolvePackage for the case of algebraic systems with a
finite number of (complex) solutions.

We shall explain now how to use the constructor SquareFreeRegularTriangularSet.

This constructor takes four 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 last one is the polynomial ring; it must
belong to the category RecursivePolynomialCategory(R,E,V).  The
abbreviation for SquareFreeRegularTriangularSet} is SREGSET.

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

Let us illustrate the use of this constructor with one example
(Donati-Traverso).  Define the coefficient ring.

  R := Integer
    Integer
                                 Type: Domain

Define the list of variables,

  ls : List Symbol := [x,y,z,t]
    [x,y,z,t]
                                 Type: List Symbol

and make it an ordered set;

  V := OVAR(ls)
    OrderedVariableList [x,y,z,t]
                                 Type: Domain

then define the exponent monoid.

  E := IndexedExponents V
    IndexedExponents OrderedVariableList [x,y,z,t]
                                 Type: Domain

Define the polynomial ring.

  P := NSMP(R, V)
    NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
                                 Type: Domain

Let the variables be polynomial.

  x: P := 'x
    x
           Type: NewSparseMultivariatePolynomial(Integer,
                                   OrderedVariableList [x,y,z,t])

  y: P := 'y
    y
           Type: NewSparseMultivariatePolynomial(Integer,
                                   OrderedVariableList [x,y,z,t])

  z: P := 'z
    z
           Type: NewSparseMultivariatePolynomial(Integer,
                                   OrderedVariableList [x,y,z,t])

  t: P := 't
    t
           Type: NewSparseMultivariatePolynomial(Integer,
                                   OrderedVariableList [x,y,z,t])

Now call the SquareFreeRegularTriangularSet domain constructor.

  ST := SREGSET(R,E,V,P)
  SquareFreeRegularTriangularSet(Integer,IndexedExponents OrderedVariableList [
  x,y,z,t],OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Intege
  r,OrderedVariableList [x,y,z,t]))
                                  Type: Domain

Define a polynomial system.

  p1 := x ** 31 - x ** 6 - x - y
      31    6
     x   - x  - x - y
           Type: NewSparseMultivariatePolynomial(Integer,
                                   OrderedVariableList [x,y,z,t])

  p2 := x ** 8  - z
      8
     x  - z
           Type: NewSparseMultivariatePolynomial(Integer,
                                   OrderedVariableList [x,y,z,t])

  p3 := x ** 10 - t
      10
     x   - t
           Type: NewSparseMultivariatePolynomial(Integer,
                                   OrderedVariableList [x,y,z,t])

  lp := [p1, p2, p3]
       31    6          8      10
     [x   - x  - x - y,x  - z,x   - t]
           Type: List NewSparseMultivariatePolynomial(Integer,
                                        OrderedVariableList [x,y,z,t])

First of all, let us solve this system in the sense of Kalkbrener.

  zeroSetSplit(lp)$ST
        5    4      2     3     8     5    3    2   4                2
     [{z  - t ,t z y  + 2z y - t  + 2t  + t  - t ,(t  - t)x - t y - z }]
        Type: List SquareFreeRegularTriangularSet(Integer,
                     IndexedExponents OrderedVariableList [x,y,z,t],
                     OrderedVariableList [x,y,z,t],
                     NewSparseMultivariatePolynomial(Integer,
                        OrderedVariableList [x,y,z,t]))

And now in the sense of Lazard (or Wu and other authors).

  zeroSetSplit(lp,false)$ST
      5    4      2     3     8     5    3    2   4                2
   [{z  - t ,t z y  + 2z y - t  + 2t  + t  - t ,(t  - t)x - t y - z },
      3      5            2    2
    {t  - 1,z  - t,t y + z ,z x  - t}, {t,z,y,x}]
        Type: List SquareFreeRegularTriangularSet(Integer,
                     IndexedExponents OrderedVariableList [x,y,z,t],
                     OrderedVariableList [x,y,z,t],
                     NewSparseMultivariatePolynomial(Integer,
                        OrderedVariableList [x,y,z,t]))

Now to see the difference with the RegularTriangularSet domain
constructor, we define:

  T := REGSET(R,E,V,P)
  RegularTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],O
  rderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedV
  ariableList [x,y,z,t]))
                                 Type: Domain

and compute:

  lts := zeroSetSplit(lp,false)$T
      5    4      2     3     8     5    3    2   4                2
   [{z  - t ,t z y  + 2z y - t  + 2t  + t  - t ,(t  - t)x - t y - z },
      3      5          2     3         2
    {t  - 1,z  - t,t z y  + 2z y + 1,z x  - t}, {t,z,y,x}]
          Type: List RegularTriangularSet(Integer,
                       IndexedExponents OrderedVariableList [x,y,z,t],
                       OrderedVariableList [x,y,z,t],
                       NewSparseMultivariatePolynomial(Integer,
                          OrderedVariableList [x,y,z,t]))

If you look at the second set in both decompositions in the sense of Lazard,
you will see that the polynomial with main variable y is not the same.

Let us understand what has happened.

We define:

  ts := lts.2
           3      5          2     3         2
   (19)  {t  - 1,z  - t,t z y  + 2z y + 1,z x  - t}
        Type: RegularTriangularSet(Integer,
                IndexedExponents OrderedVariableList [x,y,z,t],
                OrderedVariableList [x,y,z,t],
                NewSparseMultivariatePolynomial(Integer,
                   OrderedVariableList [x,y,z,t]))

  pol := select(ts,'y)$T
          2     3
     t z y  + 2z y + 1
      Type: Union(NewSparseMultivariatePolynomial(Integer,
                              OrderedVariableList [x,y,z,t]),...)

  tower := collectUnder(ts,'y)$T
       3      5
     {t  - 1,z  - t}
      Type: RegularTriangularSet(Integer,
              IndexedExponents OrderedVariableList [x,y,z,t],
              OrderedVariableList [x,y,z,t],
              NewSparseMultivariatePolynomial(Integer,
                 OrderedVariableList [x,y,z,t]))

  pack := RegularTriangularSetGcdPackage(R,E,V,P,T)
  RegularTriangularSetGcdPackage(Integer,IndexedExponents OrderedVariableList [
  x,y,z,t],OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Intege
  r,OrderedVariableList [x,y,z,t]),RegularTriangularSet(Integer,IndexedExponent
  s OrderedVariableList [x,y,z,t],OrderedVariableList [x,y,z,t],NewSparseMultiv
  ariatePolynomial(Integer,OrderedVariableList [x,y,z,t])))
                                     Type: Domain

Then we compute:

  toseSquareFreePart(pol,tower)$pack
                  2          3      5
    [[val= t y + z ,tower= {t  - 1,z  - t}]]
       Type: List Record(val: NewSparseMultivariatePolynomial(Integer,
                                  OrderedVariableList [x,y,z,t]),
                         tower: RegularTriangularSet(Integer,
                           IndexedExponents OrderedVariableList [x,y,z,t],
                           OrderedVariableList [x,y,z,t],
                           NewSparseMultivariatePolynomial(Integer,
                               OrderedVariableList [x,y,z,t])))

See Also:
o )help GcdDomain
o )help OrderedAbelianMonoidSup
o )help OrderedSet
o )help RecursivePolynomialCategory
o )help ZeroDimensionalSolvePackage
o )help LexTriangularPackage
o )help LazardSetSolvingPackage
o )help RegularTriangularSet
o )show SquareFreeRegularTriangularSet

