Extending the definition of partial differention to nonopen domains Most of the time , When  we talk about the partial derivatives of a function of several varibles, we need to require the function'domain is an open subset.
But under some special cases, the  restriction that the function'domain is an open subset may be removed.  
In the book by William R .Wade,extending the definition of partial differention to include functions defined on nonopen domains.Let $m,n,p\in \mathbf{N},$ and $E$ be a nonempty subset of $\mathbf R^{n}.$ A function $\mathbf f:E \rightarrow \mathbf R^{m}$ is said to be $\mathcal C ^{p} $ on $E$ if and only if  there is an open set $V\supseteq E $ and a function $\mathbf g:V \rightarrow \mathbf R^{m}$ whose partial derivatives of orders $j\leq p$ exist and are continuous on $V$ such that $\mathbf f(\mathbf x)=\mathbf g(\mathbf x)$ for all $\mathbf x \in E.$ In this case we define the partial derivatives of $\mathbf f$ to the partial derivatives of $\mathbf g.$
Then he saied:  "The Mean Value Theorem and the Inverse Function Theorem hold for functions in $\mathcal C^{1}(E)$. "$\color{red}{Why\quad?}$
I have an example to illustrate my puzzle.
$e.g.$
Let $E=\mathbb{Q}\cap(0,+\infty)，f(x)=x^\frac{1}{2},f:E\rightarrow \mathbb{R}.$ If we define the derivative based on $\textbf{Definition}$,then  $f'(x)=\frac{1}{2\sqrt{x}}$ for every $x\in\mathbb{Q}\cap(0,+\infty).$ $$\frac{f(2)-f(1)}{2-1}=\sqrt{2}-1 \quad (*)$$ but for every $\xi \in\mathbb{Q}\cap(1,2)$ , we have $\frac{f(2)-f(1)}{2-1}\ne f'(\xi).$ The Mean Value Theorem does not hold on $E=\mathbb{Q}\cap(0,+\infty).$
So I want to say " The Mean Value Theorem and the Inverse Function Theorem hold for functions in $\mathcal C^{1}(E)$. " should  be incorrect ! 
Can someone explain this a little bit more?
 A: The reference you cite extends the definition of partial differentiation to include functions whose domains are closed.  These are functions $f:E \rightarrow \Bbb{R}^n$ where now $E$ is allowed to be closed.  Note that this has in no way altered the codomain, $\Bbb{R}^n$.
When you calculate your example difference quotient, you get $\sqrt{2} -1 \in \Bbb{R}$, not in $\Bbb{Q} \cap (0,\infty)$.  In fact, you should not expect to get a result in that intersection -- the codomain of $f$ is $\Bbb{R}$ not $E$.
Your negative observation would be correct if $f: E \rightarrow E$, but this is immediately false in your example, since the only points in the domain having defined values are the rational squares.  If you want the domain and codomain to be $E = \Bbb{Q} \cap (0,\infty)$, we must have the images of all points of the domain in the codomain.  I.e., we require $f(E) \subseteq E$.  This doesn't happen in your example.  Your example requires a larger codomain than $E$.
The short answer for your question "Why?" is:  because they hold for $g$ on an open set containing the point of interest.
