.. _SectRDOp:

.. _operators-root-dtm:

Operations on Root Data
=======================

.. magma:operation:: R1 eq R2
   :input_types: RootDtm, RootDtm
   :output_types: BoolElt
   :label: op_eq_RootDtm_RootDtm

   Returns ``true`` if, and only if, :math:`R_1` and :math:`R_2` are identical root
   data.

.. magma:function:: IsIsomorphic(R1, R2)
   :input_types: RootDtm, RootDtm
   :output_types: BoolElt, [RngIntElt], Map
   :label: IsIsomorphic_RootDtm_RootDtm

   Returns ``true`` if, and only if, :math:`R_1` and :math:`R_2` are isomorphic
   root data. If ``true``, the second value returned is a sequence giving the
   simple root of :math:`R_2` corresponding to each simple root of :math:`R_1`, and
   the third value returned is an isomorphism :math:`R_1\to R_2`. This function is
   currently only implemented for semisimple root data.

.. magma:function:: IsCartanEquivalent(R1, R2)
   :input_types: RootDtm, RootDtm
   :output_types: BoolElt, SeqEnum
   :label: IsCartanEquivalent_RootDtm_RootDtm

   Returns ``true`` if and only if the root data :math:`R_1` and :math:`R_2` are
   Cartan equivalent; i.e. they have isomorphic Dynkin diagrams. If ``true``, the
   second value returned is a sequence giving the simple root of :math:`R_2`
   corresponding to each simple root of :math:`R_1`.

.. magma:function:: IsIsogenous(R1, R2)
   :input_types: RootDtm, RootDtm
   :output_types: BoolElt, SeqEnum, RootDtm, Map, Map, RootDtm, Map, Map
   :label: IsIsogenous_RootDtm_RootDtm

   Returns ``true`` if, and only if, :math:`R_1` and :math:`R_2` are isogenous root
   data. If ``true``, the subsequent values returned are: a sequence giving the
   root of :math:`R_2` corresponding to each root of :math:`R_1`, the corresponding
   adjoint root datum :math:`R_{ad}`, the morphisms :math:`R_{ad}\to R_1` and
   :math:`R_{ad}\to R_2`, the corresponding simply connected root datum
   :math:`R_{sc}`, and the morphisms :math:`R_1\to R_{sc}` and
   :math:`R_2\to R_{sc}`.

.. magma:example:: Example: Isomorphism Isogeny
   :label: IsomorphismIsogeny

   An example of isogenous root data: An example of distinct isomorphic root data:

   .. code-block:: magma

      > R1 := RootDatum("A3");
      > R2 := RootDatum("A3" : Isogeny := "SC");
      > R1 eq R2;
      false
      %%a> assert not $1;
      > IsIsomorphic(R1, R2);
      false
      %%a> assert not $1;
      > IsCartanEquivalent(R1, R2);
      true [ 1, 2, 3 ]
      > IsIsogenous(R1, R2);
      true [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ] 
      Adjoint root datum of type A3 
      Mapping from: RootDtm: ad to RootDtm: ad
      Mapping from: RootDtm: ad to RootDtm: sc
      Simply connected root datum of type A3 
      Mapping from: RootDtm: ad to RootDtm: sc
      Mapping from: RootDtm: sc to RootDtm: sc
      > C := CartanMatrix("B2");
      > R1 := RootDatum(C);
      > R2 := RootDatum(Transpose(C));
      > R1; R2;
      Adjoint root datum of type B2
      Adjoint root datum of type C2
      > R1 eq R2;
      false
      %%a> assert not $1;
      > IsIsomorphic(R1, R2);
      true [ 2, 1 ]

.. magma:function:: CartanName(R)
   :input_types: RootStr
   :output_types: MonStgElt
   :label: CartanName_RootStr

   The Cartan name of the root datum :math:`R`
   (Section :ref:`SectCartanFinAff`).

.. magma:function:: TwistedCartanName(R)
   :input_types: RootDtm
   :output_types: MonStgElt
   :label: TwistedCartanName_RootDtm

   The twisted Cartan name of the root datum :math:`R`. E.g., ``"2A3,2"``.

.. magma:function:: CoxeterDiagram(R)
   :input_types: RootStr
   :label: CoxeterDiagram_RootStr

Print the Coxeter diagram of the root datum :math:`R`
(Section :ref:`SectCartanFinAff`).

.. magma:function:: DynkinDiagram(R)
   :input_types: RootStr
   :label: DynkinDiagram_RootStr

   Print the Dynkin diagram of the root datum :math:`R`
   (Section :ref:`SectCartanFinAff`).

.. magma:function:: CoxeterMatrix(R)
   :input_types: RootStr
   :output_types: AlgMatElt
   :label: CoxeterMatrix_RootStr

   The Coxeter matrix of the root datum :math:`R`
   (Section :ref:`SectCartanCoxMat`).

.. magma:function:: CoxeterGraph(R)
   :input_types: RootStr
   :output_types: GrphUnd
   :label: CoxeterGraph_RootStr

   The Coxeter graph of the root datum :math:`R`
   (Section :ref:`SectCartanCoxGrph`).

.. magma:function:: CartanMatrix(R)
   :input_types: RootStr
   :output_types: AlgMatElt
   :label: CartanMatrix_RootStr

   The Cartan matrix of the root datum :math:`R`
   (Section :ref:`SectCartanCarMat`).

.. magma:function:: DynkinDigraph(R)
   :input_types: RootStr
   :output_types: GrphDir
   :label: DynkinDigraph_RootStr

   The Dynkin digraph of the root datum :math:`R`
   (Section :ref:`SectCartanDynDigrph`).

.. magma:example:: Example: Diagrams
   :label: Diagrams

   .. code-block:: magma

      > R := RootDatum("F4");
      > DynkinDiagram(R);
 
      F4    1 - 2 =>= 3 - 4
      > CoxeterDiagram(R);
 
      F4    1 - 2 === 3 - 4

.. magma:function:: GammaAction(R)
   :input_types: RootDtm
   :output_types: Rec
   :label: GammaAction_RootDtm

   The :math:`\Gamma`-action of the root datum :math:`R`. This is a record
   consisting of four elements: ``gamma`` is the Group :math:`\Gamma` acting on
   :math:`R`, ``perm_ac`` is the homomorphism defining the permutation action of
   :math:`\Gamma` on the set of all roots of :math:`R`, finally ``mats_rt`` and
   ``mats_co`` are sequences of matrices defining the action of :math:`\Gamma` on
   the root and coroot spaces of :math:`R`.

.. magma:function:: GammaRootSpace(R)
   :input_types: RootDtm
   :output_types: GSetEnum, Map
   :label: GammaRootSpace_RootDtm

.. magma:function:: GammaCorootSpace(R)
   :input_types: RootDtm
   :output_types: GSetEnum, Map
   :label: GammaCorootSpace_RootDtm

   Given a root datum :math:`R`, create the fixed space of :math:`\Gamma` acting on
   the (co)root space :math:`V = {\mathbb{Q}}\otimes X` of :math:`R` as well as the
   embedding in :math:`V`.

.. magma:function:: GammaOrbitOnRoots(R,r)
   :input_types: RootDtm, RngIntElt
   :output_types: GSetEnum
   :label: GammaOrbitOnRoots_RootDtm_RngIntElt

   The orbit through the :math:`r`\ th root of the :math:`\Gamma`-action on the
   root datum :math:`R`.

.. magma:function:: GammaOrbitsOnRoots(R)
   :input_types: RootDtm
   :output_types: SeqEnum[GSetEnum]
   :label: GammaOrbitsOnRoots_RootDtm

.. magma:function:: PositiveGammaOrbitsOnRoots(R)
   :input_types: RootDtm
   :output_types: SeqEnum[GSetEnum]
   :label: PositiveGammaOrbitsOnRoots_RootDtm

.. magma:function:: NegativeGammaOrbitsOnRoots(R)
   :input_types: RootDtm
   :output_types: SeqEnum[GSetEnum]
   :label: NegativeGammaOrbitsOnRoots_RootDtm

.. magma:function:: ZeroGammaOrbitsOnRoots(R)
   :input_types: RootDtm
   :output_types: SeqEnum[GSetEnum]
   :label: ZeroGammaOrbitsOnRoots_RootDtm

   The sequence of all (respectively positive, negative and zero) orbits of the
   :math:`\Gamma`-action on the root datum :math:`R` (Section
   :ref:`SubsectExtRD`).

.. magma:function:: GammaActionOnSimples(R)
   :input_types: RootDtm
   :output_types: HomGrp
   :label: GammaActionOnSimples_RootDtm

   The :math:`[\Gamma]`-action on the simple (co)roots of the root datum :math:`R`.
   (Section :ref:`SubsectExtRD`). This function was called
   ``GammaActionPi`` in the last release.

.. magma:function:: OrbitsOnSimples(R)
   :input_types: RootDtm
   :output_types: SeqEnum[GSetEnum]
   :label: OrbitsOnSimples_RootDtm

   The sequence of all orbits of the :math:`[\Gamma]`-action on the simple
   (co)roots of the root datum :math:`R`
   (Section :ref:`SubsectExtRD`). This function was called
   ``OrbitsPi`` in the last release.

.. magma:function:: DistinguishedOrbitsOnSimples(R)
   :input_types: RootDtm
   :output_types: SeqEnum[GSetEnum]
   :label: DistinguishedOrbitsOnSimples_RootDtm

   The sequence of distinguished orbits of the :math:`[\Gamma]`-action on the
   simple (co)roots of the root datum :math:`R`
   (Section :ref:`SubsectExtRD`). This function was called
   ``DistinguishedOrbitsPi`` in the last release.

.. magma:function:: BaseRing(R)
   :input_types: RootDtm
   :output_types: RngInt
   :label: BaseRing_RootDtm

   The base ring of the root datum :math:`R` is the field of rational numbers.

.. magma:function:: Rank(R)
   :input_types: RootStr
   :output_types: RngIntElt
   :label: Rank_RootStr

.. magma:function:: AbsoluteRank(R)
   :input_types: RootDtm
   :output_types: RngIntElt
   :label: AbsoluteRank_RootDtm

   The (absolute) rank of the root datum :math:`R`, i.e. the number of simple
   (co)roots.

.. magma:function:: RelativeRank(R)
   :input_types: RootDtm
   :output_types: RngIntElt
   :label: RelativeRank_RootDtm

   The relative rank of the root datum :math:`R`, i.e. the number of simple
   (co)roots of the relative root system. This is the same as absolute rank for
   split root data.

.. magma:function:: Dimension(R)
   :input_types: RootStr
   :output_types: RngIntElt
   :label: Dimension_RootStr

   The dimension of the root datum :math:`R`, i.e. the dimension of the (co)root
   space. This is at least as large as the rank, with equality when :math:`R` is
   semisimple.

.. magma:function:: TwistingDegree(R)
   :input_types: RootDtm
   :output_types: RngIntElt
   :label: TwistingDegree_RootDtm

   The twisting degree of the root datum :math:`R`, i.e. the order of
   :math:`\Gamma` divided by the kernel of the :math:`[\Gamma]`-action.

.. magma:function:: AnisotropicSubdatum(R)
   :input_types: RootDtm
   :output_types: RootDtm
   :label: AnisotropicSubdatum_RootDtm

   The anisitropic subdatum of the root datum :math:`R`.

.. magma:example:: Example: Operations For Twisted Root Data
   :label: OperationsForTwistedRootData

   Consider the twisted root datum of type :math:`{}^2A_{3,1}` with distinguished
   orbit :math:`\{2\}`: First, print out the action of :math:`\Gamma` on the root
   datum: Compute the orbits of the :math:`\Gamma`-action: Compute the
   :math:`[\Gamma]`-action and its orbits: Absolute and relative rank and the
   twisting degree, as well as their appearance in the name of the root datum:
   anisotropic subdatum:

   .. code-block:: magma

      > R := RootDatum( "A3" : Twist := < {{2}}, 2 > );
      > GammaAction(R);
      rec<recformat<gamma: GrpPerm, perm_ac: HomGrp, mats_rt, mats_co> |
           gamma := Permutation group acting on a set of cardinality 4
           Order = 4 = 2^2
                (1, 2, 3, 4),
           perm_ac := Homomorphism of GrpPerm: $, Degree 4, Order 2^2 into GrpPerm: $,
           Degree 12, Order 2^10 * 3^5 * 5^2 * 7 * 11 induced by
                (1, 2, 3, 4) |--> (1, 3, 7, 9)(2, 4, 6, 5)(8, 10, 12, 11),
           mats_rt := [
                [ 0  0  1]
                [ 1  1  0]
                [-1  0  0]
           ],
           mats_co := [
                [ 0  0  1]
                [ 0  1  0]
                [-1  1  0]
           ]
           >
      > PositiveGammaOrbitsOnRoots(R);
      [
           GSet{ 2, 4, 5, 6 }
      ]
      > NegativeGammaOrbitsOnRoots(R);
      [
           GSet{ 8, 10, 11, 12 }
      ]
      > ZeroGammaOrbitsOnRoots(R);
      [
           GSet{ 1, 3, 7, 9 }
      ]
      > &+[ Root(R,r) : r in ZeroGammaOrbitsOnRoots(R)[1] ];
      (0 0 0)
      > GammaActionOnSimples(R);
      Homomorphism of GrpPerm: $, Degree 4, Order 2^2 into GrpPerm: $, 
      Degree 3, Order 2 * 3 induced by
           (1, 2, 3, 4) |--> (1, 3)
      > OrbitsOnSimples(R);
      [
           GSet{ 2 },
           GSet{ 1, 3 }
      ]
      > DistinguishedOrbitsOnSimples(R);
      [
           GSet{ 2 }
      ]
      > AbsoluteRank(R);
      3
      %%a> assert $1 eq 3;
      > RelativeRank(R);
      1
      %%a> assert $1 eq 1;
      > TwistingDegree(R);
      2
      %%a> assert $1 eq 2;
      > R;
      R: Twisted adjoint root datum of type 2A3,1
      > A := AnisotropicSubdatum(R); A;
      A: Twisted root datum of type 2(A1 A1)2,0
      > GammaAction(A)`perm_ac;
      Homomorphism of GrpPerm: $, Degree 4, Order 2^2 into GrpPerm: $, 
      Degree 4, Order 2^2 induced by
           (1, 2, 3, 4) |--> (1, 2, 3, 4)

.. magma:function:: CoxeterGroupOrder(R)
   :input_types: RootStr
   :output_types: RngIntElt
   :label: CoxeterGroupOrder_RootStr

   The order of the (split) Coxeter group of the root datum :math:`R`.

.. magma:function:: GroupOfLieTypeOrder(R, q)
   :input_types: RootDtm, RngElt
   :output_types: RngIntElt
   :label: GroupOfLieTypeOrder_RootDtm_RngElt

   The order of the group of Lie type with split root datum :math:`R` over the
   field of cardinality :math:`q`.

.. magma:function:: GroupOfLieTypeFactoredOrder(R, q)
   :input_types: RootDtm, RngElt
   :output_types: RngIntElt
   :label: GroupOfLieTypeFactoredOrder_RootDtm_RngElt

   The factored order of the group of Lie type with split root datum :math:`R` over
   the field of order :math:`q`.

.. magma:example:: Example: Group Of Lie Type Order
   :label: GroupOfLieTypeOrder

   As well as accepting a specific prime power, these functions also take an
   indeterminate so that the generic order formula can be computed.

   .. code-block:: magma

      > P<q> := PolynomialRing(Integers());
      > R := RootDatum("F4");
      > GroupOfLieTypeFactoredOrder(R, q);
      [
          <q - 1, 4>,
          <q, 24>,
          <q + 1, 4>,
          <q^2 - q + 1, 2>,
          <q^2 + 1, 2>,
          <q^2 + q + 1, 2>,
          <q^4 - q^2 + 1, 1>,
          <q^4 + 1, 1>
      ]
      > 
      > R := RootDatum("B2");
      > ord := GroupOfLieTypeOrder(R, q);
      > forall{ q : q in [2..200] | not IsPrimePower(q) or
      >   Evaluate(ord, q) eq GroupOfLieTypeOrder(R, q) };
      true
      %%a> assert $1;

.. magma:function:: FundamentalGroup(R)
   :input_types: RootDtm
   :output_types: GrpAb, Map
   :label: FundamentalGroup_RootDtm

   The fundamental group :math:`\Lambda/{\mathbb{Z}}\Phi` of the root datum
   :math:`R` together with the projection
   :math:`\Lambda\rightarrow\Lambda/{\mathbb{Z}}\Phi`. See
   Subsection :ref:`SubsectRDIsogeny`.

.. magma:function:: IsogenyGroup(R)
   :input_types: RootDtm
   :output_types: GrpAb, Map
   :label: IsogenyGroup_RootDtm

   The isogeny group :math:`X/{\mathbb{Z}}\Phi` of the root datum :math:`R`
   together with the projection :math:`X\rightarrow X/{\mathbb{Z}}\Phi`. If
   :math:`R` is semisimple, the injection
   :math:`X/{\mathbb{Z}}\Phi\rightarrow\Lambda/{\mathbb{Z}}\Phi` is also returned.
   See Subsection :ref:`SubsectRDIsogeny`.

.. magma:function:: CoisogenyGroup(R)
   :input_types: RootDtm
   :output_types: GrpAb, Map
   :label: CoisogenyGroup_RootDtm

   The coisogeny group :math:`Y/{\mathbb{Z}}\Phi^\star` of the root datum :math:`R`
   together with the projection :math:`Y\rightarrow Y/{\mathbb{Z}}\Phi^\star`. If
   :math:`R` is semisimple, the projection
   :math:`Y/{\mathbb{Z}}\Phi^\star\rightarrow\Lambda/{\mathbb{Z}}\Phi` is also
   returned. See Subsection :ref:`SubsectRDIsogeny`.

.. magma:example:: Example: Isogeny Groups
   :label: IsogenyGroups

   In the semisimple case, the fundamental group contains the isogeny group, with
   quotient isomorphic to the coisogeny group. Nonsemisimple root data have
   infinite isogeny groups.

   .. code-block:: magma

      > R := RootDatum("A5" : Isogeny := 3);
      > F := FundamentalGroup(R);
      > G := IsogenyGroup(R);
      > H := CoisogenyGroup(R);
      > #G * #H eq #F;
      true
      %%a> assert $1;
      > R := StandardRootDatum("A", 5);
      > IsogenyGroup(R);
      Abelian Group isomorphic to Z
      Defined on 1 generator (free)
