Is there a 0-1 law for the theory of groups? Several months ago, Dominik asked the question Is there a 0-1 law for the theory of groups? on mathstackexchange, but although his question received attention there is still no answer. By asking the question here, I hope to find some result solving partially the problem or motivating a possible answer.
For convenience, I paste the complete question below.

For each first order sentence $\phi$ in the language of groups, define :
$$p_N(\phi)=\frac{\text{number of nonisomorphic groups $G$ of order} \le N\text{ such that } \phi \text{ is valid in } G}{\text{number of nonisomorphic groups of order} \le N}$$
Thus, $p_N(\phi)$ can be regarded as the probability that $\phi$ is valid in a randomly chosen group of order $\le N$.
Now define $$p(\phi)=\lim_{N \to \infty}p_N(\phi)$$
if this limit exists.
We say that the theory of groups fulfills a first order zero-one law if for every sentence $\phi$, $p(\phi)$ exists and equals either $0$ or $1$. I'm asking myself whether this 0-1 law holds indeed in group theory.
Since it is conjectured that "almost every group is a 2-group", statements like $\exists x: x\ne 1 \wedge x^2=1 \wedge \forall y:xy=yx$ (meaning $2|Z(G)$) or $\forall x: x^3=1 \to x=1$ (no element has order 3) should have probability $1$ and I don't see any possibility to construct any sentence with $p\not \in \{0,1\}$. Am I missing an obvious counterexample, or can you show (under the condition that almost every group is indeed a 2-group) that the theory of finite groups fulfills this 0-1 law?
 A: Here is a proposal for a possible sentence with probability that doesn't converge. Actually proving it should be hard, and I'm not sure how confident I should be in it but I thought I'd put it out there:
$$\exists_{w_1,w_2} \forall_{x_1, y_1, x_2, y_2} \exists_{z} \ w_1 z w_1^{-1} z^{-1} = x_1 y_1 x_1^{-1} y_1^{-1} \ \mbox{and} \  w_2 z w_2^{-1} z^{-1} = x_2 y_2 x_2^{-1} y_2^{-1} \quad (\ast)$$
As discussed in comments, it is thought that almost all groups are $2$-groups. The number of groups of order $p^n$ is $p^{(2/27) n^3 + O(n^{8/3})}$. (If we write $N = p^n$, this is $\exp ( (2/27) (\log N)^3/(\log p)^2 + \cdots)$, so $2$-groups overwhelm $p$ groups for other $p$.) This is a theorem of Sims. 
Let's understand where the $(2/27) n^3$ comes from. Look at central extensions
$$0 \to C_p^{n-r} \to G \to C_p^r \to 0.$$
If we look at isomorphism classes of extensions, this is classified by an $H^2$ group of dimension $f(r):= \binom{r}{2} (n-r) + r(n-r)$; Sims writes this down explicitly near the start of his paper. If we maximize $f(r)$ as a function of $r$, it is optimized at
$$r = \begin{cases} 2m & n=3m \\ 2m \ \mbox{and} \  2m+1 & n=3m+1 \\2m+1 & n=3m+2 \\ \end{cases}$$
and, at those values, it is $\approx (2/27) n^3$. Moreover, this maxima are sharply peaked: The value of $f(r)$ for any other $r$ is something like $n$ lower. So, if we were to choose $r$ in proportion to $\left| H^2(C_p^r, C_p^{n-r}) \right| = p^{f(r)}$, we would be choosing the values above with probability $1$.
In particular, if we were choosing $r$ in proportion to $|H^2|$, the probability that $r \geq 2(n-r)$ would approach $1$ for $n \equiv 0 \bmod 3$, would approach $1/2$ for $n \equiv 1 \bmod 3$ and would approach $0$ for $n \equiv 2 \bmod 3$.
For fixed $w_1$ and $w_2 \in C_p^r$, the map $z \mapsto (w_1 z w_1^{-1} z^{-1}, w_2 z w_2^{-1} z^{-1})$ gives a linear map $C_p^r \to C_p^{2(n-r)}$. So, if $r<2(n-r)$, then this map can't possibly be surjective and $(\ast)$ must fail. (Actually, it only fails if commutators generate $C_p^{n-r}$. That feels like a probability $1$ statement, but the issue should be checked.) On the other hand, if $r \geq 2(n-r)$, I see no reason that $(\ast)$ shouldn't be true.
This leaves two questions


*

*In the model where we select $r$ proportional to $\left| H^2(C_p^r, C_p^{n-r}) \right|$ and then select a random extension, how likely is condition $(\ast)$ in the cases where $r \geq 2(n-r)$?

*A much more difficult question: How close is the random $H^2$ model to the original question? Higman  and Sims prove some results along those lines, but they are very far from as strong as we'd want. Can we say heuristically whether we should expect the real situation to be as strongly peaked at a few values of $r$ as the toy model is?
A: This is not an answer to the question, but an expansion of my comment above. I’m going to briefly recap Compton’s method for showing 0–1 laws and limit laws for classes of algebraic structures (in particular, abelian groups). For various reasons, this method is not applicable to noncommutative groups. I’m relying on the excellent presentation in [1], where one can find the details.
We consider classes $\mathcal A$ of finite structures closed under finite direct products with the property that every $A\in\mathcal A$ can be (up to isomorphism) uniquely decomposed as a direct product of indecomposable structures from $\mathcal A$. Let $a(n)$ be the number of nonisomorphic $A\in\mathcal A$ of size $n$, and $A(x)=\sum_{n\le x}a(n)$ (these are the local and global counting functions of $\mathcal A$, respectively). Likewise, if $\mathcal B\subseteq\mathcal A$, let $b(n)$ and $B(x)$ be its local and global counting functions. The goal is to find sufficient conditions to guarantee that whenever $\mathcal B=\{A\in\mathcal A:A\models\phi\}$ for a first-order sentence $\phi$, then the global asymptotic density of $\mathcal B$,
$$\Delta(\mathcal B)=\lim_{n\to\infty}\frac{B(n)}{A(n)},$$
exists (this is called an FO limit law for $\mathcal A$), and ideally, that it is always $0$ or $1$ (an FO 0–1 law).
Under the assumptions above, the isomorphism classes of $\mathcal A$ form a multiplicative number system: a free commutative monoid $(\mathsf A,1,\cdot)$ endowed with a norm function $\|\cdot\|\colon\mathsf A\to(\mathbb N^+,1,\cdot)$ which is a monoid homomorphism such that $\|x\|=1$ only if $x=1$. Here, the monoid multiplication is induced by direct product, and the norm is cardinality. The free generators of $\mathsf A$, or primes, correspond to the indecomposable algebras $A\in\mathcal A$. Let $\mathsf P$ be the set of primes of $\mathsf A$, 
and $p(n)$ its local counting function. The Dirichlet generating function of $\mathsf A$ is
$$\tag{$*$}\mathbf{A}(x)=\sum_{n\ge1}a(n)n^{-x}=\prod_{n\ge2}(1-n^{-x})^{-p(n)}.$$
Finally, a partition set is a subset $\mathsf B\subseteq\mathsf A$ that can be written as
$$\mathsf B=\mathsf P_1^{\gamma_1}\cdots\mathsf P_k^{\gamma_k},$$
where $\mathsf P_1\cup\dots\cup\mathsf P_k=\mathsf P$ is a disjoint partition of $\mathsf P$, and each $\gamma_i$ stands for $m_i$, ${\ge}m_i$, or ${\le}m_i$ with $m_i\in\mathbb N$. Here, $\mathsf B\cdot\mathsf C=\{bc:b\in\mathsf B,c\in\mathbf C\}$, $\mathsf B^m=\underbrace{\mathsf B\cdots\mathsf B}_{m}$, $\mathsf B^{\ge m}=\bigcup_{n\ge m}\mathsf B^n$, and likewise for ${\le}m$.
Now, the strategy for proving FO limit and 0–1 laws goes as follows:


*

*If the Dirichlet series $\mathbf A(x)$ has a finite abscissa of convergence $\alpha<\infty$, then every partition set $\mathsf B$ has a Dirichlet density
$$\partial(\mathsf B)=\lim_{x\to\alpha+}\frac{\mathbf B(x)}{\mathbf A(x)},$$
where $\mathbf B(x)$ is the generating function of $\mathsf B$.

*If $A(n)$ satisfies some regularity conditions (which hold e.g. if $A(n)\sim cn^\alpha$), then one can prove a Tauberian theorem showing that every partition set has a global asymptotic density, which agrees with its Dirichlet density. Under some conditions, the density also turns out to be always 0 or 1.

*By the Feferman–Vaught theorem, the truth of any FO sentence in a direct product $\prod_{i\in I}A_i$ is equivalent to $\mathcal P(I)\models\Phi([[\phi_1]],\dots,[[\phi_k]])$, where $\Phi$ is a formula in the language of Boolean algebras, $\phi_1,\dots,\phi_k$ are sentences in the language of $\phi$, and $[[\phi]]=\{i\in I:A_i\models\phi\}$. Using elimination of quantifiers for atomic Boolean algebras, one can further make $\Phi$ a propositional combination of formulas asserting $|[[\phi_j]]|\ge m_j$ for integer constants $m_j$. This can be used to show that in $\mathcal A$, every FO sentence defines a disjoint union of finitely many partition sets. Thus, if $\alpha<\infty$ and $A(n)$ satisfies the conditions from 2, $\mathcal A$ has an FO limit law, or even a 0–1 law.
This machinery works well for abelian groups, and shows that finite abelian groups have an FO limit law, and for a fixed prime $p$, abelian $p$-groups have a 0–1 law. One can also readily see that abelian groups do not have a 0–1 law. Note that abelian groups have
$$p(n)=\begin{cases}1&\text{if $n$ is a prime power,}\\0&\text{otherwise,}\end{cases}$$
hence by $(*)$, their Dirichlet generating function is
$$\mathbf A(x)=\prod_{n\ge1}\zeta(nx).$$
The class $\mathcal B$ of abelian groups of odd order has a similar generating function but with the terms for powers of $2$ removed. Since the abscissa of convergence is $\alpha=1$ here, it follows easily that the Dirichlet density of $\mathcal B$ relative to $\mathcal A$ is
$$\prod_{n\ge1}(1-2^{-n})\approx0{.}29,$$
and by the general results, this is also its global asymptotic density. $\mathcal B$ is first-order definable, as it consists of abelian groups with no element of order $2$.
Unfortunately, this strategy does not work for noncommutative groups. For one thing, the analytic methods using Dirichlet generating series rely on the condition that the series converges at least somewhere, i.e., that the abscissa of convergence is finite. This is equivalent to the condition that $a(n)$ is polynomially bounded. However, by results quoted above in the comments, the number of groups of order $2^n$ is $2^{\tfrac2{27}n^3+O(n^{8/3})}$, which grows much too fast. What is even worse is that if we assume that almost all groups are $2$-groups, and that the number of $2$-groups grows smoothly enough (the estimate above is not precise enough for this), then in fact almost all  groups are directly indecomposable, which turns the whole approach on its head: if we deal only with indecomposable structures, then the fact that every formula defines a union of partition sets carries zero information, and there is no way that all sets of indecomposable structures could have asymptotic density.
Reference:
[1] Stanley N. Burris, Number theoretic density and logical limit laws, Mathematical Surveys and Monographs vol. 86, AMS, 2001, xx+289 pp.
A: The answer should be "no" for the 0-1 law. Take, for example, this sentence:
"What is the proportion of square-free natural numbers?" 
The answer is known to be $6/\pi^2$
Then turn it into a question about finite cyclic groups:
"How many cyclic groups $G$ of order less than $N$ have the property that none of its non-unit elements $g\in G$ is a square root of unity, $g\ne e, g^2=e$?"
Finally, define property $\theta$ for a finite group $G$ as simultaneously being cyclic and having no square roots of unity. 
EDIT: as pointed out in the comments, $p(\theta)=0$ because the denominator remains "all groups of order $\le N$", not "cyclic groups of order $\le N$". 
