# Singular

#### D.2.4.22 ConsLevels

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

Usage:
ConsLevels(list L);
L=[[P1,Q1],...,[Ps,Qs]] is a list of lists of of pairs of ideals represening the constructible set
S=V(P1) \ V(Q1) u ... u V(Ps) \ V(Qs).
To be called in a ring Q[a][x] or a ring Q[a]. But the ideals can contain only the parameters in Q[a].

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
canonical levels of S are represented by theirs
Crep. So we have:
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 ConsLevels 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,z),lp; short=0; ideal P1=(x^2+y^2+z^2-1); ideal Q1=z,x^2+y^2-1; ideal P2=y,x^2+z^2-1; ideal Q2=z*(z+1),y,x*(x+1); ideal P3=x; ideal Q3=5*z-4,5*y-3,x; list Cr1=Crep(P1,Q1); list Cr2=Crep(P2,Q2); list Cr3=Crep(P3,Q3); list L=list(Cr1,Cr2,Cr3); L; ==> [1]: ==> [1]: ==> _[1]=x^2+y^2+z^2-1 ==> [2]: ==> _[1]=z ==> _[2]=x^2+y^2-1 ==> [2]: ==> [1]: ==> _[1]=y ==> _[2]=x^2+z^2-1 ==> [2]: ==> _[1]=z^2+z ==> _[2]=y ==> _[3]=x+z+1 ==> [3]: ==> [1]: ==> _[1]=x ==> [2]: ==> _[1]=5*z-4 ==> _[2]=5*y-3 ==> _[3]=x def LL=ConsLevels(L); LL; ==> [1]: ==> _[1]=x^3+x*y^2+x*z^2-x ==> [2]: ==> _[1]=z ==> _[2]=x^2+y^2-1 ==> [3]: ==> _[1]=z ==> _[2]=x+y^2-1 ==> _[3]=x*y ==> _[4]=x^2-x ==> [4]: ==> _[1]=1 def LLL=Levels(LL); LLL; ==> [1]: ==> [1]: ==> 1 ==> [2]: ==> [1]: ==> _[1]=x^3+x*y^2+x*z^2-x ==> [2]: ==> _[1]=z ==> _[2]=x^2+y^2-1 ==> [2]: ==> [1]: ==> 3 ==> [2]: ==> [1]: ==> _[1]=z ==> _[2]=x+y^2-1 ==> _[3]=x*y ==> _[4]=x^2-x ==> [2]: ==> _[1]=1 ```