Sheaf of Regular Functions and Localisation I’m trying to prove the following statement:

Let $V$ be an affine algebraic set, $\Gamma(V)$ its coordinate ring, and $\Gamma(D(f),\mathcal{O}_V)$ the sheaf of regular functions of $D(f)=\{x\in V\mid f(x)\neq0\}$ for a non-zero $f\in\Gamma(V)$. Then $$\Gamma(D(f),\mathcal{O}_V)=\Gamma(V)_f$$ where $\Gamma(V)_f$ is $\Gamma(V)$ localised at $\{f^n\mid n\in\mathbb{N}_0\}$.

I can follow the proof of Fulton suggested in this answer, however he requires that the variety be irreducible, and takes the regular functions to be the rational functions defined on all of $D(f)$.
Hartshorne requires only that a regular function be given by a rational function on some open neighbourhood for every $x\in D(f)$, and I can’t seem to reconcile these definitions (although it is suggested in the linked answer that they are equivalent). However his proof is then given in the language of schemes, which I have yet to study.
Both Hartshorne and Mumford also specify that the variety is irreducible, so does this question even make sense when $\Gamma(V)$ may not have a field of fractions?
Any help would be much appreciated.
Update: There is a proof given in this Wikipedia article which doesn't seem to require $V$ be irreducible, and it would seem that their definition of regular functions here agrees with the more general one. However I can't follow the justification for the existence of $D(h)$, or the notation $k[D(h)]$.
We know that there is an open set around $x$ where $f$ is given by a rational function, and since the standard open sets form a basis we can find some subset $D(h)$ containing $x$, but I can't see why the rational function should necessarily be in $A[h^{-1}]$.
 A: This is a good question, and it does make sense even when $V$ is reducible, and the definitions are equivalent (over an algebraically closed field). Everyone deserves to see this done carefully at least once. It is important. The proof in the wiki link you cite is sloppy, and even if they fixed it, they would use irreducibility (so that open sets are dense), without warning, which is pedagogically immoral as far as I'm concerned. Shafarevich does some similar sleight of hand in his book. It took me a bit to forgive him for that. Getting your hands dirty here should not be avoided.
With that said, I tried to be careful, and I think I have been morally careful, but look out for typos. 

If a regular function $\phi$ on $D(f)$ is defined by $g/h$ in a neighborhood $U\subset D(f)$ of $x \in D(f)$, there is always some $u\in \Gamma(V)$ with $x\in D(u)\subset U$ (these $D(\cdot)$ open sets form a basis for the Zariski topology), and then $\phi$ is defined by $(ug)/(uh)$ on $D(uh) \subset D(f)$. So we can always choose an expression for $\phi$ as a rational function at $x$ which is valid in the open set defined by the nonvanishing of its denominator.

So now suppose we have a regular function $\phi$ on $D(f)$ and functions $g_i,h_i \in \Gamma(V)$, $i\in I$ some indexing set, with $\cup_{i\in I} D(h_i) = D(f)$ such that $\phi = g_i/h_i$ on $D(h_i)$. 
Let's first show we only need finitely many $i$. (As noted in the comments, you can use Noetherianness here, but I don't.) We have $V(f) = \cap_{i\in I} V(h_i) = V(h_i : i\in I)$. By the Nullstellensatz, $f$ is in the radical of the ideal $(h_i : i\in I)$, i.e., $f^m = v_1h_{i_1} +\dots+ v_nh_{i_n}$ for some $i_1,\dots,i_n\in I$, $v_1,\dots,v_n \in \Gamma(V)$, and $m\in \mathbb{N}$. Lets write $h_j := h_{i_j}$. Now $V(h_1,\dots,h_n) \subset V(f)$, so $D(h_1)\cup\dots\cup D(h_n) = D(f)$, since all $D(h_i) \subset D(f)$. 
Okay, now we have a regular function $\phi$ on $D(f)$ and functions $g_i,h_i \in \Gamma(V)$, $1\le i \le n$, with $\cup_{i=1}^n D(h_i) = D(f)$ such that $\phi = g_i/h_i$ on $D(h_i)$. Now for each $i$, we have $D(h_i) \subset D(f)$, so that $V(f) \subset V(h_i)$, and so by the Nullstellensatz, there is some $q_i \in \Gamma(V)$ and $m_i \in \mathbb{N}$ (let's go ahead and assume without loss of generality that $m_i\ge 2$ for later) so that $q_if = h_i^{m_i}$. Notice that for $x\in D(f)$, $q_i(x) = 0$ if and only if $h_i(x) = 0$.  Now as we did above (here we really do need the Nullstellensatz), since $V(h_1,\dots,h_n) = V(h_1^{m_1},\dots,h_n^{m_n}) \subset V(f)$, there exist $p_1,\dots,p_n \in \Gamma(V)$ so that $p_1h_1^{m_1} + \dots + p_nh_n^{m_n} = f^{\ell+1}$ for some $\ell \ge 0$. Now substituting, we have 
$$p_1q_1 f + \dots + p_nq_n f = f^{\ell+1}$$
so that
$$p_1q_1 + \dots + p_nq_n = f^{\ell}$$
on $D(f)$. (To get an idea for what's going to happen, see my note at the bottom before proceeding.)
Now I claim that
$$\phi = \sum_{j=1}^n \frac{p_jg_jh_j^{m_j-1}}{f^{\ell+1}}$$
on all of $D(f)$. 
Let's check it at any point $x\in D(f)$. Without loss of generality (by reordering), we assume $x\in D(h_j)$ for $j=1,\dots,k$ and $x\notin D(h_j)$ for $j=k+1,\dots,n$. So (each step here uses some stuff from above, so be alert)
$$\left(\sum_{j=1}^n \frac{p_jg_jh_j^{m_j-1}}{f^{\ell+1}}\right)(x) = \frac{1}{f^\ell(x)}\sum_{j=1}^k \frac{p_j(x)g_j(x)h_j^{m_j-1}(x)}{f(x)} $$
$$= \frac{1}{f^\ell(x)}\sum_{j=1}^k \frac{p_j(x)q_j(x)g_j(x)h_j^{m_j-1}(x)}{q_j(x)f(x)} = \frac{1}{f^\ell(x)}\sum_{j=1}^k \frac{p_j(x)q_j(x)g_j(x)h_j^{m_j-1}(x)}{h_j^{m_j}(x)}$$ 
$$= \frac{1}{f^\ell(x)}\sum_{j=1}^k \frac{p_j(x)q_j(x)g_j(x)}{h_j(x)} = \frac{1}{f^\ell(x)}\sum_{j=1}^k p_j(x)q_j(x) \phi(x)$$
$$=\frac{\phi(x)}{f^\ell(x)}\left(\sum_{i=1}^n p_i(x)q_i(x)\right) = \phi(x).$$
And that's the end. If you read the string of equations backward, you can see the motivation for the claimed form of $\phi$.

Note: If you've ever learned any differential topology, this $p_1q_1+\dots+p_nq_n$ thing is basically a partition of unity with respect to the decomposition $D(h_1)\cup\dots\cup D(h_n)$ of $D(f)$, which lets you sum functions which are only defined locally. To be a little more accurate, it's a partition of $f^\ell$, but that's just as good, since we're allowed to divide by $f^\ell$ on $D(f)$. 
