Symmetry groups corresponding to terms in an algebra Given an algebra (in the sense of universal algebra) $\mathcal{A}$ with at least one operation of arity $>1$, let the symmetry spectrum of $A$ be the class $\mathsf{SySp}(\mathcal{A})$ of finite groups $G$ such that there is some $G\cong H\subseteq S_n$ and some $\mathcal{A}$-term $t(x_1,...,x_n)$ (in which each variable $x_i$ ($1\le i\le n$) actually appears - no "dummy variables") with the property that $$H=\{\sigma\in S_n:\forall a_1,...,a_n\in\mathcal{A}[t(a_1,...,a_n)=t(a_{\sigma(1)},...,a_{\sigma(n)})]\}.$$ For example, although exponentiation is not commutative, the symmetry spectrum of $\mathcal{E}=(\mathbb{N};\mathit{exp})$ does contain the group $S_2$ via the term $(x^y)^z$. Meanwhile, we have (modulo isomorphism shenanigans) that $\mathsf{SySp}(\mathbb{N};\max)=\{S_n:n\in\mathbb{N}\}$, and if $\star:\mathbb{N}^2\rightarrow\mathbb{N}$ is injective we have $\mathsf{SySp}(\mathbb{N};\star)$ consists of just the trivial group(s).
(Note that we have a choice here between genuine terms and terms with parameters. I'm tentatively more focused in the former, but I'm definitely interested in the latter as well and open to the possibility that the latter is actually more worth considering.)
I'm generally interested in what we can say about the function $\mathsf{SySp}$. One thing I'm thinking about specifically is different ways in which $\mathsf{SySp}(\mathcal{A})$ can be "large" for a given algebra $\mathcal{A}$. Here's one question which has come up in this context:

Suppose $\mathsf{SySp}(\mathcal{A})$ contains arbitrarily large finite groups. Must every finite group embed into an element of $\mathsf{SySp}(\mathcal{A})$?

I strongly suspect that the answer is negative, and indeed there are plenty of natural candidate counterexamples. However, giving sufficiently complete descriptions of symmetry spectra even for "reasonable" algebras seems difficult.
 A: First, let me note that if $\mathsf{SySp}(\mathcal{A})$ contains any nontrivial group then it contains arbitrarily large finite groups.  This is just because if $t(x_1,\dots,x_n)$ has symmetry group $H$, then for any $m$-ary operation $s$ the symmetry group of the term $s(t(x_{11},\dots,x_{1n}),\dots,t(x_{m1},\dots,x_{mn}))$ is at least as large as $H^m$ (since you can apply $H$ to each of the sets of $n$ inner variables independently).
Now let $S$ be an infinite set (actually, probably it suffices for $S$ to just be nonempty) and let $\mathcal{A}$ be the free algebra on $S$ with a commutative binary operation.  I claim that $\mathsf{SySp}(\mathcal{A})$ consists of entirely of $2$-groups.
To prove this, note that we can think of elements of $\mathcal{A}$ as isomorphism classes of nonempty finite trees in which all non-leaf nodes have two children (we will call these "binary trees") together with a labelling of the leaves by elements of $S$.  Similarly, we can identify a term with a binary tree in which each leaf is labelled by one of our variables, and two terms are equivalent iff the corresponding labelled trees are isomorphic.  Fix a term $t$ and let $T$ be the corresponding binary tree (without the labelling).  Let $H\subseteq S_n$ be the symmetry group of $t$ and let $G$ be the automorphism group of $T$.  Note that a permutation $\sigma\in S_n$ is in $H$ iff there exists an automorphism $f:T\to T$ which sends each leaf labelled $i$ to a leaf labelled $\sigma(i)$.  Let $G_0\subseteq G$ be the subgroup consisting of automorphisms $f$ which have this property for some $\sigma\in S_n$.  We then have a surjective homomorphism $G_0\to H$ sending $f$ to $\sigma$ (this is well-defined due to the requirement that every variable must actually appear in $t$).
So, to show that $H$ is a $2$-group, it suffices to show that $G_0$ is a $2$-group, and for that, it suffices to show that $G$ is a $2$-group. In other words, it suffices show that the automorphism group of any binary tree is a $2$-group.  This is easy by induction on the size of the tree.  The base case of a single leaf is trivial.  For the induction step, suppose we have a binary tree $T$ consisting of a root with two subtrees $T_0$ and $T_1$ below it, and we already know the automorphism groups of $T_0$ and $T_1$ are $2$-groups.  There is a homomorphism $\operatorname{Aut}(T)\to S_2$ which sends an automorphism of $T$ to how it permutes $\{T_0,T_1\}$.  The kernel of this homomorphism consists of the automorphisms of $T$ that map each of $T_0$ and $T_1$ to themselves, which is just $\operatorname{Aut}(T_0)\times\operatorname{Aut}(T_1)$.  Since both $S_2$ and $\operatorname{Aut}(T_0)\times\operatorname{Aut}(T_1)$ are $2$-groups, it follows that $\operatorname{Aut}(T)$ is a $2$-group.
(More generally, instead of a single commutative binary operation, you could consider an arbitrary collection of operations which have given symmetry groups $G_i$ in their inputs.  Then a similar argument should show that if $\mathcal{A}$ is a free algebra on infinitely many generators with respect to such operations, the orders of elements of $\mathsf{SySp}(\mathcal{A})$ can only be divisible by primes that divide some $|G_i|$.)
