%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Chapter{Properties and operations with group and semigroup elements}

In this chapter we present the functionality applicable to elements of groups and semigroups.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Creation of tree automorphisms and homomorphisms}

\Declaration{TreeAutomorphism}
\Declaration{TreeHomomorphism}
\Declaration{Representative}
%Declaration{AutomFamily}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Properties and attributes of tree automorphisms and homomorphisms}

\Declaration{IsSphericallyTransitive}[treehom]!{ for tree homomorphism}
\Declaration{IsTransitiveOnLevel}[treehom]!{ for tree homomorphism}

\>IsOne( <a> ) O

Returns whether an automorphism <a> acts trivially on the tree. For contracting groups see also
`UseContraction' ("UseContraction") and `IsOneContr' ("IsOneContr").
\beginexample
gap> L := AutomatonGroup("p=(p,q)(1,2), q=(p,q)");
< p, q >
gap> IsOne(q*p^-1*q*p^-1);
true
\endexample

\Declaration{IsOneContr}


\>Order( <a> ) O

Computes the order of an automorphism <a>. In some cases it does not stop. Works always (modulo memory
restrictions) for groups generated by bounded automata.

If `InfoLevel' of `InfoAutomGrp' is greater than or equal to 3 (one can set it by
`SetInfoLevel( InfoAutomGrp, 3)') and the element has infinite order, then the proof of this fact
is printed.

\beginexample
gap> L := AutomatonGroup("p=(p,q)(1,2), q=(p,q)");
< p, q >
gap> Basilica := AutomatonGroup( "u=(v,1)(1,2), v=(u,1)" );
< u, v >
gap> Order(p*q^-1);
2
gap> SetInfoLevel( InfoAutomGrp, 3);
gap> Order( u^35*v^-12*u^2*v^-3 );
#I  (u^35*v^-12*u^2*v^-3)^68719476736 has conjugate of u^2*v^-3*u^35*v^
-12 as a section at vertex [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
infinity
\endexample

\Declaration{OrderUsingSections}

\Declaration{Perm}
\Declaration{PermOnLevel}
\Declaration{PermOnLevelAsMatrix}
\Declaration{TransformationOnLevel}
\Declaration{TransformationOnLevelAsMatrix}
\Declaration{Word}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Operations with tree automorphisms and homomorphisms}

The multiplication of tree homomorphisms is defined in the standard way

\>`<a> \* <b>'{product}!{ for tree homomorphisms}

The following operations allow computation of the actions of tree
homomorphisms on letters and vertices

\>`<letter> ^ <a>'{action}!{ of tree homomorphism on letter}
\>`<vertex> ^ <a>'{action}!{ of tree homomorphism on vertex}

\beginexample
gap> L := AutomatonGroup("p=(p,q)(1,2), q=(p,q)");
< p, q >
gap> 1^p;
2
gap> [1, 2, 2, 1, 2, 1]^(p*q^2);
[ 2, 1, 2, 2, 1, 2 ]
\endexample


The operations below describe how to work with sections of tree homomorphisms.

\Declaration{Section}[treehom]!{ for tree homomorphism}
\Declaration{Sections}
\Declaration{Decompose}





\>`<a> in <G>'{in}

Returns whether the automorphism <a> belongs to the group <G>. In some cases it does not stop.
\beginexample
gap> L := AutomatonGroup("p=(p,q)(1,2), q=(p,q)");
< p, q >
gap> H := Group([p^2, q^2]);
< p^2, q^2 >
gap> p in H;
false
\endexample



\Declaration{OrbitOfVertex}
\Declaration{PrintOrbitOfVertex}
\Declaration{PermActionOnLevel}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Elements of groups and semigroups defined by wreath recursion}

\Declaration{IsFiniteState}[selfsim]!{ for tree homomorphism}
\Declaration{AllSections}

See also operation `MealyAutomaton' ("MealyAutomaton"), which allows to construct
a Mealy automaton whose states are the sections of given tree homomorphism and which
encodes its action on the tree.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Elements of contracting groups}

\Declaration{AutomPortrait}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
