Let X be a topological space. A presheaf \mathcal{F} on X assigns to every open set U a set \mathcal{F}(U), whose elements are called sections over U, and to every inclusion V \subset U of open sets a map \operatorname{res}_{U,V} : \mathcal{F}(U) \to \mathcal{F}(V), written s \mapsto s|_{V}. These maps satisfy \operatorname{res}_{U,U} = \operatorname{id} and \operatorname{res}_{V,W} \circ \operatorname{res}_{U,V} = \operatorname{res}_{U,W} for W \subset V \subset U [1].
The model example is the presheaf C of continuous functions: C(U) is the set of continuous functions U \to \mathbb{R}, and restriction makes the domain smaller. Smooth functions, holomorphic functions on open subsets of \mathbb{C}, bounded continuous functions and constant functions give other presheaves with the same restriction. When the sets \mathcal{F}(U) are groups or rings and the restriction maps are homomorphisms, \mathcal{F} is a presheaf of groups or of rings.
Restriction can forget information, and a section over a smaller set need not come from a larger one. In the figure two continuous functions f and g on a disk U differ only near its edge, so they have the same restriction to the smaller disk V. A function h on V that grows without bound toward the edge of V lies in C(V), but it is not the restriction of any continuous function on U, since such a function is bounded near the edge of V.
A presheaf \mathcal{F} is a sheaf when two conditions hold for every open set U and every family of open sets U_i whose union is U [1]. Locality: if s, t \in \mathcal{F}(U) satisfy s|_{U_i} = t|_{U_i} for every i, then s = t. Gluing: if s_i \in \mathcal{F}(U_i) satisfy s_i|_{U_i \cap U_j} = s_j|_{U_i \cap U_j} for all i and j, then some s \in \mathcal{F}(U) has s|_{U_i} = s_i for every i.
Together the two conditions say that a section over U is the same thing as a family of local sections that agree on the overlaps. Continuous functions satisfy both: a function is determined by its values on the pieces of a cover, and continuous functions on the U_i that agree on the overlaps define one function on U, which is continuous because continuity can be checked near each point. Smooth and holomorphic functions form sheaves for the same reason.
Bounded continuous functions satisfy locality but not gluing. On \mathbb{R} the functions s_n(x) = x on the intervals (n - 1, n + 1) are bounded by n + 1 and agree on the overlaps, but the function they glue to is x, which is not bounded. In the figure the graphs over three overlapping intervals first agree on the overlaps and join into one graph; then the bounds of the pieces of x rise with n, and no single bound holds for all of them.
Constant functions fail as well. On U = (0, 1) \cup (2, 3) the constant 0 on (0, 1) and the constant 1 on (2, 3) agree on the overlap, which is empty, yet no constant function on U restricts to both. Being bounded and being constant are conditions on the whole open set, while being continuous is a condition near each point, and functions cut out by a condition near each point always form a sheaf.
Let x be a point of X. Sections s \in \mathcal{F}(U) and t \in \mathcal{F}(V) over open sets containing x have the same germ at x when they agree on some open set W \subset U \cap V containing x. The germs at x form the stalk \mathcal{F}_x, and the germ of s is written s_x [2]. For continuous functions, the germ at x determines the function on arbitrarily small neighborhoods of x and does not depend on its values farther away.
A germ records more than a value. The function \varphi with \varphi(x) = e^{-1/x} for x > 0 and \varphi(x) = 0 for x \leq 0 is smooth, and at 0 all its derivatives vanish, so it has the same value and the same Taylor series at 0 as the zero function [3]. Their germs at 0 are still different, because every neighborhood of 0 contains points x > 0, where \varphi(x) > 0. At a point p < 0 the two germs coincide.
In the figure an interval around p < 0 shrinks with |p|, and inside it the graph of \varphi lies on the axis. Around p = 0 the interval keeps shrinking while the vertical scale grows: the value \varphi(r) falls below 10^{-3}, yet on the side x > 0 the graph never lies on the axis.
In a sheaf, a section is determined by its germs. If s, t \in \mathcal{F}(U) satisfy s_x = t_x for every x \in U, each point has a neighborhood on which s and t agree, and locality gives s = t. For holomorphic functions far less is needed: on a connected open set the germ at a single point already determines the function, by the identity theorem. For smooth functions this fails, as \varphi shows.