# Singular

#### D.2.4.24 Grob1Levels

Procedure from library `grobcov.lib` (see grobcov_lib).

Usage:
Grob1Levels(list G);
G is the output of grobcov(F,"rep",1)
for obtaining the segments in C-rep.
Then Grob!Levels, selects the set of segments S of G having solutions (i.e. with basis different from 1), and determines the canonical levels of this constructible set.
To be called in a ring Q[a][x].

Return:
The list of ideals
[a1,a2,...,at]
representing the closures of the canonical levels of S and its complement C wrt to the closure of S.

The levels of S and C are
Levels of S: [a1,a2],[a3,a4],...
Levels of C: [a2,a3],[a4,a5],...
S=V(a1) \ V(a2) u V(a3) \ V(a4) u ...
C=V(a2 \ V(a3) u V(a4) \ V(a5) u ...
The expression of S can be obtained from the
output of Grob1Levels by
the call to Levels.

Note:
The algorithm was described in
J.M. Brunat, A. Montes. "Computing the canonical
representation of constructible sets."
Math. Comput. Sci. (2016) 19: 165-178.

Example:
 ```LIB "grobcov.lib"; if (defined(R)) {kill R;} ring R=(0,x,y),(x1,y1,x2,y2),lp; ideal F=-y*x1+(x-1)*y1+y, (x-1)*(x1+1)+y*y1, -y*x2+(x+1)*y2-y, (x+1)*(x2-1)+y*y2, (x1-x)^2+y1^2-(x1-x)^2-y2^2; def G=grobcov(F,"rep",1); G; ==> [1]: ==> [1]: ==> _[1]=1 ==> [2]: ==> _[1]=1 ==> [3]: ==> [1]: ==> _[1]=0 ==> [2]: ==> _[1]=(x^5*y-2*x^3*y-x*y^5+x*y) ==> [2]: ==> [1]: ==> _[1]=y2 ==> _[2]=x2 ==> _[3]=y1 ==> _[4]=x1 ==> [2]: ==> _[1]=(x^5+2*x^4*y^6+4*x^4*y^4+2*x^4*y^2+4*x^3*y^6+8*x^3*y^4+4*x^3*y\ ^2-2*x^3-4*x^2*y^6-8*x^2*y^4-4*x^2*y^2-4*x*y^6-9*x*y^4-4*x*y^2+x-2*y^10-4\ *y^8+4*y^4+2*y^2)*y2+(-6*x^4*y^5-6*x^4*y^3-2*x^3*y^7-4*x^3*y^5-2*x^3*y^3-\ 2*x^2*y^7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y^3+y) ==> [3]: ==> [1]: ==> _[1]=y2^2 ==> _[2]=y1 ==> _[3]=x1 ==> [2]: ==> _[1]=y2^2 ==> _[2]=y1 ==> _[3]=x1+1 ==> [3]: ==> [1]: ==> _[1]=(y) ==> _[2]=(x+1) ==> [2]: ==> _[1]=1 ==> [4]: ==> [1]: ==> _[1]=y2 ==> _[2]=x2 ==> _[3]=y1^2 ==> [2]: ==> _[1]=y2 ==> _[2]=x2-1 ==> _[3]=y1^2 ==> [3]: ==> [1]: ==> _[1]=(y) ==> _[2]=(x-1) ==> [2]: ==> _[1]=1 ==> [5]: ==> [1]: ==> _[1]=1 ==> [2]: ==> _[1]=1 ==> [3]: ==> [1]: ==> _[1]=(x) ==> _[2]=(y^2+1) ==> [2]: ==> _[1]=1 def L=Grob1Levels(G); L; ==> [1]: ==> _[1]=(x^5*y-2*x^3*y-x*y^5+x*y) ==> [2]: ==> _[1]=(x) ==> _[2]=(y^2+1) ==> [3]: ==> _[1]=1 def LL=Levels(L); LL; ==> [1]: ==> [1]: ==> 1 ==> [2]: ==> [1]: ==> _[1]=(x^5*y-2*x^3*y-x*y^5+x*y) ==> [2]: ==> _[1]=(x) ==> _[2]=(y^2+1) ```