# Testing the Gorenstein and regular property for Stanley-Reisner rings using Sage

Sage can construct the Stanley-Reisner ring of a simplicial complex:

```
sage: X = SimplicialComplex([[0, 1, 2], [0, 2, 3]])
sage: X.stanley_reisner_ring()
Quotient of Multivariate Polynomial Ring in x0, x1, x2, x3
over Integer Ring by the ideal (x1*x3)
```

Such rings in Sage have a method to check whether they are Cohen-Macaulay:

```
sage: X.is_cohen_macaulay(QQ)
True
```

A natural question in commutative algebra is whether a Cohen-Macaulay ring is a Gorenstein ring or even a regular ring.

**Question:** Is there a method to check for the Gorenstein
(and regular) property for a given commutative ring
(or at least for Stanley-Reisner rings) with Sage?

This is not my field, but if I understand correctly then the Stanley-Reisner ring over $\mathbb{Q}$ is Gorenstein if the top Betti number of a minimal free resolution equals one, i.e. if

`sum(X.stanley_reisner_ring(QQ).defining_ideal()._singular_().mres(0).betti()._sage_().column(-1)) == 1`

.@rburing thank you very much for the comment. This is also not my field. Do you have a reference for this characterisation of Gorenstein? The definition I know is that all localisations (which are local rings) of the ring must be Gorenstein, meaning that the regular module has finite injective dimension.

The characterization I mentioned is the definition in

Cohen-Macaulay Complexesby Stanley (1977). I don't know where the proof of the equivalence is contained.