I need to collect the $\Pr(\cdot)$ terms of the following expression:
$\sum_{m=3}^{n}\frac{g_{m}\left( \cdot \right) }{\left( \sqrt{\theta \left( 1-\theta \right) }\right) ^{m}}\left[ \sum_{j=2}^{m-1}\sum_{i=0}^{j}% \sum_{l=0}^{n-j-1}\left[ \frac{j!}{\left( j-i\right) !i!}\left( -\theta \right) ^{j-i}\left( 1-\theta \right) ^{m-1-j+i}\Pr \left( \mathbf{0}% _{j+1-i+l},\mathbf{1}_{i+n-j-1-l}\right) \right] \right] $
where $\Pr \left( \mathbf{0}% _{j+1-i+l},\mathbf{1}_{i+n-j-1-l}\right)$ is the probability that $i+n-j-1-l$ out of $n$ Bernoulli variables take value $1$ while the remaining $j+1-i+l$ take value $0$ and $g_m(\cdot)$ is a polynomial which depends only on $m$ and other variables not relevant here (hence the $(\cdot)$ argument).
Each Bernoulli variable has probability equal to $\theta\in(0,1)$ of taking value 1 (identical marginals). However, variables are NOT independent and their joint distribution is only known to be symmetric (hence the notation above where it is only reported how many zeroes and ones are taken by the $n$ variables and not the exact sequence of all values).
For the question posed here the $\Pr(\cdot)$ terms are to be considered as $n+1$ parameters of an unknown distribution. I want to collect the $\Pr(\cdot)$ terms in an expression which, ideally, reads something like
$\Pr \left( \mathbf{0}_{1},\mathbf{1}_{n-1}\right) f_{1}\left( \theta ,n,g_{3}\left( \cdot \right) ,...,g_{n}\left( \cdot \right) \right) +\Pr \left( \mathbf{0}_{2},\mathbf{1}_{n-2}\right) f_{2}\left( \theta ,n,g_{3}\left( \cdot \right) ,...,g_{n}\left( \cdot \right) \right) +...+\Pr \left( \mathbf{0}_{n},\mathbf{1}_{0}\right) f_{n}\left( \theta ,n,g_{3}\left( \cdot \right) ,...,g_{n}\left( \cdot \right) \right) $
where the $f_i(\cdot)$, $i=1,2,...,n$ are the coefficients of $\Pr(\mathbf{0}_i,\mathbf{1}_{n-i})$'s.
Hope the problem was stated sufficintly clearly. Thanks for any suggestion.