Suppose we have i.i.d samples $X_1,\dots,X_n$. Let $T(\bf X)$ be a statistic with density $f(t; \theta)$. From Statistical Inference by Casella & Berger, 2nd ed., Definition 6.2.21, the family $\mathcal{F} = \{f(t; \theta) : \theta \in \Theta\}$ is complete if, for any function of the statistic, $g(T)$, $\space\mathbb{E}_\theta g(T)=0$ for all $\theta \implies$ $g(T)=0$ a.e. I'm having a bit of trouble understanding the scope of the function $g$. I am clear on why $g$ cannot depend on parameters. However, can $g$ be a function of data other than $T(\bf X)$? For example can it be a function of just $X_1, X_2$?
My guess is that it cannot, since we could just have $g(T) = X_1 - X_2$ which has expectation 0 but is not 0 a.e. Then we wouldn't ever have a complete statistic, so the definition of completeness would not be useful. However, I am having trouble reconciling this with the proof of Basu's Theorem (6.2.24) in the same text. Here, we have a complete sufficient statistic $T(\bf X)$ and an ancillary statistic $S(\bf X)$. In the proof, they choose $g(t) = P(S({\bf X})=s\vert T({\bf X})=t) - P(S({\bf X})=s)$. This doesn't seem to be a function solely of the complete statistic $T$, but also of additional data through $S({\bf X})$. So can $g$ be a function of data other than through $T$?