`coxeter/text/perm2word` := TEXT(`    `,
`FUNCTION:  perm2word - convert a permutation to a reduced word`,`    `,
`CALLING SEQUENCE:  perm2word(pi,pg);`,
`                   perm2word(pi,pg,sc);`,`    `,
`PARAMETERS:  pi = a permutation in disjoint cycle notation`,
`             pg = a permutation representation of a reflection group`,
`             sc = a stabilizer chain for pg (optional)`,`   `,`SYNOPSIS:   `,
`  Let pi be a permutation of the integers 1,...,n for some n, in disjoint`,
`  cycle format. For a description of this format, see group[permgroup].`,`   `
,`  Let pg be a permutation representation of a reflection group in the`,
`  format produced by the function perm_rep. That is, pg should be an`,
`  unevaluated procedure call of the form`,
`               permgroup(n, {s1=<perm1>, s2=<perm2>,...}),`,
`  where each expression <perm_i> is a permutation of the integers 1,...,n`,
`  in disjoint cycle format.`,`   `,
`  perm2word(pi,pg) computes a reduced expression for the permutation pi`,
`  in terms of the generators of pg. More precisely, the result is a list`,
`  [i_1,...,i_l] of minimum length with the property that pi is the product`,
`  of the permutations s.i_1 ,..., s.i_l. If pi does not belong to the`,
`  permutation group specified by pg, FAIL is returned.`,`   `,
`  The first step of the algorithm is to use the stab_chain function to`,
`  determine a stabilizer chain for pg. To avoid repeating this step for`,
`  function calls involving the same permgroup, a precomputed stabilizer`,
`  chain can be supplied as a third argument. For a description of the`,
`  stabilizer chain format, see coxeter[stab_chain].`,`   `,`EXAMPLES:   `,
`  pg:=permgroup(8, {s1=[[6,7]], s2=[[7,8]]});`,`  sc:=stab_chain(pg);`,
`  perm2word([[6,8,7]],pg,sc);                 yields       [1,2]`,
`  perm2word([[6,7,8]],pg,sc);                 yields       [2,1]`,
`  pg:=perm_rep(H3); pi:=multperm([3,2,1,2,3],pg);`,
`  perm2word(pi,pg);                           yields    [3,2,1,2,3]`,`    `,
`SEE ALSO:  multperm, perm_rep, stab_chain, group[permgroup]`):

if `+`(0)=0 then # Maple V.4 or later
  print(INTERFACE_HELP(insert, topic=`coxeter/perm2word`,
  helpfile=HomeLib, text=`coxeter/text/perm2word`))
elif ceil(0)=0 then # Maple V.2 or V.3
  `help/coxeter/text/perm2word`:=`coxeter/text/perm2word`:
  save `help/coxeter/text/perm2word`, cat(HomeLib,`/help/coxeter/text/perm2word.m`);
fi:
