regular functions: two definitions Let $X$ be an (affine) algebraic set i.e. the zeros' locus of a set of polynomial $S\subseteq k[X_1,\ldots,X_n],$
Let's look at these two definitions:
1) A regular function in $p\in X$, is an element of the following ring:
$$\mathcal O_{X,\,p}=\{\frac{f}{g}\;:\;f,g\in k[X_1,\ldots,X_n]/I(X),\;g(p)\neq 0\}$$ Moreover a regular function on $U\subseteq X $ open (respect the Zariski toplogy?) is an element of the ring
$$\mathcal O_X(U)=\bigcap_{p\in U} \mathcal O_{X,\,p}$$
2) If $U\subseteq X$ is open (respect the Zariski toplogy?), a set theoretic function $\phi:U\rightarrow k$ is regular at a point $p$ if exists a neighborhood $V$ of $p$ such that there are polynomials $f,g\in k[X_1,\ldots,X_n]$ with $g(q)\neq 0$ and $\phi(q)=\frac{f(p)}{g(q)}$ for all $q\in V$. It is called regular on $U$ if it is regular at every $p\in U$.
Now i have two questions:
a) Stupid question: When we talk about neighborhoods and open sets in $X$, do we refer to the Zariski topology?
b) Important question: If $X$ is irreducible, (so $k[X_1,\ldots,X_n]/I(X)$ is a domain) one can show that the two definitons are equivalent. But if $X$ is NOT irreducible we have that $2)\nRightarrow 1)$. Is it correct? 
 A: a) Yes, Zariski topology is intended: there is no other choice for a field that is not endowed with a topology of its own.  
b) Yes, if $X$ is irreducible conditions 1) and 2) are equivalent.
If $X$ is  not irreducible, you have the following sort of problem: 
Take $X=V(xy) \subset \mathbb A^2_k \;$, $\; U=D(x)\subset X$ (the set $x\neq0$) and consider $\phi: U\to k: (x,o) \mapsto 1/x$.
This is certainly a regular function on $U$ according to definition 2), which is the correct interpretation in all cases .
However it is not clear what the expression $\frac {1}{x}$ would mean  with respect to the ring $A=k[x,y]/(xy)$ which is not a domain.
Sometimes the total ring of fractions $Tot (A)=S^{-1}A$ with $S$ the set of non zerodivisors of $A$ is considered as the ring of rational functions on the corresponding algebraic set $X$,  but this does not work here because $x$ is a zerodivisor in $A$.
So you can't even say that $\frac {1}{x}$ is a rational function  on $X$ which is regular on $U$.
Hence for $X$ non irreducible, definition 1) is meaningless rather than false and only definition 2) should be used.
