.. _SectGrpFPCoxAction:

.. _action:

Roots, Coroots and Reflections
==============================

Many of these functions have an optional argument ``Basis`` which may take one
of the following values

1. ``"Standard"``: the standard basis for the (co)root space. This is the
default.

2. ``"Root"``: the basis of simple (co)roots.

3. ``"Weight"``: the basis of fundamental (co)weights (see
Subsection :ref:`SubsectRDRootWeight` below).

.. _SubsectRDRootAccess:

.. _access:

Accessing Roots and Coroots
---------------------------

.. magma:function:: RootSpace(W)
   :input_types: GrpMat
   :output_types: Lat
   :label: RootSpace_GrpMat

.. magma:function:: CorootSpace(W)
   :input_types: GrpMat
   :output_types: Lat
   :label: CorootSpace_GrpMat

   The base space of the reflection group :math:`W`. If :math:`W` is not a
   reflection group, an error occurs.

.. magma:example:: Example: Root Space
   :label: RootSpace

   .. code-block:: magma

      > W := ComplexReflectionGroup("M", 3);
      > RootSpace(W);
      Full Vector space of degree 3 over Cyclotomic Field of order 24 and degree 8

.. magma:function:: SimpleOrders(W)
   :input_types: GrpMat
   :output_types: [RngIntElt]
   :label: SimpleOrders_GrpMat

   The sequence of simple orders of the reflection group :math:`W`. If :math:`W` is
   not a reflection group, an error is flagged.

.. magma:function:: SimpleRoots(W)
   :input_types: GrpMat
   :output_types: Mtrx
   :label: SimpleRoots_GrpMat

.. magma:function:: SimpleCoroots(W)
   :input_types: GrpMat
   :output_types: Mtrx
   :label: SimpleCoroots_GrpMat

   The simple (co)roots of the reflection group :math:`W` as the rows of a matrix,
   i.e. :math:`A` (resp. :math:`B`).

.. magma:function:: NumberOfPositiveRoots(W)
   :input_types: GrpMat
   :output_types: RngIntElt
   :label: NumberOfPositiveRoots_GrpMat

.. magma:function:: NumPosRoots(W)
   :input_types: GrpMat
   :output_types: RngIntElt
   :label: NumPosRoots_GrpMat

   The number of positive roots of the real reflection group :math:`W`. This is
   also the number of positive coroots. The total number of (co)roots is twice the
   number of positive (co)roots. This number is finite if and only if :math:`W` is
   finite.

.. magma:function:: Roots(W)
   :input_types: GrpMat
   :output_types: $\{@@\}$
   :label: Roots_GrpMat

.. magma:function:: Coroots(W)
   :input_types: GrpMat
   :output_types: $\{@@\}$
   :label: Coroots_GrpMat
   :parameters: Basis : MonStgElt : ``Standard"

   The indexed set of (co)roots of the real reflection group :math:`W`,
   i.e. :math:`\{@\,\alpha_1,\dots\alpha_{2N}\,@\}`
   (resp. :math:`\{@\,\alpha_1^\star,\dots\alpha_{2N}^\star\,@\}`). If :math:`W` is
   infinite, an error is flagged.

.. magma:function:: PositiveRoots(W)
   :input_types: GrpMat
   :output_types: $\{@@\}$
   :label: PositiveRoots_GrpMat

.. magma:function:: PositiveCoroots(W)
   :input_types: GrpMat
   :output_types: $\{@@\}$
   :label: PositiveCoroots_GrpMat
   :parameters: Basis : MonStgElt : ``Standard"

   The indexed set of positive (co)roots of the real reflection group :math:`W`,
   that is, :math:`\{@\,\alpha_1,\dots\alpha_N\,@\}` (resp.
   :math:`\{@\,\alpha_1^\star,\dots\alpha_N^\star\,@\}`). If :math:`W` is infinite,
   an error is flagged.

.. magma:function:: Root(W, r)
   :input_types: GrpMat, RngIntElt
   :output_types: $\{@@\}$
   :label: Root_GrpMat_RngIntElt

.. magma:function:: Coroot(W, r)
   :input_types: GrpMat, RngIntElt
   :output_types: $\{@@\}$
   :label: Coroot_GrpMat_RngIntElt
   :parameters: Basis : MonStgElt : ``Standard"

   The :math:`r`\ th (co)root :math:`\alpha_r` (resp. :math:`\alpha_r^\star`) of
   the real reflection group :math:`W`. If :math:`W` is infinite, an error is
   flagged.

.. magma:function:: RootPosition(W, v)
   :input_types: GrpMat, .
   :output_types: $\{@@\}$
   :label: RootPosition_GrpMat

.. magma:function:: CorootPosition(W, v)
   :input_types: GrpMat, .
   :output_types: $\{@@\}$
   :label: CorootPosition_GrpMat
   :parameters: Basis : MonStgElt : ``Standard"

   If :math:`v` is a (co)root in the finite real reflection group :math:`W`, return
   its index; otherwise return 0. These functions will try to coerce :math:`v` into
   the appropriate lattice; :math:`v` should be written with respect to the basis
   specified by the parameter ``Basis``. If :math:`W` is infinite, an error is
   flagged.

.. magma:example:: Example: Roots Coroots
   :label: RootsCoroots

   .. code-block:: magma

      > W := ReflectionGroup("A3");
      > Roots(W);
      {@
          (1 0 0),
          (0 1 0),
          (0 0 1),
          (1 1 0),
          (0 1 1),
          (1 1 1),
          (-1  0  0),
          (0 -1  0),
          (0  0 -1),
          (-1 -1  0),
          (0 -1 -1),
          (-1 -1 -1)
      @}
      > PositiveCoroots(W);
      {@
          (2 -1  0),
          (-1  2 -1),
          (0 -1  2),
          (1  1 -1),
          (-1  1  1),
          (1 0 1)
      @}
      > #Roots(W) eq 2*NumPosRoots(W);
      true
      %%a> assert $1;
      > Root(W, 4);
      (1 1 0)
      > Root(W, 4 : Basis := "Root");
      (1 1 0)
      > RootPosition(W, [1,1,0]);
      4
      %%a> assert $1 eq 4;
      > A := Matrix(3,3,[1,0,0, -1,-1,-3, 1,2,4]);
      > B := Matrix(3,3,[2,-1,0, -1,2,-1, 0,1,0]);
      > W := ReflectionGroup(A,B);
      > Roots(W);
      {@
          (1 0 0),
          (-1 -1 -3),
          (1 2 4),
          (0 -1 -3),
          (0 1 1),
          (1 1 1),
          (-1  0  0),
          (1 1 3),
          (-1 -2 -4),
          (0 1 3),
          (0 -1 -1),
          (-1 -1 -1)
      @}
      > PositiveCoroots(W);
      {@
          (2 -1  0),
          (-1  2 -1),
          (0 1 0),
          (1  1 -1),
          (-1  3 -1),
          (1  2 -1)
      @}
      > #Roots(W) eq 2*NumPosRoots(W);
      true
      %%a> assert $1;
      > Root(W, 4);
      (0 -1 -3)
      > Root(W, 4 : Basis := "Root");
      (1 1 0)
      > RootPosition(W, [0,-1,-3]);
      4
      %%a> assert $1 eq 4;

.. _SubsectRDRootAction:

.. _rootrefl:

Reflections
-----------

The root :math:`\alpha` acts on the root space via the reflection
:math:`s_\alpha`; the coroot :math:`\alpha^\star` acts on the coroot space via
the coreflection :math:`s_\alpha^\star`.

.. magma:function:: ReflectionMatrices(W)
   :input_types: GrpMat
   :output_types: [AlgMatElt]
   :label: ReflectionMatrices_GrpMat

.. magma:function:: CoreflectionMatrices(W)
   :input_types: GrpMat
   :output_types: [AlgMatElt]
   :label: CoreflectionMatrices_GrpMat

Basis : MonStgElt : “Standard"

The sequence of reflections in the finite real reflection group :math:`W`. The
:math:`r`\ th reflection in the sequence corresponds to the :math:`r`\ th
(co)root.

.. magma:function:: SimpleReflectionMatrices(W)
   :input_types: GrpMat
   :output_types: [AlgMatElt]
   :label: SimpleReflectionMatrices_GrpMat

.. magma:function:: SimpleCoreflectionMatrices(W)
   :input_types: GrpMat
   :output_types: [AlgMatElt]
   :label: SimpleCoreflectionMatrices_GrpMat

Basis : MonStgElt : “Standard"

The matrices giving the action of the simple (co)roots on the (co)root space of
the finite real reflection group :math:`W`.

.. magma:function:: ReflectionMatrix(W, r)
   :input_types: GrpMat, RngIntElt
   :output_types: AlgMatElt
   :label: ReflectionMatrix_GrpMat_RngIntElt

.. magma:function:: CoreflectionMatrix(W, r)
   :input_types: GrpMat, RngIntElt
   :output_types: []
   :label: CoreflectionMatrix_GrpMat_RngIntElt

Basis : MonStgElt : “Standard"

The reflection in finite real reflection group :math:`W` corresponding to the
:math:`r`\ th (co)root. If :math:`r=1,\dots,n`, this is a generator of
:math:`W`.

.. magma:function:: SimpleReflectionPermutations(W)
   :input_types: GrpMat
   :output_types: []
   :label: SimpleReflectionPermutations_GrpMat

   The sequence of permutations giving the action of the simple (co)roots of the
   finite reflection group :math:`W` on the (co)roots. This action is the same for
   roots and coroots.

.. magma:function:: ReflectionPermutations(W)
   :input_types: GrpMat
   :output_types: []
   :label: ReflectionPermutations_GrpMat

   The sequence of permutations giving the action of the (co)roots of the finite
   reflection group :math:`W` on the (co)roots. This action is the same for roots
   and coroots.

.. magma:function:: ReflectionPermutation(W, r)
   :input_types: GrpMat, RngIntElt
   :output_types: []
   :label: ReflectionPermutation_GrpMat_RngIntElt

   The permutation giving the action of the :math:`r`\ th (co)root of the finite
   reflection group :math:`W` on the (co)roots. This action is the same for roots
   and coroots.

.. magma:function:: ReflectionWords(W)
   :input_types: GrpMat
   :output_types: []
   :label: ReflectionWords_GrpMat

   The sequence of words in the simple reflections for all the reflections of the
   real reflection group :math:`W`. These words are given as sequences of integers.
   In other words, if
   :math:`a = [a_1,\dots,a_l] = \hbox{\tt ReflectionWords(W)[r]}`, then
   :math:`s_{\alpha_r} = s_{\alpha_{a_1}} \cdots s_{\alpha_{a_l}}`.

.. magma:function:: ReflectionWord(W, r)
   :input_types: GrpMat, RngIntElt
   :output_types: []
   :label: ReflectionWord_GrpMat_RngIntElt

   The word in the simple reflections for the :math:`r`\ th reflection of the real
   reflection group :math:`W`. The word is given as a sequence of integers. In
   other words, if :math:`a = [a_1,\dots,a_l] = \hbox{\tt ReflectionWord(W,r)}`,
   then :math:`s_{\alpha_r} = s_{\alpha_{a_1}} \cdots s_{\alpha_{a_l}}`.

.. magma:example:: Example: Action
   :label: Action

   .. code-block:: magma

      > Q := RationalField();
      > W := ReflectionGroup("A3");
      > mx := ReflectionMatrix(W, 4);
      > perm := ReflectionPermutation(W, 4);
      > RootPosition(W, Vector(Q, Eltseq(Root(W,2))) * mx) eq 2^perm;
      true
      %%a> assert $1;
      > mx := CoreflectionMatrix(W, 4);
      > CorootPosition(W, Coroot(W,2) * mx) eq 2^perm;
      true
      %%a> assert $1;

.. magma:function:: Length(w)
   :input_types: GrpMatElt
   :output_types: RngIntElt
   :label: Length_GrpMatElt

.. magma:function:: CoxeterLength(w)
   :input_types: GrpMatElt
   :output_types: RngIntElt
   :label: CoxeterLength_GrpMatElt

   The length of :math:`w` as an element of the Coxeter group :math:`W`, i.e. the
   number of positive roots of :math:`W` which become negative under the action of
   :math:`w`.

.. _SubsectRDRootWeight:

.. _weights:

Weights
-------

.. magma:function:: WeightLattice(W)
   :input_types: GrpMat
   :output_types: Lat
   :label: WeightLattice_GrpMat

.. magma:function:: CoweightLattice(W)
   :input_types: GrpMat
   :output_types: Lat
   :label: CoweightLattice_GrpMat

   The (co)weight lattice of the real reflection group :math:`W`. The roots and
   coroots of :math:`W` must have integral components.

.. magma:function:: FundamentalWeights(W)
   :input_types: GrpMat
   :output_types: Mtrx
   :label: FundamentalWeights_GrpMat

.. magma:function:: FundamentalCoweights(W)
   :input_types: GrpMat
   :output_types: Mtrx
   :label: FundamentalCoweights_GrpMat
   :parameters: Basis : MonStgElt : ``Standard"

   The fundamental weights of the real reflection group :math:`W` given as the rows
   of a matrix. The roots and coroots of :math:`W` must have integral components.

.. magma:example:: Example: Weights
   :label: Weights

   .. code-block:: magma

      > W := ReflectionGroup("E6");
      > WeightLattice(W);
      Lattice of rank 6 and degree 6
      Basis:
      (4  3  5  6  4  2)
      (3  6  6  9  6  3)
      (5  6 10 12  8  4)
      (6  9 12 18 12  6)
      (4  6  8 12 10  5)
      (2  3  4  6  5  4)
      Basis Denominator: 3
      > FundamentalWeights(W);    
      [ 4/3    1  5/3    2  4/3  2/3]
      [   1    2    2    3    2    1]
      [ 5/3    2 10/3    4  8/3  4/3]
      [   2    3    4    6    4    2]
      [ 4/3    2  8/3    4 10/3  5/3]
      [ 2/3    1  4/3    2  5/3  4/3]

.. magma:function:: IsDominant(R, v)
   :input_types: RootDtm, .
   :output_types: ModTupFldElt, GrpFPCoxElt
   :label: IsDominant_RootDtm
   :parameters: Basis : MonStgElt : ``Standard"

   Returns ``true`` if and only if :math:`v` is a dominant weight for the root
   datum :math:`R`, ie, a nonnegative integral linear combination of the
   fundamental weights.

.. magma:function:: DominantWeight(W, v)
   :input_types: GrpMat, .
   :output_types: ModTupFldElt, GrpFPCoxElt
   :label: DominantWeight_GrpMat
   :parameters: Basis : MonStgElt : ``Standard"

   The unique dominant weight in the same :math:`W`-orbit as :math:`v`, where
   :math:`W` is a real reflection group and :math:`v` is a weight given as a vector
   or a sequence representing a vector. The second value returned is a Coxeter
   group element taking :math:`v` to the dominant weight.

.. magma:function:: WeightOrbit(W, v)
   :input_types: GrpMat, .
   :output_types: {@ ModTupFldElt @}, [GrpFPCoxElt]
   :label: WeightOrbit_GrpMat
   :parameters: Basis : MonStgElt : ``Standard"

   The :math:`W`-orbit of :math:`v` as an indexed set, where :math:`W` is a real
   reflection group and :math:`v` is a weight given as a vector or a sequence
   representing a vector. The first element in the orbit is always dominant. The
   second value returned is a sequence of Coxeter group words taking the weight
   :math:`v` to the corresponding element of the orbit.

.. magma:example:: Example: Dominant Weights
   :label: DominantWeights

   .. code-block:: magma

      > W := CoxeterGroup("B3");
      > DominantWeight(W, [1,-1,0] : Basis:="Weight");  
      (1 0 0)
      \$.2 * \$.3 * \$.2 * \$.1
      > #WeightOrbit(W, [1,-1,0] : Basis:="Weight");   
      6
      %%a> assert $1 eq 6;
