In commutative algebra, the prime spectrum (or simply the spectrum) of a ring R is the set of all prime ideals of R, and is usually denoted by ; in algebraic geometry it is simultaneously a topological space equipped with the sheaf of rings . Zariski topology For any ideal I of R, define to be the set of prime ideals containing I. We can put a topology on by defining the collection of closed sets to be This topology is called the Zariski topology. A basis for the Zariski topology can be constructed as follows. For f ∈ R, define Df to be the set of prime ideals of R not containing f. Then each Df is an open subset of , and is a basis for the Zariski topology. is a compact space, but almost never Hausdorff: in fact, the maximal ideals in R are precisely the closed points in this topology. By the same reasoning, it is not, in general, a T1 space. However, is always a Kolmogorov space (satisfies the T0 axiom); it is also a spectral space. Sheaves and schemes Given the space with the Zariski topology, the structure sheaf OX is defined on the distinguished open subsets Df by setting Γ(Df, OX) = Rf, the localization of R by the powers of f. It can be shown that this defines a B-sheaf and therefore that it defines a sheaf. In more detail, the distinguished open subsets are a basis of the Zariski topology, so for an arbitrary open set U, written as the union of {Dfi}i∈I, we set Γ(U,OX) = limi∈I Rfi. One may check that this presheaf is a sheaf, so is a ringed space. Any ringed space isomorphic to one of this form is called an affine scheme. General schemes are obtained by gluing affine schemes together. Similarly, for a module M over the ring R, we may define a sheaf on . On the distinguished open subsets set Γ(Df, ) = Mf, using the localization of a module. As above, this construction extends to a presheaf on all open subsets of and satisfies gluing axioms. A sheaf of this form is called a quasicoherent sheaf. If P is a point in , that is, a prime ideal, then the stalk of the structure sheaf at P equals the localization of R at the ideal P, and this is a local ring.