Transforming a summation over multiple variables with a condition Given a general sum with multiple variables from some finite set, I can transform it to be a nested sum or a product of distinct sums over one variable each:
$$ S = \sum_{\substack{a,b,c, d}} f(a)f(b)f(c)f(d) = \left(\sum_a f(a)\right)\left(\sum_b f(b)\right)\left(\sum_c f(c)\right) \left(\sum_d f(d)\right)$$
But can I do something similar if I have a similar sum with a condition like
$$ S = \sum_{\substack{a,b,c, d\\a+b=c+d}} f(a)f(b)f(c)f(d) = \sum_{a}\sum_{b}\sum_c\sum_{d}f(a)f(b)f(c)f(d) \cdot \delta\{a+b=c+d\} $$
Can I transform it to be a product of simpler sums, or a nested sum?
One way I can think of is to throw away the condition, then I'll be able to write the sum as a product of independent sums (exactly as shown above), and finally multiply it by the number of 4-tuples $(a, b, c, d)$ matching the condition divided by the total number of 4-tuples $(a, b, c, d)$, but I am not sure if it's correct, or if there is a simpler solution.
 A: From
$$
a+b = c +d,
$$
we obtain
$$
d = a+b-c,
$$
and then
$$
\sum_a \sum_b \sum_c \sum_d f(a) f(b) f(c) f(d) = \sum_a \sum_b \sum_c \sum_{a+b-c} f(a) f(b) f(c) f(a+b-c).
$$
In the right-hand side, the first three summation symbols can of course be interchanged freely without affacting the answer.
A: Please note that one can transform a general nested sum into a product of the involved sums, like$$\sum_{i, j , k, l}A_iB_jC_kD_l = \left (\sum_iA_i \right ) \left ( \sum_jB_j \right ) \left ( \sum_k C_k \right ) \left ( \sum_l D_l \right ),$$if and only if the indices involved in the sums are independent, meaning that there is no relation between them.
So, if there exists a relation between the indices, for example, $i+j=k+l$, then it is not possible to take out any sum from the nested sum, for it were possible then it would contradict the existence of such a relation.
Please note that your suggestion method, and similar ones, might be used to find the total number of terms in the expanded sum. However, knowing such information does not help one to transform the nested sum into a product of simpler sums (because there are not necessarily some terms with the same value so that one can find their sum by multiplying their number and the same value) as you can easily confirm this point by examining some simple examples.
