The Spectra of First-Order Sentences and Computational Complexity

The spectrum of a first-order sentence is the set of cardinalities of its finite models. We refine the well-known equality between the class of spectra and the class of sets (of positive integers) accepted by nondeterministic Turing machines in polynomial time. Let $\operatorname{Sp} (d\forall )$ denote the class of spectra of sentences with d universal quantifiers. For any integer $d \geqq 2$ and each set of positive integers, A, we obtain: \[ A \in \operatorname{NTIME} (n^d ) \to A \operatorname{Sp} (d\forall ) \to A \in \operatorname{NTIME} (n^d (\log n)^2 ). \] Further the first implication holds even if we use multidimensional nondeterministic Turing machines. These results hold similarly for generalized spectra. As a consequence, we obtain a simplified proof of a hierarchy result of P. Pudlak about (generalized) spectra. We also prove that the set of primes is the spectrum of a certain sentence with only one variable.