Let $R$ any unital ring, and let $\mathcal{L}_R=\{+,-,0,r\}_{r\in R}$ be the language of left $R$-modules, where each $r$ is a unary function symbol. Recall that a positive primitive (pp) $\mathcal{L}_R$-formula is one of the form $\exists\overline{w}\bigwedge_{i=1}^k\overline{r_i}\bullet\overline{v}=\overline{s_i}\bullet\overline{w}$, where each $\overline{r_i}$ and $\overline{s_i}$ is a tuple of elements of $R$, and $\bullet$ denotes the "dot product". (So, eg, $\overline{r_i}\bullet\overline{v}=\sum_{j=1}^mr_{ij}\cdot v_j$.) It is well-known that, modulo the complete theory of any $R$-module, every $\mathcal{L}_R$-formula is equivalent to a boolean combination of pp-formulas. Given a pair of modules $N\leqslant M$, we say that $N$ is a pure submodule of $M$, denoted $N\preccurlyeq^+M$, if $$N\models\psi(\overline{a})\iff M\models\psi(\overline{a})$$ for any pp-formula $\psi$ and any tuple $\overline{a}\in N$. (Note that the forward implication always holds, so the content of purity is the backwards implication.)
Question: When checking that $N$ is a pure submodule of $M$, does it suffice to consider pp-formulas in a single variable? $\square$
This seems like a very natural and straightforward question, but the answer is unclear to me. Certainly if $\psi$ is of the form $\exists\overline{w}(\overline{r}\bullet\overline{v}=\overline{s}\bullet\overline{w})$ then the desired implications hold. Indeed, then the sentence $\psi(\overline{a})$ for a tuple $\overline{a}\in N$ is equivalent to the sentence $\psi'(a^1)$, where $a^1=\overline{r}\bullet\overline{a}\in N$ and $\psi'$ is the single-variable formula $\exists \overline{w}(v=\overline{s}\bullet\overline{w})$. However, things seem less straightforward if $\psi$ has multiple conjuncts. By a similar argument as above (considering each $\overline{r_i}\bullet\overline{a}$ as a single element of $N$), it suffices to consider formulas of the form $\exists\overline{w}\bigwedge_{i=1}^kv_i=\overline{s_i}\bullet\overline{w}$. Then saying that $N$ is pure in $M$ with respect to formulas in one variable amounts to saying that each equation $a_i=\overline{s_i}\bullet\overline{w}$ has a solution in $N$ if and only if it has a solution in $M$, for every $a_i\in N$. But I don't immediately see how we can "stitch" these solutions together in the way that we want, and I'm not even sure if we can in general. Does anyone have any thoughts?
A counterexample, or a proof for a particularly nice class of ring (PIDs perhaps?), would also be much appreciated. For instance, I believe the result holds if $R$ is a local PID. Sketch: suppose $R$ has maximal ideal $(\pi)$. Then every element of $R$ is associate with a power of $\pi$, so we may assume that the length of the tuple $\overline{w}$ in the formula above is $1$, and that each $s_i$ is of the form $\pi^{n_i}$ for some $n_i$. Then, assuming wlog that $n_1$ is minimal among the $n_i$, we have $N\models\exists w\bigwedge_{i=1}^ka_i=\pi^{n_i}w$ if and only if $$\text{(i) }a_1\text{ is divisible by }\pi^{n_1}\text{ in }N\ \ \ \ \ \ \ \text{ and }\ \ \ \ \ \ \ \text{(ii) }a_i=\pi^{n_i-n_1}a_1\text{ for each }i.$$ Clearly (ii) holds in $N$ if and only if it holds in $M$, and (i) is covered by the pp-criterion for single variable formulas, and so we are done.
I was enormously overthinking this; thank you to Ivo Herzog for showing me the following argument. I'm going to leave my proof for PIDs up, as it actually shows something stronger than the desired result. For now, suppose $N\leqslant M$ are modules that agree on pp-sentences over $N$ in a single variable. We prove by induction on $k$ that $N$ and $M$ agree on pp-sentences over $N$ in $k$-many variables, the base case being the hypothesis. For the inductive step, suppose $\varphi(\overline{v},w)$ is a pp-formula in $k+1$ variables, and let $\overline{a},b$ be a $k$-tuple and an element, respectively, from $N$. Suppose also that $M\models\varphi(\overline{a},b)$; we want to show that $N\models\varphi(\overline{a},b)$. To see this, first note that $\exists w\varphi(\overline{v},w)$ is a pp-formula in $k$ variables, and certainly $M\models\exists w\varphi(\overline{a},w)$, so by the inductive hypothesis $N\models\exists w\varphi(\overline{a},w)$; let $b'\in N$ be such that $N\models\varphi(\overline{a},b')$. Now, since $\varphi(\overline{v},w)$ cuts out a subgroup of $M^{k+1}$, we may subtract the tuple $(\overline{a},b')\in \varphi(N)\subseteq\varphi(M)$ from the tuple $(\overline{a},b)\in\varphi(M)$ to get $M\models\varphi(\overline{0},b-b')$. But, $b,b'\in N$, so $b-b'\in N$ too; since $\varphi(\overline{0},w)$ is a pp-formula in one variable, by the case $k=1$ we thus have $N\models\varphi(\overline{0},b-b')$. In other words, $(\overline{0},b-b')\in\varphi(N)$; since also $(\overline{a},b')\in\varphi(N)$, we may add these two tuples together to get $(\overline{a},b)\in\varphi(N)$, ie $N\models\varphi(\overline{a},b)$, as desired.