Determines if a ring is Cohen-Macaulay. If you pass the IsLocal parameter, this will simply call the isCM function in the Depth package, which checks whether the ring is Cohen-Macaulay at the origin.
i1 : T = ZZ/5[x,y]; |
i2 : S = ZZ/5[a,b,c,d]; |
i3 : g = map(T, S, {x^3, x^2*y, x*y^2, y^3}); o3 : RingMap T <--- S |
i4 : R = S/(ker g); |
i5 : isCohenMacaulay(R) o5 = true |
i6 : R = QQ[x,y,u,v]/(ideal(x*u, x*v, y*u, y*v)); |
i7 : isCohenMacaulay(R) o7 = false |
The function works as follows. It considers R as a quotient of an ambient polynomial ring, R = S/I. It takes a resolution of I. If the resolution has length equal to dim R - dim S, then it is Cohen-Macaulay. If the resolution has a different length, and I is homogeneous, then it is not Cohen-Macaulay. Finally, if the resolution has a different length and I is not homogeneous, the function looks at the Ext groups which compute the depth.
Warning, this function assumes that Spec R is connected. In particular, if you pass it a non-equidimensional Cohen-Macaulay ring (for example, if Spec R has two connected components of different dimensions), this function will return false.