  
  [1m[4m[31mD. Semilinear expressions[0m
  
  
  [1m[4m[31mD.1 Semilinear Sets[0m
  
  A  [22m[36msemilinear[0m  set,  is  a finite union of [22m[36mlinear[0m sets, i.e., of sets of the
  form  a+b_1Bbb  N+  cdots  +b_pBbb  N,  with  a, b_1, ..., b_pin Bbb N^n. We
  consider  also  sets  of  the form a+b_1Bbb Z+ cdots +b_pBbb Z, with a, b_1,
  ...,  b_pin  Bbb Z^n, i.e., cosets of subgroups of Bbb Z^n. We call them [22m[36mBbb
  Z-linear[0m.   Finite   unions  of  Bbb  Z-linear  sets  are  then  called  [22m[36mBbb
  Z-semilinear[0m.  An  expression of the form a+b_1N+ cdots +b_pN , with a, b_1,
  ...,  b_pin  Bbb  N^n,  is said to be a [22m[36mlinear expression[0m. Let us call n its
  [22m[36marity[0m,  a  its  [22m[36mbase  point[0m  and  b_1,  ...,  b_p  its  [22m[36mvectors[0m.  (Analogous
  definitions  may  be  given  for Bbb Z-linear sets.) Linear and Bbb Z-linear
  sets may be given using the functions that follow.
  
  [1m[4m[31mD.1-1 NLinear[0m
  
  [1m[34m> NLinear( [0m[22m[34marity, base\_point, vectors[0m[1m[34m ) ___________________________[0mfunction
  
  Returns a linear set. The meaning of the arguments should already be clear.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> LN := NLinear(2,[0,1],[[1,2],[5,2]]);[0m
    [22m[35m[ 0, 1 ] + [ 1, 2 ] N  + [ 5, 2 ] N [0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31mD.1-2 ZLinear[0m
  
  [1m[34m> ZLinear( [0m[22m[34marity, base\_point, vectors[0m[1m[34m ) ___________________________[0mfunction
  
  Returns  a  Bbb Z-linear set. The meaning of the arguments should already be
  clear.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> LZ := ZLinear(2,[0,1],[[1,2],[5,2]]);[0m
    [22m[35m[ 0, 1 ] + [ 1, 2 ] Z  + [ 0, 8 ] Z [0m
  [22m[35m------------------------------------------------------------------[0m
  
  In  the  case  of  a Bbb Z-linear set the expression returned represents the
  same  linear  set  than  the expression given, but the vectors have changed:
  they  are  the  nonzero rows of a matrix in Hermite Normal Form. Notice that
  a+b_1Bbb  Z+ cdots +b_pBbb Z, with a, b_1, ..., b_pin Bbb Z^n, is a coset of
  the subgroup of Bbb Z^n generated by the vectors b_1, ..., b_pin Bbb Z^n. In
  general,  when we give an expression for such a coset to \GAP\ an expression
  involving  a  basis  for the subgroup consisting of the nonzero vectors of a
  matrix in HNF is returned.
  
  
  [1m[4m[31mD.2 Operations with semilinear sets[0m
  
  We  may compute expressions for the [22m[32mproduct[0m, [22m[32munion[0m and [22m[32mstar[0m (i.e., submonoid
  generated  by)  of  semilinear  and  Bbb  Z-semilinear  sets. In some cases,
  specially for Bbb Z-semilinear expressions, simpler expressions representing
  the  same  set  are  returned.  Of  course,  these operations may be used to
  construct more complex expressions.
  
  For  linear  or  semilinear expressions we have the following functions that
  return  respectively  semilinear  expressions  for  the [22m[32munion[0m and [22m[32msum[0m of the
  languages  given  by  the semilinear expressions [22m[32mr[0m and [22m[32ms[0m and the [22m[32mstar[0m of the
  language given by the semilinear expression [22m[32mr[0m.
  
  [1m[4m[31mD.2-1 UnionNSemilinear[0m
  
  [1m[34m> UnionNSemilinear( [0m[22m[34mr, s[0m[1m[34m ) _________________________________________[0mfunction
  [1m[4m[31mD.2-2 SumNSemilinear[0m
  
  [1m[34m> SumNSemilinear( [0m[22m[34mr, s[0m[1m[34m ) ___________________________________________[0mfunction
  [1m[4m[31mD.2-3 StarNSemilinear[0m
  
  [1m[34m> StarNSemilinear( [0m[22m[34mr[0m[1m[34m ) _____________________________________________[0mfunction
  
  Some examples involving linear expressions:
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> s1 := NLinear(2,[0,3],[[1,2],[5,2]]);          [0m
    [22m[35m[ 0, 3 ] + [ 1, 2 ] N  + [ 5, 2 ] N [0m
    [22m[35mgap> s2 := NLinear(2,[1,1],[[3,2],[0,3]]);          [0m
    [22m[35m[ 1, 1 ] + [ 3, 2 ] N  + [ 0, 3 ] N [0m
    [22m[35mgap> UnionNSemilinear(s1,s2);                       [0m
    [22m[35m[ [ 0, 3 ] + [ 1, 2 ] N  + [ 5, 2 ] N , [ 1, 1 ] + [ 3, 2 ] N  + [ 0, 3 ] N  ][0m
    [22m[35mgap> StarNSemilinear(s1);                           [0m
    [22m[35m[ [ 0, 0 ], [ 0, 3 ] + [ 0, 3 ] N  + [ 1, 2 ] N  + [ 5, 2 ] N  ][0m
    [22m[35mgap> SumNSemilinear(s1,s2);                         [0m
    [22m[35m[ [ 1, 4 ] + [ 0, 3 ] N  + [ 1, 2 ] N  + [ 3, 2 ] N  + [ 5, 2 ] N  ][0m
  [22m[35m------------------------------------------------------------------[0m
  
  The  analogous  functions  for Bbb Z-linear and Bbb Z-semilinear expressions
  follow:
  
  [1m[4m[31mD.2-4 UnionZSemilinear[0m
  
  [1m[34m> UnionZSemilinear( [0m[22m[34mr, s[0m[1m[34m ) _________________________________________[0mfunction
  [1m[4m[31mD.2-5 SumZSemilinear[0m
  
  [1m[34m> SumZSemilinear( [0m[22m[34mr, s[0m[1m[34m ) ___________________________________________[0mfunction
  [1m[4m[31mD.2-6 StarZSemilinear[0m
  
  [1m[34m> StarZSemilinear( [0m[22m[34mr[0m[1m[34m ) _____________________________________________[0mfunction
  
  Now, some examples involving Bbb Z-linear expressions
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> z1 := ZLinear(2,[0,3],[[1,2],[5,2]]);[0m
    [22m[35m[ 0, 3 ] + [ 1, 2 ] Z  + [ 0, 8 ] Z [0m
    [22m[35mgap> z2 := ZLinear(2,[1,1],[[3,2],[0,3]]);[0m
    [22m[35m[ 1, 1 ] + [ 3, 2 ] Z  + [ 0, 3 ] Z [0m
    [22m[35mgap> UnionZSemilinear(z1,z2);[0m
    [22m[35m[ [ 0, 3 ] + [ 1, 2 ] Z  + [ 0, 8 ] Z , [ 1, 1 ] + [ 3, 2 ] Z  + [ 0, 3 ] Z  ][0m
    [22m[35mgap> SumZSemilinear(z1,z2);[0m
    [22m[35m[ [ 0, 0 ] + [ 1, 0 ] Z  + [ 0, 1 ] Z  ][0m
    [22m[35mgap> StarZSemilinear(z2);[0m
    [22m[35m[ [ 0, 0 ] + [ 1, 0 ] Z  + [ 0, 1 ] Z  ][0m
  [22m[35m------------------------------------------------------------------[0m
  
  Let  S  be  a  subgroup  of Bbb Z^n. An element xin Bbb Z^n belongs to a Bbb
  Z-semilinear  set  z+S if and only if the subgroup generated by x-z and S is
  equal to S. This test may be done computing basis for the subgroups < x-z,S>
  and S consisting of the nonzero vectors of a matrix in HNF and testing their
  equality.  Recall that an integer matrix B is row equivalent over Bbb Z to a
  unique matrix A in Hermite normal form. (See, for example, [S94] .)
  
  [1m[4m[31mD.2-7 BelongsZLinear[0m
  
  [1m[34m> BelongsZLinear( [0m[22m[34mx, L[0m[1m[34m ) ___________________________________________[0mfunction
  
  Tests if [22m[34mx[0m belongs to the Bbb Z-linear set [22m[34mL[0m
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> BelongsZLinear([5,27],z2);[0m
    [22m[35mfalse[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31mD.2-8 BelongsZSemilinear[0m
  
  [1m[34m> BelongsZSemilinear( [0m[22m[34mx, L[0m[1m[34m ) _______________________________________[0mfunction
  
  Tests if [22m[34mx[0m belongs to the Bbb Z-semilinear set [22m[34mL[0m
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap>  BelongsZSemilinear([5,29],UnionZSemilinear(z1,z2));[0m
    [22m[35mtrue[0m
  [22m[35m------------------------------------------------------------------[0m
  
