Commutative Differential Graded Algebras

An algebra is said to be graded commutative if it is endowed with a grading and its multiplication satisfies the Koszul sign convention: \(yx = (-1)^{ij} xy\) if \(x\) and \(y\) are homogeneous of degrees \(i\) and \(j\), respectively. Thus the multiplication is anticommutative for odd degree elements, commutative otherwise. Commutative differential graded algebras are graded commutative algebras endowed with a graded differential of degree 1. These algebras can be graded over the integers or they can be multi-graded (i.e., graded over a finite rank free abelian group \(\ZZ^n\)); if multi-graded, the total degree is used in the Koszul sign convention, and the differential must have total degree 1.

EXAMPLES:

All of these algebras may be constructed with the function GradedCommutativeAlgebra(). For most users, that will be the main function of interest. See its documentation for many more examples.

We start by constructing some graded commutative algebras. Generators have degree 1 by default:

sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ)
sage: x.degree()
1
sage: x^2
0
sage: y*x
-x*y
sage: B.<a,b> = GradedCommutativeAlgebra(QQ, degrees = (2,3))
sage: a.degree()
2
sage: b.degree()
3

Once we have defined a graded commutative algebra, it is easy to define a differential on it using the GCAlgebra.cdg_algebra() method:

sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(1,1,2))
sage: B = A.cdg_algebra({x: x*y, y: -x*y})
sage: B
Commutative Differential Graded Algebra with generators ('x', 'y', 'z') in degrees (1, 1, 2) over Rational Field with differential:
    x --> x*y
    y --> -x*y
    z --> 0
sage: B.cohomology(3)
Free module generated by {[x*z + y*z]} over Rational Field
sage: B.cohomology(4)
Free module generated by {[z^2]} over Rational Field

We can also compute algebra generators for the cohomology in a range of degrees, and in this case we compute up to degree 10:

sage: B.cohomology_generators(10)
{1: [x + y], 2: [z]}

AUTHORS:

  • Miguel Marco, John Palmieri (2014-07): initial version
class sage.algebras.commutative_dga.CohomologyClass(x)

Bases: sage.structure.sage_object.SageObject

A class for representing cohomology classes.

This just has _repr_ and _latex_ methods which put brackets around the object’s name.

EXAMPLES:

sage: from sage.algebras.commutative_dga import CohomologyClass
sage: CohomologyClass(3)
[3]
sage: A.<x,y,z,t> = GradedCommutativeAlgebra(QQ, degrees = (2,3,3,1))
sage: CohomologyClass(x^2+2*y*z)
[2*y*z + x^2]
representative()

Return the representative of self.

EXAMPLES:

sage: from sage.algebras.commutative_dga import CohomologyClass
sage: x = CohomologyClass(sin)
sage: x.representative() == sin
True
sage.algebras.commutative_dga.Differential

Differential of a commutative graded algebra.

INPUT:

  • A – algebra where the differential is defined
  • im_gens – tuple containing the image of each generator

EXAMPLES:

sage: A.<x,y,z,t> = GradedCommutativeAlgebra(QQ, degrees=(1,1,2,3))
sage: B = A.cdg_algebra({x: x*y, y: -x*y , z: t})
sage: B
Commutative Differential Graded Algebra with generators ('x', 'y', 'z', 't') in degrees (1, 1, 2, 3) over Rational Field with differential:
    x --> x*y
    y --> -x*y
    z --> t
    t --> 0
sage: B.differential()(x)
x*y
sage.algebras.commutative_dga.DifferentialGCAlgebra

A commutative differential graded algebra.

INPUT:

  • A – a graded commutative algebra; that is, an instance of GCAlgebra
  • differential – a differential

As described in the module-level documentation, these are graded algebras for which oddly graded elements anticommute and evenly graded elements commute, and on which there is a graded differential of degree 1.

These algebras should be graded over the integers; multi-graded algebras should be constructed using DifferentialGCAlgebra_multigraded instead.

Note that a natural way to construct these is to use the GradedCommutativeAlgebra() function and the GCAlgebra.cdg_algebra() method.

EXAMPLES:

sage: A.<x,y,z,t> = GradedCommutativeAlgebra(QQ, degrees=(3, 2, 2, 3))
sage: A.cdg_algebra({x: y*z})
Commutative Differential Graded Algebra with generators ('x', 'y', 'z', 't') in degrees (3, 2, 2, 3) over Rational Field with differential:
    x --> y*z
    y --> 0
    z --> 0
    t --> 0

Alternatively, starting with GradedCommutativeAlgebra():

sage: A.<x,y,z,t> = GradedCommutativeAlgebra(QQ, degrees=(3, 2, 2, 3))
sage: A.cdg_algebra(differential={x: y*z})
Commutative Differential Graded Algebra with generators ('x', 'y', 'z', 't') in degrees (3, 2, 2, 3) over Rational Field with differential:
    x --> y*z
    y --> 0
    z --> 0
    t --> 0

See the function GradedCommutativeAlgebra() for more examples.

sage.algebras.commutative_dga.DifferentialGCAlgebra_multigraded

A commutative differential multi-graded algebras.

INPUT:

  • A – a commutative multi-graded algebra
  • differential – a differential

EXAMPLES:

sage: A.<a,b,c> = GradedCommutativeAlgebra(QQ, degrees=((1,0), (0, 1), (0,2)))
sage: B = A.cdg_algebra(differential={a: c})
sage: B.basis((1,0))
[a]
sage: B.basis(1, total=True)
[b, a]
sage: B.cohomology((1, 0))
Free module generated by {} over Rational Field
sage: B.cohomology(1, total=True)
Free module generated by {[b]} over Rational Field
sage.algebras.commutative_dga.Differential_multigraded

Differential of a commutative multi-graded algebra.

sage.algebras.commutative_dga.GCAlgebra

A graded commutative algebra.

INPUT:

  • base – the base field
  • names – (optional) names of the generators: a list of strings or a single string with the names separated by commas. If not specified, the generators are named “x0”, “x1”, …
  • degrees – (optional) a tuple or list specifying the degrees of the generators; if omitted, each generator is given degree 1, and if both names and degrees are omitted, an error is raised.
  • R (optional, default None) – the ring over which the algebra is defined: if this is specified, the algebra is defined to be R/I.
  • I (optional, default None) – an ideal in R. It is should include, among other relations, the squares of the generators of odd degree

As described in the module-level documentation, these are graded algebras for which oddly graded elements anticommute and evenly graded elements commute.

The arguments R and I are primarily for use by the quotient() method.

These algebras should be graded over the integers; multi-graded algebras should be constructed using GCAlgebra_multigraded instead.

EXAMPLES:

sage: A.<a,b> = GradedCommutativeAlgebra(QQ, degrees = (2,3))
sage: a.degree()
2
sage: B = A.quotient(A.ideal(a**2*b))
sage: B
Graded Commutative Algebra with generators ('a', 'b') in degrees (2, 3) with relations [a^2*b] over Rational Field
sage: A.basis(7)
[a^2*b]
sage: B.basis(7)
[]

Note that the function GradedCommutativeAlgebra() can also be used to construct these algebras.

class sage.algebras.commutative_dga.GCAlgebraHomset(R, S, category=None)

Bases: sage.rings.homset.RingHomset_generic

Set of morphisms between two graded commutative algebras.

Note

Homsets (and thus morphisms) have only been implemented when the base fields are the same for the domain and codomain.

EXAMPLES:

sage: A.<x,y> = GradedCommutativeAlgebra(QQ, degrees=(1,2))
sage: H = Hom(A,A)
sage: H([x,y]) == H.identity()
True
sage: H([x,x]) == H.identity()
False

sage: A.<w,x> = GradedCommutativeAlgebra(QQ, degrees=(1,2))
sage: B.<y,z> = GradedCommutativeAlgebra(QQ, degrees=(1,1))
sage: H = Hom(A,B)
sage: H([y,0])
Graded Commutative Algebra morphism:
  From: Graded Commutative Algebra with generators ('w', 'x') in degrees (1, 2) over Rational Field
  To:   Graded Commutative Algebra with generators ('y', 'z') in degrees (1, 1) over Rational Field
  Defn: (w, x) --> (y, 0)
sage: H([y,y*z])
Graded Commutative Algebra morphism:
  From: Graded Commutative Algebra with generators ('w', 'x') in degrees (1, 2) over Rational Field
  To:   Graded Commutative Algebra with generators ('y', 'z') in degrees (1, 1) over Rational Field
  Defn: (w, x) --> (y, y*z)
identity()

Construct the identity morphism of this homset.

EXAMPLES:

sage: A.<x,y> = GradedCommutativeAlgebra(QQ, degrees=(1,2))
sage: H = Hom(A,A)
sage: H([x,y]) == H.identity()
True
sage: H([x,x]) == H.identity()
False
zero()

Construct the “zero” morphism of this homset: the map sending each generator to zero.

EXAMPLES:

sage: A.<x,y> = GradedCommutativeAlgebra(QQ, degrees=(1,2))
sage: B.<a,b,c> = GradedCommutativeAlgebra(QQ, degrees=(1,1,1))
sage: zero = Hom(A,B).zero()
sage: zero(x) == zero(y) == 0
True
class sage.algebras.commutative_dga.GCAlgebraMorphism(parent, im_gens, check=True)

Bases: sage.rings.morphism.RingHomomorphism_im_gens

Create a morphism between two graded commutative algebras.

INPUT:

  • parent – the parent homset
  • im_gens – the images, in the codomain, of the generators of the domain
  • check – boolean (default: True); check whether the proposed map is actually an algebra map; if the domain and codomain have differentials, also check that the map respects those.

EXAMPLES:

sage: A.<x,y> = GradedCommutativeAlgebra(QQ)
sage: H = Hom(A,A)
sage: f = H([y,x])
sage: f
Graded Commutative Algebra endomorphism of Graded Commutative Algebra with generators ('x', 'y') in degrees (1, 1) over Rational Field
  Defn: (x, y) --> (y, x)
sage: f(x*y)
-x*y
is_graded(total=False)

Return True if this morphism is graded.

That is, return True if \(f(x)\) is zero, or if \(f(x)\) is homogeneous and has the same degree as \(x\), for each generator \(x\).

INPUT:

  • total (optional, default False) – if True, use the total degree to determine whether the morphism is graded (relevant only in the multigraded case)

EXAMPLES:

sage: C.<a,b,c> = GradedCommutativeAlgebra(QQ, degrees=(1,1,2))
sage: H = Hom(C,C)
sage: H([a, b, a*b + 2*a]).is_graded()
False
sage: H([a, b, a*b]).is_graded()
True

sage: A.<w,x> = GradedCommutativeAlgebra(QQ, degrees=((1,0), (1,0)))
sage: B.<y,z> = GradedCommutativeAlgebra(QQ, degrees=((1,0), (0,1)))
sage: H = Hom(A,B)
sage: H([y,0]).is_graded()
True
sage: H([z,z]).is_graded()
False
sage: H([z,z]).is_graded(total=True)
True
sage.algebras.commutative_dga.GCAlgebra_multigraded

A multi-graded commutative algebra.

INPUT:

  • base – the base field
  • degrees – a tuple or list specifying the degrees of the generators
  • names – (optional) names of the generators: a list of strings or a single string with the names separated by commas; if not specified, the generators are named x0, x1, …
  • R – (optional) the ring over which the algebra is defined
  • I – (optional) an ideal in R; it should include, among other relations, the squares of the generators of odd degree

When defining such an algebra, each entry of degrees should be a list, tuple, or element of an additive (free) abelian group. Regardless of how the user specifies the degrees, Sage converts them to group elements.

The arguments R and I are primarily for use by the GCAlgebra.quotient() method.

EXAMPLES:

sage: A.<a,b,c> = GradedCommutativeAlgebra(QQ, degrees=((1,0), (0,1), (1,1)))
sage: A
Graded Commutative Algebra with generators ('a', 'b', 'c') in degrees ((1, 0), (0, 1), (1, 1)) over Rational Field
sage: a**2
0
sage: c.degree(total=True)
2
sage: c**2
c^2
sage: c.degree()
(1, 1)

Although the degree of c was defined using a Python tuple, it is returned as an element of an additive abelian group, and so it can be manipulated via arithmetic operations:

sage: type(c.degree())
<class 'sage.groups.additive_abelian.additive_abelian_group.AdditiveAbelianGroup_fixed_gens_with_category.element_class'>
sage: 2 * c.degree()
(2, 2)
sage: (a*b).degree() == a.degree() + b.degree()
True

The basis() method and the Element.degree() method both accept the boolean keyword total. If True, use the total degree:

sage: A.basis(2, total=True)
[a*b, c]
sage: c.degree(total=True)
2
sage.algebras.commutative_dga.GradedCommutativeAlgebra(ring, names=None, degrees=None, relations=None)

A graded commutative algebra.

INPUT:

There are two ways to call this. The first way defines a free graded commutative algebra:

  • ring – the base field over which to work
  • names – names of the generators. You may also use Sage’s A.<x,y,...> = ... syntax to define the names. If no names are specified, the generators are named x0, x1, …
  • degrees – degrees of the generators; if this is omitted, the degree of each generator is 1, and if both names and degrees are omitted, an error is raised

Once such an algebra has been defined, one can use its associated methods to take a quotient, impose a differential, etc. See the examples below.

The second way takes a graded commutative algebra and imposes relations:

  • ring – a graded commutative algebra
  • relations – a list or tuple of elements of ring

EXAMPLES:

Defining a graded commutative algebra:

sage: GradedCommutativeAlgebra(QQ, 'x, y, z')
Graded Commutative Algebra with generators ('x', 'y', 'z') in degrees (1, 1, 1) over Rational Field
sage: GradedCommutativeAlgebra(QQ, degrees=(2, 3, 4))
Graded Commutative Algebra with generators ('x0', 'x1', 'x2') in degrees (2, 3, 4) over Rational Field

As usual in Sage, the A.<...> notation defines both the algebra and the generator names:

sage: A.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(1, 2, 1))
sage: x^2
0
sage: z*x # Odd classes anticommute.
-x*z
sage: z*y # y is central since it is in degree 2.
y*z
sage: (x*y**3*z).degree()
8
sage: A.basis(3) # basis of homogeneous degree 3 elements
[y*z, x*y]

Defining a quotient:

sage: I = A.ideal(x*y)
sage: AQ = A.quotient(I)
sage: AQ
Graded Commutative Algebra with generators ('x', 'y', 'z') in degrees (1, 2, 1) with relations [x*y] over Rational Field
sage: AQ.basis(3)
[y*z]

Note that AQ has no specified differential. This is reflected in its print representation: AQ is described as a “graded commutative algebra” – the word “differential” is missing. Also, it has no default differential:

sage: AQ.differential()  # py2
Traceback (most recent call last):
...
TypeError: differential() takes exactly 2 arguments (1 given)
sage: AQ.differential()  # py3
Traceback (most recent call last):
...
TypeError: differential() missing 1 required positional argument:
'diff'

Now we add a differential to AQ:

sage: B = AQ.cdg_algebra({y:y*z})
sage: B
Commutative Differential Graded Algebra with generators ('x', 'y', 'z') in degrees (1, 2, 1) with relations [x*y] over Rational Field with differential:
    x --> 0
    y --> y*z
    z --> 0
sage: B.differential()
Differential of Commutative Differential Graded Algebra with generators ('x', 'y', 'z') in degrees (1, 2, 1) with relations [x*y] over Rational Field
  Defn: x --> 0
        y --> y*z
        z --> 0
sage: B.cohomology(1)
Free module generated by {[z], [x]} over Rational Field
sage: B.cohomology(2)
Free module generated by {[x*z]} over Rational Field

We compute algebra generators for cohomology in a range of degrees. This cohomology algebra appears to be finitely generated:

sage: B.cohomology_generators(15)
{1: [z, x]}

We can construct multi-graded rings as well. We work in characteristic 2 for a change, so the algebras here are honestly commutative:

sage: C.<a,b,c,d> = GradedCommutativeAlgebra(GF(2), degrees=((1,0), (1,1), (0,2), (0,3)))
sage: D = C.cdg_algebra(differential={a:c, b:d})
sage: D
Commutative Differential Graded Algebra with generators ('a', 'b', 'c', 'd') in degrees ((1, 0), (1, 1), (0, 2), (0, 3)) over Finite Field of size 2 with differential:
    a --> c
    b --> d
    c --> 0
    d --> 0

We can examine D using both total degrees and multidegrees. Use tuples, lists, vectors, or elements of additive abelian groups to specify degrees:

sage: D.basis(3) # basis in total degree 3
[d, a*c, a*b, a^3]
sage: D.basis((1,2)) # basis in degree (1,2)
[a*c]
sage: D.basis([1,2])
[a*c]
sage: D.basis(vector([1,2]))
[a*c]
sage: G = AdditiveAbelianGroup([0,0]); G
Additive abelian group isomorphic to Z + Z
sage: D.basis(G(vector([1,2])))
[a*c]

At this point, a, for example, is an element of C. We can redefine it so that it is instead an element of D in several ways, for instance using gens() method:

sage: a, b, c, d = D.gens()
sage: a.differential()
c

Or the inject_variables() method:

sage: D.inject_variables()
Defining a, b, c, d
sage: (a*b).differential()
b*c + a*d
sage: (a*b*c**2).degree()
(2, 5)

Degrees are returned as elements of additive abelian groups:

sage: (a*b*c**2).degree() in G
True

sage: (a*b*c**2).degree(total=True)  # total degree
7
sage: D.cohomology(4)
Free module generated by {[b^2], [a^4]} over Finite Field of size 2
sage: D.cohomology((2,2))
Free module generated by {[b^2]} over Finite Field of size 2
sage.algebras.commutative_dga.exterior_algebra_basis(n, degrees)

Basis of an exterior algebra in degree n, where the generators are in degrees degrees.

INPUT:

  • n - integer
  • degrees - iterable of integers

Return list of lists, each list representing exponents for the corresponding generators. (So each list consists of 0’s and 1’s.)

EXAMPLES:

sage: from sage.algebras.commutative_dga import exterior_algebra_basis
sage: exterior_algebra_basis(1, (1,3,1))
[[0, 0, 1], [1, 0, 0]]
sage: exterior_algebra_basis(4, (1,3,1))
[[0, 1, 1], [1, 1, 0]]
sage: exterior_algebra_basis(10, (1,5,1,1))
[]
sage.algebras.commutative_dga.total_degree(deg)

Total degree of deg.

INPUT:

  • deg - an element of a free abelian group.

In fact, deg could be an integer, a Python int, a list, a tuple, a vector, etc. This function returns the sum of the components of deg.

EXAMPLES:

sage: from sage.algebras.commutative_dga import total_degree
sage: total_degree(12)
12
sage: total_degree(range(5))
10
sage: total_degree(vector(range(5)))
10
sage: G = AdditiveAbelianGroup((0,0))
sage: x = G.gen(0); y = G.gen(1)
sage: 3*x+4*y
(3, 4)
sage: total_degree(3*x+4*y)
7