In Kunen's book he says that $\mathbb{P}$-names are absolute for a transitive models of ZFC using a theorem to the effect that functions defined by recursion are absolute, i.e;
Let $R$,$A$,$G$ be defined (using formulas) and let $R$ be set like on $A$ and suppose that $R$ is a well ordering of $A$ and $G$ is a 2-ary function, then $F(a)=G(a,F(\downarrow(a)))$ for any $a\in{A}$ and $\emptyset$ otherwise is absolute for a transitive model $M$ of ZFC as long as $R, A, G$ are absolute for $M$ and $(R \text{ is set like on }A)^{M}$ and $a\downarrow\subseteq{M}$.
He then uses this on the definition for $\mathbb{P}$-names where $\tau$ is a $\mathbb{P}$-name iff $\tau$ is a relation and $\forall\langle{\sigma,p}\rangle\in{\tau}$, $\sigma$ is a $\mathbb{P}$-name and $p\in{\mathbb{P}}$ with $xRy$ iff $a\in\text{trcl}(y)$, $A$=V and $F(\tau)=1$ if $\forall\langle{\sigma,p}\rangle\in{\tau}$, $F(\sigma)=1$ and $p\in{\mathbb{P}}$ and $0$ otherwise. He does not define what $G$ is.
I can see that $R$, $A$ satisfies the requirements for the theorem. But what is $G$? I tried to the intuitive thing and define $G:V\times{V}\rightarrow{\{0,1\}}$ as $G(\tau,\mathbb{P})=1$ iff $\tau$ is a relation and $\forall\langle{\sigma,p}\rangle\in{\tau}$, $\sigma$ is a $\mathbb{P}$-name and $G(\sigma,\mathbb{P})=1$ and $p\in{\mathbb{P}}$. But I can't figure out how $R$ helps with the recursion. I'm also not sure if $G$ is represented properly by a formula (since $G(\sigma,\mathbb{P})=1$ seems as if the formula referneces itself inside the formula which shouldn't happen).
Can someone please clarify the two points above? Thank you.
Note that in Theorem II.4.15 (p.123-124), the function $G$ must be defined on pairs $\langle x , f \rangle$ where $x$ is an element of the class $A$ under consideration, and $f$ is a function with domain $a{\downarrow}$. Since our goal is to have $$F(a) = G ( a , F \restriction ( a{\downarrow} ) ),$$ we basically re-state the definition of the desired $F$ in terms of $G ( x , f )$ where $x$ and $f$ have the desired properties:
The relation $x \mathrel{R} y \Leftrightarrow x \in \mathrm{trcl}(y)$ is just meant to ensure that if $\langle \sigma , p \rangle \in \tau$, then $F(\sigma)$ is "already" defined, i.e., it has "already" been checked whether $\sigma$ is a $\mathbb{P}$-name. It could be replaced by a long-winded relation to the effect of $x \mathrel{R} y$ iff $x$ is the first coordinate of an element of $y$ or is the first coordinate of an element of the first coordinate of an element of $y$ or &c.