  Consider a compact Abelian group $Z$ and closed subgroups $U_1$, \ldots, $U_k
\leq Z$. Let $\mathbb{T} := \mathbb{R}/\mathbb{Z}$. This paper examines two
kinds of functional equation for measurable functions $Z\to \mathbb{T}$.
  First, given $f:Z\to \mathbb{T}$ and $w \in Z$, the resulting differenced
function is \[d_wf(z) := f(z-w) - f(z).\] In this notation, we study solutions
to the system of difference equations \[d_{u_1}\cdots d_{u_k}f \equiv 0 \quad
\forall u_1 \in U_1,\ u_2 \in U_2,\ \ldots\ u_k \in U_k.\] Second, we study
tuples of measurable functions $f_i:Z\to \mathbb{T}$ such that $f_i$ is
invariant under translation by $U_i$ and also \[f_1 + \cdots + f_k = 0.\]
  For these equations, the solutions form a subgroup of $\mathcal{F}(Z)$ or
$\mathcal{F}(Z)^k$, where $\mathcal{F}(Z)$ is the group of measurable functions
$Z\to \mathbb{T}$ modulo Haar-a.e. equality. The subgroup of solutions is
closed under convergence in probability and is globally invariant under
rotations of $Z$, so it is a complete metrizable $Z$-module. We will give a
recursive description of the structure of this $Z$-module relative to the
solution-modules of lower-order equations of the same kind.
  These results are obtained as applications of an abstract theory of a special
class of $Z$-modules. Most of our work will go into showing that this class of
modules is closed under various natural operations. Knowing that, the above
descriptions follow as easy consequences.
  Partial difference equations of the above kind can be seen as an extremal
version of the inverse problem for the higher-dimensional, directional analogs
of Gowers' uniformity norms. Our methods also give some information about the
`stability' version of this inverse problem, which concerns functions whose
Gowers norm is sufficiently close to being maximal.
