  
  [1X6 Bistellar flips[0X
  
  
  [1X6.1 Theory[0X
  
  Since  two  combinatorial  manifolds are already considered distinct to each
  other  as  soon  as  they  are not combinatorially isomorphic, a topological
  PL-manifold  is  represented  by  a  whole class of combinatorial manifolds.
  Thus,  a  frequent  question  when  working  with combinatorial manifolds is
  whether  two  such  objects  are  PL-homeomorphic or not. One possibility to
  approach this problem, i. e. to find combinatorially distinct members of the
  class  of  a  PL-manifold,  is  a  heuristic  algorithm using the concept of
  bistellar moves.
  [12XDefinition[0m (Bistellar moves [Pac87])
  Let  M be a combinatorial d-manifold (d-pseudomanifold), gamma = < v_0 , ...
  ,  v_k  >  a  k-face  and  delta  = < w_0 , ... , w_d-k > a (d-k+1)-tuple of
  vertices of M that does not span a (d-k)-face in M, 0 <= k <= d, such that {
  v_0 , ..., v_k } cap { w_0 , ... , w_d-k } = emptyset and { v_0 , ... , v_k,
  w_0 , ... w_k-d } spans exactly d-k+1 facets. Then the operation
  kappa_(gamma,delta)  (  M ) = M \ (gamma star partial delta) cup (delta star
  partial gamma)
  is called a [13Xbistellar (d-k)-move[0m.
  In  other  words:  If there exists a bouquet D subset M of d-k+1 facets on a
  subset  of  vertices  W subset V of order d+2 with a common k-face gamma and
  the  complement  delta  of  the  vertices  of  gamma  in  W  does not span a
  (d-k)-face  in M we can remove D and replace it by a bouquet of k+1 facets E
  subset  M  with  vertex  set  W  with  a  common  face  spanned by delta. By
  construction  partial  D  =  partial  E  and  the altered complex is again a
  combinatorial  d-manifold  (d-pseudomanifold).  See  Fig. 11 for a bistellar
  1-move  of  a  2-dimensional complex, see Fig. 12 for all bistellar moves in
  dimension 3.
  
  A  bistellar  0-move  is  a  [13Xstellar subdivision[0m, i. e. the subdivision of a
  facet delta into d+1 new facets by introducing a new vertex at the center of
  delta  (cf.  Fig.  12  on  the  left).  In  particular,  the vertex set of a
  combinatorial  manifold  (pseudomanifold)  is  not invariant under bistellar
  moves.  For  any bistellar (d-k)-move kappa_(gamma,delta) we have an inverse
  bistellar  k-move  kappa^-1_(gamma,delta)  =  kappa_(delta,gamma)  such that
  kappa_(delta,gamma) ( kappa_(gamma,delta) (M)) = M. If for two combinatorial
  manifolds  M and N there exist a sequence of bistellar moves that transforms
  one  into  the  other,  M  and  N  are called [13Xbistellarly equivalent[0m. So far
  bistellar  moves are local operations on combinatorial manifolds that change
  its   combinatorial   type.   However,   the  strength  of  the  concept  in
  combinatorial topology is a consequence of the following
  [12XTheorem[0m (Bistellar moves [Pac87])
  Two combinatorial manifolds (pseudomanifolds) M and N are PL homeomorphic if
  and only if they are bistellarly equivalent.
  Unfortunately  Pachners  theorem  does  not  guarantee that the search for a
  connecting  sequence  of  bistellar moves between M and N terminates. Hence,
  using   bistellar   moves,   we   can  not  prove  that  M  and  N  are  not
  PL-homeomorphic.  However,  there  is  a  very effective simulated annealing
  approach  that  is  able  to  give  a positive answer in a lot of cases. The
  heuristic  was  first  implemented  by  Bjoerner  and  Lutz  in  [BL00]. The
  functions presented in this chapter are based on this code which can be used
  for several tasks:
  
  In many cases the heuristic reduces a given triangulation but does not reach
  a minimal triangulation after a reasonable amount of flips. Thus, we usually
  can  not  expect  the  algorithm  to  terminate.  However, in some cases the
  program normally stops after a small number of flips:
  
  Technical  note:  Since  bistellar  flips  do  not respect the combinatorial
  properties  of  a  complex,  no  attention  to the original vertex labels is
  payed,  i.  e.  the  flipped  complex  will be relabeled whenever its vertex
  labels  become different from the standard labeling (for example after every
  reverse 0-move).
  
  
  [1X6.2 Functions for bistellar flips[0X
  
  [1X6.2-1 SCBistellarOptions[0m
  
  [2X> SCBistellarOptions( [0X[3X[0X[2X ) ___________________________________________[0Xproperty
  
  Record  of  global variables to adjust output an behavior of bistellar moves
  in    [2XSCIntFunc.SCChooseMove[0m    ([14X6.2-4[0m)   and   [2XSCReduceComplexEx[0m   ([14X6.2-14[0m)
  respectively.
  
  (1)   [10XBaseRelaxation[0m:  determines  the  length  of  the  relaxation  period.
        Default: 3
  
  (2)   [10XBaseHeating[0m: determines the length of the heating period. Default: 4
  
  (3)   [10XRelaxation[0m: value of the current relaxation period. Default: 0
  
  (4)   [10XHeating[0m: value of the current heating period. Default: 0
  
  (5)   [10XMaxRounds[0m:  maximal  over  all  number of bistellar flips that will be
        performed. Default: 500000
  
  (6)   [10XMaxInterval[0m:  maximal number of bistellar flips that will be performed
        without a change of the f-vector of the moved complex. Default: 100000
  
  (7)   [10XMode[0m:  flip  mode,  0=reducing,  1=comparing, 2=reduce as sub-complex,
        3=randomize. Default: 0
  
  (8)   [10XWriteLevel[0m:  0=no output, 1=storing of every vertex minimal complex to
        user library, 2=e-mail notification. Default: 1
  
  (9)   [10XMailNotifyIntervall[0m:  (minimum)  number  of seconds between two e-mail
        notifications. Default: 24 * 60 * 60 (one day)
  
  (10)  [10XMaxIntervalIsManifold[0m:  maximal number of bistellar flips that will be
        performed  without  a  change  of  the f-vector of a vertex link while
        trying to prove that the complex is a combinatorial manifold. Default:
        5000
  
  (11)  [10XMaxIntervalRandomize  :=  50[0m:  number  of  flips performed to create a
        randomized sphere. Default: 50
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> SCBistellarOptions.BaseRelaxation;[0X
    [4X 3[0X
    [4X gap> SCBistellarOptions.BaseHeating;[0X
    [4X 4[0X
    [4X gap> SCBistellarOptions.Relaxation;[0X
    [4X 0[0X
    [4X gap> SCBistellarOptions.Heating;[0X
    [4X 0[0X
    [4X gap> SCBistellarOptions.MaxRounds;[0X
    [4X 500000[0X
    [4X gap> SCBistellarOptions.MaxInterval;[0X
    [4X 100000[0X
    [4X gap> SCBistellarOptions.Mode;[0X
    [4X 0[0X
    [4X gap> SCBistellarOptions.WriteLevel;[0X
    [4X 1[0X
    [4X gap> SCBistellarOptions.MailNotifyInterval;[0X
    [4X 86400[0X
    [4X gap> SCBistellarOptions.MaxIntervalIsManifold;[0X
    [4X 5000[0X
    [4X gap> SCBistellarOptions.MaxIntervalRandomize;[0X
    [4X 50[0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X6.2-2 SCEquivalent[0m
  
  [2X> SCEquivalent( [0X[3Xcomplex1, complex2[0X[2X ) _______________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0m  or  [9Xfalse[0m  upon  success,  [9Xfail[0m  or  a  list of type [10X[ fail,
            SCSimplicialComplex, Integer, facet list][0m otherwise.
  
  Checks  if  the  simplicial  complex [3Xcomplex1[0m (which has to fulfill the weak
  pseudomanifold   property  with  empty  boundary)  can  be  reduced  to  the
  simplicial  complex  [3Xcomplex2[0m  via  bistellar  moves,  i. e. if [3Xcomplex1[0m and
  [3Xcomplex2[0m   are   PL-homeomorphic.  Note  that  in  general  the  problem  is
  undecidable. In this case [9Xfail[0m is returned.
  
  It  is  recommended to use a minimal triangulation [3Xcomplex2[0m for the check if
  possible.
  
  Internally                      calls                      [2XSCReduceComplexEx[0m
  ([14X6.2-14[0m)[10X(complex1,complex2,1,SCIntFunc.SCChooseMove);[0m
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X # hexagon[0X
    [4X gap> obj:=SC([[1,2],[2,3],[3,4],[4,5],[5,6],[6,1]]);;[0X
    [4X # triangle as a (minimal) reference object[0X
    [4X gap> refObj:=SCBdSimplex(2);;[0X
    [4X gap> SCEquivalent(obj,refObj);[0X
    [4X #I  round 0: [ 5, 5 ][0X
    [4X #I  round 1: [ 4, 4 ][0X
    [4X #I  round 2: [ 3, 3 ][0X
    [4X #I  SCReduceComplexEx: complexes are bistellarly equivalent.[0X
    [4X true[0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X6.2-3 SCExamineComplexBistellar[0m
  
  [2X> SCExamineComplexBistellar( [0X[3Xcomplex[0X[2X ) _____________________________[0Xfunction
  [6XReturns:[0X  simplicial  complex  passed as argument with additional properties
            upon success, [9Xfail[0m otherwise.
  
  Computes  the  face lattice, the f-vector, the AS-determinant, the dimension
  and the maximal vertex label of [3Xcomplex[0m.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> obj:=SC([[1,2],[2,3],[3,4],[4,5],[5,6],[6,1]]);[0X
    [4X [SimplicialComplex[0X
    [4X [0X
    [4X  Properties known: Dim, Facets, Name, VertexLabels.[0X
    [4X [0X
    [4X  Name="unnamed complex m"[0X
    [4X  Dim=1[0X
    [4X [0X
    [4X /SimplicialComplex][0X
    [4X gap> SCExamineComplexBistellar(obj);[0X
    [4X [SimplicialComplex[0X
    [4X [0X
    [4X  Properties known: AltshulerSteinberg, Boundary, Chi, Dim, F, Faces, Facets, [0X
    [4X                    HasBoundary, IsPM, IsPure, Name, VertexLabels.[0X
    [4X [0X
    [4X  Name="unnamed complex 21"[0X
    [4X  Dim=1[0X
    [4X  Chi=0[0X
    [4X  F=[ 6, 6 ][0X
    [4X  HasBoundary=false[0X
    [4X  IsPM=true[0X
    [4X  IsPure=true[0X
    [4X [0X
    [4X /SimplicialComplex][0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X6.2-4 SCIntFunc.SCChooseMove[0m
  
  [2X> SCIntFunc.SCChooseMove( [0X[3Xdim, moves[0X[2X ) _____________________________[0Xfunction
  [6XReturns:[0X  a  bistellar  move,  i.  e.  a  pair  of  lists upon success, [9Xfail[0m
            otherwise.
  
  Since  the  problem  of  finding  a  bistellar  flip sequence that reduces a
  simplicial  complex  is undecidable, we have to use an heuristic approach to
  choose the next move.
  
  The  implemented  strategy  [10XSCIntFunc.SCChooseMove[0m  first  tries to directly
  remove  vertices, edges, i-faces in increasing dimension etc. If this is not
  possible it inserts high dimensional faces in decreasing co-dimension. To do
  this  in an efficient way a number of parameters have to be adjusted, namely
  [10XSCBistellarOptions.BaseHeating[0m  and  [10XSCBistellarOptions.BaseRelaxation[0m.  See
  [2XSCBistellarOptions[0m ([14X6.2-1[0m) for further options.
  
  If this strategy does not work for you, just implement a customized strategy
  and pass it to [2XSCReduceComplexEx[0m ([14X6.2-14[0m).
  
  See [2XSCRMoves[0m ([14X6.2-10[0m) for further information.
  
  [1X6.2-5 SCIsKStackedSphere[0m
  
  [2X> SCIsKStackedSphere( [0X[3Xcomplex, k[0X[2X ) _________________________________[0Xfunction
  [6XReturns:[0X  a list upon success, [9Xfail[0m otherwise.
  
  Checks,  whether  the  given  simplicial  complex  [3Xcomplex[0m that must be a PL
  d-sphere  is  a  [3Xk[0m-stacked  sphere with 1<= k<= lfloorfracd+22rfloor using a
  randomized  algorithm based on bistellar moves (see [Eff09]. Note that it is
  not checked whether [3Xcomplex[0m is a PL sphere -- if not, the algorithm will not
  succeed.  Returns  a list upon success: the first entry is an integer with a
  value less or equal to [3Xk[0m, where a positive value of [10Xi[0m means that the complex
  is [10Xi[0m-stacked, a zero return value means that the complex cannot be [3Xk[0m-stacked
  and  a  value of -1 means that the question could not be decided. The second
  argument  contains  a  simplicial complex that, in case of success, contains
  the     trigangulated     (d+1)-ball     B     with    partial    B=S    and
  operatornameskel_d-k(B)=operatornameskel_d-k(S),   where   S   denotes   the
  simplicial complex passed in [3Xcomplex[0m.
  
  Internally calls [2XSCReduceComplexEx[0m ([14X6.2-14[0m).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> SCLib.SearchByName("S^4~S^1");[0X
    [4X [ [ 204, "S^4~S^1 (VT)" ], [ 339, "S^4~S^1 (VT)" ], [ 341, "S^4~S^1 (VT)" ], [0X
    [4X   [ 438, "S^4~S^1 (VT)" ], [ 493, "S^4~S^1 (VT)" ], [ 494, "S^4~S^1 (VT)" ], [0X
    [4X   [ 495, "S^4~S^1 (VT)" ], [ 496, "S^4~S^1 (VT)" ], [ 497, "S^4~S^1 (VT)" ], [0X
    [4X   [ 500, "S^4~S^1 (VT)" ], [ 501, "S^4~S^1 (VT)" ], [ 502, "S^4~S^1 (VT)" ] ][0X
    [4X gap> c:=SCLib.Load(204);;[0X
    [4X gap> l:=c.Link(1);[0X
    [4X [SimplicialComplex[0X
    [4X [0X
    [4X  Properties known: Dim, Facets, Name, VertexLabels.[0X
    [4X [0X
    [4X  Name="lk(1) in S^4~S^1 (VT)"[0X
    [4X  Dim=4[0X
    [4X [0X
    [4X /SimplicialComplex][0X
    [4X gap> SCIsKStackedSphere(l,1);[0X
    [4X #I  SCIsKStackedSphere: try 1/50[0X
    [4X #I  round 0: [ 11, 40, 70, 65, 26 ][0X
    [4X #I  round 1: [ 10, 35, 60, 55, 22 ][0X
    [4X #I  round 2: [ 9, 30, 50, 45, 18 ][0X
    [4X #I  round 3: [ 8, 25, 40, 35, 14 ][0X
    [4X #I  round 4: [ 7, 20, 30, 25, 10 ][0X
    [4X #I  round 5: [ 6, 15, 20, 15, 6 ][0X
    [4X #I  SCReduceComplexEx: computed locally minimal complex after 6 rounds.[0X
    [4X 1[0X
    [4X gap> [0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X6.2-6 SCIsManifold[0m
  
  [2X> SCIsManifold( [0X[3Xcomplex[0X[2X ) __________________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0m or [9Xfalse[0m upon success, [9Xfail[0m otherwise.
  
  Tries  to prove that a closed simplicial d-pseudomanifold is a combinatorial
  manifold by reducing its vertex links to the boundary of the d-simplex.
  
  [9Xfalse[0m  is returned if it can be proven that there exists a vertex link which
  is  not  PL-homeomorphic  to the standard PL-sphere, [9Xtrue[0m is returned if all
  vertex links are bistellarly equivalent to the boundary of the simplex, [9Xfail[0m
  is  returned  if the algorithm does not terminate after the number of rounds
  indicated by [10XSCBistellarOptions.MaxIntervallIsManifold[0m.
  
  Internally                      calls                      [2XSCReduceComplexEx[0m
  ([14X6.2-14[0m)[10X(link,SCEmpty(),0,SCIntFunc.SCChooseMove);[0m   for   every   link   of
  [3Xcomplex[0m. Note that [9Xfalse[0m is returned in case of a bounded manifold.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> c:=SCBdCrossPolytope(3);;[0X
    [4X gap> SCIsManifold(c);[0X
    [4X #I  SCIsManifold: processing vertex link 1/6[0X
    [4X #I  round 0: [ 3, 3 ][0X
    [4X #I  SCReduceComplexEx: computed locally minimal complex after 1 rounds.[0X
    [4X #I  SCIsManifold: link is sphere.[0X
    [4X ...[0X
    [4X #I  SCIsManifold: processing vertex link 6/6[0X
    [4X #I  round 0: [ 3, 3 ][0X
    [4X #I  SCReduceComplexEx: computed locally minimal complex after 1 rounds.[0X
    [4X #I  SCIsManifold: link is sphere.[0X
    [4X true[0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X6.2-7 SCIsMovableComplex[0m
  
  [2X> SCIsMovableComplex( [0X[3Xcomplex[0X[2X ) ____________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0m or [9Xfalse[0m upon success, [9Xfail[0m otherwise.
  
  Checks  if  a simplicial complex [3Xcomplex[0m can be modified by bistellar moves,
  i.  e.  if  it  is  a  pure  simplicial  complex  which  fulfills  the  weak
  pseudomanifold property with empty boundary.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> c:=SCBdCrossPolytope(3);;[0X
    [4X gap> SCIsMovableComplex(c);[0X
    [4X true[0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  Complex with non-empty boundary:
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> c:=SC([[1,2],[2,3],[3,4],[3,1]]);;[0X
    [4X gap> SCIsMovableComplex(c);[0X
    [4X false[0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X6.2-8 SCMove[0m
  
  [2X> SCMove( [0X[3Xcomplex, move[0X[2X ) __________________________________________[0Xfunction
  [6XReturns:[0X  simplicial  complex of type [10XSCSimplicialComplex[0m upon success, [9Xfail[0m
            otherwise.
  
  Applies  the  bistellar  move  [3Xmove[0m to a simplicial complex [3Xcomplex[0m. [3Xmove[0m is
  given  as  a (r+1)-tuple together with a (d+1-r)-tuple if d is the dimension
  of  [3Xcomplex[0m  and  if  [3Xmove[0m  is  a r-move. See [2XSCRMoves[0m ([14X6.2-10[0m) for detailed
  information about bistellar r-moves.
  
  Note:  [3Xmove[0m  and  [3Xcomplex[0m  should  be given in standard labeling to ensure a
  correct result.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> obj:=SC([[1,2],[2,3],[3,4],[4,1]]);[0X
    [4X [SimplicialComplex[0X
    [4X[0X
    [4X Properties known: Dim, Facets, Name, VertexLabels.[0X
    [4X[0X
    [4X Name="unnamed complex m"[0X
    [4X Dim=1[0X
    [4X[0X
    [4X /SimplicialComplex][0X
    [4X gap> moves:=SCMoves(obj);[0X
    [4X [[[[1, 2], []], [[1, 4], []], [0X
    [4X     [[2, 3], []], [[3, 4], []]], [0X
    [4X   [[[1], [2, 4]], [[2], [1, 3]], [0X
    [4X     [[3], [2, 4]], [[4], [1, 3]]]][0X
    [4X gap> obj:=SCMove(obj,last[2][1]);[0X
    [4X [SimplicialComplex[0X
    [4X [0X
    [4X  Properties known: Chi, Dim, F, Faces, Facets, VertexLabels.[0X
    [4X[0X
    [4X  Name="unnamed complex m"[0X
    [4X  Dim=1[0X
    [4X  Chi=0[0X
    [4X  F=[3, 3][0X
    [4X [0X
    [4X /SimplicialComplex][0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X6.2-9 SCMoves[0m
  
  [2X> SCMoves( [0X[3Xcomplex[0X[2X ) _______________________________________________[0Xfunction
  [6XReturns:[0X  a list of list of pairs of lists upon success, [9Xfail[0m otherwise.
  
  See [2XSCRMoves[0m ([14X6.2-10[0m) for further information.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> c:=SCBdCrossPolytope(3);;[0X
    [4X gap> moves:=SCMoves(c);[0X
    [4X [[0X
    [4X # 0-moves[0X
    [4X   [[[1, 3, 5], []], [[1, 3, 6], []], [[1, 4, 5], []], [0X
    [4X     [[1, 4, 6], []], [[2, 3, 5], []], [[2, 3, 6], []],[0X
    [4X     [[2, 4, 5], []], [[2, 4, 6], []]], [0X
    [4X # 1-moves[0X
    [4X   [[[1, 3], [5, 6]], [[1, 4], [5, 6]], [[1, 5], [3, 4]], [0X
    [4X     [[1, 6], [3, 4]], [[2, 3], [5, 6]], [[2, 4], [5, 6]], [0X
    [4X     [[2, 5], [3, 4]], [[2, 6], [3, 4]], [[3, 5], [1, 2]], [0X
    [4X     [[3, 6], [1, 2]], [[4, 5], [1, 2]], [[4, 6], [1, 2]]],[0X
    [4X # 2-moves[0X
    [4X   [] [0X
    [4X][0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X6.2-10 SCRMoves[0m
  
  [2X> SCRMoves( [0X[3Xcomplex, r[0X[2X ) ___________________________________________[0Xfunction
  [6XReturns:[0X  a list of pairs of the form [10X[ list, list ][0m, [9Xfail[0m otherwise.
  
  A  bistellar  r-move  of a d-dimensional combinatorial manifold [3Xcomplex[0m is a
  r-face  m_1  together  with  a  d-r-tuple  m_2 where m_1 is a common face of
  exactly (d+1-r) facets and m_2 is not a face of [3Xcomplex[0m.
  
  The  r-move removes all facets containing m_1 and replaces them by the (r+1)
  faces obtained by uniting m_2 with any subset of m_1 of order r.
  
  The resulting complex is PL-homeomorphic to [3Xcomplex[0m.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> c:=SCBdCrossPolytope(3);;[0X
    [4X gap> moves:=SCRMoves(c,1);[0X
    [4X [ [ [ 1, 3 ], [ 5, 6 ] ], [ [ 1, 4 ], [ 5, 6 ] ], [ [ 1, 5 ], [ 3, 4 ] ], [0X
    [4X   [ [ 1, 6 ], [ 3, 4 ] ], [ [ 2, 3 ], [ 5, 6 ] ], [ [ 2, 4 ], [ 5, 6 ] ], [0X
    [4X   [ [ 2, 5 ], [ 3, 4 ] ], [ [ 2, 6 ], [ 3, 4 ] ], [ [ 3, 5 ], [ 1, 2 ] ], [0X
    [4X   [ [ 3, 6 ], [ 1, 2 ] ], [ [ 4, 5 ], [ 1, 2 ] ], [ [ 4, 6 ], [ 1, 2 ] ] ][0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X6.2-11 SCRandomize[0m
  
  [2X> SCRandomize( [0X[3Xcomplex[, allowedmoves][0X[2X ) ___________________________[0Xfunction
  [6XReturns:[0X  a simplicial complex upon success, [9Xfail[0m otherwise.
  
  Randomizes  the  given simplicial complex [3Xcomplex[0m via bistellar moves chosen
  at  random.  By  passing  the optional array [3Xallowedmoves[0m, which has to be a
  dense array of integer values of length [10XSCDim(complex)[0m, certain moves can be
  allowed  or  forbidden  in  the  proccess. An entry [10Xallowedmoves[i]=1[0m allows
  (i-1)-moves  and  an  entry  [10Xallowedmoves[i]=0[0m  forbids  (i-1)-moves  in the
  randomization process. Internally calls [2XSCReduceComplexEx[0m ([14X6.2-14[0m).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> c:=SCRandomize(SCBdSimplex(4));[0X
    [4X #I  SCRandomize: randomizing complex S^3_5 with allowed moves [ -1, 1, 1, 1 ][0X
    [4X [SimplicialComplex[0X
    [4X [0X
    [4X  Properties known: Dim, Facets, Name, VertexLabels.[0X
    [4X [0X
    [4X  Name="Randomized S^3_5"[0X
    [4X Dim=3[0X
    [4X [0X
    [4X /SimplicialComplex][0X
    [4X gap> c.F;[0X
    [4X [ 20, 85, 130, 65 ][0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X6.2-12 SCReduceAsSubcomplex[0m
  
  [2X> SCReduceAsSubcomplex( [0X[3Xcomplex1, complex2[0X[2X ) _______________________[0Xfunction
  [6XReturns:[0X  [10XSCBistellarOptions.WriteLevel=0[0m:  a  triple of the form [10X[ boolean,
            simplicial  complex,  rounds  performed  ][0m upon termination of the
            algorithm.
  
            [10XSCBistellarOptions.WriteLevel=1[0m: A library of simplicial complexes
            with  a  number  of  complexes from the reducing process and (upon
            termination)  a  triple of the form [10X[ boolean, simplicial complex,
            rounds performed ][0m.
  
            [10XSCBistellarOptions.WriteLevel=2[0m:  A mail in case a smaller version
            of  [3Xcomplex1[0m  was  found, a library of simplicial complexes with a
            number   of   complexes   from  the  reducing  process  and  (upon
            termination)  a  triple of the form [10X[ boolean, simplicial complex,
            rounds performed ][0m.
  
            Returns [9Xfail[0m upon an error.
  
  Reduces  a  simplicial  complex [3Xcomplex1[0m (satisfying the weak pseudomanifold
  property  with  empty  boundary)  as a sub-complex of the simplicial complex
  [3Xcomplex2[0m.
  
  Main  application:  Reduce  a  sub-complex  of  the  cross  polytope without
  introducing diagonals.
  
  Internally                      calls                      [2XSCReduceComplexEx[0m
  ([14X6.2-14[0m)[10X(complex1,complex2,2,SCIntFunc.SCChooseMove);[0m
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> c:=SCFromFacets([[1,3],[3,5],[4,5],[4,1]]);;[0X
    [4X gap> SCReduceAsSubcomplex(c,SCBdCrossPolytope(3));[0X
    [4X #I  round 0, move: [ [ 2 ], [ 1, 4 ] ][0X
    [4X [ 3, 3 ][0X
    [4X #I  SCReduceComplexEx: computed locally minimal complex after 1 rounds.[0X
    [4X [ true, [SimplicialComplex[0X
    [4X     [0X
    [4X      Properties known: Dim, Facets, Name, VertexLabels.[0X
    [4X     [0X
    [4X      Name="unnamed complex 9"[0X
    [4X      Dim=1[0X
    [4X     [0X
    [4X     /SimplicialComplex], 1 ][0X
  [4X------------------------------------------------------------------[0X
  
  [1X6.2-13 SCReduceComplex[0m
  
  [2X> SCReduceComplex( [0X[3Xcomplex[0X[2X ) _______________________________________[0Xfunction
  [6XReturns:[0X  [10XSCBistellarOptions.WriteLevel=0[0m:  a  triple of the form [10X[ boolean,
            simplicial  complex,  rounds  performed  ][0m upon termination of the
            algorithm.
  
            [10XSCBistellarOptions.WriteLevel=1[0m: A library of simplicial complexes
            with  a  number  of  complexes from the reducing process and (upon
            termination)  a  triple of the form [10X[ boolean, simplicial complex,
            rounds performed ][0m.
  
            [10XSCBistellarOptions.WriteLevel=2[0m:  A mail in case a smaller version
            of  [3Xcomplex1[0m  was  found, a library of simplicial complexes with a
            number   of   complexes   from  the  reducing  process  and  (upon
            termination)  a  triple of the form [10X[ boolean, simplicial complex,
            rounds performed ][0m.
  
            Returns [9Xfail[0m upon an error..
  
  Reduces a pure simplicial complex [3Xcomplex[0m satisfying the weak pseudomanifold
  property   via   bistellar   moves.   Internally   calls   [2XSCReduceComplexEx[0m
  ([14X6.2-14[0m)[10X(complex,SCEmpty(),0,SCIntFunc.SCChooseMove);[0m
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X # hexagon[0X
    [4X gap> obj:=SC([[1,2],[2,3],[3,4],[4,5],[5,6],[6,1]]);;[0X
    [4X gap> SCReduceComplex(obj);[0X
    [4X #I  round 0, move: [ [ 6 ], [ 1, 5 ] ][0X
    [4X [ 5, 5 ][0X
    [4X #I  round 1, move: [ [ 4 ], [ 3, 5 ] ][0X
    [4X [ 4, 4 ][0X
    [4X #I  round 2, move: [ [ 3 ], [ 2, 5 ] ][0X
    [4X [ 3, 3 ][0X
    [4X #I  SCReduceComplexEx: computed locally minimal complex after 3 rounds.[0X
    [4X [ true, [SimplicialComplex[0X
    [4X     [0X
    [4X      Properties known: Dim, Facets, Name, VertexLabels.[0X
    [4X     [0X
    [4X      Name="unnamed complex 6"[0X
    [4X      Dim=1[0X
    [4X     [0X
    [4X     /SimplicialComplex], 3 ][0X
    [4X ## [0X
  [4X------------------------------------------------------------------[0X
  
  [1X6.2-14 SCReduceComplexEx[0m
  
  [2X> SCReduceComplexEx( [0X[3Xcomplex, refComplex, mode, choosemove[0X[2X ) _______[0Xfunction
  [6XReturns:[0X  [10XSCBistellarOptions.WriteLevel=0[0m:  a  triple of the form [10X[ boolean,
            simplicial complex, rounds ][0m upon termination of the algorithm.
  
            [10XSCBistellarOptions.WriteLevel=1[0m: A library of simplicial complexes
            with  a  number  of  complexes from the reducing process and (upon
            termination)  a  triple of the form [10X[ boolean, simplicial complex,
            rounds ][0m.
  
            [10XSCBistellarOptions.WriteLevel=2[0m:  A mail in case a smaller version
            of  [3Xcomplex1[0m  was  found, a library of simplicial complexes with a
            number   of   complexes   from  the  reducing  process  and  (upon
            termination)  a  triple of the form [10X[ boolean, simplicial complex,
            rounds ][0m.
  
            Returns [9Xfail[0m upon an error.
  
  Reduces a pure simplicial complex [3Xcomplex[0m satisfying the weak pseudomanifold
  property via bistellar moves [3Xmode = 0[0m, compares it to the simplicial complex
  [3XrefComplex[0m  ([3Xmode  = 1[0m) or reduces it as a sub-complex of [3XrefComplex[0m ([3Xmode =
  2[0m).
  
  [3Xchoosemove[0m   is   a   function   containing   a   flip  strategy,  see  also
  [2XSCIntFunc.SCChooseMove[0m ([14X6.2-4[0m).
  
  The  currently  smallest  complex  is stored to the variable [10XminComplex[0m, the
  currently smallest f-vector to [10XminF[0m. Note that in general the algorithm will
  not  stop  until the maximum number of rounds is reached. You can adjust the
  maximum  number  of  rounds via the property [2XSCBistellarOptions[0m ([14X6.2-1[0m). The
  number  of  rounds  performed  is  returned in the third entry of the triple
  returned by this function.
  
  This function is called by
  
  (1)   [2XSCReduceComplex[0m ([14X6.2-13[0m),
  
  (2)   [2XSCEquivalent[0m ([14X6.2-2[0m),
  
  (3)   [2XSCReduceAsSubcomplex[0m ([14X6.2-12[0m),
  
  (4)   [2XSCIsManifold[0m ([14X6.2-6[0m).
  
  (5)   [2XSCRandomize[0m ([14X6.2-11[0m).
  
  Please  see [2XSCMailIsPending[0m ([14X11.2-3[0m) for further information about the email
  notification system in case [10XSCBistellarOptions.WriteLevel[0m is set to 2.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> c:=SCBdCrossPolytope(4);;[0X
    [4X gap> SCBistellarOptions.WriteLevel:=0;;                      [0X
    [4X gap> SCReduceComplexEx(c,SCEmpty(),0,SCIntFunc.SCChooseMove);[0X
    [4X [ true, [SimplicialComplex[0X
    [4X     [0X
    [4X      Properties known: Dim, Facets, Name, VertexLabels.[0X
    [4X     [0X
    [4X      Name="unnamed complex 14425"[0X
    [4X      Dim=3[0X
    [4X     [0X
    [4X     /SimplicialComplex], 9 ][0X
    [4X gap> SCBistellarOptions.WriteLevel:=1;;                      [0X
    [4X gap> SCReduceComplexEx(c,SCEmpty(),0,SCIntFunc.SCChooseMove);[0X
    [4X #I  SCLibInit: made directory "/home/spreerjn/reducedComplexes/2010-10-29_11-5\[0X
    [4X 1-34/" for user library.[0X
    [4X #I  SCIntFunc.SCLibInit: index not found -- trying to reconstruct it.[0X
    [4X #I  SCLibUpdate: rebuilding index for /home/spreerjn/reducedComplexes/2010-10-\[0X
    [4X 29_11-51-34/.[0X
    [4X #I  SCLibUpdate: rebuilding index done.[0X
    [4X #I  SCLibAdd: saving complex to file "complex_ReducedComplex_7_vertices_3_2010\[0X
    [4X -10-29_11-51-34.sc".[0X
    [4X #I  SCLibAdd: saving complex to file "complex_ReducedComplex_6_vertices_5_2010\[0X
    [4X -10-29_11-51-34.sc".[0X
    [4X #I  SCLibAdd: saving complex to file "complex_ReducedComplex_5_vertices_6_2010\[0X
    [4X -10-29_11-51-34.sc".[0X
    [4X #I  SCLibAdd: saving complex to file "complex_ReducedComplex_5_vertices_7_2010\[0X
    [4X -10-29_11-51-34.sc".[0X
    [4X [ true, [SimplicialComplex[0X
    [4X     [0X
    [4X      Properties known: Boundary, Chi, Date, Dim, F, Faces, Facets, G, H, [0X
    [4X                        HasBoundary, Homology, IsConnected, IsManifold, IsPM, N\[0X
    [4X ame, [0X
    [4X                        VertexLabels, Vertices.[0X
    [4X     [0X
    [4X      Name="ReducedComplex_5_vertices_7"[0X
    [4X      Dim=3[0X
    [4X      Chi=0[0X
    [4X      F=[ 5, 10, 10, 5 ][0X
    [4X      G=[ 0, 0 ][0X
    [4X      H=[ 1, 1, 1, 1 ][0X
    [4X      HasBoundary=false[0X
    [4X      Homology=[ [ 0, [ ] ], [ 0, [ ] ], [ 0, [ ] ], [ 1, [ ] ] ][0X
    [4X      IsConnected=true[0X
    [4X      IsPM=true[0X
    [4X     [0X
    [4X     /SimplicialComplex], 7 ][0X
    [4X gap> SCBistellarOptions.WriteLevel:=2;;                      [0X
    [4X gap> SCMailSetAddress("johndoe@somehost");   [0X
    [4X true[0X
    [4X gap> SCMailIsEnabled();                     [0X
    [4X true[0X
    [4X gap> SCReduceComplexEx(c,SCEmpty(),0,SCIntFunc.SCChooseMove);[0X
    [4X #I  SCLibInit: made directory "/home/spreerjn/reducedComplexes/2010-10-29_11-5\[0X
    [4X 2-40/" for user library.[0X
    [4X #I  SCIntFunc.SCLibInit: index not found -- trying to reconstruct it.[0X
    [4X #I  SCLibUpdate: rebuilding index for /home/spreerjn/reducedComplexes/2010-10-\[0X
    [4X 29_11-52-40/.[0X
    [4X #I  SCLibUpdate: rebuilding index done.[0X
    [4X #I  SCLibAdd: saving complex to file "complex_ReducedComplex_7_vertices_5_2010\[0X
    [4X -10-29_11-52-40.sc".[0X
    [4X #I  SCLibAdd: saving complex to file "complex_ReducedComplex_6_vertices_7_2010\[0X
    [4X -10-29_11-52-40.sc".[0X
    [4X #I  SCLibAdd: saving complex to file "complex_ReducedComplex_5_vertices_8_2010\[0X
    [4X -10-29_11-52-40.sc".[0X
    [4X #I  SCLibAdd: saving complex to file "complex_ReducedComplex_5_vertices_9_2010\[0X
    [4X -10-29_11-52-40.sc".[0X
    [4X [ true, [SimplicialComplex[0X
    [4X     [0X
    [4X      Properties known: Boundary, Chi, Date, Dim, F, Faces, Facets, G, H, [0X
    [4X                        HasBoundary, Homology, IsConnected, IsManifold, IsPM, N\[0X
    [4X ame, [0X
    [4X                        VertexLabels, Vertices.[0X
    [4X     [0X
    [4X      Name="ReducedComplex_5_vertices_9"[0X
    [4X      Dim=3[0X
    [4X      Chi=0[0X
    [4X      F=[ 5, 10, 10, 5 ][0X
    [4X      G=[ 0, 0 ][0X
    [4X      H=[ 1, 1, 1, 1 ][0X
    [4X      HasBoundary=false[0X
    [4X      Homology=[ [ 0, [ ] ], [ 0, [ ] ], [ 0, [ ] ], [ 1, [ ] ] ][0X
    [4X      IsConnected=true[0X
    [4X      IsPM=true[0X
    [4X     [0X
    [4X     /SimplicialComplex], 9 ][0X
    [4X gap> [0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  Content of sent mail:
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X Greetings master,[0X
    [4X [0X
    [4X this is simpcomp %%%VERSION%%% running on igt215.mathematik.uni-stuttgart.de[0X
    [4X (Linux igt215 2.6.26-2-amd64 #1 SMP Thu Nov 5 02:23:12 UTC 2009 x86_64[0X
    [4X GNU/Linux), GAP 4.4.12.[0X
    [4X [0X
    [4X I have been working hard for 0 seconds and have a message for you, see below.[0X
    [4X [0X
    [4X #### START MESSAGE ####[0X
    [4X [0X
    [4X SCReduceComplex:[0X
    [4X [0X
    [4X Computed locally minimal complex after 7 rounds:[0X
    [4X [0X
    [4X [SimplicialComplex[0X
    [4X [0X
    [4X  Properties known: Boundary, Chi, Date, Dim, F, Faces, Facets, G, H,[0X
    [4X  HasBoundary, Homology, IsConnected, IsManifold, IsPM, Name, VertexLabels,[0X
    [4X  Vertices.[0X
    [4X [0X
    [4X  Name="ReducedComplex_5_vertices_7"[0X
    [4X  Dim=3[0X
    [4X  Chi=0[0X
    [4X  F=[ 5, 10, 10, 5 ][0X
    [4X  G=[ 0, 0 ][0X
    [4X  H=[ 1, 1, 1, 1 ][0X
    [4X  HasBoundary=false[0X
    [4X  Homology=[ [ 0, [ ] ], [ 0, [ ] ], [ 0, [ ] ], [ 1, [ ] ] ][0X
    [4X  IsConnected=true[0X
    [4X  IsPM=true[0X
    [4X [0X
    [4X /SimplicialComplex][0X
    [4X [0X
    [4X ##### END MESSAGE #####[0X
    [4X [0X
    [4X That's all, I hope this is good news! Have a nice day.[0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
