 Overview - Maple Help

Overview of the RegularChains Package Calling Sequence RegularChains:-command(arguments) command(arguments) Description

 • The RegularChains package is a collection of commands for solving systems of algebraic equations, inequations and inequalities symbolically. This package also allows the user to manipulate and study the solutions of such systems.
 • The main two commands are Triangularize and RealTriangularize. Each of them computes from a system of polynomials $S$ a list of simpler systems ${S}_{1},\mathrm{...},{S}_{n}$ such that a point is a solution of $S$ if and only if it is a solution of one of the systems ${S}_{1},\mathrm{...},{S}_{n}$. Each of these simpler systems ${S}_{1},\mathrm{...},{S}_{n}$ is called a regular chain in the case of Triangularize and a regular semi-algebraic system in the case of RealTriangularize. In both cases, each of these simpler systems has a special shape and remarkable properties. We describe below the notion of a regular chain and refer to the page SemiAlgebraicSetTools for that of a regular semi-algebraic system.
 • To understand what a regular chain is, one first needs to define the input system $S$ of Triangularize. It is assumed to be a list (or a set) of polynomials with coefficients in a field $K$ and with variables from a set $X$. Typically, the field $K$ is the set of the rational numbers. Call $R$ the set of the polynomials with coefficients in $K$ and variables in $X$. The set $X$ is assumed to be totally ordered. Hence, when looking at a non-constant polynomial $p$ of $R$, one can talk about its main (or greatest) variable, say $v$, and the leading coefficient of $p$ with respect to $v$, called the initial of $p$.
 • Now we can describe the shape of a regular chain by defining a more general concept, sometimes called an ascending chain or a triangular set. A finite set $T$ of non-constant polynomials of $R$ is a triangular set if two different polynomials of $T$ have different main variables. For example, if $X$ consists of the two variables $x$ and $y$ such that $y holds, then $\left[x-y+1,{y}^{2}+1\right]$ is a triangular set, whereas $\left[x-y+1,{y}^{2}-x\right]$ is not. In broad words, a triangular set is a system of algebraic equations that is ready to be solved by evaluating the unknowns one after the other, just like a triangular linear system. However, there is a difference with the linear case: the back solving process may lead to some degenerated situation, or even to no solutions. Consider for example, for $y, the triangular set $\left\{yx-1,{y}^{2}-y\right\}$. The value $y=1$ leads to $x=1$, but the value $y=0$ does not lead to a value of $x$. In broad words, regular chains are a particular kind of triangular sets for which the back solving process succeeds in every case. A precise definition of a regular chain is given below, just before the examples.
 • Regular chains have many interesting computational properties. One property is that it is very convenient to perform computations modulo a set of relations given by a regular chain. The set of relations that is naturally associated with a regular chain is called its saturated ideal. This concept is defined precisely below, just before the examples. When the regular chain $T$ has as many polynomials as variables in $X$, then its saturated ideal is simply the ideal generated by $T$.  The operations NormalForm and SparsePseudoRemainder are used intensively for computing modulo regular chains: they are used to simplify a polynomial with respect to a regular chain.
 • In addition to its main functions Triangularize and RealTriangularize, and its subpackages ChainTools, MatrixTools, ConstructibleSetTools, ParametricSystemTools, SemiAlgebraicSetTools, FastArithmeticTools, and AlgebraicGeometryTools, the RegularChains package provides basic commands for computing with polynomials and regular chains. The commands PolynomialRing, DisplayPolynomialRing, MainVariable, Initial, MainDegree, Rank, Tail, and Separant allow the user to manipulate polynomials in the context of regular chains. The commands Equations and Inequations allow the user to inspect a regular chain. The commands RegularGcd, ExtendedRegularGcd, Inverse, IsRegular, RegularizeInitial, NormalForm, SparsePseudoRemainder, and MatrixCombine provide computations modulo regular chains.  SuggestVariableOrder attempts to provide an optimal order of variables for speeding up the decomposition of polynomial systems.
 • The commands Display and Info allow the user to print the different types of objects that the RegularChains package. The former is a raw printer which gives direct access to the object encoding. The latter is a pretty printer.
 • In addition to RealTriangularize, the commands LazyRealTriangularize and SamplePoints are alternative ways to obtain information on the real solutions of polynomial systems. These two commands solve partially their input system and can return their result much faster than RealTriangularize. In addition, LazyRealTriangularize can be used as an interactive solver, which can be helpful with difficult problems.
 • Similarly, the command Intersect can be used to solve systems of polynomial equations incrementally (that is, one equation after another) and thus interactively. Therefore, it is also a useful command in complement to Triangularize. List of the RegularChains Package Commands

 The following is a list of available top-level commands.

 To display the help page for a particular RegularChains command, see Getting Help with a Command in a Package.
 See the appropriate subpackage help page for a list of commands in the ChainTools, ConstructibleSetTools, FastArithmeticTools, MatrixTools, ParametricSystemTools, SemiAlgebraicSetTools, and AlgebraicGeometryTools subpackages.
 The RegularChains example worksheet provides an overview of each of the subpackages. List of RegularChains Subpackages

 • The MatrixTools subpackage provides commands for solving linear systems of equations modulo the saturated ideal of a regular chain. Among other operations are computations of matrix inverses and lower echelon forms. These commands are considered here in a non-standard context. Indeed, the coefficients of these matrices are polynomials and the computations are performed modulo (the saturated ideal of) a regular chain. Since this latter is not required to be a prime ideal, the commands of this subpackage allow you to do linear algebra computations over non-integral domains.
 • The ConstructibleSetTools subpackage provides a large set of commands for manipulating constructible sets. Constructible sets are the fundamental objects of Algebraic Geometry, and they play there the role that ideals play in Polynomial Algebra. In broad terms, a constructible set is the solution set of a system of polynomial equations and inequations. Constructible sets appear naturally in many questions, from high-school problems to advanced research topics.
 • The SemiAlgebraicSetTools subpackage contains a collection of commands for isolating and counting real roots of zero-dimensional semi-algebraic systems or regular chains (that is regular chains with a finite number of complex solutions). It also offers various commands for studying the real solutions of polynomial systems of positive dimension or with parameters. In particular, commands for real root classification, cylindrical algebraic decomposition and partial cylindrical algebraic decomposition sampling are available. Several inspection functions on semi-algebraic systems and their solution sets (namely, semi-algebraic sets) are also provided. They are intended to support the commands RealRootClassification, RealTriangularize and LazyRealTriangularize.
 • The ParametricSystemTools subpackage provides commands for solving systems of equations that depend on parameters. Given a parametric polynomial system $F$, this subpackage can be used to answer questions such as: for which values of the parameters does $F$ have solutions? finitely many solutions? $N$  real solutions, for a given $N$?
 • The ChainTools subpackage provides advanced operations on regular chains. Most of these commands allow you to inspect, construct and transform regular chains, or to check the properties of a polynomial with respect to a regular chain. Some commands operate transformations on a set of regular chains; they can be used to analyze the results computed by the command Triangularize.
 • The FastArithmeticTools subpackage contains a collection of commands for computing with regular chains in prime characteristic using asymptotically fast algorithms. Most of the underlying polynomial arithmetic is performed at C level and relies on (multi-dimensional) Fast Fourier Transform (FFT). This imposes some constraints on the characteristic. One of the main purposes of this subpackage is to offer efficient basic routines in order to support the implementation of modular algorithms for computing with regular chains and algebraic numbers.
 • The AlgebraicGeometryTools subpackage contains a collection of commands for manipulating algebraic curves, surfaces and algebraic sets of higher dimension. The commands currently available mainly focus on computing the limit of a family of sets like limits of a family of secants in the case of tangent cone computation. Mathematical Definitions

 Here is a precise definition of a regular chain and its saturated ideal.
 First, recall that a non-zero element h of a ring R is called regular if h is not a zero-divisor; that is, for every f of R, if the product f*h is null, then f is null.
 Now, let T be a triangular set. We define by induction what it means for T to be a regular chain. Also, we define the saturated ideal of T. If T is empty, then it is a regular chain and its saturated ideal is the trivial ideal (the ideal consisting only of zero). Assume now that T is not empty. Let p be the polynomial of T with greatest main variable and let C be the set of the other polynomials in T. If C is a regular chain with saturated ideal I, and if the initial h of p is regular with respect to I, then T is a regular chain. In addition, the saturated ideal of T is the set of the polynomials g such that there exists a power h^e of h such that h^e * g belongs to the ideal generated by I and p. An important property of a regular chain T is that a polynomial f belongs to the saturated ideal of T if and only if f reduces to zero by pseudo-division with respect to T. The pseudo-division of a polynomial with respect to a regular chain is implemented by the command SparsePseudoRemainder.
 It follows from the previous definition that a set consisting of a single polynomial p is a regular chain whose saturated ideal is the ideal generated by the primitive part of p regarded as a univariate polynomial in its main variable.
 Let T be a triangular set consisting of two polynomials p and q such that q is univariate in y and p is bivariate in x and y. Let h be the initial of p. Then T is a regular chain if the GCD of q and h is 1. This second example generalizes to regular chains with more than two variables or more than two polynomials. Verifying that a triangular set is a regular chain can be made by means of GCD computations.
 These GCD computations take as input two polynomials p1 and p2 with the same main variable v and a regular chain T. Since these GCD computations rely on division (or pseudo-division), the initial of the intermediate remainders (or pseudo-remainders) must be regular modulo the saturated ideal of T. As a consequence, the input polynomials p1 and p2 are required to have regular initials, and the output polynomial, if it has main variable v, also has an initial regular with respect to T. This explains the name of the command RegularGcd. You can check that the input polynomials are valid input by calling IsRegular on their initials. If one of the initials of the input polynomials p1 and p2 is not regular with respect to (the saturated ideal of) T, then you can split T into several regular chains ${T}_{1},\mathrm{...},{T}_{s}$ such that RegularGcd can be called on p1 and p2 for each of T1,...,Ts. This splitting is obtained by using the RegularizeInitial command on p1 and p2.
 Let K be a field and let R a polynomial ring over K obtained by the command PolynomialRing. When R has no parameters, the field K can be Q, the field of rational numbers, or a prime field. When R has parameters, the field K is a field of rational functions. For a set (or a list) F of polynomials of R, the command Triangularize computes the common roots of F in an algebraically closed field L containing K. If K is Q, then one can think of L as the field of the complex numbers. The command Triangularize returns a list of regular chains ${C}_{1},\mathrm{...},{C}_{s}$, which is called a triangular decomposition of the common roots of F.
 There are two possible relations between the common roots of F and the regular chains C1, ...,Cs, leading to two notions of a triangular decomposition.
 We say that C1, ...,Cs is a triangular decomposition of F in the sense of Kalkbrener if the following holds: a point is a root of F if and only if it is a root of one of the saturated ideals of C1,...,Cs.
 To introduce the other notion of a triangular decomposition, we need a definition. A point P is a root of a regular chain T if P cancels every polynomial of T but does not cancel any of the initials of the polynomials of T. The commands Equations and Inequations applied to T return the list of its polynomials and the list of their initials, respectively.
 We say that C1,...,Cs is a triangular decomposition of F in the sense of Lazard if the following holds: a point is a root of F if and only if it is a root of one of the regular chains C1,...,Cs. A triangular decomposition in the sense of Lazard is in particular a triangular decomposition in the sense of Kalkbrener. But the converse is false.
 The command Triangularize is capable of computing both kinds of triangular decompositions. This is achieved by means of options. By default, the sense of Kalkbrener is used. The command Triangularize admits other options that allow the user to control the properties of the computed regular chains. One important property is that of being strongly normalized; see ChainTools for the definition of this notion. Indeed, if T is a strongly normalized regular chain, then you can compute the NormalForm of a polynomial with respect to T.
 An irreducible univariate polynomial over K defines both a field extension of K and a regular chain. More generally, let L1 be a direct product of fields, and let p be a univariate polynomial over L1 that generates a radical ideal; then p defines an extension L2 of L1 which is another direct product of fields. It turns out that regular chains are a way to encode extensions of fields or extensions of direct products of fields. This idea is central to the algorithms that the commands IsRegular, Inverse, RegularizeInitial, RegularGcd, and ExtendedRegularGcd implement. The fact that direct products of fields admit zero-divisors is handled by the celebrated D5 principle, which allows us to extend algorithms working fields to direct products of fields.
 The theory of regular chains is based on a recursive and univariate vision of polynomials which reduces computations with multivariate polynomials to series of computations with univariate polynomials. The commands MainVariable, Initial, MainDegree, Rank, Tail, and Separant are the basic operations in this recursive and univariate vision of multivariate polynomials. Examples

Presented here is an overview of the RegularChains library by means of a series of examples. The first ones are for non-experts in symbolic computations, whereas the last ones require some familiarity with this area. Solving polynomial systems by means of regular chains

 The first example shows how the RegularChains library can solve systems of algebraic equations symbolically. Start by loading the library.
 > $\mathrm{with}\left(\mathrm{RegularChains}\right):$$\mathrm{with}\left(\mathrm{ChainTools}\right):$$\mathrm{with}\left(\mathrm{MatrixTools}\right):$
 First, define the ring of the polynomials of the system to be solved. Indeed, most operations of the RegularChains library require such a polynomial ring as a parameter. This is how to specify the variable ordering. See PolynomialRing for more details.
 > $R≔\mathrm{PolynomialRing}\left(\left[x,y,z\right]\right)$
 ${R}{≔}{\mathrm{polynomial_ring}}$ (1)
 Define a set of polynomials of R.
 > $\mathrm{sys}≔\left\{{x}^{2}+y+z-1,x+{y}^{2}+z-1,x+y+{z}^{2}-1\right\}$
 ${\mathrm{sys}}{≔}\left\{{{z}}^{{2}}{+}{x}{+}{y}{-}{1}{,}{{y}}^{{2}}{+}{x}{+}{z}{-}{1}{,}{{x}}^{{2}}{+}{y}{+}{z}{-}{1}\right\}$ (2)
 Ideally, we would like to decompose the solutions of this system into a list of points. In broad terms, this is what the command Triangularize does. However, some of these points are grouped because they share some properties. These groups are described by regular chains.
 > $\mathrm{dec}≔\mathrm{Triangularize}\left(\mathrm{sys},R\right)$
 ${\mathrm{dec}}{≔}\left[{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}\right]$ (3)
 Because these points may involve large expressions, you need to ask to see them! The command Equations displays the list of polynomials of a regular chain.
 > $\mathrm{map}\left(\mathrm{Equations},\mathrm{dec},R\right)$
 $\left[\left[{x}{-}{z}{,}{y}{-}{z}{,}{{z}}^{{2}}{+}{2}{}{z}{-}{1}\right]{,}\left[{x}{,}{y}{,}{z}{-}{1}\right]{,}\left[{x}{,}{y}{-}{1}{,}{z}\right]{,}\left[{x}{-}{1}{,}{y}{,}{z}\right]\right]$ (4)
 The last three regular chains are very simple: each of them clearly corresponds to a point in the space. Have a closer look at the first one. The polynomial in z has two solutions. To each of them corresponds a point in the space. You can retrieve these five points by using the solve command.
 > $\left\{\mathrm{solve}\left(\mathrm{sys}\right)\right\}$
 $\left\{\left\{{x}{=}{0}{,}{y}{=}{0}{,}{z}{=}{1}\right\}{,}\left\{{x}{=}{0}{,}{y}{=}{1}{,}{z}{=}{0}\right\}{,}\left\{{x}{=}{1}{,}{y}{=}{0}{,}{z}{=}{0}\right\}{,}\left\{{x}{=}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{+}{2}{}{\mathrm{_Z}}{-}{1}\right){,}{y}{=}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{+}{2}{}{\mathrm{_Z}}{-}{1}\right){,}{z}{=}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{+}{2}{}{\mathrm{_Z}}{-}{1}\right)\right\}\right\}$ (5)
 Consider again the regular chain above that corresponds to two points. Since these two points are grouped together, you can check whether each of them is a solution of the input system. This can be achieved by means of the command IsInRadical from the ChainTools subpackage by using the following fact: a regular chain T encodes a subset of the solution set of the input system S if and only if every polynomial of S belongs to the radical of the saturated ideal of T.
 > $\mathrm{seq}\left(\mathrm{IsInSaturate}\left({\mathrm{sys}}_{i},{\mathrm{dec}}_{1},R\right),i=1..\mathrm{nops}\left(\mathrm{sys}\right)\right)$
 ${\mathrm{true}}{,}{\mathrm{true}}{,}{\mathrm{true}}$ (6)
 Note that Triangularize can also take inequations among its input. Below, impose the condition that $x$ must be different from $z$.
 > $\mathrm{decn}≔\mathrm{Triangularize}\left(\mathrm{sys},\left[x-z\right],R\right);$$\mathrm{map}\left(\mathrm{Equations},\mathrm{decn},R\right)$
 ${\mathrm{decn}}{≔}\left[{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}\right]$
 $\left[\left[{x}{-}{1}{,}{y}{,}{z}\right]{,}\left[{x}{,}{y}{,}{z}{-}{1}\right]\right]$ (7)
 Observe that two points from the original decomposition have been removed.
 If you are solving with the lazard option, then the output is a constructible set, rather than a list of regular chains. Such a distinction matters, if the input system is in positive dimension.
 > $\mathrm{cs}≔\mathrm{Triangularize}\left(\left[\mathrm{op}\left(1..2,\mathrm{sys}\right)\right],\left[x-z\right],R,\mathrm{output}=\mathrm{lazard}\right);$$\mathrm{Info}\left(\mathrm{cs},R\right)$
 ${\mathrm{cs}}{≔}{\mathrm{constructible_set}}$
 $\left[\left[{x}{+}{{z}}^{{2}}{+}{z}{-}{1}{,}{y}{-}{z}\right]{,}\left[{{z}}^{{2}}{+}{2}{}{z}{-}{1}\right]\right]{,}\left[\left[{x}{+}{{z}}^{{2}}{-}{z}{,}{y}{+}{z}{-}{1}\right]{,}\left[{z}\right]\right]$ (8)
 > $\mathrm{decn}≔\mathrm{Triangularize}\left(\left[\mathrm{op}\left(1..2,\mathrm{sys}\right)\right],\left[x-z\right],R\right);$$\mathrm{map}\left(\mathrm{Equations},\mathrm{decn},R\right)$
 ${\mathrm{decn}}{≔}\left[{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}\right]$
 $\left[\left[{x}{+}{{z}}^{{2}}{+}{z}{-}{1}{,}{y}{-}{z}\right]{,}\left[{x}{+}{{z}}^{{2}}{-}{z}{,}{y}{+}{z}{-}{1}\right]\right]$ (9)
 By default, Triangularize gives generic solutions. With the lazard option, it outputs all solutions, which generally form a constructible set. Computing inverses modulo a regular chain

 The second example illustrates an important feature of the RegularChains library: computations modulo a regular chain. To do so, consider a second system.
 > $\mathrm{sys}≔\left\{{x}^{8}+y{x}^{2}+x+z,{x}^{2}y+3x+2,{x}^{2}-yx+z\right\}$
 ${\mathrm{sys}}{≔}\left\{{{x}}^{{2}}{}{y}{+}{3}{}{x}{+}{2}{,}{{x}}^{{2}}{-}{x}{}{y}{+}{z}{,}{{x}}^{{8}}{+}{{x}}^{{2}}{}{y}{+}{x}{+}{z}\right\}$ (10)
 > $\mathrm{dec}≔\mathrm{Triangularize}\left(\mathrm{sys},R\right)$
 ${\mathrm{dec}}{≔}\left[{\mathrm{regular_chain}}\right]$ (11)
 The solution computed by the Triangularize command consists of a single regular chain. In this polynomial ring, the variable ordering makes $x>y>z$. This means that the $x$-coordinate of each point must be expressed in terms of $y$ and $z$, and the $y$-coordinate as a function of $z$.
 > $\mathrm{rc}≔{\mathrm{dec}}_{1}$
 ${\mathrm{rc}}{≔}{\mathrm{regular_chain}}$ (12)
 > $\mathrm{pz}≔\mathrm{Polynomial}\left(z,\mathrm{rc},R\right)$
 ${\mathrm{pz}}{≔}{{z}}^{{9}}{+}{22}{}{{z}}^{{8}}{+}{208}{}{{z}}^{{7}}{+}{1126}{}{{z}}^{{6}}{+}{3834}{}{{z}}^{{5}}{+}{8136}{}{{z}}^{{4}}{+}{9053}{}{{z}}^{{3}}{-}{224}{}{{z}}^{{2}}{-}{14055}{}{z}{-}{13302}$ (13)
 > $\mathrm{py}≔\mathrm{Polynomial}\left(y,\mathrm{rc},R\right)$
 ${\mathrm{py}}{≔}{4}{}{y}{}{{z}}^{{6}}{-}{3}{}{{z}}^{{7}}{+}{16}{}{y}{}{{z}}^{{5}}{+}{6}{}{{z}}^{{6}}{+}{42}{}{y}{}{{z}}^{{4}}{+}{426}{}{{z}}^{{5}}{+}{742}{}{y}{}{{z}}^{{3}}{+}{3177}{}{{z}}^{{4}}{+}{4056}{}{y}{}{{z}}^{{2}}{+}{11093}{}{{z}}^{{3}}{+}{9416}{}{y}{}{z}{+}{21282}{}{{z}}^{{2}}{+}{10056}{}{y}{+}{21096}{}{z}{+}{5832}$ (14)
 > $\mathrm{px}≔\mathrm{Polynomial}\left(x,\mathrm{rc},R\right)$
 ${\mathrm{px}}{≔}{x}{}{{y}}^{{2}}{-}{y}{}{z}{+}{3}{}{x}{+}{2}$ (15)
 The polynomial py gives y as a rational function in z. You may ask if you could express y as a polynomial function in z. In other words, can we replace py by a polynomial with 1 as its Initial? Indeed, the polynomial in z defines a field extension K of the field Q of the rational numbers. In the field K, you can compute the Inverse of the initial of py.
 > $\mathrm{newrc}≔\mathrm{Under}\left(y,\mathrm{rc},R\right);$$\mathrm{Equations}\left(\mathrm{newrc},R\right)$
 ${\mathrm{newrc}}{≔}{\mathrm{regular_chain}}$
 $\left[{{z}}^{{9}}{+}{22}{}{{z}}^{{8}}{+}{208}{}{{z}}^{{7}}{+}{1126}{}{{z}}^{{6}}{+}{3834}{}{{z}}^{{5}}{+}{8136}{}{{z}}^{{4}}{+}{9053}{}{{z}}^{{3}}{-}{224}{}{{z}}^{{2}}{-}{14055}{}{z}{-}{13302}\right]$ (16)
 > $\mathrm{lcy}≔\mathrm{Initial}\left(\mathrm{py},R\right);$$\mathrm{ilcy}≔\mathrm{Inverse}\left(\mathrm{lcy},\mathrm{newrc},R\right)$
 ${\mathrm{lcy}}{≔}{4}{}{{z}}^{{6}}{+}{16}{}{{z}}^{{5}}{+}{42}{}{{z}}^{{4}}{+}{742}{}{{z}}^{{3}}{+}{4056}{}{{z}}^{{2}}{+}{9416}{}{z}{+}{10056}$
 ${\mathrm{ilcy}}{≔}\left[\left[\left[{43056952878224602831649}{}{{z}}^{{8}}{+}{851556715329089933233928}{}{{z}}^{{7}}{+}{6829798380079214157184280}{}{{z}}^{{6}}{+}{28121353959653668128495638}{}{{z}}^{{5}}{+}{58395516864169985401373466}{}{{z}}^{{4}}{+}{31177496499998617409832000}{}{{z}}^{{3}}{-}{118245600582993390444999143}{}{{z}}^{{2}}{-}{157661907907876621441394914}{}{z}{+}{143594593667712002746022313}{,}{100270485333918213150443394312}{,}{\mathrm{regular_chain}}\right]\right]{,}\left[\right]\right]$ (17)
 > $\mathrm{nilcy}≔{{{\mathrm{ilcy}}_{1}}_{1}}_{1};$$\mathrm{dilcy}≔{{{\mathrm{ilcy}}_{1}}_{1}}_{2}$
 ${\mathrm{nilcy}}{≔}{43056952878224602831649}{}{{z}}^{{8}}{+}{851556715329089933233928}{}{{z}}^{{7}}{+}{6829798380079214157184280}{}{{z}}^{{6}}{+}{28121353959653668128495638}{}{{z}}^{{5}}{+}{58395516864169985401373466}{}{{z}}^{{4}}{+}{31177496499998617409832000}{}{{z}}^{{3}}{-}{118245600582993390444999143}{}{{z}}^{{2}}{-}{157661907907876621441394914}{}{z}{+}{143594593667712002746022313}$
 ${\mathrm{dilcy}}{≔}{100270485333918213150443394312}$ (18)
 The help page for Inverse explains how to read the output of this command. In this example, this output means that the inverse of lcy is a fraction with numerator nilcy and denominator dilcy. To check that ilcy is the inverse of lcy modulo newrc, use the command NormalForm to simplify the product nilcy*lcy. Regular chains have a notion of normal form attached to them, just like Groebner bases.
 > $\mathrm{NormalForm}\left(\mathrm{nilcy}\mathrm{lcy},\mathrm{newrc},R\right)$
 ${100270485333918213150443394312}$ (19)
 You obtain dilcy as expected. Now you can make the polynomial py look better by multiplying it by ilcy and removing its content.
 > $\mathrm{newpy}≔\mathrm{NormalForm}\left(\mathrm{nilcy}\mathrm{py},\mathrm{newrc},R\right):$$\mathrm{cnewpy}≔\mathrm{content}\left(\mathrm{newpy}\right)$
 ${\mathrm{cnewpy}}{≔}{8391661701681509748}$ (20)
 > $\mathrm{newpy}≔\frac{\mathrm{newpy}}{\mathrm{cnewpy}}$
 ${\mathrm{newpy}}{≔}{31071832}{}{{z}}^{{8}}{+}{559158565}{}{{z}}^{{7}}{+}{4309096681}{}{{z}}^{{6}}{+}{19396993429}{}{{z}}^{{5}}{+}{54553636695}{}{{z}}^{{4}}{+}{88747638462}{}{{z}}^{{3}}{+}{54918900470}{}{{z}}^{{2}}{+}{11948823594}{}{y}{-}{78024336215}{}{z}{-}{156442784340}$ (21)
 The same treatment can be applied to the polynomial px.
 > $\mathrm{newrc}≔\mathrm{Chain}\left(\left[\mathrm{newpy}\right],\mathrm{newrc},R\right);$$\mathrm{Equations}\left(\mathrm{newrc},R\right)$
 ${\mathrm{newrc}}{≔}{\mathrm{regular_chain}}$
 $\left[{11948823594}{}{y}{+}{31071832}{}{{z}}^{{8}}{+}{559158565}{}{{z}}^{{7}}{+}{4309096681}{}{{z}}^{{6}}{+}{19396993429}{}{{z}}^{{5}}{+}{54553636695}{}{{z}}^{{4}}{+}{88747638462}{}{{z}}^{{3}}{+}{54918900470}{}{{z}}^{{2}}{-}{78024336215}{}{z}{-}{156442784340}{,}{{z}}^{{9}}{+}{22}{}{{z}}^{{8}}{+}{208}{}{{z}}^{{7}}{+}{1126}{}{{z}}^{{6}}{+}{3834}{}{{z}}^{{5}}{+}{8136}{}{{z}}^{{4}}{+}{9053}{}{{z}}^{{3}}{-}{224}{}{{z}}^{{2}}{-}{14055}{}{z}{-}{13302}\right]$ (22)
 > $\mathrm{lcx}≔\mathrm{Initial}\left(\mathrm{px},R\right);$$\mathrm{ilcx}≔\mathrm{Inverse}\left(\mathrm{lcx},\mathrm{newrc},R\right)$
 ${\mathrm{lcx}}{≔}{{y}}^{{2}}{+}{3}$
 ${\mathrm{ilcx}}{≔}\left[\left[\left[{-}{336484613006303}{}{{z}}^{{8}}{-}{6472881536029244}{}{{z}}^{{7}}{-}{52074812760151232}{}{{z}}^{{6}}{-}{233680431492813710}{}{{z}}^{{5}}{-}{628167256520883558}{}{{z}}^{{4}}{-}{914048962864580664}{}{{z}}^{{3}}{-}{280077377390474863}{}{{z}}^{{2}}{+}{1137261498645304126}{}{z}{+}{1492395674188006257}{,}{822063553694174988}{,}{\mathrm{regular_chain}}\right]\right]{,}\left[\right]\right]$ (23)
 > $\mathrm{nilcx}≔{{{\mathrm{ilcx}}_{1}}_{1}}_{1};$$\mathrm{dilcx}≔{{{\mathrm{ilcx}}_{1}}_{1}}_{2}$
 ${\mathrm{nilcx}}{≔}{-}{336484613006303}{}{{z}}^{{8}}{-}{6472881536029244}{}{{z}}^{{7}}{-}{52074812760151232}{}{{z}}^{{6}}{-}{233680431492813710}{}{{z}}^{{5}}{-}{628167256520883558}{}{{z}}^{{4}}{-}{914048962864580664}{}{{z}}^{{3}}{-}{280077377390474863}{}{{z}}^{{2}}{+}{1137261498645304126}{}{z}{+}{1492395674188006257}$
 ${\mathrm{dilcx}}{≔}{822063553694174988}$ (24)
 > $\mathrm{newpx}≔\mathrm{NormalForm}\left(\mathrm{nilcx}\mathrm{px},\mathrm{newrc},R\right);$$\mathrm{cnewpx}≔\mathrm{content}\left(\mathrm{newpx}\right)$
 ${\mathrm{newpx}}{≔}{-}{1173512875760890}{}{{z}}^{{8}}{-}{23382929946795160}{}{{z}}^{{7}}{-}{192607789095942472}{}{{z}}^{{6}}{-}{872326306307566684}{}{{z}}^{{5}}{-}{2350486446974102010}{}{{z}}^{{4}}{-}{3377744504245671336}{}{{z}}^{{3}}{-}{867887371605727550}{}{{z}}^{{2}}{+}{822063553694174988}{}{x}{+}{4280831462806439198}{}{z}{+}{5386815096525691500}$
 ${\mathrm{cnewpx}}{≔}{68798702}$ (25)
 > $\mathrm{newpx}≔\frac{\mathrm{newpx}}{\mathrm{cnewpx}}$
 ${\mathrm{newpx}}{≔}{-}{17057195}{}{{z}}^{{8}}{-}{339874580}{}{{z}}^{{7}}{-}{2799584636}{}{{z}}^{{6}}{-}{12679400642}{}{{z}}^{{5}}{-}{34164691755}{}{{z}}^{{4}}{-}{49096049868}{}{{z}}^{{3}}{-}{12614880025}{}{{z}}^{{2}}{+}{11948823594}{}{x}{+}{62222561449}{}{z}{+}{78298208250}$ (26)
 Then you obtain a new regular newrc chain which encodes the same solution set as rc.
 > $\mathrm{newrc}≔\mathrm{Chain}\left(\left[\mathrm{newpx}\right],\mathrm{newrc},R\right)$
 ${\mathrm{newrc}}{≔}{\mathrm{regular_chain}}$ (27)
 > $\mathrm{polys}≔\mathrm{Equations}\left(\mathrm{rc},R\right)$
 ${\mathrm{polys}}{≔}\left[\left({{y}}^{{2}}{+}{3}\right){}{x}{-}{y}{}{z}{+}{2}{,}\left({4}{}{{z}}^{{6}}{+}{16}{}{{z}}^{{5}}{+}{42}{}{{z}}^{{4}}{+}{742}{}{{z}}^{{3}}{+}{4056}{}{{z}}^{{2}}{+}{9416}{}{z}{+}{10056}\right){}{y}{-}{3}{}{{z}}^{{7}}{+}{6}{}{{z}}^{{6}}{+}{426}{}{{z}}^{{5}}{+}{3177}{}{{z}}^{{4}}{+}{11093}{}{{z}}^{{3}}{+}{21282}{}{{z}}^{{2}}{+}{21096}{}{z}{+}{5832}{,}{{z}}^{{9}}{+}{22}{}{{z}}^{{8}}{+}{208}{}{{z}}^{{7}}{+}{1126}{}{{z}}^{{6}}{+}{3834}{}{{z}}^{{5}}{+}{8136}{}{{z}}^{{4}}{+}{9053}{}{{z}}^{{3}}{-}{224}{}{{z}}^{{2}}{-}{14055}{}{z}{-}{13302}\right]$ (28)
 > $\mathrm{newpolys}≔\mathrm{Equations}\left(\mathrm{newrc},R\right)$
 ${\mathrm{newpolys}}{≔}\left[{11948823594}{}{x}{-}{17057195}{}{{z}}^{{8}}{-}{339874580}{}{{z}}^{{7}}{-}{2799584636}{}{{z}}^{{6}}{-}{12679400642}{}{{z}}^{{5}}{-}{34164691755}{}{{z}}^{{4}}{-}{49096049868}{}{{z}}^{{3}}{-}{12614880025}{}{{z}}^{{2}}{+}{62222561449}{}{z}{+}{78298208250}{,}{11948823594}{}{y}{+}{31071832}{}{{z}}^{{8}}{+}{559158565}{}{{z}}^{{7}}{+}{4309096681}{}{{z}}^{{6}}{+}{19396993429}{}{{z}}^{{5}}{+}{54553636695}{}{{z}}^{{4}}{+}{88747638462}{}{{z}}^{{3}}{+}{54918900470}{}{{z}}^{{2}}{-}{78024336215}{}{z}{-}{156442784340}{,}{{z}}^{{9}}{+}{22}{}{{z}}^{{8}}{+}{208}{}{{z}}^{{7}}{+}{1126}{}{{z}}^{{6}}{+}{3834}{}{{z}}^{{5}}{+}{8136}{}{{z}}^{{4}}{+}{9053}{}{{z}}^{{3}}{-}{224}{}{{z}}^{{2}}{-}{14055}{}{z}{-}{13302}\right]$ (29)
 > $\mathrm{seq}\left(\mathrm{IsInSaturate}\left({\mathrm{polys}}_{i},\mathrm{newrc},R\right),i=1..\mathrm{nops}\left(\mathrm{polys}\right)\right)$
 ${\mathrm{true}}{,}{\mathrm{true}}{,}{\mathrm{true}}$ (30)
 > $\mathrm{seq}\left(\mathrm{IsInSaturate}\left({\mathrm{newpolys}}_{i},\mathrm{rc},R\right),i=1..\mathrm{nops}\left(\mathrm{newpolys}\right)\right)$
 ${\mathrm{true}}{,}{\mathrm{true}}{,}{\mathrm{true}}$ (31)
 This new regular newrc has an additional property with respect to rc: it is strongly normalized. See IsStronglyNormalized for the definition of strongly normalized. Being strongly normalized is a requirement in order to use the command NormalForm.
 You could have obtained this regular chain from the input system by using an option of Triangularize.
 > $\mathrm{decn}≔\mathrm{Triangularize}\left(\mathrm{sys},R,\mathrm{normalized}=\mathrm{yes}\right)$
 ${\mathrm{decn}}{≔}\left[{\mathrm{regular_chain}}\right]$ (32)
 > $\mathrm{map}\left(\mathrm{Equations},\mathrm{decn},R\right)$
 $\left[\left[{11948823594}{}{x}{-}{17057195}{}{{z}}^{{8}}{-}{339874580}{}{{z}}^{{7}}{-}{2799584636}{}{{z}}^{{6}}{-}{12679400642}{}{{z}}^{{5}}{-}{34164691755}{}{{z}}^{{4}}{-}{49096049868}{}{{z}}^{{3}}{-}{12614880025}{}{{z}}^{{2}}{+}{62222561449}{}{z}{+}{78298208250}{,}{11948823594}{}{y}{+}{31071832}{}{{z}}^{{8}}{+}{559158565}{}{{z}}^{{7}}{+}{4309096681}{}{{z}}^{{6}}{+}{19396993429}{}{{z}}^{{5}}{+}{54553636695}{}{{z}}^{{4}}{+}{88747638462}{}{{z}}^{{3}}{+}{54918900470}{}{{z}}^{{2}}{-}{78024336215}{}{z}{-}{156442784340}{,}{{z}}^{{9}}{+}{22}{}{{z}}^{{8}}{+}{208}{}{{z}}^{{7}}{+}{1126}{}{{z}}^{{6}}{+}{3834}{}{{z}}^{{5}}{+}{8136}{}{{z}}^{{4}}{+}{9053}{}{{z}}^{{3}}{-}{224}{}{{z}}^{{2}}{-}{14055}{}{z}{-}{13302}\right]\right]$ (33)
 The Triangularize command does not always return the normalized decomposition so that it can handle the most general cases, including very large examples. Indeed, observe that the first regular chain rc has smaller coefficients than the strongly normalized regular chain newrc. Automatic case discussion

 The next example shows that RegularChains can handle automatic case discussion. Start by trying to answer the following question. Why does the above output of Inverse look complicated? Because RegularChains can handle automatic case discussion! To illustrate this, consider two variables y and z; assume that they are solutions of the regular chain below.
 > $R≔\mathrm{PolynomialRing}\left(\left[y,z\right]\right)$
 ${R}{≔}{\mathrm{polynomial_ring}}$ (34)
 > $\mathrm{rc}≔\mathrm{Empty}\left(R\right)$
 ${\mathrm{rc}}{≔}{\mathrm{regular_chain}}$ (35)
 > $\mathrm{rc}≔\mathrm{Chain}\left(\left[{z}^{4}+1,{y}^{2}-{z}^{2}\right],\mathrm{rc},R\right):$
 > $\mathrm{Equations}\left(\mathrm{rc},R\right)$
 $\left[{{y}}^{{2}}{-}{{z}}^{{2}}{,}{{z}}^{{4}}{+}{1}\right]$ (36)
 Compute the inverse of the following matrix modulo the relations of the regular chain rc.
 > $m≔\mathrm{Matrix}\left(\left[\left[1,y+z\right],\left[0,y-z\right]\right]\right)$
 ${m}{≔}\left[\begin{array}{cc}{1}& {y}{+}{z}\\ {0}& {y}{-}{z}\end{array}\right]$ (37)
 Clearly, the result depends on whether y and z are equal or not.
 > $\mathrm{mim}≔\mathrm{MatrixInverse}\left(m,\mathrm{rc},R\right)$
 ${\mathrm{mim}}{≔}\left[\left[\left[\left[\begin{array}{cc}{1}& {0}\\ {0}& \frac{{{z}}^{{3}}}{{2}}\end{array}\right]{,}{\mathrm{regular_chain}}\right]\right]{,}\left[\left[{"noInv"}{,}\left[\begin{array}{cc}{1}& {y}{+}{z}\\ {0}& {y}{-}{z}\end{array}\right]{,}{\mathrm{regular_chain}}\right]\right]\right]$ (38)
 Check the first result.
 > $\mathrm{m1}≔{{{\mathrm{mim}}_{1}}_{1}}_{1}$
 ${\mathrm{m1}}{≔}\left[\begin{array}{cc}{1}& {0}\\ {0}& \frac{{{z}}^{{3}}}{{2}}\end{array}\right]$ (39)
 > $\mathrm{rc1}≔{{{\mathrm{mim}}_{1}}_{1}}_{2}$
 ${\mathrm{rc1}}{≔}{\mathrm{regular_chain}}$ (40)
 > $\mathrm{Equations}\left(\mathrm{rc1},R\right)$
 $\left[{y}{+}{z}{,}{{z}}^{{4}}{+}{1}\right]$ (41)
 > $\mathrm{MatrixMultiply}\left(\mathrm{m1},m,\mathrm{rc1},R\right)$
 $\left[\begin{array}{cc}{1}& {0}\\ {0}& {1}\end{array}\right]$ (42)
 Consider now the other matrix.
 > $m≔\mathrm{Matrix}\left(\left[\left[1,y+z\right],\left[2,y-z\right]\right]\right)$
 ${m}{≔}\left[\begin{array}{cc}{1}& {y}{+}{z}\\ {2}& {y}{-}{z}\end{array}\right]$ (43)
 > $\mathrm{mim}≔\mathrm{MatrixInverse}\left(m,\mathrm{rc},R\right)$
 ${\mathrm{mim}}{≔}\left[\left[\left[\left[\begin{array}{cc}{1}& {0}\\ {-}{{z}}^{{3}}& \frac{{{z}}^{{3}}}{{2}}\end{array}\right]{,}{\mathrm{regular_chain}}\right]{,}\left[\left[\begin{array}{cc}{0}& \frac{{1}}{{2}}\\ {-}\frac{{{z}}^{{3}}}{{2}}& \frac{{{z}}^{{3}}}{{4}}\end{array}\right]{,}{\mathrm{regular_chain}}\right]\right]{,}\left[\right]\right]$ (44)
 Double check.
 > $\mathrm{m1}≔{{{\mathrm{mim}}_{1}}_{1}}_{1}$
 ${\mathrm{m1}}{≔}\left[\begin{array}{cc}{1}& {0}\\ {-}{{z}}^{{3}}& \frac{{{z}}^{{3}}}{{2}}\end{array}\right]$ (45)
 > $\mathrm{rc1}≔{{{\mathrm{mim}}_{1}}_{1}}_{2}$
 ${\mathrm{rc1}}{≔}{\mathrm{regular_chain}}$ (46)
 > $\mathrm{m2}≔{{{\mathrm{mim}}_{1}}_{2}}_{1}$
 ${\mathrm{m2}}{≔}\left[\begin{array}{cc}{0}& \frac{{1}}{{2}}\\ {-}\frac{{{z}}^{{3}}}{{2}}& \frac{{{z}}^{{3}}}{{4}}\end{array}\right]$ (47)
 > $\mathrm{rc2}≔{{{\mathrm{mim}}_{1}}_{2}}_{2}$
 ${\mathrm{rc2}}{≔}{\mathrm{regular_chain}}$ (48)
 > $\mathrm{MatrixMultiply}\left(\mathrm{m2},m,\mathrm{rc2},R\right)$
 $\left[\begin{array}{cc}{1}& {0}\\ {0}& {1}\end{array}\right]$ (49)
 > $\mathrm{MatrixMultiply}\left(\mathrm{m2},m,\mathrm{rc2},R\right)$
 $\left[\begin{array}{cc}{1}& {0}\\ {0}& {1}\end{array}\right]$ (50)
 Can you get a "generic" answer that would hold both cases? Yes, you can.
 > $\mathrm{clr}≔\mathrm{MatrixCombine}\left(\left[\mathrm{rc1},\mathrm{rc2}\right],R,\left[\mathrm{m1},\mathrm{m2}\right]\right)$
 ${\mathrm{clr}}{≔}\left[\left[\left[\begin{array}{cc}\frac{{y}{}{{z}}^{{3}}}{{2}}{+}\frac{{1}}{{2}}& {-}\frac{{y}{}{{z}}^{{3}}}{{4}}{+}\frac{{1}}{{4}}\\ \frac{{1}}{{4}}{}{y}{}{{z}}^{{2}}{-}\frac{{3}}{{4}}{}{{z}}^{{3}}& {-}\frac{{1}}{{8}}{}{y}{}{{z}}^{{2}}{+}\frac{{3}}{{8}}{}{{z}}^{{3}}\end{array}\right]{,}{\mathrm{regular_chain}}\right]\right]$ (51)
 Check.
 > $\mathrm{MatrixMultiply}\left({{\mathrm{clr}}_{1}}_{1},m,{{\mathrm{clr}}_{1}}_{2},R\right)$
 $\left[\begin{array}{cc}{1}& {0}\\ {0}& {1}\end{array}\right]$ (52) Recombining the results from a case discussion

 The overview of the RegularChains library continues with more advanced examples, extending on the topic of automatic case discussion.
 Can you have several cases in the output of MatrixCombine? Yes, this can happen. Reuse the first polynomial system above.
 > $R≔\mathrm{PolynomialRing}\left(\left[x,y,z\right]\right)$
 ${R}{≔}{\mathrm{polynomial_ring}}$ (53)
 > $\mathrm{sys}≔\left\{{x}^{2}+y+z-1,x+{y}^{2}+z-1,x+y+{z}^{2}-1\right\}$
 ${\mathrm{sys}}{≔}\left\{{{z}}^{{2}}{+}{x}{+}{y}{-}{1}{,}{{y}}^{{2}}{+}{x}{+}{z}{-}{1}{,}{{x}}^{{2}}{+}{y}{+}{z}{-}{1}\right\}$ (54)
 > $\mathrm{lrc}≔\mathrm{Triangularize}\left(\mathrm{sys},R,\mathrm{normalized}=\mathrm{yes}\right);$$\mathrm{map}\left(\mathrm{Equations},\mathrm{lrc},R\right)$
 ${\mathrm{lrc}}{≔}\left[{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}\right]$
 $\left[\left[{x}{-}{z}{,}{y}{-}{z}{,}{{z}}^{{2}}{+}{2}{}{z}{-}{1}\right]{,}\left[{x}{,}{y}{,}{z}{-}{1}\right]{,}\left[{x}{,}{y}{-}{1}{,}{z}\right]{,}\left[{x}{-}{1}{,}{y}{,}{z}\right]\right]$ (55)
 Generate four random matrices.
 > $\mathrm{randomize}\left(4869257127\right):$
 > $\mathrm{lm}≔\left[\mathrm{seq}\left(\mathrm{Matrix}\left(\left[\mathrm{seq}\left(\left[\mathrm{seq}\left(\mathrm{randpoly}\left(\left[x,y,z\right],\mathrm{degree}=1\right),j=1..2\right)\right],i=1..2\right)\right]\right),k=1..4\right)\right]$
 ${\mathrm{lm}}{≔}\left[\left[\begin{array}{cc}{40}{}{x}{+}{17}{}{y}{+}{49}{}{z}{+}{75}& {-}{9}{}{x}{+}{71}{}{y}{+}{22}{}{z}{+}{68}\\ {79}{}{x}{+}{26}{}{y}{-}{35}{}{z}{+}{21}& {-}{48}{}{x}{-}{80}{}{y}{-}{32}{}{z}{-}{85}\end{array}\right]{,}\left[\begin{array}{cc}{-}{78}{}{x}{-}{35}{}{y}{+}{50}{}{z}{-}{26}& {32}{}{x}{+}{47}{}{y}{+}{32}{}{z}{+}{69}\\ {34}{}{x}{+}{58}{}{y}{-}{8}{}{z}{-}{63}& {98}{}{x}{+}{84}{}{y}{-}{71}{}{z}{+}{38}\end{array}\right]{,}\left[\begin{array}{cc}{49}{}{x}{-}{56}{}{y}{+}{36}{}{z}{+}{4}& {-}{98}{}{x}{+}{46}{}{y}{-}{43}{}{z}{+}{79}\\ {80}{}{x}{-}{y}{+}{49}{}{z}{-}{14}& {-}{52}{}{x}{+}{5}{}{y}{-}{46}{}{z}{+}{1}\end{array}\right]{,}\left[\begin{array}{cc}{29}{}{x}{+}{65}{}{y}{+}{7}{}{z}{-}{22}& {29}{}{x}{-}{12}{}{y}{-}{31}{}{z}{+}{25}\\ {50}{}{x}{-}{5}{}{y}{+}{28}{}{z}{+}{3}& {-}{34}{}{x}{+}{82}{}{y}{-}{96}{}{z}{-}{48}\end{array}\right]\right]$ (56)
 Now ask for the re-combination of the four cases.
 > $\mathrm{clr}≔\mathrm{MatrixCombine}\left(\mathrm{lrc},R,\mathrm{lm}\right)$
 ${\mathrm{clr}}{≔}\left[\left[\left[\begin{array}{cc}{-}{59}{}{y}{+}{7}& {71}{}{y}{+}{54}\\ {-}{68}{}{y}{+}{53}& {88}{}{y}{-}{82}\end{array}\right]{,}{\mathrm{regular_chain}}\right]{,}\left[\left[\begin{array}{cc}{-}\frac{{157}}{{2}}{}{{z}}^{{2}}{-}{51}{}{z}{+}\frac{{307}}{{2}}& {-}\frac{{51}}{{2}}{}{{z}}^{{2}}{+}{33}{}{z}{+}\frac{{187}}{{2}}\\ {-}{81}{}{{z}}^{{2}}{-}{92}{}{z}{+}{102}& {106}{}{{z}}^{{2}}{+}{52}{}{z}{-}{191}\end{array}\right]{,}{\mathrm{regular_chain}}\right]\right]$ (57)
 It turns out that you cannot obtain a unique case. This is surprising, since the saturated ideals of the four regular chains are pairwise relatively prime.
 Check why the re-combination into a single regular chain is not possible.
 > $\mathrm{rc1}≔{{\mathrm{clr}}_{1}}_{2}$
 ${\mathrm{rc1}}{≔}{\mathrm{regular_chain}}$ (58)
 > $\mathrm{Equations}\left(\mathrm{rc1},R\right)$
 $\left[{x}{+}{y}{-}{1}{,}{{y}}^{{2}}{-}{y}{,}{z}\right]$ (59)
 > $\mathrm{rc2}≔{{\mathrm{clr}}_{2}}_{2}$
 ${\mathrm{rc2}}{≔}{\mathrm{regular_chain}}$ (60)
 > $\mathrm{Equations}\left(\mathrm{rc2},R\right)$
 $\left[{2}{}{x}{+}{{z}}^{{2}}{-}{1}{,}{2}{}{y}{+}{{z}}^{{2}}{-}{1}{,}{{z}}^{{3}}{+}{{z}}^{{2}}{-}{3}{}{z}{+}{1}\right]$ (61)
 The two ideals generated by rc1 and rc2 are obviously relatively prime (no common roots in z). But if you try to recombine them, you create a polynomial qy in y with a zero-divisor as initial; this is forbidden by the properties of a regular chain. Construct the polynomial qy and check if its initial is a zero-divisor.
 > $\mathrm{Rz}≔\mathrm{PolynomialRing}\left(\left[z\right]\right)$
 ${\mathrm{Rz}}{≔}{\mathrm{polynomial_ring}}$ (62)
 > $\mathrm{rc}≔\mathrm{Empty}\left(\mathrm{Rz}\right)$
 ${\mathrm{rc}}{≔}{\mathrm{regular_chain}}$ (63)
 > $\mathrm{rc1}≔\mathrm{Chain}\left(\left[z\right],\mathrm{rc},\mathrm{Rz}\right)$
 ${\mathrm{rc1}}{≔}{\mathrm{regular_chain}}$ (64)
 > $\mathrm{rc2}≔\mathrm{Chain}\left(\left[{z}^{3}+{z}^{2}-3z+1\right],\mathrm{rc},\mathrm{Rz}\right)$
 ${\mathrm{rc2}}{≔}{\mathrm{regular_chain}}$ (65)
 > $\mathrm{m1}≔\mathrm{Matrix}\left(\left[\left[{y}^{2}-y\right]\right]\right)$
 ${\mathrm{m1}}{≔}\left[\begin{array}{c}{{y}}^{{2}}{-}{y}\end{array}\right]$ (66)
 > $\mathrm{m2}≔\mathrm{Matrix}\left(\left[\left[2y+{z}^{2}-1\right]\right]\right)$
 ${\mathrm{m2}}{≔}\left[\begin{array}{c}{2}{}{y}{+}{{z}}^{{2}}{-}{1}\end{array}\right]$ (67)
 > $\mathrm{clr}≔\mathrm{MatrixCombine}\left(\left[\mathrm{rc1},\mathrm{rc2}\right],\mathrm{Rz},\left[\mathrm{m1},\mathrm{m2}\right]\right);$$m≔{{\mathrm{clr}}_{1}}_{1}$
 ${\mathrm{clr}}{≔}\left[\left[\left[\begin{array}{c}{{y}}^{{2}}{}{{z}}^{{3}}{+}{{y}}^{{2}}{}{{z}}^{{2}}{-}{3}{}{y}{}{{z}}^{{3}}{-}{3}{}{{y}}^{{2}}{}{z}{-}{3}{}{y}{}{{z}}^{{2}}{+}{{z}}^{{3}}{+}{{y}}^{{2}}{+}{9}{}{y}{}{z}{+}{2}{}{{z}}^{{2}}{-}{y}{-}{3}{}{z}\end{array}\right]{,}{\mathrm{regular_chain}}\right]\right]$
 ${m}{≔}\left[\begin{array}{c}{{y}}^{{2}}{}{{z}}^{{3}}{+}{{y}}^{{2}}{}{{z}}^{{2}}{-}{3}{}{y}{}{{z}}^{{3}}{-}{3}{}{{y}}^{{2}}{}{z}{-}{3}{}{y}{}{{z}}^{{2}}{+}{{z}}^{{3}}{+}{{y}}^{{2}}{+}{9}{}{y}{}{z}{+}{2}{}{{z}}^{{2}}{-}{y}{-}{3}{}{z}\end{array}\right]$ (68)
 > $\mathrm{rc}≔{{\mathrm{clr}}_{1}}_{2};$$\mathrm{qy}≔{m}_{1,1}$
 ${\mathrm{rc}}{≔}{\mathrm{regular_chain}}$
 ${\mathrm{qy}}{≔}{{y}}^{{2}}{}{{z}}^{{3}}{+}{{y}}^{{2}}{}{{z}}^{{2}}{-}{3}{}{y}{}{{z}}^{{3}}{-}{3}{}{{y}}^{{2}}{}{z}{-}{3}{}{y}{}{{z}}^{{2}}{+}{{z}}^{{3}}{+}{{y}}^{{2}}{+}{9}{}{y}{}{z}{+}{2}{}{{z}}^{{2}}{-}{y}{-}{3}{}{z}$ (69)
 > $\mathrm{Inverse}\left(\mathrm{Initial}\left(\mathrm{qy},R\right),\mathrm{rc},\mathrm{Rz}\right)$
 $\left[\left[\left[{1}{,}{1}{,}{\mathrm{regular_chain}}\right]\right]{,}\left[{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}\right]\right]$ (70) Solving systems with an infinite number of solutions

 The next example in the overview of RegularChains is a second round for experts. All previous automatic case discussions involve discussions with algebraic numbers only. Can the RegularChains library handle automatic case discussion with parameters? Yes, this is possible.  Consider the following system.
 > $R≔\mathrm{PolynomialRing}\left(\left[x,y,a,b,c,d,g,h\right]\right)$
 ${R}{≔}{\mathrm{polynomial_ring}}$ (71)
 > $\mathrm{sys}≔\left\{ax+by-g,cx+dy-h\right\}$
 ${\mathrm{sys}}{≔}\left\{{a}{}{x}{+}{b}{}{y}{-}{g}{,}{c}{}{x}{+}{d}{}{y}{-}{h}\right\}$ (72)
 This new system has a property that the previous examples do not have. Clearly, this new system has an infinite number of solutions, if we view its 8 variables as unknowns. There are two ways of solving such systems. First, by describing its generic solutions, which is done by computing a triangular decomposition in the sense of Kalkbrener.
 > $\mathrm{dec}≔\mathrm{Triangularize}\left(\mathrm{sys},R\right);$$\mathrm{map}\left(\mathrm{Equations},\mathrm{dec},R\right)$
 ${\mathrm{dec}}{≔}\left[{\mathrm{regular_chain}}\right]$
 $\left[\left[{c}{}{x}{+}{y}{}{d}{-}{h}{,}\left({a}{}{d}{-}{b}{}{c}\right){}{y}{-}{a}{}{h}{+}{c}{}{g}\right]\right]$ (73)
 Computing triangular decompositions in the sense of Kalkbrener is the default mode of Triangularize. Observe that the output does not provide explicitly the solutions of the system that cancel the determinant $ad-bc$. Now compute all the solutions (generic or not); that is, find a triangular decomposition in the sense of Lazard.
 > $\mathrm{dec}≔\mathrm{Triangularize}\left(\mathrm{sys},R,\mathrm{output}=\mathrm{lazard}\right)$
 ${\mathrm{dec}}{≔}\left[{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}\right]$ (74)
 > $\mathrm{map}\left(\mathrm{Equations},\mathrm{dec},R\right);$$\mathrm{map}\left(\mathrm{Inequations},\mathrm{dec},R\right)$
 $\left[\left[{c}{}{x}{+}{d}{}{y}{-}{h}{,}\left({d}{}{a}{-}{b}{}{c}\right){}{y}{-}{h}{}{a}{+}{c}{}{g}\right]{,}\left[{c}{}{x}{+}{d}{}{y}{-}{h}{,}{d}{}{a}{-}{b}{}{c}{,}{h}{}{b}{-}{d}{}{g}\right]{,}\left[{a}{}{x}{+}{b}{}{y}{-}{g}{,}{d}{}{y}{-}{h}{,}{c}\right]{,}\left[{d}{}{y}{-}{h}{,}{a}{,}{h}{}{b}{-}{d}{}{g}{,}{c}\right]{,}\left[{c}{}{x}{-}{h}{,}{h}{}{a}{-}{c}{}{g}{,}{b}{,}{d}\right]{,}\left[{a}{}{x}{+}{b}{}{y}{-}{g}{,}{c}{,}{d}{,}{h}\right]{,}\left[{c}{}{x}{+}{d}{}{y}{,}{d}{}{a}{-}{b}{}{c}{,}{g}{,}{h}\right]{,}\left[{b}{}{y}{-}{g}{,}{a}{,}{c}{,}{d}{,}{h}\right]{,}\left[{y}{,}{a}{,}{c}{,}{g}{,}{h}\right]{,}\left[{x}{,}{b}{,}{d}{,}{g}{,}{h}\right]{,}\left[{a}{,}{b}{,}{c}{,}{d}{,}{g}{,}{h}\right]\right]$
 $\left[\left\{{c}{,}{d}{}{a}{-}{b}{}{c}\right\}{,}\left\{{c}{,}{d}{,}{h}\right\}{,}\left\{{a}{,}{d}\right\}{,}\left\{{d}{,}{h}\right\}{,}\left\{{c}{,}{h}\right\}{,}\left\{{a}\right\}{,}\left\{{c}{,}{d}\right\}{,}\left\{{b}\right\}{,}{\varnothing }{,}{\varnothing }{,}{\varnothing }\right]$ (75)
 > $\left[\mathrm{seq}\left(\left[\mathrm{eq}=\mathrm{Equations}\left({\mathrm{dec}}_{i},R\right),\mathrm{ineq}=\mathrm{Inequations}\left({\mathrm{dec}}_{i},R\right)\right],i=1..\mathrm{nops}\left(\mathrm{dec}\right)\right)\right]$
 $\left[\left[{\mathrm{eq}}{=}\left[{c}{}{x}{+}{d}{}{y}{-}{h}{,}\left({d}{}{a}{-}{b}{}{c}\right){}{y}{-}{h}{}{a}{+}{c}{}{g}\right]{,}{\mathrm{ineq}}{=}\left\{{c}{,}{d}{}{a}{-}{b}{}{c}\right\}\right]{,}\left[{\mathrm{eq}}{=}\left[{c}{}{x}{+}{d}{}{y}{-}{h}{,}{d}{}{a}{-}{b}{}{c}{,}{h}{}{b}{-}{d}{}{g}\right]{,}{\mathrm{ineq}}{=}\left\{{c}{,}{d}{,}{h}\right\}\right]{,}\left[{\mathrm{eq}}{=}\left[{a}{}{x}{+}{b}{}{y}{-}{g}{,}{d}{}{y}{-}{h}{,}{c}\right]{,}{\mathrm{ineq}}{=}\left\{{a}{,}{d}\right\}\right]{,}\left[{\mathrm{eq}}{=}\left[{d}{}{y}{-}{h}{,}{a}{,}{h}{}{b}{-}{d}{}{g}{,}{c}\right]{,}{\mathrm{ineq}}{=}\left\{{d}{,}{h}\right\}\right]{,}\left[{\mathrm{eq}}{=}\left[{c}{}{x}{-}{h}{,}{h}{}{a}{-}{c}{}{g}{,}{b}{,}{d}\right]{,}{\mathrm{ineq}}{=}\left\{{c}{,}{h}\right\}\right]{,}\left[{\mathrm{eq}}{=}\left[{a}{}{x}{+}{b}{}{y}{-}{g}{,}{c}{,}{d}{,}{h}\right]{,}{\mathrm{ineq}}{=}\left\{{a}\right\}\right]{,}\left[{\mathrm{eq}}{=}\left[{c}{}{x}{+}{d}{}{y}{,}{d}{}{a}{-}{b}{}{c}{,}{g}{,}{h}\right]{,}{\mathrm{ineq}}{=}\left\{{c}{,}{d}\right\}\right]{,}\left[{\mathrm{eq}}{=}\left[{b}{}{y}{-}{g}{,}{a}{,}{c}{,}{d}{,}{h}\right]{,}{\mathrm{ineq}}{=}\left\{{b}\right\}\right]{,}\left[{\mathrm{eq}}{=}\left[{y}{,}{a}{,}{c}{,}{g}{,}{h}\right]{,}{\mathrm{ineq}}{=}{\varnothing }\right]{,}\left[{\mathrm{eq}}{=}\left[{x}{,}{b}{,}{d}{,}{g}{,}{h}\right]{,}{\mathrm{ineq}}{=}{\varnothing }\right]{,}\left[{\mathrm{eq}}{=}\left[{a}{,}{b}{,}{c}{,}{d}{,}{g}{,}{h}\right]{,}{\mathrm{ineq}}{=}{\varnothing }\right]\right]$ (76)
 By defining the PolynomialRing correctly, you find that Triangularize can solve polynomial systems with parameters.
 > $\mathrm{R2}≔\mathrm{PolynomialRing}\left(\left[x,y,a,b,c,d\right],\left\{g,h\right\}\right)$
 ${\mathrm{R2}}{≔}{\mathrm{polynomial_ring}}$ (77)
 > $\mathrm{dec}≔\mathrm{Triangularize}\left(\mathrm{sys},\mathrm{R2},\mathrm{output}=\mathrm{lazard}\right)$
 ${\mathrm{dec}}{≔}\left[{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}\right]$ (78)
 > $\left[\mathrm{seq}\left(\left[\mathrm{eq}=\mathrm{Equations}\left({\mathrm{dec}}_{i},\mathrm{R2}\right),\mathrm{ineq}=\mathrm{Inequations}\left({\mathrm{dec}}_{i},\mathrm{R2}\right)\right],i=1..\mathrm{nops}\left(\mathrm{dec}\right)\right)\right]$
 $\left[\left[{\mathrm{eq}}{=}\left[{c}{}{x}{+}{d}{}{y}{-}{h}{,}\left({d}{}{a}{-}{b}{}{c}\right){}{y}{-}{h}{}{a}{+}{c}{}{g}\right]{,}{\mathrm{ineq}}{=}\left\{{c}{,}{d}{}{a}{-}{b}{}{c}\right\}\right]{,}\left[{\mathrm{eq}}{=}\left[{c}{}{x}{+}{d}{}{y}{-}{h}{,}{d}{}{a}{-}{b}{}{c}{,}{h}{}{b}{-}{d}{}{g}\right]{,}{\mathrm{ineq}}{=}\left\{{c}{,}{d}\right\}\right]{,}\left[{\mathrm{eq}}{=}\left[{a}{}{x}{+}{y}{}{b}{-}{g}{,}{d}{}{y}{-}{h}{,}{c}\right]{,}{\mathrm{ineq}}{=}\left\{{a}{,}{d}\right\}\right]{,}\left[{\mathrm{eq}}{=}\left[{d}{}{y}{-}{h}{,}{a}{,}{h}{}{b}{-}{d}{}{g}{,}{c}\right]{,}{\mathrm{ineq}}{=}\left\{{d}\right\}\right]{,}\left[{\mathrm{eq}}{=}\left[{c}{}{x}{-}{h}{,}{h}{}{a}{-}{c}{}{g}{,}{b}{,}{d}\right]{,}{\mathrm{ineq}}{=}\left\{{c}\right\}\right]\right]$ (79)
 Similarly, Triangularize can solve polynomial systems in prime characteristic.
 > $\mathrm{R2}≔\mathrm{PolynomialRing}\left(\left[x,y,a,b,c,d\right],\left\{g,h\right\},3\right)$
 ${\mathrm{R2}}{≔}{\mathrm{polynomial_ring}}$ (80)
 > $\mathrm{dec}≔\mathrm{Triangularize}\left(\mathrm{sys},\mathrm{R2},\mathrm{output}=\mathrm{lazard}\right)$
 ${\mathrm{dec}}{≔}\left[{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}{,}{\mathrm{regular_chain}}\right]$ (81)
 > $\left[\mathrm{seq}\left(\left[\mathrm{eq}=\mathrm{Equations}\left({\mathrm{dec}}_{i},\mathrm{R2}\right),\mathrm{ineq}=\mathrm{Inequations}\left({\mathrm{dec}}_{i},\mathrm{R2}\right)\right],i=1..\mathrm{nops}\left(\mathrm{dec}\right)\right)\right]$
 $\left[\left[{\mathrm{eq}}{=}\left[{c}{}{x}{+}{d}{}{y}{+}{2}{}{h}{,}\left({d}{}{a}{+}{2}{}{b}{}{c}\right){}{y}{+}{2}{}{h}{}{a}{+}{c}{}{g}\right]{,}{\mathrm{ineq}}{=}\left\{{c}{,}{d}{}{a}{+}{2}{}{b}{}{c}\right\}\right]{,}\left[{\mathrm{eq}}{=}\left[{c}{}{x}{+}{d}{}{y}{+}{2}{}{h}{,}{d}{}{a}{+}{2}{}{b}{}{c}{,}{h}{}{b}{+}{2}{}{d}{}{g}\right]{,}{\mathrm{ineq}}{=}\left\{{c}{,}{d}\right\}\right]{,}\left[{\mathrm{eq}}{=}\left[{a}{}{x}{+}{y}{}{b}{+}{2}{}{g}{,}{d}{}{y}{+}{2}{}{h}{,}{c}\right]{,}{\mathrm{ineq}}{=}\left\{{a}{,}{d}\right\}\right]{,}\left[{\mathrm{eq}}{=}\left[{d}{}{y}{+}{2}{}{h}{,}{a}{,}{h}{}{b}{+}{2}{}{d}{}{g}{,}{c}\right]{,}{\mathrm{ineq}}{=}\left\{{d}\right\}\right]{,}\left[{\mathrm{eq}}{=}\left[{c}{}{x}{+}{2}{}{h}{,}{h}{}{a}{+}{2}{}{c}{}{g}{,}{b}{,}{d}\right]{,}{\mathrm{ineq}}{=}\left\{{c}\right\}\right]\right]$ (82) Controlling the size of the coefficients

 Solving systems of equations by means of regular chains can help reduce the size of the coefficients, even when no splitting arises.
 In the example below, compare the size of the output of Triangularize with the lexicographical Groebner basis for the same variable ordering. Do not print this Groebner basis since it is quite large; print its size (number of characters) only.
 > $R≔\mathrm{PolynomialRing}\left(\left[x,y,z\right]\right)$
 ${R}{≔}{\mathrm{polynomial_ring}}$ (83)
 > $\mathrm{sys}≔\left\{-{x}^{5}+{y}^{5}-3y-1,5{y}^{4}-3,-20x+y-z\right\}$
 ${\mathrm{sys}}{≔}\left\{{-}{20}{}{x}{+}{y}{-}{z}{,}{5}{}{{y}}^{{4}}{-}{3}{,}{-}{{x}}^{{5}}{+}{{y}}^{{5}}{-}{3}{}{y}{-}{1}\right\}$ (84)
 > $\mathrm{dec}≔\mathrm{Triangularize}\left(\mathrm{sys},R\right);$$\mathrm{map}\left(\mathrm{Equations},\mathrm{dec},R\right);$$\mathrm{nops}\left(\mathrm{dec}\right)$
 ${\mathrm{dec}}{≔}\left[{\mathrm{regular_chain}}\right]$
 $\left[\left[{20}{}{x}{-}{y}{+}{z}{,}\left({4375}{}{{z}}^{{12}}{+}{52800011625}{}{{z}}^{{8}}{+}{32000000000}{}{{z}}^{{7}}{+}{110591902080002925}{}{{z}}^{{4}}{+}{61439980800000000}{}{{z}}^{{3}}{+}{12800000000000000}{}{{z}}^{{2}}{+}{56623117271041036800027}\right){}{y}{-}{1875}{}{{z}}^{{13}}{-}{9600010125}{}{{z}}^{{9}}{+}{2000000000}{}{{z}}^{{8}}{-}{7372714752004545}{}{{z}}^{{5}}{+}{30720002400000000}{}{{z}}^{{4}}{+}{12800000000000000}{}{{z}}^{{3}}{-}{22118403456000135}{}{z}{+}{23592963686400144000000}{,}{3125}{}{{z}}^{{20}}{-}{9375}{}{{z}}^{{16}}{-}{40000000000}{}{{z}}^{{15}}{-}{2015999988750}{}{{z}}^{{12}}{-}{1560000000000}{}{{z}}^{{11}}{+}{192000000000000000}{}{{z}}^{{10}}{-}{12165125356800006750}{}{{z}}^{{8}}{-}{14745602232000000000}{}{{z}}^{{7}}{-}{6528000000000000000}{}{{z}}^{{6}}{-}{409600000000000000000000}{}{{z}}^{{5}}{-}{16986908639233347839997975}{}{{z}}^{{4}}{-}{14155767152640302400000000}{}{{z}}^{{3}}{-}{5898238732800000000000000}{}{{z}}^{{2}}{-}{1228800000000000000000000}{}{z}{-}{6195303619231982878732441600243}\right]\right]$
 ${1}$ (85)
 > $\mathrm{length}\left(\mathrm{convert}\left(\mathrm{map}\left(\mathrm{Equations},\mathrm{dec},R\right),\mathrm{string}\right)\right)$
 ${654}$ (86)
 > $\mathrm{with}\left(\mathrm{Groebner}\right):$
 > $\mathrm{gb}≔\mathrm{Basis}\left(\mathrm{sys},\mathrm{plex}\left(x,y,z\right)\right):$$\mathrm{length}\left(\mathrm{convert}\left(\mathrm{gb},\mathrm{string}\right)\right)$
 ${8674}$ (87)
 The commands below illustrate the fact that the RegularChains library provides tools to reduce the size of the coefficients of an output. To see this, use the previous system again, starting from a large output. Indeed, it turns out that for the above system, the lexicographical Groebner basis can be obtained also by using Triangularize with the option normalize=yes. This is because every strongly normalized regular chain T is a lexicographical Groebner basis over the field of the rational functions in the variables that are not algebraic in T. In this example, each variable IsAlgebraic in the output regular chain.
 > $\mathrm{dec}≔\mathrm{Triangularize}\left(\mathrm{sys},R,\mathrm{normalized}=\mathrm{yes}\right)$
 ${\mathrm{dec}}{≔}\left[{\mathrm{regular_chain}}\right]$ (88)
 > $\mathrm{length}\left(\mathrm{convert}\left(\mathrm{map}\left(\mathrm{Equations},\mathrm{dec},R\right),\mathrm{string}\right)\right)$
 ${8674}$ (89)
 Then, the command DahanSchostTransform can be applied to reduce this large regular chain (which is also a lexicographical Groebner basis) into a smaller one.
 > $\mathrm{dst}≔\mathrm{DahanSchostTransform}\left({\mathrm{dec}}_{1},R\right)$
 ${\mathrm{dst}}{≔}{\mathrm{regular_chain}}$ (90)
 > $\mathrm{length}\left(\mathrm{convert}\left(\mathrm{Equations}\left(\mathrm{dst},R\right),\mathrm{string}\right)\right)$
 ${1533}$ (91)
 Check that the two regular chains define the same (saturated) ideal by means of the command EqualSaturatedIdeals.
 > $\mathrm{EqualSaturatedIdeals}\left({\mathrm{dec}}_{1},\mathrm{dst},R\right)$
 ${\mathrm{true}}$ (92) Splitting for solving

 In this library, almost every operation takes a regular chain as a parameter. A regular chain encodes a tower of simple extensions of the underlying field. This tower is a direct product of fields and may contain zero-divisors, so splitting may be needed.
 > $R≔\mathrm{PolynomialRing}\left(\left[x,y,z\right]\right)$
 ${R}{≔}{\mathrm{polynomial_ring}}$ (93)
 > $\mathrm{rc}≔\mathrm{Empty}\left(R\right)$
 ${\mathrm{rc}}{≔}{\mathrm{regular_chain}}$ (94)
 > $\mathrm{rc}≔\mathrm{Chain}\left(\left[z\left(z-1\right)\right],\mathrm{rc},R\right)$
 ${\mathrm{rc}}{≔}{\mathrm{regular_chain}}$ (95)
 > $\mathrm{p1}≔zx\left(x+1\right)-\left(z-1\right)x\left(x+2\right)$
 ${\mathrm{p1}}{≔}{z}{}{x}{}\left({x}{+}{1}\right){-}\left({z}{-}{1}\right){}{x}{}\left({x}{+}{2}\right)$ (96)
 > $\mathrm{p2}≔z\left(x-1\right)\left(x+1\right)-\left(z-1\right)\left(x+3\right)\left(x+2\right)$
 ${\mathrm{p2}}{≔}{z}{}\left({x}{-}{1}\right){}\left({x}{+}{1}\right){-}\left({z}{-}{1}\right){}\left({x}{+}{3}\right){}\left({x}{+}{2}\right)$ (97)
 > $\mathrm{expand}\left(\mathrm{p1}\right)$
 ${{x}}^{{2}}{-}{x}{}{z}{+}{2}{}{x}$ (98)
 > $\mathrm{expand}\left(\mathrm{p2}\right)$
 ${{x}}^{{2}}{-}{5}{}{x}{}{z}{+}{5}{}{x}{-}{7}{}{z}{+}{6}$ (99)
 > $\mathrm{RegularGcd}\left(\mathrm{p1},\mathrm{p2},x,\mathrm{rc},R\right)$
 $\left[\left[\left({-}{4}{}{z}{+}{3}\right){}{x}{-}{7}{}{z}{+}{6}{,}{\mathrm{regular_chain}}\right]\right]$ (100)
 As a consequence, every operation (taking a regular chain as a parameter) needs to manage tasks, where a task is [something-to-compute, a-regular-chain]. Manipulating Constructible Sets

 This example demonstrates how to manipulate constructible sets, which usually encode the solution set of a polynomial system with both equations and inequations.
 > $\mathrm{with}\left(\mathrm{ConstructibleSetTools}\right):$
 > $R≔\mathrm{PolynomialRing}\left(\left[x,y,s\right]\right)$
 ${R}{≔}{\mathrm{polynomial_ring}}$ (101)
 Define a polynomial system with equations F and inequations H.
 > $F≔\left[s-\left(y+1\right)x,s-\left(x+1\right)y\right];$$H≔\left[s-1\right]$
 ${F}{≔}\left[{s}{-}\left({y}{+}{1}\right){}{x}{,}{s}{-}\left({x}{+}{1}\right){}{y}\right]$
 ${H}{≔}\left[{s}{-}{1}\right]$ (102)
 Use the GeneralConstruct command to create a constructible set cs to encode its solutions.
 > $\mathrm{cs}≔\mathrm{GeneralConstruct}\left(F,H,R\right)$
 ${\mathrm{cs}}{≔}{\mathrm{constructible_set}}$ (103)
 In the RegularChains library, cs is represented by a list of regular systems.
 > $\mathrm{lrs}≔\mathrm{RepresentingRegularSystems}\left(\mathrm{cs},R\right)$
 ${\mathrm{lrs}}{≔}\left[{\mathrm{regular_system}}{,}{\mathrm{regular_system}}\right]$ (104)
 Each regular system is a pair consisting of a regular chain and an inequation given by one or more polynomials.
 > $\mathrm{rs}≔{\mathrm{lrs}}_{1}$
 ${\mathrm{rs}}{≔}{\mathrm{regular_system}}$ (105)
 > $\mathrm{rc}≔\mathrm{RepresentingChain}\left(\mathrm{rs},R\right)$
 ${\mathrm{rc}}{≔}{\mathrm{regular_chain}}$ (106)
 > $h≔\mathrm{RepresentingInequations}\left(\mathrm{rs},R\right)$
 ${h}{≔}\left[{s}{-}{1}\right]$ (107)
 The library provides the basic set-theoretic operations on constructible sets, including complementation, union, intersection, difference, inclusion test, and more.
 > $\mathrm{F2}≔\left[s-\left({y}^{2}+1\right)x,s-\left({x}^{2}+1\right)y\right];$$H≔\left[s-1\right]$
 ${\mathrm{F2}}{≔}\left[{s}{-}\left({{y}}^{{2}}{+}{1}\right){}{x}{,}{s}{-}\left({{x}}^{{2}}{+}{1}\right){}{y}\right]$
 ${H}{≔}\left[{s}{-}{1}\right]$ (108)
 > $\mathrm{cs2}≔\mathrm{GeneralConstruct}\left(\mathrm{F2},H,R\right)$
 ${\mathrm{cs2}}{≔}{\mathrm{constructible_set}}$ (109)
 > $\mathrm{Complement}\left(\mathrm{cs},R\right)$
 ${\mathrm{constructible_set}}$ (110)
 > $\mathrm{Union}\left(\mathrm{cs},\mathrm{cs2},R\right)$
 ${\mathrm{constructible_set}}$ (111)
 > $\mathrm{Intersection}\left(\mathrm{cs},\mathrm{cs2},R\right)$
 ${\mathrm{constructible_set}}$ (112)
 > $\mathrm{Difference}\left(\mathrm{cs},\mathrm{cs2},R\right)$
 ${\mathrm{constructible_set}}$ (113)
 > $\mathrm{IsContained}\left(\mathrm{cs},\mathrm{cs2},R\right)$
 ${\mathrm{false}}$ (114)
 Besides these, some advanced operations are also provided. See ConstructibleSetTools for details. Solving Parametric Polynomial Systems

 This tour d'horizon concludes with an illustration of how to solve parametric polynomial systems with comprehensive triangular decomposition.
 Let $U$ be the last d variables of R, which are regarded as parameters. The output of ComprehensiveTriangularize(sys, d, R) consists of two parts. The first part is a pre-comprehensive triangular decomposition $S$ of sys with respect to the last d variables of R.  The second part is a list $L$ of pairs; the first item of each pair is a constructible set and the second item is a list of indices (positive integers) such that the union of these constructible sets forms a partition of the projection of $V\left(\mathrm{sys}\right)$ onto the parameter space. Moreover, for each part (or cell) $C$, the list of positive integers associated with it gives the positions of the regular chains in $S$ satisfying the following property: for each parameter value $u$ in $C$, the associated regular chains specialized at $u$ form a triangular decomposition of the input system sys specialized at $u$.
 > $R≔\mathrm{PolynomialRing}\left(\left[x,y,s\right]\right)$
 ${R}{≔}{\mathrm{polynomial_ring}}$ (115)
 > $F≔\left[s-\left(y+1\right)x,s-\left(x+1\right)y\right]$
 ${F}{≔}\left[{s}{-}\left({y}{+}{1}\right){}{x}{,}{s}{-}\left({x}{+}{1}\right){}{y}\right]$ (116)
 A comprehensive triangular decomposition of F with respect to parameter $s$ is as follows.
 >