.. _SectCartanCarMat:

.. _cartanmat:

Cartan Matrices
===============

A *Cartan matrix* is a real valued matrix :math:`C=(c_{ij})_{i,j=1}^n`
satisfying the properties:

1. :math:`c_{ii}=2`;

2. :math:`c_{ij}\le 0` for :math:`i\ne j`;

3. :math:`c_{ij}=0` if, and only if, :math:`c_{ji}=0`; and

4. if :math:`n_{ij}:=c_{ij}c_{ji}<4`, then :math:`n_{ij}=4\cos^2(\pi/m_{ij})`
for some integer :math:`m_{ij}\ge2`. In Magma, Cartan matrices can be defined
over the integer ring (Chapter :ref:`RngInt`), the rational field
(Chapter :ref:`FldRat`), number fields
(Chapter :ref:`FldNum:main`), and cyclotomic fields
(Chapter :ref:`ChapFldCyc`). The real field
(Chapter :ref:`ChapFldRe`) is *not* allowed since it is not infinite
precision. A Cartan matrix is called *crystallographic* if all its entries are
integers.

Given a Cartan matrix, the corresponding Coxeter matrix
:math:`M=(m_{ij})_{i,j=1}^n` is defined by :math:`m_{ii}=1`; :math:`m_{ij}` as
in (4) if :math:`n_{ij}<4`; :math:`m_{ij}=\infty` (ie, :math:`0`) if
:math:`n_{ij}\ge 4`. The significance of Cartan matrices is due to the following
construction: Let :math:`X` be a real inner-product space with basis
:math:`\alpha_1,\dots,\alpha_n`. Take the unique basis
:math:`\alpha^\star_1,\dots,\alpha^\star_n` for :math:`X` such that
:math:`(\alpha_i,\alpha_j^\star)=c_{ij}`. Let :math:`s_i` be the reflection in
:math:`\alpha_i` and :math:`\alpha_i^\star`, i.e. :math:`s_i:V\rightarrow V` is
defined by :math:`vs_i= v-(v,\alpha_i^\star)\alpha_i`. Then the group generated
by :math:`s_1,\dots,s_n` is a Coxeter group with Coxeter matrix :math:`M`. In
other words, a Cartan matrix specifies a faithful representation of the Coxeter
group as a real reflection group. For more details on reflection groups see
Chapter :ref:`ChapGrpRfl`.

.. magma:function:: \name{IntrIsCart}{IsCartanMatrix}(C)
   :input_types: AlgMatElt
   :output_types: BoolElt
   :parameters: RealInjection : Any : \texttt{false}

   Returns ``true`` if, and only if, the matrix :math:`C` is a Cartan matrix.

   Number field elements and cyclotomic field elements do not have a natural
   identification with real numbers. The ``RealInjection`` flag allows the user to
   provide one. If the base field of :math:`C` is a number field, the flag should
   be an injection into the real field; if the base field is cyclotomic, the flag
   should be an injection into the complex field taking real values on the entries
   of :math:`C`. If no real injection is given, conditions (2) and (4) of the
   definition are not checked.

.. magma:function:: CartanMatrix(M)
   :input_types: AlgMatElt
   :output_types: AlgMatElt
   :label: CartanMatrix_AlgMatElt

.. magma:function:: CartanMatrix(G)
   :input_types: GrphUnd
   :output_types: AlgMatElt
   :label: CartanMatrix_GrphUnd

Symmetric : BoolElt : ``false``

BaseField : MonStgElt : “NumberField"

A Cartan matrix corresponding to the Coxeter matrix :math:`M` or Coxeter graph
:math:`G`. Note that the Cartan matrix of a Coxeter system is not unique. By
default this function returns the Cartan matrix with
:math:`c_{ij}=-4\cos^2(\pi/m_{ij})`, :math:`c_{ji}=-1` when :math:`m_{ij}\ne2`
and :math:`i<j`. This matrix is crystallographic whenever there exists a
crystallographic Cartan matrix corresponding to :math:`M`.

If the ``Symmetric`` flag is set ``true``, the symmetric Cartan matrix with

.. math:: c_{ij}=c_{ji}=-2\cos(\pi/m_{ij})

is returned.

The ``BaseField`` flag determines the field over which the Cartan matrix is
defined. If the matrix is crystallographic however, it is defined over the
integers regardless of the value of this flag. The possible values are:

1. ``"NumberField"``: An algebraic number field. This is the default. See
Chapter :ref:`FldNum:main`.

2. ``"Cyclotomic"`` or ``"SparseCyclotomic"``: A cyclotomic field with the
sparse representation for elements. See Chapter :ref:`ChapFldCyc`.

3. ``"DenseCyclotomic"``: A cyclotomic field with the dense representation for
elements. See Chapter :ref:`ChapFldCyc`.

.. magma:function:: CartanMatrix(D)
   :input_types: GrphDir
   :output_types: AlgMatElt
   :label: CartanMatrix_GrphDir

   The crystallographic Cartan matrix corresponding to the Dynkin digraph
   :math:`D`.

.. magma:example:: Example: Cartan Matrix Construction
   :label: CartanMatrixConstruction

   .. code-block:: magma

      > C := Matrix(2,2, [ 2,-3, -1,2 ]);
      > C;
      > IsCartanMatrix(C);
      true
      %%a> assert $1;
      > CoxeterMatrix(C);
      [1 6]
      [6 1]
      > 
      > G := PathGraph(4);
      > AssignLabel(G, 1,2, 4);
      > AssignLabel(G, 3,4, 4);
      > CartanMatrix(G);
      [ 2 -2  0  0]
      [-1  2 -1  0]
      [ 0 -1  2 -2]
      [ 0  0 -1  2]
      > CartanMatrix(G : Symmetric, BaseField := "Cyclotomic");
      [2 zeta(8)_8^3 - zeta(8)_8 0 0]
      [zeta(8)_8^3 - zeta(8)_8 2 -1 0]
      [0 -1 2 zeta(8)_8^3 - zeta(8)_8]
      [0 0 zeta(8)_8^3 - zeta(8)_8 2]

.. magma:function:: IsCoxeterIsomorphic(C1, C2)
   :input_types: AlgMatElt, AlgMatElt
   :output_types: RngIntElt
   :label: IsCoxeterIsomorphic_AlgMatElt_AlgMatElt

   Tests if the Cartan matrices :math:`C_1` and :math:`C_2` give rise to isomorphic
   Coxeter systems; i.e., their Coxeter matrices are equal modulo a permutation of
   the underlying basis. If ``true``, a sequence giving the permutation of the
   underlying basis which takes the Coxeter matrix of :math:`C_1` to the Coxeter
   matrix of :math:`C_2` is also returned.

.. magma:function:: IsCartanEquivalent(C1, C2)
   :input_types: AlgMatElt, AlgMatElt
   :output_types: BoolElt
   :label: IsCartanEquivalent_AlgMatElt_AlgMatElt

   Returns ``true`` if, and only if, the crystallographic Cartan matrices
   :math:`C_1` and :math:`C_2` are Cartan equivalent, i.e. they are equal modulo
   permutation of the underlying basis. If so, a sequence giving the permutation of
   the underlying basis which takes :math:`C_1` to :math:`C_2` is also returned.

.. magma:example:: Example: Cartan Matrix Equivalence
   :label: CartanMatrixEquivalence

   Cartan equivalence is a stronger condition than Coxeter isomorphism.

   .. code-block:: magma

      > C1 := Matrix(2,2, [ 2,-2, -2,2 ]);
      > C2 := Matrix(2,2, [ 2,-1, -5,2 ]);
      > IsCoxeterIsomorphic(C1, C2);
      true [ 1, 2 ]
      > IsCartanEquivalent(C1, C2);
      false
      %%a> assert not $1;

.. magma:function:: NumberOfPositiveRoots(C)
   :input_types: AlgMatElt
   :output_types: RngIntElt
   :label: NumberOfPositiveRoots_AlgMatElt

.. magma:function:: NumPosRoots(C)
   :input_types: AlgMatElt
   :output_types: RngIntElt
   :label: NumPosRoots_AlgMatElt

   The number of positive roots of the root system with Cartan matrix :math:`C`.
   See Subsection :ref:`SubsectRSPosSimple` for the definition
   of positive roots.

.. magma:function:: CoxeterGroupOrder(C)
   :input_types: AlgMatElt
   :output_types: .
   :label: CoxeterGroupOrder_AlgMatElt

.. magma:function:: CoxeterGroupFactoredOrder(C)
   :input_types: AlgMatElt
   :output_types: .
   :label: CoxeterGroupFactoredOrder_AlgMatElt

   The (factored) order of the Coxeter group with Cartan matrix :math:`C`.

.. magma:function:: FundamentalGroup(C)
   :input_types: AlgMatElt
   :output_types: GrpAb
   :label: FundamentalGroup_AlgMatElt

   The fundamental group of the crystallographic Cartan matrix :math:`C`,
   i.e. :math:`{\mathbb{Z}}^n/\Gamma` where :math:`n` is the degree of :math:`C`
   and :math:`\Gamma` is the lattice generated by the rows of :math:`C`. The
   natural mapping :math:`{\mathbb{Z}}^n\to{\mathbb{Z}}^n/\Gamma` is the second
   returned value.

.. magma:example:: Example: Cartan Matrix Operations
   :label: CartanMatrixOperations

   .. code-block:: magma

      > C := CartanMatrix(PathGraph(4));
      > FundamentalGroup(C);
      Abelian Group isomorphic to Z/5
      Defined on 1 generator
      Relations:
          5*$.1 = 0
      Mapping from: Standard Lattice of rank 4 and degree 4 to Abelian Group
      isomorphic to Z/5
      Defined on 1 generator
      Relations:
          5*$.1 = 0

.. magma:function:: IsCoxeterIrreducible(C)
   :input_types: AlgMatElt
   :output_types: BoolElt
   :label: IsCoxeterIrreducible_AlgMatElt

   Returns ``true`` if, and only if, :math:`C` is the Cartan matrix of an
   irreducible Coxeter system. If the Coxeter matrix is reducible, this function
   also returns a nontrivial subset :math:`I` of :math:`\{1,\dots,n\}` such that
   :math:`m_{ij}=2` (i.e. :math:`c_{ij}=0`) whenever :math:`i\in I`,
   :math:`j\notin I`.

.. magma:function:: IsCrystallographic(C)
   :input_types: AlgMatElt
   :output_types: BoolElt
   :label: IsCrystallographic_AlgMatElt

   Returns ``true`` if, and only if, the Cartan matrix :math:`C` is
   crystallographic, i.e. :math:`C` has integral entries.

.. magma:function:: IsSimplyLaced(C)
   :input_types: AlgMatElt
   :output_types: BoolElt
   :label: IsSimplyLaced_AlgMatElt

   Returns ``true`` if, and only if, the Cartan matrix :math:`C` is simply laced,
   i.e. all the entries in its Coxeter matrix are 1, 2, or 3.

.. magma:example:: Example: Cartan Matrix Properties
   :label: CartanMatrixProperties

   .. code-block:: magma

      > C := Matrix(2,2, [ 2,-2, -2,2 ]);
      > IsCoxeterIrreducible(C);
      true
      %%a> assert $1;
      > IsCrystallographic(C);
      true
      %%a> assert $1;
      > IsSimplyLaced(C);
      false
      %%a> assert not $1;
