Let |M| be a topological space. A presheaf of commutative algebras F on X is an assignment

U ↦ F(U), U open in |M|, F(U) is a commutative algebra, such that the following holds,

(1) If U ⊂ V are two open sets in |M|, ∃ a morphism r_{V, U}: F(V) → F(U), called the restriction morphism and often denoted by r_{V, U}(ƒ) = ƒ|_{U}, such that

(i) r_{U, U} = id,

(ii) r_{W, U} = r_{V, U} ○ r_{W, V}

A presheaf ƒ is called a sheaf if the following holds:

(2) Given an open covering {U_{i}}_{i∈I} of U and a family {ƒ_{i}}_{i∈I}, ƒ_{i} ∈ F(U_{i}) such that ƒ_{i}|_{Ui ∩ Uj} = ƒ_{j}|_{Ui ∩ Uj} ∀ i, j ∈ I, ∃ a unique ƒ ∈ F(U) with ƒ|_{Ui} = ƒ_{i}

The elements in F(U) are called sections over U, and with U = |M|, these are termed global sections.

The assignments U ↦ C^{∞}(U), U open in the differentiable manifold M and U ↦ O_{X}(U), U open in algebraic variety X are examples of sheaves of functions on the topological spaces |M| and |X| underlying the differentiable manifold M and the algebraic variety X respectively.

In the language of categories, the above definition says that we have defined a functor, F, from top(M) to (alg), where top(M) is the category of the open sets in the topological space |M|, the arrows given by the inclusions of open sets while (alg) is the category of commutative algebras. In fact, the assignment U ↦ F(U) defines F on the objects while the assignment

U ⊂ V ↦ r_{V, U}: F(V) → F(U)

defines F on the arrows.

Let |M| be a topological space. We define a presheaf of algebras on |M| to be a functor

F: top(M)^{op} → (alg)

The suffix “op” denotes as usual the opposite category; in other words, F is a contravariant functor from top(M) to (alg). A presheaf is a sheaf if it satisfies the property (2) of the above definition.

If F is a (pre)sheaf on |M| and U is open in |M|, we define F|_{U}, the (pre)sheaf F restricted to U, as the functor F restricted to the category of open sets in U (viewed as a topological space itself).

Let F be a presheaf on the topological space |M| and let x be a point in |M|. We define the stalk F_{x} of F, at the point x, as the direct limit

lim_{→} F(U)

where the direct limit is taken ∀ the U open neighbourhoods of x in |M|. F_{x} consists of the disjoint union of all pairs (U, s) with U open in |M|, x ∈ U, and s ∈ F(U), modulo the equivalence relation: (U, s) ≅ (V, t) iff ∃ a neighbourhood W of x, W ⊂ U ∩ V, such that s|_{W} = t|_{W}.

The elements in F_{x} are called germs of sections.

Let F and G be presheaves on |M|. A morphism of presheaves φ: F → G, for each open set U in |M|, such that ∀ V ⊂ U, the following diagram commutes

Equivalently and more elegantly, one can also say that a morphism of presheaves is a natural transformation between the two presheaves F and G viewed as functors.

A morphism of sheaves is just a morphism of the underlying presheaves.

Clearly any morphism of presheaves induces a morphism on the stalks: φ_{x}: F_{x} → G_{x}. The sheaf property, i.e., property (2) in the above definition, ensures that if we have two morphisms of sheaves φ and ψ, such that φ_{x} = ψ_{x} ∀ x, then φ = ψ.

We say that the morphism of sheaves is injective (resp. surjective) if x is injective (resp. surjective).

On the notion of surjectivity, however, one should exert some care, since we can have a surjective sheaf morphism φ: F → G such that φ_{U}: F(U) → G(U) is not surjective for some open sets U. This strange phenomenon is a consequence of the following fact. While the assignment U ↦ ker(φ(U)) always defines a sheaf, the assignment

U ↦ im( φ(U)) = F(U)/G(U)

defines in general only a presheaf and not all the presheaves are sheaves. A simple example is given by the assignment associating to an open set U in R, the algebra of constant real functions on U. Clearly this is a presheaf, but not a sheaf.

We can always associate, in a natural way, to any presheaf a sheaf called its sheafification. Intuitively, one may think of the sheafification as the sheaf that best “approximates” the given presheaf. For example, the sheafification of the presheaf of constant functions on open sets in R is the sheaf of locally constant functions on open sets in R. We construct the sheafification of a presheaf using the * étalé space*, which we also need in the sequel, since it gives an equivalent approach to sheaf theory.

Let F be a presheaf on |M|. We define the *étalé space *of F to be the disjoint union ⊔_{x∈|M|} F_{x}. Let each open U ∈ |M| and each s ∈ F(U) define the map š_{U}: U ⊔_{x∈|U|} F_{x}, š_{U}(x) = s_{x}. We give to the étalé space the finest topology that makes the maps š continuous, ∀ open U ⊂ |M| and all sections s ∈ F(U). We define F_{et} to be the presheaf on |M|:

U ↦ F_{et}(U) = {š_{U}: U → ⊔_{x∈|U|} F_{x}, š_{U}(x) = s_{x} ∈ F_{x}}

Let F be a presheaf on |M|. A sheafification of F is a sheaf F^{~}, together with a presheaf morphism α: F → F^{~ }such that

(1) any presheaf morphism ψ: F → G, G a sheaf factors via α, i.e. ψ: F →^{α} F^{~} → G,

(2) F and F^{~ }are locally isomorphic, i.e., ∃ an open cover {U_{i}}_{i∈I} of |M| such that F(U_{i}) ≅ F^{~}(U_{i}) via α.

Let F and G be sheaves of rings on some topological space |M|. Assume that we have an injective morphism of sheaves G → F such that G(U) ⊂ F(U) ∀ U open in |M|. We define the quotient F/G to be the sheafification of the image presheaf: U ↦ F(U)/G(U). In general F/G (U) ≠ F(U)/G(U), however they are locally isomorphic.

Ringed space is a pair M = (|M|, F) consisting of a topological space |M| and a sheaf of commutative rings F on |M|. This is a locally ringed space, if the stalk F_{x} is a local ring ∀ x ∈ |M|. A morphism of ringed spaces φ: M = (|M|, F) → N = (|N|, G) consists of a morphism |φ|: |M| → |N| of the topological spaces and a sheaf morphism φ^{*}: O_{N} → φ_{*}O_{M}, where φ_{*}O_{M} is a sheaf on |N| and defined as follows:

(φ_{*}O_{M})(U) = O_{M}(φ^{-1}(U)) ∀ U open in |N|

Morphism of ringed spaces induces a morphism on the stalks for each

x ∈ |M|: φ_{x}: O_{N,|φ|(x)} → O_{M,x}

If M and N are locally ringed spaces, we say that the morphism of ringed spaces φ is a morphism of locally ringed spaces if φ_{x} is local, i.e. φ^{-1}_{x}(m_{M,x}) = m_{N,|φ|(x)}, where m_{N,|φ|(x)} and m_{M,x} are the maximal ideals in the local rings O_{N,|φ|(x)} and O_{M,x} respectively.