Ticket #5794: trac_5794-more-exceptional.patch

File trac_5794-more-exceptional.patch, 33.2 KB (added by bump, 13 years ago)
  • sage/combinat/root_system/all.py

    # HG changeset patch
    # User Daniel Bump <bump@match.stanford.edu>
    # Date 1242852919 25200
    # Node ID d08a5b0589dced39b0df63fff168b21730f7dabf
    # Parent  cce35f128d34ffdbdd944067dd21298ad95cc34d
    Further exceptional branching rules
    
    diff --git a/sage/combinat/root_system/all.py b/sage/combinat/root_system/all.py
    a b  
    44from coxeter_matrix import coxeter_matrix
    55from root_system import RootSystem, WeylDim
    66from weyl_group import WeylGroup, WeylGroupElement
    7 from weyl_characters import WeylCharacter, WeylCharacterRing, branch_weyl_character, WeightRing, WeightRingElement, branching_rule_from_plethysm
     7from weyl_characters import WeylCharacter, WeylCharacterRing, branch_weyl_character, WeightRing, WeightRingElement, branching_rule_from_plethysm, get_branching_rule
  • sage/combinat/root_system/weyl_characters.py

    diff --git a/sage/combinat/root_system/weyl_characters.py b/sage/combinat/root_system/weyl_characters.py
    a b  
    536536
    537537    In the coroot style the Lie group or Lie algebra is treated as
    538538    semisimple, so you lose the distinction between GL(n) and
    539     SL(n). It gives you output that is comparable to that
    540     in Tables of Dimensions, Indices and Branching Rules for
    541     Representations of Simple Lie Algebras (Marcel Dekker, 1981).
     539    SL(n); you also some information about representations of E6
     540    and E7 for the same reason. The coroot style gives you output
     541    that is comparable to that in Tables of Dimensions, Indices
     542    and Branching Rules for Representations of Simple Lie Algebras
     543    (Marcel Dekker, 1981).
    542544
    543545    EXAMPLES::
    544546   
     
    642644        self._cache = cache
    643645        if cache:
    644646            self._irreducibles={}
     647        if ct.is_irreducible() and ct[0] == 'E':
     648            self._v0 = self._space([0,0,0,0,0,0,1,1])
     649            self._v1 = self._space([0,0,0,0,0,-2,1,-1])
    645650
    646651    def __call__(self, *args):
    647652        """
     
    705710
    706711        # if style == "coroots" and type == 'A' subtract a power of det to put self in SL(r+1,CC)
    707712        if self._style == "coroots":
    708             x = self.coerce_to_sl(x)
     713            if self._cartan_type.is_irreducible() and self._cartan_type[0] == 'E':
     714                if self._rank == 6:
     715                    x = self.coerce_to_e6(x)
     716                elif self._rank == 7:
     717                    x = self.coerce_to_e7(x)
     718            else:
     719                x = self.coerce_to_sl(x)
    709720
    710721        alphacheck = self._space.simple_coroots()
    711722        vp = [x.inner_product(alphacheck[i]) for i in self._cartan_type.index_set()]
     
    725736
    726737    def coerce_to_sl(self, x):
    727738        """
    728         For type ['A',r], this coerces an element of the ambient space into SL(r+1,CC)
    729         by subtracting a (possibly fractional) power of the determinant.
     739        For type ['A',r], this coerces an element of the ambient space into the
     740        root space by orthogonal projection. The root space has codimension one
     741        and corresponds to the Lie algebra of SL(r+1,CC), whereas the full weight
     742        space corresponds to the Lie algebra of GL(r+1,CC). So this operation
     743        corresponds to multiplication by a (possibly fractional) power of the
     744        determinant to give a weight determinant one.
     745
     746        EXAMPLES::
     747
     748            sage: A2=WeylCharacterRing("A2")
     749            sage: [A2.coerce_to_sl(fw) for fw in A2.fundamental_weights()]
     750            [(2/3, -1/3, -1/3), (1/3, 1/3, -2/3)]
    730751        """
    731752        if self._cartan_type.is_irreducible():
    732753            if self._cartan_type[0] == 'A':
     
    741762                    x = x - self._space.inject_weights(i, s)
    742763        return x
    743764
     765    def coerce_to_e7(self, x):
     766        """
     767        For type E8, this orthogonally projects an element of the E8 root
     768        lattice into the E7 root lattice. This operation on weights
     769        corresponds to intersection with the semisimple subgroup E7.
     770        """
     771        ret = x - (x.inner_product(self._v0)/2)*self._v0
     772        return ret
     773
     774    def coerce_to_e6(self, x):
     775        """
     776        For type E7 or E8, orthogonally projects an element of the root lattice
     777        into the E6 root lattice. This operation on weights corresponds to
     778        intersection with the semisimple subgroup E7.
     779        """
     780        x = x - (x.inner_product(self._v0)/2)*self._v0
     781        return  x - (x.inner_product(self._v1)/6)*self._v1
     782
    744783    def __repr__(self):
    745784        """
    746785        EXAMPLES::
     
    818857        """
    819858        return self._space.simple_coroots()
    820859
     860    def highest_root(self):
     861        """
     862        Returns the highest_root.
     863
     864        EXAMPLES::
     865
     866            sage: WeylCharacterRing("G2").highest_root()
     867             (2, -1, -1)
     868        """
     869        return self._space.highest_root()
     870
    821871    def positive_roots(self):
    822872        """
    823873        Returns the positive roots.
     
    944994    def irr_repr(self, hwv):
    945995        """
    946996        Return a string representing the irreducible character with highest
    947         weight vectr hwv.
     997        weight vector hwv.
    948998       
    949999        EXAMPLES::
    9501000       
     
    10811131       ['C',r] => ['C',r-1]
    10821132       ['D',r] => ['A',r-1]
    10831133       ['D',r] => ['D',r-1]
    1084        ['E',r] => ['A',r-1] r = 6,7,8 (not implemented yet)
    1085        ['E',r] => ['D',r-1] r = 6,7,8 (not implemented yet)
    1086        ['E',r] => ['E',r-1] r = 6,7 (not implemented yet)
     1134       ['E',r] => ['A',r-1] r = 7,8
     1135       ['E',r] => ['D',r-1] r = 6,7,8
     1136       ['E',r] => ['E',r-1]
    10871137       F4 => B3
    10881138       F4 => C3
    10891139       G2 => A1 (short root)
    10901140   
    1091     The other Levi branching rule from G2 => A1 corresponding to the
    1092     long root is available by first branching G_2 => A_2 then A2 => A1.
    1093    
     1141    Not all Levi subgroups are maximal subgroups. If the Levi is not
     1142    maximal there may or may not be a preprogrammed rule="levi" for
     1143    it. If there is not, the branching rule may still be obtained by going
     1144    through an intermediate subgroup that is maximal using rule="extended".
     1145    Thus the other Levi branching rule from G2 => A1 corresponding to the
     1146    long root is available by first branching G2 => A_2 then A2 => A1.
     1147    Similarly the branching rules to the Levi subgroup::
     1148
     1149       ['E',r] => ['A',r-1] r = 6,7,8
     1150
     1151    may be obtained by first branching E6=>A5xA1, E7=>A7 or E8=>A8.
     1152
    10941153    AUTOMORPHIC TYPE. If the Dynkin diagram has a symmetry, then there
    10951154    is an automorphism that is a special case of a branching rule.
    10961155    There is also an exotic "triality" automorphism of D4 having order
    1097     3. Use rule="automorphic" or (for D4) rule="triality"
     1156    3. Use rule="automorphic" or (for D4) rule="triality"::
    10981157   
    1099     ['A',r] => ['A',r]
    1100     ['D',r] => ['D',r]
    1101     E6 => E6 (not implemented yet)
     1158        ['A',r] => ['A',r]
     1159        ['D',r] => ['D',r]
     1160        E6 => E6
    11021161   
    11031162    SYMMETRIC TYPE. Related to the automorphic type, when either
    11041163    the Dynkin diagram or the extended diagram has a symmetry
    11051164    there is a branching rule to the subalgebra (or subgroup) of
    11061165    invariants under the automorphism. Use rule="symmetric".
    11071166    The last branching rule, D4=>G2 is not to a maximal subgroup
    1108     since D4=>B3=>G2, but it is included for convenience.
     1167    since D4=>B3=>G2, but it is included for convenience. ::
    11091168   
    1110     ['A',2r+1] => ['B',r]
    1111     ['A',2r] => ['C',r]
    1112     ['A',2r] => ['D',r]
    1113     ['D',r] => ['B',r-1]
    1114     E6 => F4
    1115     D4 => G2
     1169        ['A',2r+1] => ['B',r]
     1170        ['A',2r] => ['C',r]
     1171        ['A',2r] => ['D',r]
     1172        ['D',r] => ['B',r-1]
     1173        E6 => F4
     1174        D4 => G2
    11161175   
    11171176    EXTENDED TYPE. If removing a node from the extended Dynkin diagram
    11181177    results in a Dynkin diagram, then there is a branching rule. Use
    11191178    rule="extended" for these. We will also use this classification
    11201179    for some rules that are not of this type, mainly involving type B,
    11211180    such as D6 => B3xB3.
     1181
     1182    Here is the extended Dynkin diagram for D6::
    11221183   
    1123     G2 => A2
    1124     ['B',r] => ['D',r]
    1125     F4 => B4
    1126     E7 => A7 (not implemented yet)
    1127     E8 => A8 (not implemented yet)
    1128    
    1129     Here is the extended Dynkin diagram for D6:
    1130    
    1131         0       6
    1132         O       O
    1133         |       |
    1134         |       |
    1135     O---O---O---O---O
    1136     1   2   3   4   6
     1184            0       6
     1185            O       O
     1186            |       |
     1187            |       |
     1188        O---O---O---O---O
     1189        1   2   3   4   6
    11371190
    11381191    Removing the node 3 results in an embedding D3xD3 -> D6. This
    11391192    corresponds to the embedding SO(6)xSO(6) -> SO(12), and is of
     
    11471200    where O(a) = ['D',r] (a=2r) or ['B',r] (a=2r+1)
    11481201    and Sp(2r)=['C',r].
    11491202
    1150     TENSOR: There are branching rules
     1203    The following rules are implemented as special cases of rule="extended". ::
    11511204
    1152     ['A', rs-1] => ['A',r-1] x ['A',s-1]
    1153     ['B',2rs+r+s] => ['B',r] x ['B',s]
    1154     ['D',2rs+s] => ['B',r] x ['D',s]
    1155     ['D',2rs] => ['D',r] x ['D',s]
    1156     ['D',2rs] => ['C',r] x ['C',s]
    1157     ['C',2rs+s] => ['B',r] x ['C',s]
    1158     ['C',2rs] => ['C',r] x ['D',s].
     1205        E6 => A5xA1, A2xA2xA2
     1206        E7 => A7, D6xA1, A3xA3xA1
     1207        E8 => A8, D8, E7xA1, A4xA4, D5xA3, E6xA2
     1208        F4 => B4, C3xA1, A2xA2, A3xA1
     1209        G2 => A1xA1
     1210       
     1211    Note that E8 has only a limited number of representations of reasonably low
     1212    degree.
     1213
     1214    TENSOR: There are branching rules:
     1215    ::
     1216
     1217        ['A', rs-1] => ['A',r-1] x ['A',s-1]
     1218        ['B',2rs+r+s] => ['B',r] x ['B',s]
     1219        ['D',2rs+s] => ['B',r] x ['D',s]
     1220        ['D',2rs] => ['D',r] x ['D',s]
     1221        ['D',2rs] => ['C',r] x ['C',s]
     1222        ['C',2rs+s] => ['B',r] x ['C',s]
     1223        ['C',2rs] => ['C',r] x ['D',s].
    11591224
    11601225    corresponding to the tensor product homomorphism. For type
    11611226    A, the homomorphism is GL(r) x GL(s) -> GL(rs). For the
     
    11681233   
    11691234    The corresponding branching rules are obtained using rule="tensor".
    11701235
    1171 
    11721236    SYMMETRIC POWER: The k-th symmetric and exterior power homomorphisms
    11731237    map GL(n) --> GL(binomial(n+k-1,k)) and GL(binomial(n,k)). The
    11741238    corresponding branching rules are not implemented but a special
    11751239    case is. The k-th symmetric power homomorphism SL(2) --> GL(k+1)
    11761240    has its image inside of SO(2r+1) if k=2r and inside of Sp(2r) if
    1177     k=2r-1. Hence there are branching rules
     1241    k=2r-1. Hence there are branching rules::
    11781242
    1179     ['B',r] => A1
    1180     ['C',r] => A1
     1243        ['B',r] => A1
     1244        ['C',r] => A1
    11811245
    11821246    and these may be obtained using the rule "symmetric_power".
    11831247
    1184     MISCELLANEOUS: Use rule="miscellaneous" for the following rules.
     1248    MISCELLANEOUS: Use rule="miscellaneous" for the following rules::
    11851249   
    1186     B3 => G2
    1187     F4 => G2xA1 (not implemented yet)
     1250        B3 => G2
     1251        F4 => G2xA1 (not implemented yet)
    11881252   
    11891253    BRANCHING RULES FROM PLETHYSMS
    11901254
     
    11941258
    11951259    ISOMORPHIC TYPE: Although not usually referred to as a branching
    11961260    rule, the effects of the accidental isomorphisms may be handled
    1197     using rule="isomorphic"
     1261    using rule="isomorphic"::
    11981262   
    1199     B2 => C2
    1200     C2 => B2
    1201     A3 => D3
    1202     D3 => A3
    1203     D2 => A1xA1
    1204     B1 => A1
    1205     C1 => A1
     1263        B2 => C2
     1264        C2 => B2
     1265        A3 => D3
     1266        D3 => A3
     1267        D2 => A1xA1
     1268        B1 => A1
     1269        C1 => A1
    12061270   
    12071271    EXAMPLES: (Levi type)
    12081272   
     
    12221286        sage: D4 = WeylCharacterRing("D4")
    12231287        sage: D5 = WeylCharacterRing("D5")
    12241288        sage: G2 = WeylCharacterRing("G2")
    1225         sage: F4 = WeylCharacterRing("F4") # long time
     1289        sage: F4 = WeylCharacterRing("F4",style="coroots") # long time
     1290        sage: E6=WeylCharacterRing("E6",style="coroots")
     1291        sage: D5=WeylCharacterRing("D5",style="coroots")
    12261292        sage: [B3(w).branch(A2,rule="levi") for w in B3.fundamental_weights()]
    12271293        [A2(0,0,-1) + A2(0,0,0) + A2(1,0,0),
    12281294         A2(0,-1,-1) + A2(0,0,-1) + A2(0,0,0) + A2(1,0,-1) + A2(1,0,0) + A2(1,1,0),
     
    12631329         D4(1/2,1/2,1/2,-1/2) + D4(1/2,1/2,1/2,1/2)]
    12641330        sage: G2(1,0,-1).branch(A1,rule="levi")
    12651331         A1(0,-1) + A1(1,-1) + A1(1,0)
     1332        sage: E6=WeylCharacterRing("E6",style="coroots") # long time
     1333        sage: D5=WeylCharacterRing("D5",style="coroots") # long time
     1334        sage: fw = E6.fundamental_weights() # long time
     1335        sage: [E6(fw[i]).branch(D5,rule="levi") for i in [1,2,6]] # long time
     1336        [D5(0,0,0,0,0) + D5(0,0,0,0,1) + D5(1,0,0,0,0),
     1337         D5(0,0,0,0,0) + D5(0,0,0,1,0) + D5(0,0,0,0,1) + D5(0,1,0,0,0),
     1338         D5(0,0,0,0,0) + D5(0,0,0,1,0) + D5(1,0,0,0,0)]
     1339        sage: E7=WeylCharacterRing("E7",style="coroots") # long time
     1340        sage: D6=WeylCharacterRing("D6",style="coroots") # long time
     1341        sage: fw = E7.fundamental_weights() # long time
     1342        sage: [E7(fw[i]).branch(D6,rule="levi") for i in [1,2,7]] # long time
     1343        [3*D6(0,0,0,0,0,0) + 2*D6(0,0,0,0,1,0) + D6(0,1,0,0,0,0),
     1344         3*D6(0,0,0,0,0,1) + 2*D6(1,0,0,0,0,0) + 2*D6(0,0,1,0,0,0) + D6(1,0,0,0,1,0),
     1345         D6(0,0,0,0,0,1) + 2*D6(1,0,0,0,0,0)]
     1346        sage: D7=WeylCharacterRing("D7",style="coroots",cache=True) # long time
     1347        sage: E8=WeylCharacterRing("E8",style="coroots",cache=True) # long time
     1348        sage: D7=WeylCharacterRing("D7",style="coroots",cache=True) # long time
     1349        sage: E8(1,0,0,0,0,0,0,0).branch(D7,rule="levi") # long time
     1350         3*D7(0,0,0,0,0,0,0) + 2*D7(0,0,0,0,0,1,0) + 2*D7(0,0,0,0,0,0,1) + 2*D7(1,0,0,0,0,0,0)
     1351         + D7(0,1,0,0,0,0,0) + 2*D7(0,0,1,0,0,0,0) + D7(0,0,0,1,0,0,0) + D7(1,0,0,0,0,1,0) + D7(1,0,0,0,0,0,1) + D7(2,0,0,0,0,0,0)
     1352        sage: E8(0,0,0,0,0,0,0,1).branch(D7,rule="levi") # long time
     1353         D7(0,0,0,0,0,0,0) + D7(0,0,0,0,0,1,0) + D7(0,0,0,0,0,0,1) + 2*D7(1,0,0,0,0,0,0) + D7(0,1,0,0,0,0,0)
    12661354        sage: [F4(fw).branch(B3,rule="levi") for fw in F4.fundamental_weights()] # long time
    12671355         [B3(0,0,0) + 2*B3(1/2,1/2,1/2) + 2*B3(1,0,0) + B3(1,1,0),
    12681356         B3(0,0,0) + 6*B3(1/2,1/2,1/2) + 5*B3(1,0,0) + 7*B3(1,1,0) + 3*B3(1,1,1)
     
    13101398        [B3(0,0,0) + B3(1,0,0), B3(1,0,0) + B3(1,1,0), B3(1/2,1/2,1/2), B3(1/2,1/2,1/2)]
    13111399        sage: [D4(x).branch(G2,rule="symmetric") for x in D4.fundamental_weights()]
    13121400        [G2(0,0,0) + G2(1,0,-1), 2*G2(1,0,-1) + G2(2,-1,-1), G2(0,0,0) + G2(1,0,-1), G2(0,0,0) + G2(1,0,-1)]
    1313         sage: E6=WeylCharacterRing("E6",style="coroots") # long time
    1314         sage: F4=WeylCharacterRing("F4",style="coroots") # long time
    13151401        sage: [E6(fw).branch(F4,rule="symmetric") for fw in E6.fundamental_weights()] # long time
    13161402        [F4(0,0,0,0) + F4(0,0,0,1),
    13171403         F4(0,0,0,1) + F4(1,0,0,0),
     
    13371423         B4(1/2,1/2,1/2,1/2) + B4(1,0,0,0) + B4(1,1,0,0) + B4(1,1,1,0) + B4(3/2,1/2,1/2,1/2),
    13381424         B4(0,0,0,0) + B4(1/2,1/2,1/2,1/2) + B4(1,0,0,0)]
    13391425
    1340         sage: E6 = WeylCharacterRing("E6", style="coroots")
     1426        sage: E6 = WeylCharacterRing("E6", style="coroots") # long time
    13411427        sage: A2xA2xA2=WeylCharacterRing("A2xA2xA2",style="coroots")
    13421428        sage: A5xA1=WeylCharacterRing("A5xA1",style="coroots")
    13431429        sage: G2 = WeylCharacterRing("G2", style="coroots")
     
    13511437         A5xA1(0,0,0,1,0,0) + A5xA1(1,0,0,0,0,1)
    13521438        sage: E6(1,0,0,0,0,0).branch(A2xA2xA2, rule="extended") # long time
    13531439         A2xA2xA2(0,0,0,1,1,0) + A2xA2xA2(0,1,1,0,0,0) + A2xA2xA2(1,0,0,0,0,1)
     1440        sage: E7=WeylCharacterRing("E7",style="coroots") # long time
     1441        sage: A7=WeylCharacterRing("A7",style="coroots") # long time
     1442        sage: E7(1,0,0,0,0,0,0).branch(A7,rule="extended") # long time
     1443         A7(0,0,0,1,0,0,0) + A7(1,0,0,0,0,0,1)
     1444        sage: E8=WeylCharacterRing("E8",cache=true,style="coroots") # long time
     1445        sage: D8=WeylCharacterRing("D8",cache=true,style="coroots") # long time
     1446        sage: E8(0,0,0,0,0,0,0,1).branch(D8,rule="extended") # long time
     1447         D8(0,0,0,0,0,0,1,0) + D8(0,1,0,0,0,0,0,0)
    13541448        sage: F4(1,0,0,0).branch(A1xC3,rule="extended") # long time
    13551449         A1xC3(0,2,0,0) + A1xC3(1,0,0,1) + A1xC3(2,0,0,0)
    13561450        sage: G2(0,1).branch(A1xA1, rule="extended")
     
    14031497
    14041498    EXAMPLES: (Symmetric Power)
    14051499
     1500    ::
     1501
    14061502        sage: A1=WeylCharacterRing("A1",style="coroots")
    14071503        sage: B3=WeylCharacterRing("B3",style="coroots")
    14081504        sage: C3=WeylCharacterRing("C3",style="coroots")
     
    14461542   
    14471543    In cases like this you might prefer style="coroots".
    14481544
     1545    ::
     1546
    14491547        sage: A3 = WeylCharacterRing("A3",style="coroots")
    14501548        sage: D3 = WeylCharacterRing("D3",style="coroots")
    14511549        sage: [D3(fw) for fw in D3.fundamental_weights()]
     
    14621560    This is a general rule that includes any branching rule
    14631561    from types A,B,C or D as a special case. Thus it could be
    14641562    used in place of the above rules and would give the same
    1465     results.
     1563    results. However it is most useful when branching from G
     1564    to a maximal subgroup H such that rank(H) < rank(G)-1.
    14661565
    14671566    We consider a homomorphism H --> G where G is one of
    14681567    SL(r+1), SO(2r+1), Sp(2r) or SO(2r). The function
     
    14761575    us consider the symmetric fifth power representation
    14771576    of SL(2).
    14781577
     1578    ::
     1579
    14791580        sage: A1=WeylCharacterRing("A1",style="coroots")
    14801581        sage: chi=A1([5])
    14811582        sage: chi.degree()
     
    14881589    SL(2) --> Sp(6), and there is a corresponding
    14891590    branching rule C3 => A1.
    14901591
     1592    ::
     1593
    14911594        sage: C3 = WeylCharacterRing("C3",style="coroots")
    14921595        sage: sym5rule = branching_rule_from_plethysm(chi,"C3")
    14931596        sage: [C3(hwv).branch(A1,rule=sym5rule) for hwv in C3.fundamental_weights()]
     
    14971600    rule="symmetric_power". The next example gives a branching
    14981601    not available by other standard rules.
    14991602
     1603    ::
     1604
    15001605        sage: G2 = WeylCharacterRing("G2",style="coroots")
    15011606        sage: D7 = WeylCharacterRing("D7",style="coroots")
    15021607        sage: ad=G2(0,1); ad.degree(); ad.frobenius_schur_indicator()
     
    15201625    type is the root system to be branched to, and rule is the
    15211626    branching rule.
    15221627
     1628    ::
     1629
    15231630        sage: D4 = WeylCharacterRing("D4",style="coroots")
    15241631        sage: D2xD2 = WeylCharacterRing("D2xD2",style="coroots")
    15251632        sage: A1xA1xA1xA1 = WeylCharacterRing("A1xA1xA1xA1",style="coroots")
     
    15381645    Arrange the embedding so that a Cartan subalgebra U of H is
    15391646    contained in a Cartan subalgebra T of G. There is thus
    15401647    a mapping from the weight spaces Lie(T)* --> Lie(U)*.
    1541     The embedding must be chosen in such a way that the
    1542     restriction of the image of the positive Weyl chamber
    1543     in Lie(T)* is contained in the positive Weyl chamber
    1544     in Lie(U)*.
     1648    Two embeddings will produce identical branching rules if they
     1649    differ by an element of the Weyl group of H.
    15451650
    15461651    The RULE is this map Lie(T)* = G.space() to Lie(U)* = H.space(),
    15471652    which you may implement as a function. As an example, let
     
    15561661    that is, [x0,x1,x2,x3] -> [x0-x3,x1-x2]. Hence we may
    15571662    encode the rule:
    15581663
    1559     def rule(x):
    1560         return [x[0]-x[3],x[1]-x[2]]
     1664   
     1665    ::
     1666
     1667       def rule(x):
     1668           return [x[0]-x[3],x[1]-x[2]]
    15611669
    15621670    or simply:
    15631671
    1564     rule = lambda x : [x[0]-x[3],x[1]-x[2]]
     1672    ::
     1673
     1674        rule = lambda x : [x[0]-x[3],x[1]-x[2]]
    15651675
    15661676    EXAMPLES::
    15671677   
     1678    ::
     1679
    15681680        sage: A3 = WeylCharacterRing(['A',3])
    15691681        sage: C2 = WeylCharacterRing(['C',2])
    15701682        sage: rule = lambda x : [x[0]-x[3],x[1]-x[2]]
     
    15901702    mdict = {}
    15911703    for k in chi._mdict:
    15921704        if S._style == "coroots":
    1593             h = S.coerce_to_sl(S._space(rule(list(k.to_vector()))))
     1705            if S._cartan_type.is_irreducible() and S._cartan_type[0] == 'E':
     1706                if S._cartan_type[1] == 6:
     1707                    h = S._space(rule(list(k.to_vector())))
     1708                    h = S.coerce_to_e6(h)
     1709                elif S._cartan_type[1] == 7:
     1710                    h = S.coerce_to_e7(S._space(rule(list(k.to_vector()))))
     1711            else:
     1712                h = S.coerce_to_sl(S._space(rule(list(k.to_vector()))))
    15941713        else:
    15951714            h = S._space(rule(list(k.to_vector())))
    15961715        if h in mdict:
     
    16241743            raise ValueError, "Incompatible ranks"
    16251744        if Rtype[0] == 'A':
    16261745            if Stype.is_reducible():
    1627                 if all(ct[0]=='A' for ct in stypes) \
    1628                        and rdim == sdim:
     1746                if all(ct[0]=='A' for ct in stypes) and rdim == sdim:
    16291747                    return lambda x : x
    16301748                else:
    16311749                    raise ValueError, "Rule not found"
     
    16431761                return lambda x : x
    16441762            else:
    16451763                raise ValueError, "Rule not found"
    1646         elif Rtype[0] == 'E' and Stype[0] in ['A','D','E']:
    1647             raise NotImplementedError, "Exceptional branching rules are yet to be implemented"
     1764        elif Rtype[0] == 'E':
     1765            if Stype.is_irreducible():
     1766                if Stype[0] == 'D':
     1767                    if r == 6:
     1768                        return lambda x : [-x[4],-x[3],-x[2],-x[1],-x[0]]
     1769                    if r == 7:
     1770                        return lambda x : [-x[5],-x[4],-x[3],-x[2],-x[1],-x[0]]
     1771                    if r == 8:
     1772                        return lambda x : [-x[6],-x[5],-x[4],-x[3],-x[2],-x[1],-x[0]]
     1773                elif r in [7,8] and Stype[0] == 'E':
     1774                    return lambda x : x
     1775                elif Stype[0] == 'A':
     1776                    if r == 6:
     1777                        raise NotImplementedError, """A5 Levi is not maximal. Branch to A5xA1 (rule="extended")."""
     1778                    if r == 7:
     1779                        raise NotImplementedError, """A5 Levi is not maximal. Branch to A5xA1 (rule="extended")."""
     1780            raise NotImplementedError, "Not implemented yet"
    16481781        elif Rtype[0] == 'F' and s == 3:
    16491782            if Stype[0] == 'B':
    16501783                return lambda x : list(x)[1:]
    16511784            elif Stype[0] == 'C':
    16521785                return lambda x : [x[1]-x[0],x[2]+x[3],x[2]-x[3]]
    16531786            else:
    1654                 raise NotImplementedError, "Exceptional branching rules are yet to be implemented"
     1787                raise NotImplementedError, "Not implemented yet"
    16551788        elif Rtype[0] == 'G' and Stype[0] == 'A':
    16561789            return lambda x : list(x)[1:]
    16571790        else:
     
    16591792    elif rule == "automorphic":
    16601793        if not Rtype == Stype:
    16611794            raise ValueError, "Cartan types must agree for automorphic branching rule"
    1662         elif Rtype[0] == 'E' and r == 6:
    1663             raise NotImplementedError, "Exceptional branching rules are yet to be implemented"
    16641795        elif Rtype[0] == 'A':
    16651796            def rule(x) : y = [-i for i in x]; y.reverse(); return y
    16661797            return rule
     
    16681799            def rule(x) : x[len(x)-1] = -x[len(x)-1]; return x
    16691800            return rule
    16701801        elif Rtype[0] == 'E' and r == 6:
    1671             raise NotImplementedError, "Exceptional branching rules are yet to be implemented"
     1802            M = matrix(QQ,[(3, 3, 3, -3, 0, 0, 0, 0), \
     1803                           (3, 3, -3, 3, 0, 0, 0, 0), \
     1804                           (3, -3, 3, 3, 0, 0, 0, 0), \
     1805                           (-3, 3, 3, 3, 0, 0, 0, 0), \
     1806                           (0, 0, 0, 0, -3, -3, -3, 3), \
     1807                           (0, 0, 0, 0, -3, 5, -1, 1), \
     1808                           (0, 0, 0, 0, -3, -1, 5, 1), \
     1809                           (0, 0, 0, 0, 3, 1, 1, 5)])/6
     1810            return lambda x : tuple(M*vector(x))                       
    16721811        else:
    16731812            raise ValueError, "No automorphism found"
    16741813    elif rule == "triality":
     
    16931832        else:
    16941833            raise ValueError, "Rule not found"
    16951834    elif rule == "extended":
     1835        if not s == r:
     1836            raise ValueError, """Ranks should be equal for rule="extended" """
    16961837        if Stype.is_reducible():
    16971838            if Rtype[0] in ['B','D'] and all(t[0] in ['B','D'] for t in stypes):
    16981839                if Rtype[0] == 'D':
     
    17091850                    return lambda x : x[:s]
    17101851                else:
    17111852                    raise ValueError, "Rule not found"
    1712             elif Rtype[0] == 'C'  and s == r:
     1853            elif Rtype[0] == 'C':
    17131854                if all(t[0] == Rtype[0] for t in stypes):
    17141855                    return lambda x : x
    1715             elif Rtype[0] == 'E' and s == r:
     1856            elif Rtype[0] == 'E':
    17161857                if r == 6:
    1717                     if stypes[0][0] == 'A' and stypes[0][1] == 5:
     1858                    if stypes[0][0] == 'A' and stypes[0][1] == 5: # need doctest
    17181859                        if stypes[1][0] == 'A' and stypes[1][1] == 1:
    17191860                            M = matrix(QQ,[(-3, -3, -3, -3, -3, -5, -5, 5), \
    17201861                                           (-9, 3, 3, 3, 3, 1, 1, -1), \
     
    17251866                                           (-3, -3, -3, -3, -3, -1, 11, 1), \
    17261867                                           (3, 3, 3, 3, 3, 1, 1, 11)])/12
    17271868                            return lambda x : tuple(M*vector(x))                       
    1728                     if len(stypes) == 3 and all(x[0] == 'A' and x[1] == 2 for x in stypes):
     1869                    if len(stypes) == 3 and all(x[0] == 'A' and x[1] == 2 for x in stypes): # need doctest
    17291870                        M = matrix(QQ,[(0, 0, -2, -2, -2, -2, -2, 2), \
    17301871                                       (-3, 3, 1, 1, 1, 1, 1, -1), \
    17311872                                       (3, -3, 1, 1, 1, 1, 1, -1), \
     
    17351876                                       (0, 0, -2, -2, -2, 2, 2, -2), \
    17361877                                       (3, 3, 1, 1, 1, -1, -1, 1), \
    17371878                                       (-3, -3, 1, 1, 1, -1, -1, 1)])/6
    1738                         return lambda x : tuple(M*vector(x))                       
    1739             elif Rtype[0] == 'F' and s == r:
     1879                        return lambda x : tuple(M*vector(x))
     1880                elif r == 7:
     1881                    if stypes[0][0] == 'D' and stypes[0][1] == 6 and stypes[1][0] == 'A' and stypes[1][1] == 1:
     1882                        return lambda x : [x[5],x[4],x[3],x[2],x[1],x[0],x[6],x[7]] # need doctest
     1883                    elif stypes[0][0] == 'A' and stypes[1][0] == 'A':
     1884                        if stypes[0][1] == 5 and stypes[1][1] == 2:
     1885                            M = matrix(QQ,[(5, 1, 1, 1, 1, 1, 0, 0), \
     1886                                           (-1, -5, 1, 1, 1, 1, 0, 0), \
     1887                                           (-1, 1, -5, 1, 1, 1, 0, 0), \
     1888                                           (-1, 1, 1, -5, 1, 1, 0, 0), \
     1889                                           (-1, 1, 1, 1, -5, 1, 0, 0), \
     1890                                           (-1, 1, 1, 1, 1, -5, 0, 0), \
     1891                                           (1, -1, -1, -1, -1, -1, 0, -6), \
     1892                                           (1, -1, -1, -1, -1, -1, -6, 0), \
     1893                                           (-2, 2, 2, 2, 2, 2, -3, -3)])/6
     1894                            return lambda x : tuple(M*vector(x))
     1895                        if len(stypes) == 3 and stypes[2][0] == 'A' and [stypes[0][1],stypes[1][1],stypes[2][1]] == [3,3,1]: # need doctest
     1896                            M = matrix(QQ, [(0, 0, -1, -1, -1, -1, 2, -2), \
     1897                                            (0, 0, -1, -1, -1, -1, -2, 2), \
     1898                                            (-2, 2, 1, 1, 1, 1, 0, 0), \
     1899                                            (2, -2, 1, 1, 1, 1, 0, 0), \
     1900                                            (0, 0, -1, -1, -1, 3, 0, 0), \
     1901                                            (0, 0, -1, -1, 3, -1, 0, 0), \
     1902                                            (0, 0, -1, 3, -1, -1, 0, 0), \
     1903                                            (0, 0, 3, -1, -1, -1, 0, 0), \
     1904                                            (2, 2, 0, 0, 0, 0, -2, -2), \
     1905                                            (-2, -2, 0, 0, 0, 0, -2, -2)])/4
     1906                            return lambda x : tuple(M*vector(x))
     1907                elif r == 8:
     1908                    if stypes[0][0] == 'A' and stypes[1][0] == 'A':
     1909                        if stypes[0][1] == 7 and stypes[1][1] == 1:
     1910                            raise NotImplementedError, "Not maximal: first branch to E7xA1"
     1911                        elif stypes[0][1] == 4 and stypes[1][1] == 4:
     1912                            M = matrix(QQ,[(0, 0, 0, -4, -4, -4, -4, 4), \
     1913                                           (-5, 5, 5, 1, 1, 1, 1, -1), \
     1914                                           (5, -5, 5, 1, 1, 1, 1, -1), \
     1915                                           (5, 5, -5, 1, 1, 1, 1, -1), \
     1916                                           (-5, -5, -5, 1, 1, 1, 1, -1), \
     1917                                           (0, 0, 0, -8, 2, 2, 2, -2), \
     1918                                           (0, 0, 0, 2, -8, 2, 2, -2), \
     1919                                           (0, 0, 0, 2, 2, -8, 2, -2), \
     1920                                           (0, 0, 0, 2, 2, 2, -8, -2), \
     1921                                           (0, 0, 0, 2, 2, 2, 2, 8)])/10
     1922                            return lambda x : tuple(M*vector(x))
     1923                        elif len(stypes)==3:
     1924                            if stypes[0][1] == 5 and stypes[1][0] == 2 and stypes[2][0] == 1:
     1925                                raise NotImplementedError, "Not maximal: first branch to A7xA1"
     1926                    elif stypes[0][0] == 'D' and stypes[1][0] == 'A':
     1927                        if stypes[0][1] == 5 and stypes[1][1] == 3:
     1928                            raise NotImplementedError, "Not maximal: first branch to D8 then D5xD3=D5xA3"
     1929                    elif stypes[0][0] == 'E' and stypes[1][0] == 'A':
     1930                        if stypes[0][1] == 6 and stypes[1][1] == 2:
     1931                            return lambda x : [x[0],x[1],x[2],x[3],x[4], \
     1932                                               (x[5]+x[6]-x[7])/3,(x[5]+x[6]-x[7])/3,(-x[5]-x[6]+x[7])/3, \
     1933                                               (-x[5]-x[6]-2*x[7])/3,(-x[5]+2*x[6]+x[7])/3,(2*x[5]-x[6]+x[7])/3]
     1934                        elif stypes[0][1] == 7 and stypes[1][1] == 1:
     1935                            return lambda x : [x[0],x[1],x[2],x[3],x[4],x[5],(x[6]-x[7])/2,(-x[6]+x[7])/2,(-x[6]-x[7])/2,(x[6]+x[7])/2]
     1936                raise ValueError, "Rule not found"
     1937            elif Rtype[0] == 'F':
    17401938                if stypes[0][0] == 'C' and stypes[0][1] == 3:
    17411939                    if stypes[1][0] == 'A' and stypes[1][1] == 1:
    17421940                        return lambda x : [x[0]-x[1],x[2]+x[3],x[2]-x[3],(-x[0]-x[1])/2,(x[0]+x[1])/2]
     
    17531951                    return lambda x : tuple(M*vector(x))
    17541952                else:
    17551953                    raise ValueError, "Rule not found"
    1756             elif Rtype[0] == 'G' and s == r:
     1954            elif Rtype[0] == 'G':
    17571955                if all(t[0] == 'A' and t[1] == 1 for t in stypes):
    17581956                    return lambda x : [(x[1]-x[2])/2,-(x[1]-x[2])/2, x[0]/2, -x[0]/2]
    17591957            else:
    17601958                raise ValueError, "Rule not found"
    1761         elif Rtype[0] == 'B' and Stype[0] == 'D' and s == r:
    1762             return lambda x : x
    1763         elif Rtype[0] == 'G' and Stype[0] == 'A' and s == r:
    1764             return lambda x : [(x[0]-x[2])/3, (-x[1]+x[2])/3, (-x[0]+x[1])/3]
    1765         elif Rtype[0] == 'F' and Stype[0] == 'B' and s == r:
    1766             return lambda x : [-x[0], x[1], x[2], x[3]]
    1767         elif Rtype[0] == 'E' and Stype[0] == 'E' and s == r and r >= 7:
    1768             raise NotImplementedError, "Exceptional branching rules are yet to be implemented"
    1769         else:
    1770             raise ValueError, "Rule not found"
     1959        else: # irreducible Stype
     1960            if Rtype[0] == 'B' and Stype[0] == 'D':
     1961                return lambda x : x
     1962            elif Rtype[0] == 'E':
     1963                if r == 7:
     1964                    if Stype[0] == 'A':
     1965                        M = matrix(QQ, [(-1, -1, -1, -1, -1, -1, 2, -2), \
     1966                                        (-1, -1, -1, -1, -1, -1, -2, 2), \
     1967                                        (-3, 1, 1, 1, 1, 1, 0, 0), \
     1968                                        (1, -3, 1, 1, 1, 1, 0, 0), \
     1969                                        (1, 1, -3, 1, 1, 1, 0, 0), \
     1970                                        (1, 1, 1, -3, 1, 1, 0, 0), \
     1971                                        (1, 1, 1, 1, -3, 1, 2, 2), \
     1972                                        (1, 1, 1, 1, 1, -3, 2, 2)])/4
     1973                        return lambda x : tuple(M*vector(x))                       
     1974                elif r == 8:
     1975                    if Stype[0] == 'D':
     1976                        return lambda x : [-x[7],x[6],x[5],x[4],x[3],x[2],x[1],x[0]]
     1977                    elif Stype[0] == 'A':
     1978                        M = matrix([(-2, -2, -2, -2, -2, -2, -2, 2), \
     1979                                    (-5, 1, 1, 1, 1, 1, 1, -1), \
     1980                                    (1, -5, 1, 1, 1, 1, 1, -1), \
     1981                                    (1, 1, -5, 1, 1, 1, 1, -1), \
     1982                                    (1, 1, 1, -5, 1, 1, 1, -1), \
     1983                                    (1, 1, 1, 1, -5, 1, 1, -1), \
     1984                                    (1, 1, 1, 1, 1, -5, 1, -1), \
     1985                                    (1, 1, 1, 1, 1, 1, -5, -1), \
     1986                                    (1, 1, 1, 1, 1, 1, 1, 5)])/6 # doctest needed
     1987                        return lambda x : tuple(M*vector(x))                       
     1988            elif Rtype[0] == 'F' and Stype[0] == 'B' and s == r:
     1989                return lambda x : [-x[0], x[1], x[2], x[3]]
     1990            elif Rtype[0] == 'G' and Stype[0] == 'A' and s == r:
     1991                return lambda x : [(x[0]-x[2])/3, (-x[1]+x[2])/3, (-x[0]+x[1])/3]
     1992            else:
     1993                raise ValueError, "Rule not found"
    17711994    elif rule == "isomorphic":
    17721995        if r != s:
    17731996            raise ValueError, "Incompatible ranks"