How to relate these two definition of sheaf of regular function In Gortz and Wedhorn's Algebraic geometry book the sheaf of regular function on $U$ is defined as :
Definition 1.39. Let $X$ be an irreducible affine algebraic set and let $\emptyset \neq U \subseteq X$ be open. We denote by $\mathfrak{m}_x$ the maximal ideal of $\Gamma(X)$ corresponding to $x \in X$ and by $\Gamma(X)_{\mathfrak{m}_x}$ the localization of the affine coordinate ring with respect to $\mathfrak{m}_x$. We define
$$
\mathscr{O}_X(U)=\bigcap_{x \in U} \Gamma(X)_{\mathfrak{m}_x} \subset K(X) .
$$
We let $\mathscr{O}_X(\emptyset)$ be a singleton.
This definition is not the same as what I typically learned, which is pointwise defined to be the regular if exist some $f/h$ represent the map and $h\ne 0$ aroud that point.

I want to see that these two definition are the same , But I don't know how to write it down precisely.
A side question, the element in $\bigcap_{x \in U} \Gamma(X)_{\mathfrak{m}_x} $ may not have single representative correct?(I mean there may not have a $f/g$ with $g\notin \mathfrak{m}_x$ for all $x$)

Let $x\in U$. Any element $\in
\mathscr{O}_X(U)=\bigcap_{x \in U} \Gamma(X)_{\mathfrak{m}_x} \subset K(X)$ has a representation $f/g$ with $g(x)\neq 0$($\iff g\in \Gamma (X)\setminus \mathfrak{m}_x$). We can define a map $U \to K$ using the representation. This establishes Görtz-Wedhorn $\Longrightarrow$ your definition.
Conversely, suppose we have a map which can be represented as $f/g\in K(X)$ locally. If we have two such representations $f_1/g_1, f_2/g_2$, the intersection of their domains of definition $D(g_1)\cap D(g_2)=D(g_1g_2)\neq \varnothing$ since $X$ is irreducible. Then Lemma 1.38 ensures $f_1/g_1=f_2/g_2$ as elements of $K(X)$. This shows the map $$\{\text{locally representable map on }U\}\to
\mathscr{O}_X(U)=\bigcap_{x \in U} \Gamma(X)_{\mathfrak{m}_x} \subset K(X)$$
is well defined, so that we have your definition $\Longrightarrow $Görtz-Wedhorn.
