A typical definition of "provably total function in a theory $T$" goes like this (paraphrased from Odifreddi, Classical Recursion Theory II):
A function $f : \mathbb{N}^n \to \mathbb{N}$ is provably total in a theory $T$ (over a language that includes $0$ and successor) iff $$T\models (\forall x_1)...(\forall x_n)(\exists y) \varphi(x_1,...,x_n,y)$$ where for any $\vec{x}\in\mathbb{N}^n$, $y \in \mathbb{N}$, $$f(\vec{x})=y \Leftrightarrow T \models \varphi(\underline{x_1},...,\underline{x_n},\underline{y})$$ where for any $n \in \mathbb{N}$ we have denoted by $\underline{n}$ a canonical term representing $n$ (like $s^{(n)}(0)$).
I haven't been able to find any reference where this definition is fully formalized, in the sense that the first relation must happen for any $\varphi$ that "weakly represents" $f$ according to the second relation, or only for some $\varphi$, or even a (short?) proof that "$\exists$ implies $\forall$".
Can anyone enlighten me?