Ticket #13838: trac_13871-virtual_cartan_type-ts.patch

File trac_13871-virtual_cartan_type-ts.patch, 13.4 KB (added by tscrim, 9 years ago)
  • sage/combinat/root_system/all.py

    # HG changeset patch
    # Parent d05a606cf1c917715737172c3a2f95a63ca888e2
    Trac 13871 - Implemented virtual Cartan types
    
    diff --git a/sage/combinat/root_system/all.py b/sage/combinat/root_system/all.py
    a b from sage.misc.lazy_import import lazy_i 
    22lazy_import('sage.combinat.root_system.associahedron', 'Associahedron')
    33
    44from cartan_type import CartanType
     5from virtual_cartan_type import VirtualCartanType
    56from dynkin_diagram import DynkinDiagram, dynkin_diagram
    67from cartan_matrix import cartan_matrix
    78from coxeter_matrix import coxeter_matrix
  • sage/combinat/root_system/cartan_type.py

    diff --git a/sage/combinat/root_system/cartan_type.py b/sage/combinat/root_system/cartan_type.py
    a b class CartanTypeFactory(SageObject): 
    400400            t = args
    401401        if isinstance(t, CartanType_abstract):
    402402            return t
     403        from sage.combinat.root_system.virtual_cartan_type import VirtualCartanType
     404        if isinstance(t, VirtualCartanType):
     405            return t.cartan_type
    403406        if hasattr(t, "cartan_type"):
    404407            return  t.cartan_type()
    405408
    class CartanType_crystalographic(CartanT 
    12351238            O---O---O---O=<=O
    12361239            2   2   2   2   4
    12371240
     1241        TESTS:
     1242
     1243        Check that this is compatible with :class:`VirtualCartanType`::
     1244
     1245            sage: vct = VirtualCartanType(['C', 4, 1])
     1246            sage: CartanType(vct)
     1247            ['C', 4, 1]
    12381248        """
    12391249        from sage.matrix.constructor import matrix, diagonal_matrix
    12401250        m = self.cartan_matrix()
  • sage/combinat/root_system/type_relabel.py

    diff --git a/sage/combinat/root_system/type_relabel.py b/sage/combinat/root_system/type_relabel.py
    a b class CartanType(UniqueRepresentation, S 
    7979            B4
    8080
    8181        And relabel its nodes::
    82        
     82
    8383            sage: cycle = {1:2, 2:3, 3:4, 4:1}
    8484
    8585            sage: T = T.relabel(cycle)
    class CartanType(UniqueRepresentation, S 
    229229        """
    230230        EXAMPLES::
    231231
    232            sage: ct = CartanType(['F', 4]).dual()
    233            sage: ct.is_irreducible()
    234            True
     232            sage: ct = CartanType(['G', 2]).relabel({1:2,2:1})
     233            sage: ct.is_irreducible()
     234            True
    235235        """
    236236        return self._type.is_irreducible()
    237237       
    class CartanType(UniqueRepresentation, S 
    239239        """
    240240        EXAMPLES::
    241241
    242            sage: ct = CartanType(['F', 4]).dual()
    243            sage: ct.is_finite()
    244            True
     242            sage: ct = CartanType(['G', 2]).relabel({1:2,2:1})
     243            sage: ct.is_finite()
     244            True
    245245        """
    246246        return self._type.is_finite()
    247247
    class CartanType(UniqueRepresentation, S 
    249249        """
    250250        EXAMPLES::
    251251
    252            sage: ct = CartanType(['F', 4]).dual()
    253            sage: ct.is_crystalographic()
    254            True
     252            sage: ct = CartanType(['G', 2]).relabel({1:2,2:1})
     253            sage: ct.is_crystalographic()
     254            True
    255255        """
    256256        return self._type.is_crystalographic()
    257257
    class CartanType(UniqueRepresentation, S 
    259259        """
    260260        EXAMPLES::
    261261
    262            sage: ct = CartanType(['F', 4]).dual()
    263            sage: ct.is_affine()
    264            False
     262            sage: ct = CartanType(['G', 2]).relabel({1:2,2:1})
     263            sage: ct.is_affine()
     264            False
    265265        """
    266266        return self._type.is_affine()
    267267
    class CartanType(UniqueRepresentation, S 
    269269        """
    270270        EXAMPLES::
    271271
    272            sage: ct = CartanType(['F', 4]).dual()
    273            sage: ct.rank()
    274            4
     272            sage: ct = CartanType(['G', 2]).relabel({1:2,2:1})
     273            sage: ct.rank()
     274            2
    275275        """
    276276        return self._type.rank()
    277277
    class CartanType(UniqueRepresentation, S 
    279279        """
    280280        EXAMPLES::
    281281
    282            sage: ct = CartanType(['F', 4]).dual()
    283            sage: ct.index_set()
    284            [1, 2, 3, 4]
     282            sage: ct = CartanType(['G', 2]).relabel({1:2,2:1})
     283            sage: ct.index_set()
     284            [1, 2]
    285285        """
    286286        return self._index_set
    287287
    class CartanType(UniqueRepresentation, S 
    304304            BC3~* relabelled by {0: 1, 1: 2, 2: 3, 3: 0}
    305305        """
    306306        return self._type.dual().relabel(self._relabelling)
     307   
     308    def type(self):
     309        """
     310        Return the type of ``self`` or ``None`` if unknown.
     311
     312        EXAMPLES::
     313
     314            sage: ct = CartanType(['G', 2]).relabel({1:2,2:1})
     315            sage: ct.type()
     316            'G'
     317        """
     318        return self._type.type()
    307319
    308320
    309321###########################################################################
  • new file sage/combinat/root_system/virtual_cartan_type.py

    diff --git a/sage/combinat/root_system/virtual_cartan_type.py b/sage/combinat/root_system/virtual_cartan_type.py
    new file mode 100644
    - +  
     1r"""
     2Virtual Cartan types
     3
     4AUTHORS:
     5
     6- Travis Scrimshaw (2013-01-12) - Initial version
     7"""
     8#*****************************************************************************
     9#       Copyright (C) 2013 Travis Scrimshaw <tscrim@ucdavis.edu>
     10#
     11#  Distributed under the terms of the GNU General Public License (GPL)
     12#
     13#    This code is distributed in the hope that it will be useful,
     14#    but WITHOUT ANY WARRANTY; without even the implied warranty of
     15#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16#    General Public License for more details.
     17#
     18#  The full text of the GPL is available at:
     19#
     20#                  http://www.gnu.org/licenses/
     21#*****************************************************************************
     22
     23from sage.misc.cachefunc import cached_method
     24from sage.misc.abstract_method import abstract_method
     25from sage.rings.all import ZZ
     26from sage.structure.unique_representation import UniqueRepresentation
     27from sage.combinat.root_system.cartan_type import CartanType
     28
     29class VirtualCartanType(UniqueRepresentation):
     30    """
     31    A virtual Cartan type.
     32
     33    Given an affine Cartan type `X`, we say `\hat{X}` is a virtual Cartan
     34    type of `X` if there exists am affine folding of the Dynkin diagram of
     35    `\hat{X}` onto `X`.
     36
     37    An affine folding of (the Dynkin diagram of) `X` is an automorphism
     38    `\sigma` of `X` which fixes the `0` node. The resulting Dynkin diagram
     39    induced by `I / \sigma` where `I` is the index set of `X`. By abuse of
     40    notation, we will denote the folding by `\sigma`.
     41
     42    We also have multiplication factors `\gamma_i` where `i \in I` induced
     43    by the folding `\sigma`. We define `\gamma_i` as follows:
     44
     45    1. There exists a unique arrow (multiple bond) in `X`.
     46
     47        a. Suppose the arrow points towards 0. Then `\gamma_i = 1` for all
     48           `i \in I`.
     49        b. Otherwise `\gamma_i` is the order of `\sigma` for all `i` in the
     50           connected component of 0 after removing the arrow, else
     51           `\gamma_i = 1`.
     52
     53    2. There is not a unique arrow. Thus `\hat{X} = A_{2n-1}^{(1)}` and
     54       `\gamma_i = 1` for all `1 \leq i \leq n-1`. If `i \in \{0, n\}`, then
     55       `\gamma_i = 2` if the arrow indicent to `i` points away and is `1`
     56       otherwise.
     57
     58    The default embeddings we consider here are:
     59
     60    .. MATH::
     61
     62        C_n^{(1)}, A_{2n}^{(2)}, A_{2n}^{(2)\dagger}, D_{n+1}^{(2)}
     63        \hookrightarrow A_{2n-1}^{(1)}
     64
     65        A_{2n-1}^{(2)}, B_n^{(1)} \hookrightarrow D_{n+1}^{(1)}
     66
     67        E_6^{(2)}, F_4^{(1)} \hookrightarrow E_6^{(1)}
     68
     69        D_4^{(3)}, G_2^{(1)} \hookrightarrow D_4^{(1)}
     70
     71    and were chosen based on virtual crystals.
     72
     73    If the Cartan type is simply laced, this is the folding induced from the
     74    identity map.
     75
     76    For more information in Cartan types, see
     77    :mod:`sage.combinat.root_system.cartan_type`.
     78
     79    To consider a folding that is not one of the default embeddings, one may
     80    pass in an optional second argument ``virtual_data``. See below.
     81
     82    INPUT:
     83
     84    - ``cartan_type`` -- The Cartan type `X` to create a virtual crystal of
     85
     86    - ``virtual_data`` -- (Optional, default: ``None``) A tuple
     87      ``(virtual, gamma, sigma)`` where:
     88
     89      - ``virtual`` -- the codomain of the embedding,
     90      - ``gamma`` -- the multiplication factors,
     91      - ``sigma`` -- the Dynkin diagram automorphism.
     92
     93    EXAMPLES::
     94
     95        sage: vct = VirtualCartanType(['C',4,1]); vct
     96        Virtual Cartan type of ['C', 4, 1] in ['A', 7, 1]
     97
     98    If the Cartan type is simply-laced, then just consider it a virtual type
     99    of itself::
     100
     101        sage: vct = VirtualCartanType(['A',4,1]); vct
     102        Virtual Cartan type of ['A', 4, 1] in ['A', 4, 1]
     103    """
     104    @staticmethod
     105    def __classcall_private__(cls, cartan_type, virtual_data=None):
     106        """
     107        Normalize input to ensure a unique representation.
     108
     109        EXAMPLES::
     110
     111            sage: vct1 = VirtualCartanType(['C',4,1])
     112            sage: vct2 = VirtualCartanType(CartanType(['C',4,1]))
     113            sage: vct3 = VirtualCartanType(vct2)
     114            sage: vct1 is vct2, vct1 is vct3
     115            (True, True)
     116        """
     117        if isinstance(cartan_type, VirtualCartanType):
     118            return cartan_type
     119        cartan_type = CartanType(cartan_type)
     120        if virtual_data is not None:
     121            virtual_data = (CartanType(virtual_data[0]), tuple(virtual_data[1]), tuple(virtual_data[2]))
     122        return super(VirtualCartanType, cls).__classcall__(cls, cartan_type, virtual_data)
     123
     124    def __init__(self, cartan_type, virtual_data):
     125        """
     126        Initialize ``self``.
     127
     128        EXAMPLES::
     129
     130            sage: vct = VirtualCartanType(['C',4,1]); vct
     131            Virtual Cartan type of ['C', 4, 1] in ['A', 7, 1]
     132            sage: TestSuite(vct).run()
     133        """
     134        if not cartan_type.is_affine():
     135            raise ValueError("%s must be an affine type"%cartan_type)
     136
     137        gamma = None # Embedding multiplier
     138        sigma = None # Dynkin diagram cosets
     139
     140        # Determine if this is a virtual crystal
     141        type = cartan_type.type()
     142        if virtual_data is not None:
     143            virtual = virtual_data[0]
     144            gamma = virtual_data[1]
     145            sigma = virtual_data[2]
     146            #raise ValueError("%s is not a virtual Cartan type of %s"%cartan_type, virtual)
     147        elif cartan_type.is_simply_laced():
     148            virtual = cartan_type
     149            rank = cartan_type.rank()
     150            gamma = [1]*rank
     151            sigma = [[i] for i in range(rank)]
     152        elif cartan_type.is_untwisted_affine():
     153            if type == 'B':
     154                n = cartan_type.n
     155                virtual = CartanType(['D', n + 1, 1])
     156                gamma = [2]*n + [1]
     157                sigma = [[i] for i in range(n)] + [[n, n+1]]
     158            elif type == 'C':
     159                n = cartan_type.n
     160                virtual = CartanType(['A', 2*n - 1, 1])
     161                gamma = [2] + [1]*(n-1) + [2]
     162                sigma = [[0]] + [[i, 2*n-i] for i in range(1, n)] + [[n]]
     163            elif type == 'F':
     164                virtual = CartanType(['E', 6, 1])
     165                gamma = [2, 2, 2, 1, 1]
     166                sigma = [[0], [2], [4], [3, 5], [1, 6]]
     167            elif type == 'G':
     168                virtual = CartanType(['D', 4, 1])
     169                gamma = [3, 1, 3]
     170                sigma = [[0], [1, 3, 4], [2]]
     171        else:
     172            if type == 'BC': # A_{2n}^{(2)}
     173                n = cartan_type.classical().n
     174                virtual = CartanType(['A', 2*n - 1, 1])
     175                gamma = [1]*n + [2]
     176                sigma = [[0]] + [[i, 2*n-i] for i in range(1, n)] + [[n]]
     177            elif cartan_type.dual().type() == 'BC': # A_{2n}^{(2)\dagger}
     178                n = cartan_type.classical().n
     179                virtual = CartanType(['A', 2*n - 1, 1])
     180                gamma = [2] + [1]*n
     181                sigma = [[0]] + [[i, 2*n-i] for i in range(1, n)] + [[n]]
     182            elif cartan_type.dual().type() == 'B': # A_{2n-1}^{(2)}
     183                n = cartan_type.classical().n
     184                virtual = CartanType(['D', n + 1, 1])
     185                gamma = [1]*(n+1)
     186                sigma = [[i] for i in range(n)] + [[n, n+1]]
     187            elif cartan_type.dual().type() == 'C': # D_{n+1}^{(2)}
     188                n = cartan_type.classical().n
     189                virtual = CartanType(['A', 2*n-1, 1])
     190                gamma = [1]*(n+1)
     191                sigma = [[0]] + [[i, 2*n-i] for i in range(1, n)] + [[n]]
     192            elif cartan_type.dual().type() == 'F': # E_6^{(2)}
     193                virtual = CartanType(['E', 6, 1])
     194                gamma = [1, 1, 1, 1, 1]
     195                sigma = [[0], [2], [4], [3, 5], [1, 6]]
     196            elif cartan_type.dual().type() == 'G': # D_4^{(3)}
     197                # Get rid of the relabeling...
     198                cartan_type = CartanType(['G',2,1]).dual()
     199                virtual = CartanType(['D', 4, 1])
     200                gamma = [1, 1, 1]
     201                sigma = [[0], [1, 3, 4], [2]]
     202
     203        self.cartan_type = cartan_type
     204        self.virtual = virtual
     205        self.gamma = gamma
     206        self.sigma = sigma
     207
     208    def __repr__(self):
     209        """
     210        Return a string representation of ``self``.
     211
     212        EXAMPLES::
     213
     214            sage: vct = VirtualCartanType(['C',4,1]); vct # indirect doctest
     215            Virtual Cartan type of ['C', 4, 1] in ['A', 7, 1]
     216        """
     217        return "Virtual Cartan type of %s in %s"%(self.cartan_type,self.virtual)