We say that a formula $\phi$ with free variables $v_1,\ldots,v_n$ represents the $n$-ary relation $R\subset\mathbb{N}^n$ in the axiom system $A_E$ (this contains axioms for addition, multiplication, ordering, and the first two Peano axioms) if for any $a_1,\ldots,a_n\in\mathbb{N}$,
$$(a_1,\ldots,a_n)\in R\Rightarrow A_E\vdash\phi(S^{a_1}0,\ldots,S^{a_n}0)$$ $$(a_1,\ldots,a_n)\not\in R\Rightarrow A_E\vdash\neg\phi(S^{a_1}0,\ldots,S^{a_n}0)$$
We say that a formula $\theta$ with free variables $v_1,\ldots,v_{n+1}$ functionally represents the $n$-ary function $f:\mathbb{N}^n\to\mathbb{N}$ if for any $a_1,\ldots,a_n\in\mathbb{N}$,
$$A_E\vdash\forall v_{n+1}(\theta(S^{a_1}0,\ldots,S^{a_n}0,v_{m+1})\leftrightarrow v_{m+1}=S^{f(a_1,\ldots,a_n)}0)$$
If a formula functionally represents a function $f$, then it represents $f$ as a relation, but the converse is supposedly not true. I am trying to find a counterexample for the converse. I expect this will come down to cleverly using a formula which is true in the theory of $\mathbb{N}$ but which is not provable from $A_E$. Also, note that if $\phi$ represents $R$, then $$R=\{(a_1,\ldots,a_n):\ \vDash_{\mathbb{N}}\phi(S^{a_1}0,\ldots,S^{a_n}0)\}$$
So, what is an example of a formula $\phi$ and a function $f$ such that $\phi$ represents $f$ as a relation but does not functionally represent $f$?