# Dimension of Ideals

Let $I$ be an ideal of the polynomial ring $P = K[x_1, \ldots, x_n]$, where $K$ is a field. Let $X$ be the set $\lbrace x_1, \ldots, x_n \rbrace$ of variables of $P$. A subset $U$ of $X$ is called *independent modulo* $I$ if $I \cap K[U] = \emptyset$. A subset $U$ of $X$ is called *maximally independent modulo* $I$ if $U$ is independent modulo $I$, and no proper superset of $U$ is independent modulo $I$. The *dimension* of $I$ is defined to be the maximum of the cardinalities of all the independent sets modulo $I$. It is not too hard to see in this case that this coincides with the more abstract commutative algebra definition of the Krull dimension of the *quotient algebra* $P/I$ as the maximal length of a chain of prime ideals. Note that the definition given above of zero-dimensionality (as the case when the quotient of $P$ by $I$ has finite dimension as a vector space over the coefficient field) coincides with the definition of zero-dimensionality as dimension 0.

## `Dimension(I): RngMPol -> RngIntElt, [ RngIntElt ]`

Given an ideal $I$ of a polynomial ring $P$ defined over a field, return the dimension $d$ of $I$, together with a (sorted) sequence $U$ of integers of length $d$ such that the variables of $P$ corresponding to the integers of $U$ constitute a maximally independent set modulo $I$. If $I$ is the full polynomial ring $P$, the dimension is defined to be $-1$, and the second return value is not set. The algorithm implemented is that given in [[Becker and Weispfenning, 1993](../../references.md#cite-beckerweispfenning), p. 449].
