Let $X$ be a topological space, and consider for each open set $U \subseteq X$ a set $F_U$ of functions $U \to k$ into some fixed field $k$. Let $\mathcal{O}$ be the sheaf of $k$-algebras induced by those $F_U$, i.e. the smallest sub-sheaf of the sheaf of all functions into $k$, such that $F_U \subseteq \mathcal{O}(U)$ for all $U$.
Suppose we know that for any open set $U$ and any $f \in F_U$ the set $D(f) \subseteq X$ of non-zeros of $f$ is open, and $\frac{1}{f} : D(f) \to k$ is an element of $F_{D(f)}$. Can we conclude that the same holds for all functions of $\mathcal{O}$, so that $(X,\mathcal{O})$ turns out to be a locally ringed space?
I believe this is true, and I tried to prove it in an inductive way: Let $\mathcal{O}'$ consist of those functions $f$ of $\mathcal{O}$ for which $D(f)$ is open and $\frac{1}{f}$ is an element of $\mathcal{O}(D(f))$. If we could show that $\mathcal{O}'$ is a sheaf of $k$-algebras as well it would follow $\mathcal{O}'= \mathcal{O}$ by definition of $\mathcal{O}$, and hence the claim. Indeed, the sheaf-properties and most of the $k$-algebra-properties are easy to show but the closure property under addition makes trouble. How could we show that $D(f+g)$ is open, and that $\frac{1}{f+g}$ is an element of $\mathcal{O}$ if $f$ and $g$ are elements of $\mathcal{O}'$ with the same domain? Is it even true?
Thank you in advance!
You don't have to show any algebraic closure properties. Since $\mathcal{O}$ is also the smallest sheaf of sets which contains $F$ (the sections are those functions which are locally from $F$), you only have to show that $\mathcal{O}'$ is a sheaf of sets. And this is quite clear.