Let $\mathbb{F}_2^{n}$ be the set of binary strings of length $n$ and let $f: \mathbb{F}_2^{n} \rightarrow \mathbb{R}$ be a function from the set of binary strings of length $n$ to the reals.

Let's say we are given a set of permutations $\pi = \{\pi_1,...,\pi_k\}$ under which the value $f(s)$ is invariant. This set of permutations can be **any** subset of the set of all permutations.

For example, consider the set of binary strings of length $4$ and let $\{(s_1 s_2)\}$ be a set of permutations (in cycle notation) under which $f$ is invariant. Then, we have that $f(0101)=f(1001), f(0110)=f(1010), f(0100)=f(1000)$, and $f(0111)=f(1011)$.

Question: Is there an elegant way of finding a canonical representation of the equivalence classes induced on $\mathbb{F}_2^{n}$ by $f$ (and, therefore, by $\pi$)? I envision a representation that lists one member of each class and the number of strings in each class.

The naive algorithmic approach would apply the permutations exhaustively to all strings to find these classes. Note that, in the worst case, this would require the explicit enumeration of all $2^n$ strings, which is exactly what I want to avoid. I have a feeling that this should be possible in a more elegant way. For instance, if we know that $\pi$ is the set of **all** permutations then the strings can be classified by looking at the number of $1$s: two strings with the same number of $1$s would be invariant under $f$. Thus, one possible canonical representation would be to pick the smallest representative (lexicographically) of each class.

My intuition tells me that there is probably a connection to Invariant Theory. Any answers and/or pointers would be greatly appreciated.

Cheers, Mathias