  
  [1m[4m[31m9. Stallings foldings[0m
  
  
  [1m[4m[31m9.1 Some theory[0m
  
  
  [1m[4m[31m9.2 Foldings[0m
  
  A  finitely  generated  subgroup of a finitely generated free group is given
  through  a  list whose first element is the number of generators of the free
  group and the remaining elements are the generators of the subgroup.
  
  A  generator  of  the  subgroup  may be given through a string of letters or
  through a list of positive integers as decribed in what follows.
  
  When  the  free  group  has  n generators, the n+j^th letter of the alphabet
  should  be  used to represent the formal inverse of the j^th generator which
  is  represented  by  the  j^th  letter. The number of generators of the free
  group must not exceed 7.
  
  For  example,  [22m[32m[2,"abc","bbabcd"][0m  means the subgroup of the free group on 2
  generators  generated  by  aba^-1 and bbaba^-1b^-1. The same subgroup may be
  given as [22m[32m[2,[1,2,3],[2,2,1,2,3,4]][0m
  
  [1m[4m[31m9.2-1 FlowerAutomaton[0m
  
  [1m[34m> FlowerAutomaton( [0m[22m[34mL[0m[1m[34m ) _____________________________________________[0mfunction
  
  The  argument  [22m[32mL[0m  is  a  subgroup of the free group given through any of the
  representations described above.
  
  [1m[4m[31m9.2-2 FoldFlowerAutomaton[0m
  
  [1m[34m> FoldFlowerAutomaton( [0m[22m[34mA[0m[1m[34m ) _________________________________________[0mfunction
  
  Makes identifications on the flower automaton [22m[32mA[0m
  
