[Math] Notation for a sum over a set of variables

notationsummation

I have a vector of variables $y=(y_1, \ldots, y_n)$ whose elements are either zero or one. I would like to express the sum over all variables belonging to a subset $S$. For example, if $n=4$ and $S=\{2, 3\}$, I would like to express

$$
\sum_{y_2\in\{0,1\}}\sum_{y_3\in\{0,1\}} f[y] = f[(y_1, 0, 0, y_3)] + f[(y_1, 1, 0, y_3)] + f[(y_1, 0, 1, y_3)]+ f[(y_1, 1, 1, y_3)]
$$

more concisely. Does standard notation exist?

For context, I am concerned with marginalisation of a subset of a binary likelihood.

Best Answer

If I understand your question correctly, you could write

$$\sum_{s \in S}\sum_{y_s\in\{0,1\}}.$$

Related Question