Ticket #7729: trac_7729_iwahori-hecke-algebra.patch

File trac_7729_iwahori-hecke-algebra.patch, 21.3 KB (added by Nicolas M. Thiéry, 13 years ago)

IwahoriHeckeAlgebraT now takes a Coxeter group + moved method to ModulesWithBasis?. Replaces the previous patch.

  • sage/algebras/all.py

    # HG changeset patch
    # User Nicolas M. Thiery <nthiery@users.sf.net>
    # Date 1262792679 -3600
    # Node ID 8012005a34c78018635bddb7a35a2d3372a7ed30
    # Parent  1b890e1c664ba3caed920d0c971f0ecf17eb0d1e
    #7729: Iwahori Hecke algebras in the T basis
    
    diff --git a/sage/algebras/all.py b/sage/algebras/all.py
    a b from steenrod_algebra_bases import steen 
    3535
    3636from group_algebra import GroupAlgebra, GroupAlgebraElement
    3737
    38    
     38from iwahori import IwahoriHeckeAlgebraT
     39   
    3940def is_R_algebra(Q, R):
    4041    # TODO: do something nontrivial when morphisms are defined.
    4142    return True
  • new file sage/algebras/iwahori.py

    diff --git a/sage/algebras/iwahori.py b/sage/algebras/iwahori.py
    new file mode 100644
    - +  
     1"""
     2Iwahori Hecke Algebras
     3"""
     4#*****************************************************************************
     5#  Copyright (C) 2008 Daniel Bump <bump at match.stanford.edu>
     6#
     7#  Distributed under the terms of the GNU General Public License (GPL)
     8#                  http://www.gnu.org/licenses/
     9#*****************************************************************************
     10from sage.categories.all import AlgebrasWithBasis, FiniteDimensionalAlgebrasWithBasis, CoxeterGroups
     11import sage.combinat.root_system.cartan_type
     12from sage.combinat.root_system.cartan_type import CartanType
     13from sage.combinat.root_system.weyl_group import WeylGroup
     14from sage.structure.element import is_Element
     15from sage.rings.all import ZZ
     16from sage.misc.misc import repr_lincomb
     17from sage.algebras.algebra_element import AlgebraElement
     18from sage.combinat.family import Family
     19import sage.rings.polynomial.laurent_polynomial
     20from sage.combinat.free_module import CombinatorialFreeModule, CombinatorialFreeModuleElement
     21from sage.misc.cachefunc import cached_method
     22
     23class IwahoriHeckeAlgebraT(CombinatorialFreeModule):
     24    r"""
     25    INPUT:
     26
     27     - ``ct`` -- A Cartan Type (possibly affine)
     28     - ``q1`` -- a parameter.
     29
     30    OPTIONAL ARGUMENTS:
     31
     32     - ``q2`` -- another parameter (default -1)
     33     - ``base_ring`` -- A ring containing q1 and q2 (default q1.parent())
     34     - ``prefix`` -- a label for the generators (default "T")
     35
     36    Given a Cartan type T, the Iwahori Hecke algebra is defined in:
     37
     38    Nagayoshi Iwahori, On the structure of a Hecke ring of a Chevalley group
     39    over a finite field.  J. Fac. Sci. Univ. Tokyo Sect. I 10 1964 215--236
     40    (1964).
     41
     42    The Iwahori Hecke algebra is a deformation of the group algebra of
     43    the Weyl/Coxeter group. Taking the deformation parameter `q=1` as in the
     44    following example gives a ring isomorphic to that group
     45    algebra. The parameter `q` is a deformation parameter.
     46
     47    EXAMPLES::
     48
     49        sage: H = IwahoriHeckeAlgebraT("A3",1,prefix = "s")
     50        sage: [s1,s2,s3] = H.algebra_generators()
     51        sage: s1*s2*s3*s1*s2*s1 == s3*s2*s1*s3*s2*s3
     52        True
     53        sage: w0 = H(H.coxeter_group().long_element())
     54        sage: w0
     55        s1*s2*s3*s1*s2*s1
     56        sage: H.an_element()
     57        3*s1*s2 + 3*s1 + 1
     58
     59    Iwahori Hecke algebras have proved to be fundamental. See for example:
     60
     61    Kazhdan and Lusztig, Representations of Coxeter groups and Hecke algebras.
     62    Invent. Math. 53 (1979), no. 2, 165--184.
     63
     64    Iwahori-Hecke Algebras: Thomas J. Haines, Robert E. Kottwitz,
     65    Amritanshu Prasad, http://front.math.ucdavis.edu/0309.5168
     66
     67    V. Jones, Hecke algebra representations of braid groups and link
     68    polynomials.  Ann. of Math. (2) 126 (1987), no. 2, 335--388.
     69
     70    For every simple reflection `s_i` of the Coxeter group, there is a
     71    corresponding generator `T_i` of the Iwahori Hecke algebra. These
     72    are subject to the relations
     73
     74        `(T_i-q_1)*(T_i-q_2) == 0`
     75
     76    together with the braid relations `T_i T_j T_i ... == T_j T_i T_j ...`,
     77    where the number of terms on both sides is `k/2` with `k` the order of
     78    `s_i s_j` in the Coxeter group.
     79
     80    Weyl group elements form a basis of the Iwahori Hecke algebra `H`
     81    with the property that if `w1` and `w2` are Coxeter group elements
     82    such that ``(w1*w2).length() == w1.length() + w2.length()`` then
     83    ``H(w1*w2) == H(w1)*H(w2)``.
     84
     85    With the default value `q_2 = -1` and with `q_1 = q` the
     86    generating relation may be written `T_i^2 = (q-1)*T_i + q*1` as in
     87    Iwahori's paper.
     88
     89    EXAMPLES::
     90
     91        sage: R.<q>=PolynomialRing(ZZ)
     92        sage: H=IwahoriHeckeAlgebraT("B3",q); H
     93        The Iwahori Hecke Algebra of Type B3 in q,-1 over Univariate Polynomial Ring in q over Integer Ring and prefix T
     94        sage: T1,T2,T3 = H.algebra_generators()
     95        sage: T1*T1
     96        (q-1)*T1 + q
     97
     98    It is useful to define ``T1,T2,T3 = H.algebra_generators()`` as above
     99    so that H can parse its own output::
     100
     101        sage: H(T1)
     102        T1
     103
     104    The Iwahori Hecke algebra associated with an affine Weyl group is
     105    called an affine Hecke algebra. These may be implemented as follows::
     106
     107        sage: R.<q>=QQ[]
     108        sage: H=IwahoriHeckeAlgebraT(['A',2,1],q)
     109        sage: [T0,T1,T2]=H.algebra_generators()
     110        sage: T1*T2*T1*T0*T1*T0
     111        (q-1)*T1*T2*T0*T1*T0 + q*T1*T2*T0*T1
     112        sage: T1*T2*T1*T0*T1*T1
     113        q*T1*T2*T1*T0 + (q-1)*T1*T2*T0*T1*T0
     114        sage: T1*T2*T1*T0*T1*T2
     115        T1*T2*T0*T1*T0*T2
     116
     117        sage: R = IwahoriHeckeAlgebraT("A3",0,0,prefix = "s")
     118        sage: [s1,s2,s3] = R.algebra_generators()
     119        sage: s1*s1
     120        0
     121
     122    TESTS::
     123
     124        sage: H1 = IwahoriHeckeAlgebraT("A2",1)
     125        sage: H2 = IwahoriHeckeAlgebraT("A2",1)
     126        sage: H3 = IwahoriHeckeAlgebraT("A2",-1)
     127        sage: H1 == H1, H1 == H2, H1 is H2
     128        (True, True, True)
     129        sage: H1 == H3
     130        False
     131
     132        sage: R.<q>=PolynomialRing(QQ)
     133        sage: IwahoriHeckeAlgebraT("A3",q).base_ring() == R
     134        True
     135
     136        sage: R.<q>=QQ[]; H=IwahoriHeckeAlgebraT("A2",q)
     137        sage: 1+H(q)
     138        (q+1)
     139
     140        sage: R.<q>=QQ[]
     141        sage: H = IwahoriHeckeAlgebraT("A2",q)
     142        sage: T1,T2 = H.algebra_generators()
     143        sage: H(T1+2*T2)
     144        T1 + 2*T2
     145
     146    .. rubric:: Design discussion
     147
     148    This is a preliminary implementation. For work in progress, see:
     149    http://wiki.sagemath.org/HeckeAlgebras.
     150
     151     - Should we use q in QQ['q'] as default parameter for q_1?
     152
     153    """
     154
     155    @staticmethod
     156    def __classcall__(cls, W, q1, q2=-1, base_ring=None, prefix="T"):
     157        """
     158        TESTS::
     159
     160            sage: H = IwahoriHeckeAlgebraT("A2", 1)
     161            sage: H.coxeter_group() == WeylGroup("A2")
     162            True
     163            sage: H.cartan_type() == CartanType("A2")
     164            True
     165            sage: H.base_ring() == ZZ
     166            True
     167            sage: H._q2 == -1
     168            True
     169        """
     170        if W not in CoxeterGroups():
     171            W = WeylGroup(W)
     172        if base_ring is None:
     173            base_ring = q1.parent()
     174        q2 = base_ring(q2)
     175        return super(IwahoriHeckeAlgebraT, cls).__classcall__(cls, W, q1=q1, q2=q2, base_ring=base_ring, prefix=prefix)
     176
     177    def __init__(self, W, q1, q2, base_ring, prefix):
     178         """
     179        EXAMPLES ::
     180
     181            sage: R.<q1,q2>=QQ[]
     182            sage: H = IwahoriHeckeAlgebraT("A2",q1,q2,base_ring=Frac(R),prefix="t"); H
     183            The Iwahori Hecke Algebra of Type A2 in q1,q2 over Fraction Field of Multivariate Polynomial Ring in q1, q2 over Rational Field and prefix t
     184            sage: TestSuite(H).run()
     185
     186         """
     187         self._cartan_type = W.cartan_type()
     188         self._prefix = prefix
     189         self._index_set = W.index_set()
     190         self._q1 = base_ring(q1)
     191         self._q2 = base_ring(q2)
     192
     193         if W.is_finite():
     194             category = FiniteDimensionalAlgebrasWithBasis(base_ring)
     195         else:
     196             category = AlgebrasWithBasis(base_ring)
     197         CombinatorialFreeModule.__init__(self, base_ring, W, category = category)
     198
     199    def _element_constructor_(self, w):
     200        """
     201        Construct a basis element from an element of the Weyl group
     202
     203        EXAMPLES ::
     204
     205            sage: R.<q>=QQ[]
     206            sage: H = IwahoriHeckeAlgebraT("A2",q)
     207            sage: [H(x) for x in H.coxeter_group()]   # indirect doctest
     208            [1, T1, T1*T2, T1*T2*T1, T2, T2*T1]
     209
     210        """
     211        assert w in self.basis().keys()
     212        return self.term(w)
     213
     214    @cached_method
     215    def one_basis(self):
     216        """
     217        Returns the unit of the underlying coxeter group, which index
     218        the one of this algebra, as per
     219        :meth:`AlgebrasWithBasis.ParentMethods.one_basis`.
     220
     221        EXAMPLES::
     222
     223            sage: H = IwahoriHeckeAlgebraT("B3", 1)
     224            sage: H.one_basis()
     225            [1 0 0]
     226            [0 1 0]
     227            [0 0 1]
     228            sage: H.one_basis() == H.coxeter_group().one()
     229            True
     230            sage: H.one()
     231            1
     232        """
     233        return self.coxeter_group().one()
     234
     235    def _repr_(self):
     236        """
     237        EXAMPLES ::
     238
     239            sage: R.<q1,q2>=QQ[]
     240            sage: IwahoriHeckeAlgebraT("A2",q1,-q2,base_ring=Frac(R),prefix="Z") # indirect doctest
     241            The Iwahori Hecke Algebra of Type A2 in q1,-q2 over Fraction Field of Multivariate Polynomial Ring in q1, q2 over Rational Field and prefix Z
     242
     243        """
     244        return "The Iwahori Hecke Algebra of Type %s in %s,%s over %s and prefix %s"%(self._cartan_type._repr_(compact=True), self._q1, self._q2, self.base_ring(), self._prefix)
     245
     246    def cartan_type(self):
     247        """
     248        EXAMPLES ::
     249
     250            sage: IwahoriHeckeAlgebraT("D4",0).cartan_type()
     251            ['D', 4]
     252
     253        """
     254        return self._cartan_type
     255
     256    def coxeter_group(self):
     257        """
     258        EXAMPLES::
     259
     260            sage: IwahoriHeckeAlgebraT("B2",1).coxeter_group()
     261            Weyl Group of type ['B', 2] (as a matrix group acting on the ambient space)
     262
     263        """
     264        return self.basis().keys()
     265
     266    def index_set(self):
     267        """
     268        EXAMPLES::
     269
     270            sage: IwahoriHeckeAlgebraT("B2",1).index_set()
     271            [1, 2]
     272        """
     273        return self._index_set
     274
     275    @cached_method
     276    def algebra_generators(self):
     277        """
     278        Returns the generators. They do not have order two but satisfy
     279        a quadratic relation. They coincide with the simple
     280        reflections in the Coxeter group when `q_1=1` and `q_2=-1`. In
     281        this special case, the Iwahori Hecke algebra is identified
     282        with the group algebra of the Coxeter group.
     283
     284        EXAMPLES ::
     285
     286            sage: R.<q>=QQ[]
     287            sage: H = IwahoriHeckeAlgebraT("A3",q)
     288            sage: T=H.algebra_generators(); T
     289            Finite family {1: T1, 2: T2, 3: T3}
     290            sage: T.list()
     291            [T1, T2, T3]
     292            sage: [T[i] for i in [1,2,3]]
     293            [T1, T2, T3]
     294            sage: [T1, T2, T3] = H.algebra_generators()
     295            sage: T1
     296            T1
     297            sage: H = IwahoriHeckeAlgebraT(['A',2,1],q)
     298            sage: T=H.algebra_generators(); T
     299            Finite family {0: T0, 1: T1, 2: T2}
     300            sage: T.list()
     301            [T0, T1, T2]
     302            sage: [T[i] for i in [0,1,2]]
     303            [T0, T1, T2]
     304            sage: [T0, T1, T2] = H.algebra_generators()
     305            sage: T0
     306            T0
     307        """
     308        return self.coxeter_group().simple_reflections().map(self.term)
     309
     310    def algebra_generator(self, i):
     311        """
     312        EXAMPLES ::
     313
     314            sage: R.<q>=QQ[]
     315            sage: H = IwahoriHeckeAlgebraT("A3",q)
     316            sage: [H.algebra_generator(i) for i in H.index_set()]
     317            [T1, T2, T3]
     318
     319        """
     320        return self.algebra_generators()[i]
     321
     322    def inverse_generator(self, i):
     323        """
     324        This method is only available if q1 and q2 are invertible. In
     325        that case, the algebra generators are also invertible and this
     326        method returns the inverse of self.algebra_generator(i). The
     327        base ring should be either a field or a Laurent polynomial ring.
     328
     329        EXAMPLES::
     330
     331            sage: P.<q1,q2>=QQ[]
     332            sage: F=Frac(P)
     333            sage: H = IwahoriHeckeAlgebraT("A2",q1,q2,base_ring=F)
     334            sage: H.base_ring()
     335            Fraction Field of Multivariate Polynomial Ring in q1, q2 over Rational Field
     336            sage: H.inverse_generator(1)
     337            ((-1)/(q1*q2))*T1 + ((q1+q2)/(q1*q2))
     338            sage: H = IwahoriHeckeAlgebraT("A2",q1,-1,base_ring=F)
     339            sage: H.inverse_generator(2)
     340            ((-1)/(-q1))*T2 + ((q1-1)/(-q1))
     341            sage: P1.<r1,r2>=LaurentPolynomialRing(QQ)
     342            sage: H1 = IwahoriHeckeAlgebraT("B2",r1,r2,base_ring=P1)
     343            sage: H1.base_ring()
     344            Multivariate Laurent Polynomial Ring in r1, r2 over Rational Field
     345            sage: H1.inverse_generator(2)
     346            (-r1^-1*r2^-1)*T2 + (r2^-1+r1^-1)
     347            sage: H2 = IwahoriHeckeAlgebraT("C2",r1,-1,base_ring=P1)
     348            sage: H2.inverse_generator(2)
     349            (r1^-1)*T2 + (-1+r1^-1)
     350
     351        """
     352        try:
     353            # This currently works better than ~(self._q1) if
     354            # self.base_ring() is a Laurent polynomial ring since it
     355            # avoids accidental coercion into a field of fractions.
     356            i1 = self._q1.__pow__(-1)
     357            i2 = self._q2.__pow__(-1)
     358        except:
     359            raise ValueError, "%s and %s must be invertible."%(self._q1, self._q2)
     360        return (-i1*i2)*self.algebra_generator(i)+(i1+i2)
     361
     362    @cached_method
     363    def inverse_generators(self):
     364        """
     365        This method is only available if q1 and q2 are invertible. In
     366        that case, the algebra generators are also invertible and this
     367        method returns their inverses.
     368
     369        EXAMPLES ::
     370            sage: P.<q> = PolynomialRing(QQ)
     371            sage: F = Frac(P)
     372            sage: H = IwahoriHeckeAlgebraT("A2",q,base_ring=F)
     373            sage: [T1,T2]=H.algebra_generators()
     374            sage: [U1,U2]=H.inverse_generators()
     375            sage: U1*T1,T1*U1
     376            (1, 1)
     377            sage: P1.<q> = LaurentPolynomialRing(QQ)
     378            sage: H1 = IwahoriHeckeAlgebraT("A2",q,base_ring=P1,prefix="V")
     379            sage: [V1,V2]=H1.algebra_generators()
     380            sage: [W1,W2]=H1.inverse_generators()
     381            sage: [W1,W2]
     382            [(q^-1)*V1 + (-1+q^-1), (q^-1)*V2 + (-1+q^-1)]
     383            sage: V1*W1, W2*V2
     384            (1, 1)
     385
     386        """
     387        return Family(self.index_set(), self.inverse_generator)
     388
     389    def product_on_basis(self, w1, w2):
     390        """
     391
     392        Returns `T_w1 T_w2`, where `w_1` and `w_2` are in the Coxeter group
     393
     394        EXAMPLES::
     395
     396            sage: R.<q>=QQ[]; H = IwahoriHeckeAlgebraT("A2",q)
     397            sage: s1,s2 = H.coxeter_group().simple_reflections()
     398            sage: [H.product_on_basis(s1,x) for x in [s1,s2]]
     399            [(q-1)*T1 + q, T1*T2]
     400
     401        """
     402        result = self.term(w1)
     403        for i in w2.reduced_word():
     404            result = self.product_by_generator(result, i)
     405        return result
     406
     407    def product_by_generator_on_basis(self, w, i, side = "right"):
     408        """
     409        INPUT:
     410         - ``w`` - an element of the Coxeter group
     411         - ``i`` - an element of the index set
     412         - ``side`` - "left" or "right" (default: "right")
     413
     414        Returns the product `T_w T_i` (resp. `T_i T_w`) if ``side`` is "right" (resp. "left")
     415
     416        EXAMPLES::
     417
     418            sage: R.<q>=QQ[]; H = IwahoriHeckeAlgebraT("A2",q)
     419            sage: s1,s2 = H.coxeter_group().simple_reflections()
     420            sage: [H.product_by_generator_on_basis(w, 1) for w in [s1,s2,s1*s2]]
     421            [(q-1)*T1 + q, T2*T1, T1*T2*T1]
     422            sage: [H.product_by_generator_on_basis(w, 1, side = "left") for w in [s1,s2,s1*s2]]
     423            [(q-1)*T1 + q, T1*T2, (q-1)*T1*T2 + q*T2]
     424        """
     425        wi = w.apply_simple_reflection(i, side = side)
     426        if w.has_descent(i, side = side):
     427            return self.monomial(w ,  self._q1+self._q2) + \
     428                   self.monomial(wi, -self._q1*self._q2)
     429        else:
     430            return self.term(wi)
     431
     432    def product_by_generator(self, x, i, side = "right"):
     433        """
     434        Returns T_i*x, where T_i is the i-th generator. This is coded
     435        individually for use in x._mul_().
     436
     437        EXAMPLES ::
     438            sage: R.<q>=QQ[]; H = IwahoriHeckeAlgebraT("A2",q)
     439            sage: [T1,T2] = H.algebra_generators()
     440            sage: [H.product_by_generator(x, 1, side = "left") for x in [T1,T2]]
     441            [(q-1)*T1 + q, T2*T1]
     442
     443        """
     444        return self.sum(self.product_by_generator_on_basis(w, i)._acted_upon_(c) for (w,c) in x)
     445
     446    def _repr_term(self, t):
     447        """
     448        EXAMPLES ::
     449
     450            sage: R.<q>=QQ[]
     451            sage: H = IwahoriHeckeAlgebraT("A3",q)
     452            sage: W=H.coxeter_group()
     453            sage: H._repr_term(W.from_reduced_word([1,2,3]))
     454            'T1*T2*T3'
     455
     456        """
     457        redword = t.reduced_word()
     458        if len(redword) == 0:
     459            return "1"
     460        else:
     461            return "*".join("%s%d"%(self._prefix, i) for i in redword)
     462
     463    class Element(CombinatorialFreeModuleElement):
     464        """
     465        A class for elements of an IwahoriHeckeAlgebra
     466
     467        TESTS::
     468
     469            sage: R.<q>=QQ[]
     470            sage: H=IwahoriHeckeAlgebraT("B3",q)
     471            sage: [T1, T2, T3] = H.algebra_generators()
     472            sage: T1+2*T2*T3
     473            T1 + 2*T2*T3
     474
     475            sage: R.<q1,q2>=QQ[]
     476            sage: H=IwahoriHeckeAlgebraT("A2",q1,q2,prefix="x")
     477            sage: sum(H.algebra_generators())^2
     478            x1*x2 + x2*x1 + (q1+q2)*x1 + (q1+q2)*x2 + (-2*q1*q2)
     479
     480            sage: H=IwahoriHeckeAlgebraT("A2",q1,q2,prefix="t")
     481            sage: [t1,t2] = H.algebra_generators()
     482            sage: (t1-t2)^3
     483            (q1^2-q1*q2+q2^2)*t1 + (-q1^2+q1*q2-q2^2)*t2
     484
     485            sage: R.<q>=QQ[]
     486            sage: H=IwahoriHeckeAlgebraT("G2",q)
     487            sage: [T1, T2] = H.algebra_generators()
     488            sage: T1*T2*T1*T2*T1*T2 == T2*T1*T2*T1*T2*T1
     489            True
     490            sage: T1*T2*T1 == T2*T1*T2
     491            False
     492
     493            sage: H = IwahoriHeckeAlgebraT("A2",1)
     494            sage: [T1,T2]=H.algebra_generators()
     495            sage: T1+T2
     496            T1 + T2
     497
     498            sage: -(T1+T2)
     499            -T1 - T2
     500
     501            sage: 1-T1
     502            -T1 + 1
     503
     504            sage: T1.parent()
     505            The Iwahori Hecke Algebra of Type A2 in 1,-1 over Integer Ring and prefix T
     506        """
     507
     508        def inverse(self):
     509            """
     510            If the element is a basis element, that is, an element of the
     511            form self(w) with w in the Weyl group, this method computes
     512            its inverse. The base ring must be a field or Laurent
     513            polynomial ring. Other elements of the ring have inverses but
     514            the inverse method is only implemented for the basis elements.
     515
     516            EXAMPLES::
     517
     518                sage: R.<q>=LaurentPolynomialRing(QQ)
     519                sage: H = IwahoriHeckeAlgebraT("A2",q)
     520                sage: [T1,T2]=H.algebra_generators()
     521                sage: x = (T1*T2).inverse(); x
     522                (q^-2)*T2*T1 + (-q^-1+q^-2)*T1 + (-q^-1+q^-2)*T2 + (1-2*q^-1+q^-2)
     523                sage: x*T1*T2
     524                1
     525
     526            """
     527            if len(self) != 1:
     528                raise NotImplementedError, "inverse only implemented for basis elements (monomials in the generators)"%self
     529            H = self.parent()
     530            w = self.support_of_monomial()
     531
     532            return H.prod(H.inverse_generator(i) for i in reversed(w.reduced_word()))
  • sage/categories/modules_with_basis.py

    diff --git a/sage/categories/modules_with_basis.py b/sage/categories/modules_with_basis.py
    a b class ModulesWithBasis(Category_over_bas 
    239239
    240240    # TODO: find something better to get this inheritance from CategoryWithTensorProduct.Element
    241241    class ElementMethods(CategoryWithTensorProduct.ElementMethods, CategoryWithCartesianProduct.ElementMethods):
    242         pass
     242
     243        def support_of_monomial(self):
     244            """
     245            INPUT:
     246
     247             - ``self`` - a monomial
     248
     249            Returns the support of ``self``.
     250
     251            EXAMPLES::
     252
     253                sage: X = CombinatorialFreeModule(QQ, [1,2,3,4]); X.rename("X")
     254                sage: X.term(2).support_of_monomial()
     255                2
     256                sage: X.monomial(3, 2).support_of_monomial()
     257                3
     258
     259            An exception is raised if ``self`` has more than one term:
     260
     261                sage: (X.term(2) + X.term(3)).support_of_monomial()
     262                Traceback (most recent call last):
     263                ...
     264                ValueError: B[2] + B[3] is not a monomial
     265
     266            """
     267            if len(self) == 1:
     268                return self.support()[0]
     269            else:
     270                raise ValueError, "%s is not a monomial"%(self)
    243271
    244272#         def _neg_(self):
    245273#             """
  • sage/categories/pushout.py

    diff --git a/sage/categories/pushout.py b/sage/categories/pushout.py
    a b class LaurentPolynomialFunctor(Construct 
    310310        if self.multi_variate and is_LaurentPolynomialRing(R):
    311311            return LaurentPolynomialRing(R.base_ring(), (list(R.variable_names()) + [self.var]))
    312312        else:
     313            from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
    313314            return PolynomialRing(R, self.var)
    314315    def __cmp__(self, other):
    315316        c = cmp(type(self), type(other))