betaFeedback

WorksComputer Science

Two Primes Suffice for Definable Graph Canonisation

Abstract

We study inflationary fixed-point logic on finite simple graphs with unordered vertices and an ordered number sort. For a prime rr, the quantifier MrM_r tests whether the number of relations satisfying a formula is nonzero modulo rr. For any distinct primes pp and qq, the logic with MpM_p and MqM_q defines the adjacency matrix of a canonical copy on the number sort. On labelled inputs this matrix is computable in deterministic polynomial time with an oracle that tests whether the number of satisfying assignments of a Boolean circuit is nonzero modulo pp. For each prime pp, the logic with MpM_p alone cannot define a canonical copy on all graphs. The primes also differ on Boolean queries. There is a single first-order formula β(S)β(S) on vertex sets such that MqSβ(S)M_q S β(S) is undefinable with MpM_p alone whenever p≠qp \ne q. For a positive integer-valued function gg, consider the class of all graphs GG with at most g(∣V(G)∣)g(|V(G)|) automorphisms. For each fixed prime pp, the logic with MpM_p canonises this class exactly when gg is bounded.

Introduction

The two endpoints of a single edge are indistinguishable. Neither can be chosen first by a formula, yet either ordering gives the same adjacency matrix. For a graph on nn vertices, a canonisation specifies an isomorphic graph on In={0,…,n−1}I_n = \{0,\ldots,n-1\} whose adjacency matrix depends only on the isomorphism type of the input.

On ordered structures, fixed-point logic captures polynomial time (PTIME) [17, 22]. A definable canonisation lets us apply this theorem to an unordered graph by evaluating a sentence on its ordered copy. This is how Grohe [14] obtains a logic for PTIME on graph classes with an excluded minor. On arbitrary graphs, the question is whether there is a logic with effective syntax that expresses every PTIME graph property and effectively assigns a polynomial-time evaluation algorithm to each sentence [15]. For a logic that evaluates ordered fixed-point sentences on a canonical copy, it would suffice to compute that copy in polynomial time.

The input has an unordered vertex sort and the ordered number sort InI_n. For a prime pp, the formula MpR φM_pR\,\varphi holds when the number of relations RR satisfying φ\varphi is nonzero modulo pp. Each relation variable has a fixed arity and specified argument sorts. For example, it may count vertex sets or binary relations that encode maps from vertices to numbers. Let Lp\mathcal{L}_p be first-order logic with inflationary fixed points and MpM_p, and let Lp,q\mathcal{L}_{p,q} allow both modular quantifiers. Our first theorem separates these languages using only a set of vertices as the counted relation.

Theorem (Boolean separation). There is a first-order graph formula β(S)\beta(S) with one unary relation parameter such that, for every pair of distinct primes p,qp,q, the graph property MqSβ(S)M_q^S\beta(S) is undefinable in LpL_p. Consequently the single-prime languages are pairwise incomparable on graphs, and adjoining any second prime strictly increases expressive power.

To construct β\beta, take a connected network over the field Fp\mathbb{F}_p with a prescribed net outflow at each vertex. If the prescribed values sum to zero, any assignment to the dd edges outside a spanning tree extends to a unique flow. There are then pdp^d flows. If the total is nonzero, there are none. Counting modulo any other prime distinguishes these cases. The graph encodes the local constraints, and each flow corresponds to one set satisfying β\beta.

To prove the separation, we must rule out every LpL_p sentence that might distinguish the two loads. We use the prime-field version of the Cai–Fürer–Immerman construction [5, 12]. Its automorphisms form a pp-group, a group whose order is a power of pp. When this group acts on the relations satisfying a formula, only relations fixed by the whole group contribute modulo pp. We match those fixed relations across the two structures and prove that the matching persists under further quantification and at each stage of a fixed point.

Kontinen and Szymanik (2014, Definition 2.7 and Corollary 3.6) separated coprime second-order divisibility quantifiers on a supplied family of sets. Here a single first-order formula defines the family on simple graphs, and the competing logic may count relations of any fixed arity. Affine systems have also supplied lower bounds for infinitary counting logic (Atserias et al., 2009) and for logics with linear-algebraic operators [13, 7]. In our examples Gaussian elimination over Fp\mathbb{F}_p decides whether a solution exists, although the number of solutions is divisible by pp on both graphs.

Theorem (Canonisation). For any distinct primes p,qp,q, an Lp,qL_{p,q} formula γp,q(i,j)\gamma_{p,q}(i,j) defines the adjacency matrix of a canonical copy of every finite simple graph on its number sort. No LpL_p formula defines such a copy on all finite simple graphs.

For the lower bound, a proposed one-prime formula would give the same adjacency bit at every numerical position on two nonisomorphic CFI graphs. For the upper bound, let QQ be a Sylow pp-subgroup of the permutations of InI_n, so its order is the largest power of pp dividing n!n!. Group two labellings together if they differ by a permutation in QQ. Each class, called a frame, has ∣Q∣|Q| labellings, and the number of frames is prime to pp. Canonical placement under a permutation group [2] selects one adjacency string per frame. The inner quantifier MqM_q recognises a frame with a given prefix because qq does not divide the number of compatible labellings. The outer quantifier MpM_p counts each such frame once. Starting at the empty prefix, we can always extend by a bit whose count remains nonzero. The final string is a copy of the graph.

Our companion paper [11] uses the same count of cosets of a Sylow subgroup. Its algorithm guesses one representative per coset on a labelled input. Here we represent each coset by a relation on unordered vertices. The matrix can be computed in polynomial time with an oracle for modular circuit satisfiability. This oracle tests whether the number of satisfying assignments is nonzero modulo pp, a complete problem for ModpP\mathrm{Mod}_p\mathrm{P}. Evaluating ordered fixed-point sentences with this circuit test on the copy captures the isomorphism-invariant queries in PModpP\mathrm{P}^{\mathrm{Mod}_p\mathrm{P}}.

When one prime suffices. A base for a permutation group is a tuple of points whose pointwise stabiliser contains only the identity. We now consider bases for the vertex action of a Sylow pp-subgroup of the automorphism group Aut⁡(G)\operatorname{Aut}(G). For a positive integer-valued function gg, let Gg={G:∣Aut⁡(G)∣≤g(∣V(G)∣)}\mathcal{G}_g = \{G : |\operatorname{Aut}(G)| \leq g(|V(G)|)\}.

Theorem (One-prime canonisation and capture). Fix a prime pp and an integer k≥0k \geq0. On graphs where a Sylow pp-subgroup of Aut⁡(G)\operatorname{Aut}(G) has a base of at most kk vertices, Lp\mathcal{L}_p defines a canonical ordered copy and captures the invariant ModpP\mathrm{Mod}_p\mathrm{P} Boolean queries.

On Gg\mathcal{G}_g, each of these conclusions holds if and only if gg is bounded. One PTIME graph property witnesses failure of capture for every prime pp and every unbounded gg. Both equivalences also hold when gg bounds the Sylow pp-subgroup order or its minimum base size.

The entries of a base of bounded size allow a single relation of fixed arity to encode an entire orbit of labellings. For the converse, we read the field as well as the flow equations from the graph. Solubility is then one PTIME property for all primes. Taking the disjoint union of each graph in a CFI pair with the same long path preserves both answers and doubles each automorphism group order. We can therefore meet the bound at any sufficiently large size where gg exceeds these two orders.

We first encode the flow problem on simple graphs and prove that the one-prime logic preserves the resulting pairs. We then construct the ordered copy and show how to evaluate queries on it. The final sections treat graphs with bounded symmetry, the polynomial-time prefix test on circulants of bounded odd part, and the counts that can be computed on odd cycles.

Syntax and ordered output

Write VV for the vertex domain and In={0,…,n−1}I_n = \{0, \ldots, n - 1\} for the number domain, where n=∣V∣n = |V|. Equality compares elements of the same sort. Adjacency is a relation on VV, and order is a relation on InI_n. For other input vocabularies, all input relations likewise have object arguments. If DD is the product of the argument sorts of RR, then

MrRφ(R,aˉ)⟺∣{S⊆D:φ(S,aˉ)}∣≠0(modr).M_r R \varphi(R,\bar{a}) \Longleftrightarrow\left|\{S \subseteq D : \varphi(S,\bar{a})\}\right| \ne0 \pmod r.

Each interpretation of RR gives one expansion of the input structure. Compton and Grädel [6] study the number of satisfying expansions as a counting function. On strings, Kontinen and Vollmer [20] study related second-order quantifiers over unary relations. Here RR may have arguments of either sort. The language is closed under Boolean operations and first-order quantification of either sort. We use the inflationary semantics of Gurevich and Shelah [16]. A fixed point with body ψ(T,xˉ)\psi(T,\bar{x}) starts at T0=∅T_0 = \varnothing and successively sets Th+1=Th∪{aˉ:ψ(Th,aˉ)}T_{h+1} = T_h \cup\{\bar{a} : \psi(T_h,\bar{a})\}. It returns the first stable relation. Parameters keep their values during iteration. This convention allows negation and modular tests in the body without a monotonicity assumption. Simultaneous tables can be represented by one relation with a numerical tag. Any finite list of exceptional domain sizes in such an encoding can be handled by first-order cases.

A canonising formula has two free number variables. Its output is the graph on InI_n with the edges it defines, equipped with the usual order. Its graph reduct must be isomorphic to the input, and isomorphic inputs must have identical outputs. The latter condition is automatic for formulas in our language because an input isomorphism acts as the identity on InI_n. The formula gives the edges on numbers directly and need never choose a bijection from VV to InI_n. We apply the Immerman–Vardi theorem only after defining the input to an ordered computation on the number sort.

A flow problem on graphs

Fix a prime pp and a connected ordered cubic graph D=(W,F)D = (W,F), where FF is its set of undirected edges. The CFI structure over DD encodes a flow problem in a vocabulary independent of pp [12 Section 5]. For each orientation ee of an edge, its domain contains a fibre {(e,x):x∈Fp}\{(e,x) : x \in\mathbb{F}_p\}. The base order induces an order on the directed edges. A preorder on the domain compares elements by their edge and ties the elements of each fibre. A successor relation acts by x↦x+1x \mapsto x + 1 in each fibre, and an inverse relation links (e,x)(e,x) to (e−1,−x)(e^{-1},-x).

A load λ:W→Fp\lambda: W \to\mathbb{F}_p specifies the net outflows. At each vertex ww, list the three outgoing edges in base order. The ternary relation on their fibres contains exactly the triples whose coordinates sum to λ(w)\lambda(w). Write A(D,λ)A(D,\lambda) for the resulting structure. Only the relations belong to the vocabulary. The field coordinates serve to describe the construction.

Write x∼yx \sim y for equivalence in the fibre preorder, J0(x,y)J_0(x,y) for the inverse relation, and UU for the CFI ternary relation. Define U∗(x,y,z)U^*(x,y,z) to hold if some x′∼xx' \sim x, y′∼yy' \sim y, z′∼zz' \sim z satisfy U(x′,y′,z′)U(x',y',z'). It records the ordered triples of fibres incident at a base vertex. A section is a set SS that selects exactly one element of each fibre. We write Sec⁡(S)\operatorname{Sec}(S) for the first-order condition that SS is a section satisfying both constraints. Selection of xx forces selection of its inverse yy whenever J0(x,y)J_0(x,y) holds. For three selected elements x,y,zx,y,z, the incidence condition U∗(x,y,z)U^*(x,y,z) forces U(x,y,z)U(x,y,z).

Lemma (Counting flows). On A(D,λ)A(D,\lambda) the number of sets satisfying Sec⁡\operatorname{Sec} is zero if ∑wλ(w)≠0\sum_w \lambda(w) \ne0 and is p∣F∣−∣W∣+1p^{|F|-|W|+1} otherwise.

Proof. Orient the undirected edges for the calculation. The selected point in each forward fibre specifies one field value. The inverse condition fixes the value in the reverse fibre as its negative. The ternary condition gives exactly the signed incidence equations prescribing divergence λ\lambda. Summing them gives the necessary zero-total condition. Conversely, choose a spanning tree and assign arbitrary values to the ∣F∣−∣W∣+1|F|-|W|+1 edges outside it. Each leaf equation fixes the remaining incident tree edge. Stripping leaves determines all tree edges, and the last equation holds by the zero-total condition. Each resulting flow gives a different set SS.

For example, take the complete graph on four vertices as the base over F2\mathbb{F}_2. Three of its six edges lie outside a spanning tree. Eight sets satisfy Sec at total load zero, and none do at total load one. Counting sections modulo three distinguishes the loads. To rule out every formula with modulus two we will need larger base graphs.

Encoding the witnesses as vertex sets

The graph encoding must preserve the number of witnesses. It must also let us recognise relations on graph tuples when proving the lower bound. We use a separate vertex for each tuple and give every auxiliary vertex a unique code over the original structure.

Lemma (An incidence encoding). For a fixed finite relational vocabulary of positive arities there is a faithful encoding J(A)J(A) as a simple graph. Its size depends only on ∣A∣|A|. Each graph vertex has a unique representation by a finite tag and a bounded tuple of elements of AA. Adjacency on these codes is first-order definable. The object domain and its relations are first-order recoverable in the graph.

Proof. Start with an element vertex for each object. For each symbol UU of arity ss and each aˉ∈As\bar{a} \in A^s, add a tuple vertex, a marker, and ss position vertices. Join each position to the tuple and to its element aja_j. Join the marker to the tuple precisely when U(aˉ)U(\bar{a}) holds. Distinguish element, tuple, marker and position types, including the relation symbol and the position index, by attaching a different constant number of private leaves to each type, always at least two. The element, tuple, marker and position vertices now have degree at least two. The private leaves have degree one. The type of each nonleaf vertex is read from its number of leaf neighbours. Relations on element vertices are thus recovered by a fixed first-order formula following the position edges and testing the marker edge. Every structure isomorphism extends, and every graph isomorphism induces a structure isomorphism. A private leaf has the code of its parent and a fixed leaf index. All code domains depend only on ∣A∣|A|, even when membership of tuples changes.

On simple graphs, define β(S)\beta(S) by interpreting Sec⁡(S)\operatorname{Sec}(S) on the decoded element vertices and requiring every member of SS to be an element vertex. Each flow then gives exactly one witness on the graph. Neither the decoder nor β\beta mentions the field size.

Preservation at one prime

The flow count shows why counting sections modulo pp loses the total load. To prove undefinability we compare the two CFI structures on arbitrary Lp\mathcal{L}_p formulas. We first describe how a correspondence between tuple orbits extends to relations.

Fix KK and consider formulas that use at most KK variable symbols and allow arbitrary conjunctions and disjunctions. For each integer m≥0m \ge0 they also allow a quantifier asking whether at least mm elements satisfy a formula. The counting type tp⁡K(A,aˉ)\operatorname{tp}_K(A,\bar{a}) is the set of these formulas true of aˉ\bar{a} in AA. We call two tuples matched if their types agree. Numeric parameters, when present, must agree coordinate by coordinate. The counting types are taken in the original object vocabulary. We use these types to compare structures in the proof.

Matching relations across two structures

Let A,BA,B be finite structures of the same vocabulary and cardinality, and let ΓA,ΓB\Gamma_A,\Gamma_B be pp-subgroups of their automorphism groups. Suppose that the empty tuples are matched. Up to a tuple length d≤Kd \le K, suppose also that within either structure two tuples have the same KK-type exactly when they lie in the same orbit of its designated group. Call the tuple of assigned object parameters the context. Write ΓA,aˉ\Gamma_{A,\bar{a}} for its pointwise stabiliser, the subgroup fixing each entry of aˉ\bar{a}, and define ΓB,bˉ\Gamma_{B,\bar{b}} likewise. Suppose the contexts aˉ,bˉ\bar{a},\bar{b} match. For ∣aˉ∣+s≤d|\bar{a}|+s \le d, the correspondence

ΓA,aˉuˉ⟷ΓB,bˉvˉwhentp⁡K(A,aˉ,uˉ)=tp⁡K(B,bˉ,vˉ)\Gamma_{A,\bar{a}}\bar{u}\longleftrightarrow\Gamma_{B,\bar{b}}\bar{v}\qquad\text{when}\qquad\operatorname{tp}_K(A,\bar{a},\bar{u})=\operatorname{tp}_K(B,\bar{b},\bar{v})

is a bijection between stabiliser orbits on ss-tuples. Indeed, among tuples realised in the two finite structures any one KK-type can be isolated by conjoining formulas that distinguish it from the other realised types. Existentially binding the ss new variables gives a test of realisation over the context, within the same KK slots. The tests agree on matched contexts. Within each side, equality of the extended types gives a group element sending one extension to the other and fixing the common prefix. For mixed-sort tuples we use the same bijection separately at each numerical tuple.

For matched contexts aˉ,bˉ\bar{a},\bar{b}, write τaˉ,bˉ(S)\tau_{\bar{a},\bar{b}}(S) for the union of the orbits corresponding to those in SS, whenever SS is a union of ΓA,aˉ\Gamma_{A,\bar{a}}-orbits. This transport is a bijection on invariant relations of each allowed sort and arity. It preserves unions and the empty relation. In a purely numerical argument domain the orbits are singletons and transport is the identity.

The formula determines how long a tuple we must match. Let tt be the number of object variables in the initial context, including all free object variables. Give distinct names to all bound variables. Let bb be the total number of object variables bound by individual quantifiers or introduced as arguments of fixed-point bodies. Let rr be the largest number of object arguments of any relation variable in the formula, taking r=0r=0 if there are none. A bound d≥t+b+rd \ge t+b+r then covers the context of every subformula together with one argument tuple for a relation. Repeated fixed-point stages use the same variables.

Lemma (Preservation under modular relation quantification). Let φ∈Lp\varphi\in\mathcal{L}_p and let A,BA, B satisfy the orbit and counting-type hypotheses above through length d≥t+b+rd \ge t+b+r. Evaluate φ\varphi at matched contexts aˉ,bˉ\bar{a},\bar{b}. For each free relation let its value SS on AA be invariant under ΓA,aˉ\Gamma_{A,\bar{a}} and give it value τaˉ,bˉ(S)\tau_{\bar{a},\bar{b}}(S) on BB. Then the two evaluations agree.

Proof. We argue by induction on the formula, retaining the outer context at each step.

Extending the context. If (aˉ,uˉ)(\bar{a},\bar{u}) and (bˉ,vˉ)(\bar{b},\bar{v}) match, every relation SS invariant at aˉ\bar{a} is invariant at (aˉ,uˉ)(\bar{a},\bar{u}). Moreover,

τaˉuˉ,bˉvˉ(S)=τaˉ,bˉ(S).\tau_{\bar{a}\bar{u},\bar{b}\bar{v}}(S)=\tau_{\bar{a},\bar{b}}(S).

Corresponding orbits in the extended contexts have the same extended type. Forgetting the new coordinates sends them to corresponding orbits in the original contexts. Membership in SS is constant on each original orbit, which proves the equality. In particular, a relation bound by an outer modular quantifier keeps the same interpretation when an inner quantifier introduces a new parameter.

Atomic formulas agree by matched types, equality of numerical arguments, and the assumption on free relations. The Boolean steps follow immediately. For a first-order existential formula, extend the context by a witness. The orbit correspondence supplies a matched extension on the other side. For a numerical witness use the same number. The induction hypothesis applies, and the argument is symmetric.

Binding a relation. For MpR ψM_pR\,\psi in AA, the stabiliser of aˉ\bar{a} acts on the set of all assignments to RR that satisfy ψ\psi. This set is closed under the action because the other free relations are invariant and formula evaluation commutes with automorphisms for every assignment to RR. An automorphism carries the witnesses of each inner modular test bijectively to those for the transported parameters, and it carries each fixed-point stage to the corresponding stage. Each orbit with more than one assignment has size divisible by pp. It follows that the count modulo pp depends only on the satisfying assignments fixed by the stabiliser. Each fixed assignment to RR is a union of orbits on its argument tuples. The orbit correspondence pairs these unions bijectively across the two structures. Applying the induction hypothesis to ψ\psi with each corresponding pair of assignments shows that equal numbers of them satisfy ψ\psi. The two modular counts therefore agree.

Iterating a fixed point. Let FA(T)F_A(T) be one inflationary update in the original context aˉ\bar{a}, and define FBF_B likewise. Write τ=τaˉ,bˉ\tau=\tau_{\bar{a},\bar{b}}. If the original stabiliser fixes TT, it also fixes FA(T)F_A(T), since formula evaluation commutes with automorphisms. At matched argument tuples uˉ,vˉ\bar{u},\bar{v}, the refinement identity allows us to pass T,τ(T)T,\tau(T) and all outer relations to the body. The induction hypothesis for the body gives the same decision about adding the tuple on both sides. Old membership also agrees. Hence the updates satisfy

τ(FA(T))=FB(τ(T)).\tau(F_A(T))=F_B(\tau(T)).

Starting from the empty relations gives ThB=τ(ThA)T_h^B=\tau(T_h^A) at every stage hh. Bijectivity of τ\tau implies that a stage changes on one side exactly when it changes on the other. At their common stable stage, membership agrees at the argument of the fixed-point formula. This stage argument uses the induction hypothesis only for the update body, which may itself contain fixed points and modular quantifiers.

Applying the lemma to the encoded graphs

On a common connected base, two CFI structures are isomorphic exactly when their total loads agree. Their automorphisms act by translations on the edge fibres and form a pp-group [12 Section 5.2 and Theorem 5.2].

Two further results apply on the ordered cubic expander bases. For every fixed KK, structures with different total loads on a sufficiently large common base agree on all KK-variable counting sentences [12 Theorem 5.6]. Within either structure, the counting type in ℓs\ell s variables determines the automorphism orbit of an ss-tuple, for a constant ℓ\ell independent of the base [12 Theorem 5.7]. Given the tuple bound dd, choose K≥ℓdK \ge\ell d large enough to read the vocabulary and then choose the base. This gives both hypotheses of the preservation lemma on the CFI structures.

Proof (One-prime lower bound). Fix a proposed canonising formula. Multiply its tuple-length bound by the maximum number of object coordinates in a graph vertex code (the incidence encoding). Choose CFI structures AA, BB on the same base with total loads zero and one, using this enlarged bound. Let Aut⁡(A)\operatorname{Aut}(A) act on J(A)J(A) through the coordinates of the codes, fixing each tag, and use the corresponding action on J(B)J(B). These designated groups are pp-groups even though private leaves with the same parent can also be permuted. The tags specify this action on the constructed graphs. No tag or leaf index is supplied to the proposed canonising formula.

Match two graph tuples when their tags agree and their concatenated object coordinates have the same counting type. For fixed tags, extending a graph tuple amounts to adjoining a bounded number of object coordinates. The uniqueness of each code therefore gives the orbit correspondence on graph tuples. Forgetting a graph parameter removes exactly its tag and object coordinates, so the refinement identity for invariant relations also holds. Atomic adjacency agrees because it is first-order definable on codes, with KK chosen large enough for the decoding formula. The graphs have the same size, so their numerical parameters match by equality.

The induction in the preservation lemma uses only agreement on atomic formulas and a bijection of extension orbits compatible with forgetting coordinates. The matching on graph codes supplies both, so the proposed formula gives the same answer on the two graphs at each numerical pair (i,j)(i,j). A single matrix cannot be a copy of two nonisomorphic graphs.

Proof (Boolean separation). Fix qq and any prime p≠qp \ne q. On graphs encoding CFI structures over Fp\mathbb{F}_p, the flow count gives either zero witnesses or a power of pp. Consequently MqS β(S)M_qS\,\beta(S) accepts exactly the zero-total loads on these encodings. If an Lp\mathcal{L}_p sentence defined this graph query, the preceding argument with empty context would give it the same truth value on the two encoded structures. This contradicts the count. Exchanging the roles of pp and qq gives incomparability. Syntactic inclusion gives Lp⊆Lp,q\mathcal{L}_p \subseteq\mathcal{L}_{p,q} and the exhibited sentence makes this inclusion strict.

A canonical matrix with two primes

Fix distinct primes p,qp, q. A frame groups together the labellings that differ by a permutation in a fixed Sylow pp-subgroup of SnS_n. To count frames with a relation quantifier, we need one relation per class of labellings. We construct that relation from the colours of ordered pairs of positions.

The frame and its labellings

Write n=∑hahphn = \sum_h a_h p^h in base pp. Divide InI_n into consecutive slots in decreasing order of size, with aha_h separately indexed slots of size php^h. Identify the members of such a slot with the words of length hh over Fp\mathbb{F}_p in digit order. For a pair of positions record both slot indices. For distinct words in the same slot record also the first position at which they differ and the difference between their digits there, taken in argument order (second minus first). Use separate tags for a diagonal pair and a pair in different slots, and fix every unused coordinate to zero. Regard this table as a relation Col⁡n(i,j,cˉ)\operatorname{Col}_n(i,j,\bar{c}) whose unique value cˉ\bar{c} is a fixed-length numerical tuple. For fixed pp its entries are uniformly computable in polynomial time, so an ordered fixed-point formula defines Col⁡n\operatorname{Col}_n. Write vp(n!)v_p(n!) for the exponent of pp in n!n!.

Lemma (The group of a frame). The automorphism group QQ of the table on its position domain, with colours fixed, has order pvp(n!)p^{v_p(n!)}.

Proof. Each slot is preserved. Within a slot the first differing position tells which pairs agree on any given prefix. A table automorphism therefore acts on the rooted tree of prefixes. If it sends a node to another node, the induced bijection σ\sigma of their child digits satisfies σ(b)−σ(a)=b−a\sigma(b)-\sigma(a)=b-a for all a,ba,b. It is a translation. Conversely, choosing a translation at each internal node defines a tree automorphism that preserves the table. A slot of size php^h has (ph−1)/(p−1)(p^h-1)/(p-1) internal nodes. Thus the exponent of pp in ∣Q∣|Q| is

∑hahph−1p−1=∑j≥1⌊npj⌋=vp(n!).\sum_h a_h \frac{p^h-1}{p-1}=\sum_{j\geq1}\left\lfloor\frac{n}{p^j}\right\rfloor=v_p(n!).

For a bijection f:V→Inf:V\to I_n let Hf(u,v,cˉ)H_f(u,v,\bar{c}) mean Col⁡n(f(u),f(v),cˉ)\operatorname{Col}_n(f(u),f(v),\bar{c}). Two maps f,gf,g give the same relation exactly when gf−1∈Qgf^{-1}\in Q. Each frame occurs as the pullback of exactly ∣Q∣|Q| maps. Consequently there are n!/∣Q∣n!/|Q| frames, a number nonzero modulo pp.

Reading a frame and choosing the prefix

The cyclic shifts of the children at individual nodes generate QQ. Each shift leaves suffix digits unchanged, and there are only polynomially many nodes. Acting on unordered pairs of positions, these generators again give a pp-group, hence a solvable group. The canonical placement algorithm of Babai and Luks [2]}) therefore computes in polynomial time a string cf⁡Q(X)\operatorname{cf}_{Q}(X) in the orbit of XX, with the same output for all strings in that orbit. We order pairs i<ji < j lexicographically, use 0<10 < 1 for bits and follow their first-orbit and first-minimal-block-system rules (Section 3.2). For any labelling ff compatible with a frame HH, put

D(G,H)=cf⁡Q(f(G)).D(G,H)=\operatorname{cf}_{Q}(f(G)).

All compatible labellings give the same string because they differ by elements of QQ.

Encode a prefix ss by its length or endpoint and its known bits in the lexicographic order on pairs i<ji < j. Define θ(G,H,f,s)\theta(G,H,f,s) by requiring that f⊆V×Inf \subseteq V \times I_n be the graph of a bijection, that H(u,v,cˉ)H(u,v,\bar{c}) agree with Col⁡n(f(u),f(v),cˉ)\operatorname{Col}_n(f(u),f(v),\bar{c}) on every argument, and that cf⁡Q(f(G))\operatorname{cf}_{Q}(f(G)) start with ss. The last test is a polynomial-time predicate on an ordered graph with numerical parameters encoding ss. Translate it to ordered fixed-point logic and substitute

∃u∃v (f(u,i)∧f(v,j)∧E(u,v))\exists u \exists v\,(f(u,i) \land f(v,j) \land E(u,v))

for the transported edge relation. The resulting formula for θ\theta uses only first-order quantifiers and fixed points.

Lemma (Counting frames with a given prefix). The formula

MpH(Mqfθ(G,H,f,s))M_p^H\left(M_q^f\theta(G,H,f,s)\right)

holds exactly when the number of frames HH for which D(G,H)D(G,H) begins with ss is nonzero modulo pp.

Proof. For an invalid table no bijection passes the pullback test. For a valid frame the number of maps passing all three tests is either zero or ∣Q∣|Q|. Since ∣Q∣|Q| is a power of pp, the inner quantifier accepts exactly the valid frames with the specified prefix. Each such frame contributes one assignment to the outer quantifier.

Take a graph consisting of two disjoint edges and let p=2p=2. The three frames are the three partitions into two pairs, each with eight compatible labellings. One frame pairs the endpoints of both edges and places a one first. The other two pair non-neighbours and place a zero first. With q=3q=3 the inner test recognises each eligible frame since eight is nonzero modulo three. Two frames extend the empty prefix by zero and one frame extends it by one. The parity test therefore chooses one. Counting labellings by parity would give zero for both children.

Proof (Two-prime construction). Let cG(s)c_G(s) count the frames whose placed string begins with ss. The count at the empty prefix is prime to pp. If the current count is nonzero modulo pp, then cG(s0)+cG(s1)=cG(s)c_G(s0) + c_G(s1) = c_G(s) implies that at least one child count is nonzero modulo pp. Choose zero when the test in the prefix-counting lemma accepts s0s0, and one otherwise. An inflationary fixed point stores triples (i,j,b)(i,j,b) for the bits already decided. Its body adds the value for the first undecided pair using the current table and the prefix test. By induction every stage is a prefix with nonzero count. After nn steps some frame realises the entire string. That string is a labelled copy of the input. Relabelling the input transports frames bijectively and preserves their strings, so it preserves all the decisions. Read the stored bits symmetrically, with zero diagonal. For n≤1n \le1 the output edge relation is empty.

Computing the same matrix with one oracle. On a labelled input, guess one membership bit for each entry of the frame table in a fixed order. Each table occurs on exactly one branch. The following procedure recovers a compatible map from every valid table. Read slot indices from diagonal entries. Within each slot group leaves by agreement through each prefix length, using the first-difference field. Check that these are nested partitions of the required sizes. At each internal node take the child containing the least input vertex for digit zero and use the recorded differences from it to place the others. Reject if any test fails. Once all digits have been assigned, compare the entire table with the pullback along the resulting bijection. This equality certifies that the table is a frame. On a valid frame, translation symmetry permits any choice of the zero child. Compute cfQc_{f_Q} using this map and check the prefix. The accepting path count is exactly cG(s)c_G(s). A Mod⁡pP\operatorname{Mod}_p\mathrm{P} oracle answers the zero-child query at each of polynomially many positions.

Evaluation on the ordered copy

For any polynomial-time graph property PP, the Immerman–Vardi theorem gives an IFP sentence ψ(E,<)\psi(E,<) defining PP on ordered graphs. Run ψ\psi on the number sort, replacing each adjacency test E(i,j)E(i,j) by γp,q(i,j)\gamma_{p,q}(i,j). By the canonisation theorem the graph on which ψ\psi runs is isomorphic to the input, so the resulting sentence defines PP. Once the matrix is known, evaluating ψ\psi takes ordinary polynomial time.

We can also characterise the queries computable with the same oracle that constructs the matrix. Keep γp,q\gamma_{p,q} fixed and allow ordered IFP sentences to test whether a definable Boolean circuit has a nonzero number of satisfying assignments modulo pp. Index the gates by fixed-length number tuples and reject circuit descriptions that are malformed or cyclic. To express this test, bind a relation of gate values by MpM_p, check every gate and the output, and force unused tuple entries to be zero. Each satisfying assignment to the input gates has a unique extension to all gates.

Corollary (Evaluation on the ordered copy). Ordered fixed-point logic with modular circuit tests, evaluated on the copy defined by γp,q\gamma_{p,q}, captures the isomorphism-invariant Boolean graph queries in Mod⁡pP\operatorname{Mod}_p\mathrm{P}.

Proof. First compute the canonical copy with a Mod⁡pP\operatorname{Mod}_p\mathrm{P} oracle. For any fixed ordered sentence the relation tables and fixed-point iterations are polynomially bounded. Each circuit call has polynomial size and takes one oracle query after its description has been evaluated. Fixed nesting of subformulas preserves the polynomial bound.

For the converse, take modular circuit satisfiability as the complete oracle problem. A polynomial-time nondeterministic verifier can be represented by a circuit on its polynomially many choice bits with unused bits fixed, preserving the path count. Fix a deterministic polynomial-time oracle machine for the query. On the ordered copy, tuples index time, tape cells and query gates up to the machine’s polynomial bound. An inflationary table records the configuration at each time. Its successor row is given by the fixed transition rule, using the circuit test on the preceding query tape at an oracle instruction. The initial row and the decoding of the query tape are polynomial-time ordered predicates and hence are definable by ordered fixed points. The accepting state defines the desired sentence. Isomorphism invariance gives the correct answer on the canonical copy.

One prime under symmetry bounds

The two-prime construction counts a frame by testing its labellings with a second prime. Under the base hypothesis of the one-prime canonisation theorem, we can count orbits of labellings directly. Wielandt [23] showed that the orbits on (k+1)(k+1)-tuples determine a permutation group with a base of size kk. Köbler and Verbitsky [18] used bases for the full automorphism group to reduce parallel canonisation to a complete invariant for coloured graphs. Here the base bound applies to a Sylow subgroup. The input supplies neither the subgroup nor a base. We perform the group computations on the number sort once a candidate graph has been specified.

When k=0k=0, we have p∤∣Aut⁡(G)∣p \nmid|\operatorname{Aut}(G)|, and exactly ∣Aut⁡(G)∣|\operatorname{Aut}(G)| bijections onto InI_n give any specified copy. On the number sort a one-prime formula can test whether that copy equals the canonical output, using the ordered simulation of the oracle machine. Counting the bijections that pass this test and give a one at (i,j)(i,j) recovers the canonical bit. For larger kk the same multiplicity can be zero modulo pp. We therefore count orbits of bijections under a suitable subgroup. A related result of Faben and Jerrum [9] says that two graphs without automorphisms of order pp are isomorphic if their homomorphism counts from every graph agree modulo pp.

Encoding an orbit of labellings by one relation

Keep the Sylow subgroup Q≤SnQ \le S_n and the canonical placement function cfQ\mathrm{cf}_Q from the two-prime construction. For an ordered candidate graph YY on InI_n, put HY=Q∩Aut⁡(Y)H_Y = Q \cap\operatorname{Aut}(Y), where automorphisms here preserve the graph reduct of YY. We can compute generators of HYH_Y in polynomial time on the number sort by the Babai–Luks stabiliser algorithm for the solvable group QQ acting on pair positions [2 Lemma 3.2 and Theorem 3.5]. For n≥3n \ge3 this action is faithful, and a permutation of vertices is recovered from its action on incident pairs. Smaller graphs can be handled directly.

Suppose GG satisfies the base bound kk of the one-prime canonisation theorem. If YY is a copy of GG, then HYH_Y lies in a Sylow pp-subgroup of Aut⁡(Y)\operatorname{Aut}(Y). By Sylow conjugacy that subgroup has a base of size at most kk, which is also a base for HYH_Y. We need only a base for this last group. For example, on a triangle a single vertex can be a base for a Sylow 22-subgroup even though its stabiliser in the full group S3S_3 contains a transposition.

Call a candidate YY admissible if cf⁡Q(Y)=Y\operatorname{cf}_Q(Y) = Y and HYH_Y admits a base in InkI_n^k, allowing repetitions. For an admissible candidate take the lexicographically first such tuple bˉ\bar b. Compute ∣HY∣|H_Y| from its generators [10]. For fixed kk each tuple orbit has size at most nkn^k, so we can enumerate it in polynomial time and test whether its size equals ∣HY∣|H_Y|. At k=0k = 0 the sole candidate base is the empty tuple, which passes precisely when HYH_Y is trivial. Orbit membership for (k+1)(k+1)-tuples is polynomial-time decidable by the same enumeration. Ordered fixed-point logic defines both tests.

For an isomorphism f:G→Yf:G \to Y define the mixed-sort relation

Rf(xˉ,u,i)⟺(bˉ,i)∈HY⋅(f(xˉ),f(u)),xˉ∈Vk,u∈V,i∈In.R_f(\bar x,u,i) \Longleftrightarrow(\bar b,i) \in H_Y \cdot(f(\bar x),f(u)), \qquad\bar x \in V^k,\quad u \in V,\quad i \in I_n.

Its slice at xˉ\bar x is empty unless some h∈HYh \in H_Y sends f(xˉ)f(\bar x) to bˉ\bar b. Such an hh is unique because bˉ\bar b is a base. The slice is then the graph of hfhf. Conversely, every hfhf occurs in the slice at (hf)−1(bˉ)(hf)^{-1}(\bar b). Thus the distinct nonempty slices are precisely the maps in the orbit HYfH_Y f.

Lemma (One relation per orbit of labellings). For each admissible YY, a formula with first-order quantifiers on the vertices and fixed points on the number sort recognises exactly the relations RfR_f. There is one such relation per HYH_Y-orbit of isomorphisms from GG to YY.

Proof. For a proposed relation RR, existentially quantify a vertex tuple xˉ0\bar x_0 and read the slice R(xˉ0,u,i)R(\bar x_0,u,i) as the graph of a map gg. Verify that it is a bijection carrying the edges and nonedges of GG to those of YY. Test the displayed equivalence defining RgR_g on every argument, using that slice wherever gg occurs. If the test succeeds, R=RgR = R_g. For R=RfR = R_f the slice at xˉ0=f−1(bˉ)\bar x_0 = f^{-1}(\bar b) gives g=fg = f, so the test succeeds. Postcomposition by HYH_Y preserves RfR_f. Conversely, Rf=Rf′R_f = R_{f'} implies that the slice equal to f′f' also occurs in RfR_f, so f′=hff' = hf for some h∈HYh \in H_Y. The tuple xˉ0\bar x_0 is an ordinary existential witness inside the test, so choosing it introduces no multiplicity into the count of relations.

For a prefix ss, count pairs (Y,R)(Y,R) for which YY is an admissible QQ-canonical graph extending ss and RR satisfies the orbit encoding conditions. A single binder MpM_p counts these pairs. Reserve two numerical tags in one mixed-sort relation, one for YY and one for RR. For each tag, require membership to be independent of the unused coordinates. Forbid entries with any other tag. This encodes each pair exactly once on domains of size at least two. The candidate adjacency relation is required to be symmetric with empty diagonal.

Let a=∣Aut⁡(G)∣a = |\operatorname{Aut}(G)|. There are aa isomorphisms from GG to a specified copy YY. The free action of HYH_Y on these maps gives a/∣HY∣a/|H_Y| distinct relations for YY. The QQ-orbit of YY, in turn, contains ∣Q∣/∣HY∣|Q|/|H_Y| labelled graphs. Sum over the unique QQ-canonical representative of each orbit of copies. All these representatives are admissible, so the count at the empty prefix is

∑Ya∣HY∣=a∣Q∣∑Y∣Q⋅Y∣=a∣Q∣n!a=[Sn:Q].\sum_Y \frac{a}{|H_Y|} = \frac{a}{|Q|}\sum_Y |Q \cdot Y| = \frac{a}{|Q|}\frac{n!}{a} = [S_n : Q].

This integer is prime to pp. The same pairs (Y,R)(Y,R) partition at each prefix according to the next bit of YY. We can therefore use the prefix fixed point to choose a full string. Relabelling GG transports RR and fixes YY, so every input labelling gives the same string.

On labelled inputs the data complexity of every fixed Lp\mathcal{L}_p formula is in Mod⁡pP\operatorname{Mod}_p\mathrm{P}. To see this, induct on syntax with the current free relations supplied as explicit tables. A modular binder guesses one table and tests its body by an oracle call. Individual quantification and fixed-point iteration need only polynomially many such calls for a fixed formula. The induction closes by the prime-modulus lowness theorem Mod⁡pPMod⁡pP=Mod⁡pP\operatorname{Mod}_p\mathrm{P}^{\operatorname{Mod}_p\mathrm{P}} = \operatorname{Mod}_p\mathrm{P} [3 Theorem 6.7 and Corollary 6.8]. Conversely, on the promised class the matrix formula supplies an ordered copy. The ordered circuit test then expresses every invariant Mod⁡pP\operatorname{Mod}_p\mathrm{P} query with the same prime. Thus the sentences of Lp\mathcal{L}_p define exactly the restrictions of those queries to the class. A polynomially clocked machine correct only on the promise gives the same conclusion. Its simulation on the definable matrix is invariant on all inputs and agrees with the query on the promised class, even when membership in the class is undecidable.

One polynomial-time witness for all primes

We define a Boolean query UU on all simple graphs. First apply the first-order decoder of the incidence encoding for the CFI signature. Require a nonempty decoded domain, a total preorder on it, and a successor relation consisting of one directed cycle on each equivalence class of the preorder. Require all cycles to have the same prime length rr. Reject if any of these tests fails.

Choose an origin in each cycle and follow its successor to give its elements coordinates in Fr\mathbb{F}_r. Introduce one unknown zCz_C in that field per class CC. For the decoded inverse and ternary relations, partition their tuples by their ordered lists of classes. Each nonempty block with list (C1,…,Cj)(C_1,\ldots,C_j) gives a table B⊆FrjB \subseteq\mathbb{F}_r^j, where j=2j=2 or 33. Require BB to be an affine subspace, and impose the constraint (zC1,…,zCj)∈B(z_{C_1},\ldots,z_{C_j}) \in B. Empty blocks contribute no constraint. Accept exactly when all tests pass and the resulting system is soluble.

This defines an invariant polynomial-time query even on malformed encodings. Gaussian elimination computes the affine hull of each nonempty block and equations for it. A block with hull of dimension ee equals its hull exactly when it has rer^{e} entries. Solve the combined system by elimination. The field size is at most the input size. Changing the origins translates each unknown and its occurrences in all tables by the same offset. Thus solubility and the tests for affine subspaces are independent of these choices. On an encoded A(D,λ)A(D,\lambda) the inverse blocks impose negation and the ternary blocks prescribe the sum at each vertex. The flow count gives

U(J(A(D,λ)))⟺∑wλ(w)=0.U(J(A(D,\lambda))) \Longleftrightarrow\sum_{w} \lambda(w) = 0.

The field is read from the graph, so the query is common to all primes.

Blass et al. [4] used padded CFI structures to separate fixed-point logic with counting from choiceless polynomial time. Their padding by isolated vertices permits arbitrary permutations of those vertices. Here the size of the full automorphism group is part of the hypothesis, so we use a single path.

Fix pp, an unbounded gg, and a proposed LpL_p formula. Choose its encoded CFI pair X0,X1X_0, X_1 as in the one-prime lower bound. Let mm be their common order and a∗=max⁡i∣Aut⁡(Xi)∣a_* = \max_i |\operatorname{Aut}(X_i)|. Every tail of gg is unbounded, so there exists NN with N−m>max⁡(m,3)N-m > \max(m,3) and g(N)≥2a∗g(N) \ge2a_*. Add a disjoint path on N−mN-m vertices to each graph. It is larger than every old component and has two automorphisms. The new automorphism group order is therefore 2∣Aut⁡(Xi)∣2|\operatorname{Aut}(X_i)|, and both padded graphs lie in GgG_g. No path vertex has the two leaf neighbours required by the decoder, so UU still distinguishes the graphs.

Extend the designated pp-group on each core XiX_i by the identity on the path. Match core coordinates as in the one-prime lower bound and match path vertices and numbers by equality. Once the path vertices and numbers of a tuple are specified, its stabiliser orbit is determined by its core coordinates. The orbit correspondence therefore extends to mixed tuples and still commutes with forgetting parameters. Adjacency is preserved, since the path and the core are disjoint.

These are the hypotheses used in the induction of the preservation lemma. Modular binders match unions of the extended orbits, and fixed-point updates preserve the matching at every stage. The formula’s tuple-length bound is independent of NN. Thus the two padded graphs agree on the proposed sentence, although UU distinguishes them. A proposed canoniser likewise assigns the same matrix to the two nonisomorphic graphs.

For the bounded case, suppose ∣Aut⁡(G)∣≤C|\operatorname{Aut}(G)| \le C. Whenever the current pointwise stabiliser in a Sylow pp-subgroup is nontrivial, choose a vertex that it moves. Fixing that vertex decreases its order by a factor of at least pp. After at most ⌈log⁡pC⌉\lceil\log_p C\rceil choices the stabiliser is trivial, so the bounded-base result applies. The same argument works when CC bounds just the Sylow order, and a bound on the base size is the hypothesis itself. Conversely, the padded examples meet all three unbounded bounds because the full group order bounds both other parameters. The equivalences in the one-prime canonisation theorem concern classes specified by a numerical bound alone. Particular graph classes with unbounded automorphism groups, such as the complete graphs, can still admit a definable canonical copy.

What remains for polynomial-time evaluation

The construction expresses every PTIME graph property on the ordered copy. Its evaluation cost comes from the modular prefix test. Lichter and Schweitzer [21] obtain a different connection in choiceless polynomial time with witnessed symmetric choice. In their logic, definable isomorphism yields definable canonisation on classes closed under individualisation.

For the full language, modular circuit satisfiability already occurs on simple graphs. Encode the gate types and wires of a Boolean circuit by the incidence encoding. A first-order formula requires a vertex set to consist exactly of the gates assigned true in a consistent evaluation with true output. Each satisfying input has one such extension, so MrM_r applied to this formula tests modular circuit satisfiability. The encoding takes polynomial time. A polynomial-time evaluator for every fixed Lp,q\mathcal{L}_{p,q} sentence would therefore put both Mod⁡pP\operatorname{Mod}_p\mathrm{P} and Mod⁡qP\operatorname{Mod}_q\mathrm{P} in P.

The prefix test. Fix the primes p,qp,q and the canonical placement algorithm. Call ss reached if it occurs during the construction of the matrix on GG. Consider the promise problem with input GG and a reached, unfinished prefix ss. Is cG(s0)c_G(s0) nonzero modulo pp?

The test and the matrix are polynomial-time equivalent. Starting from the empty prefix, (n2)\binom{n}{2} calls recover the matrix, and each call uses the prefix reached so far. Conversely, given the matrix, read the bit after ss. It is zero exactly when cG(s0)c_G(s0) is nonzero modulo pp. A polynomial-time algorithm for the test would therefore give a logic capturing PTIME by evaluation on the copy. Comparing the matrices of two graphs would also decide isomorphism in polynomial time.

Circulant graphs of bounded odd part

A graph is circulant if it has an automorphism consisting of a single cycle through all its vertices. If the odd part of the cycle length is bounded, only polynomially many frames are fixed by the subgroup of rotations of power-of-two order.

Proposition (Circulants of bounded odd part). Fix MM. On circulant graphs of order n=m2hn=m2^h, with mm odd and m≤Mm\le M, every frame-prefix parity is computable in deterministic polynomial time from the graph alone. Consequently ordinary ordered IFP evaluated on the copy γ2,q\gamma_{2,q}, for any odd prime qq, captures PTIME on this class.

Proof. Evdokimov and Ponomarenko [8] compute a cycle base in polynomial time. On a circulant graph this gives a full-cycle automorphism σ\sigma. Put L=2hL=2^h. The permutation τ=σm\tau=\sigma^m has mm cycles of length LL. The cyclic group generated by τ\tau has power-of-two order and preserves the placed string of each frame it moves. Every prefix parity is therefore the parity of its matching τ\tau-fixed frames.

When m=1m = 1 there is just one such frame. Number the vertices along σ\sigma in Z/2hZ\mathbb{Z}/2^{h}\mathbb{Z}. Each level of a fixed binary tree is a partition invariant under translations. The block containing zero is a subgroup, and the other blocks are its cosets. At depth jj the cyclic group has a unique subgroup of index 2j2^j. Thus the levels are exactly the partitions into residue classes modulo 2j2^j. One placement of this explicit frame answers all prefix queries.

For bounded mm, the top slots have distinct sizes kLkL, with kk ranging over the powers of two occurring in mm. Assign whole cycles of τ\tau to these slots in at most m!m! ways. Let F(k,L)F(k,L) count the balanced trees on one slot preserved by its kk cycles. We have F(1,L)=1F(1,L) = 1, and F(k,1)F(k,1) counts all balanced trees on kk leaves. For k,L≥2k,L \ge2,

F(k,L)=12(kk/2)F(k/2,L)2+2k−1F(k,L/2).F(k,L) = \frac{1}{2}\binom{k}{k/2}F(k/2,L)^2 + 2^{k-1}F(k,L/2).

In the first term each root child receives half the cycles. In the second term τ\tau exchanges the children, so their leaves alternate around each cycle. There are 2k−12^{k-1} unordered choices of halves. One half carries kk cycles of τ2\tau^2 of length L/2L/2. Choosing its tree determines the other by transport.

For fixed kk, induction on kk gives F(k,L)=Ok(Lk−1)F(k,L) = O_k(L^{k-1}). Indeed the first summand is Ok(Lk−2)O_k(L^{k-2}). Dividing by Lk−1L^{k-1} gives f(L)≤f(L/2)+Ok(1/L)f(L) \le f(L/2) + O_k(1/L), where f(L)=F(k,L)/Lk−1f(L) = F(k,L)/L^{k-1}. The sum of the error terms over powers of two is bounded. The same splits enumerate the trees. Always process the child containing the least input vertex first to avoid duplicates. Every partial choice extends to an output, and the path to an output has at most n−1n - 1 splits. Thus the enumeration visits at most nn partial choices per output on average. Each choice takes polynomial time. The bound on mm makes the product of the slot counts polynomial in nn. Run placement on each resulting frame and count the requested prefix modulo two. The answer depends only on the original frame count, so any full cycle returned by the algorithm gives the same answers. The capture assertion follows by evaluating ordered IFP on this copy.

The parity test on odd cycles

Numbering an odd cycle consecutively gives it a canonical form. To compute the matrix defined by the two-prime construction, we must recover the bits chosen by the parity test. Each frame is a forest of full binary trees, one for each power of two in the binary expansion of nn. The singleton slot provides a distinguished leaf. Rotate the cycle until this leaf is at vertex 0. Each anchored frame then accounts for nn rotations, an odd number. Reflection about 0 pairs the remaining frames unless it preserves their trees. Let Fρ\mathcal{F}^{\rho} denote the anchored frames fixed by this reflection. For every prefix tt,

cCn(t)≡∣{F∈Fρ:D(Cn,F) begins with t}∣(mod2).c_{C_n}(t) \equiv\left|\left\{F \in\mathcal{F}^{\rho} : D(C_n,F)\text{ begins with }t\right\}\right| \pmod{2}.

For example, on C7C_7 there are nine anchored frames fixed by reflection. Seven place 00 first. Of those seven, three continue with zero and four with one, so the algorithm chooses 000. Counting all labelled copies of the cycle would assign a different multiplicity to the same strings.

For the counts below, fix p=2p=2 and write n=2k+1≥5n=2k+1\ge5. Let B=2bB=2b be the largest power of two at most nn. Write the cycle in the order 0,1,…,k,−k,…,−10,1,\ldots,k,-k,\ldots,-1, with singleton slot at 0. Reflection sends ii to −i-i. We use the placement algorithm and numerical pair order of the two-prime construction. On C3C_3 every placement gives the string 111.

Counting at the beginning and end of the matrix

The QQ-orbit of the first output position (0,1)(0,1) consists of the bb sibling pairs in the largest slot. The Babai–Luks algorithm minimises the bit at the least position of its current domain. In an intransitive call it places the orbit of that position first. In a transitive call it keeps the least of the recursively placed strings. Induction on these two cases gives the claim. The first placed bit is therefore one exactly when all bb sibling pairs are cycle edges.

For a power of two hh, let T(h)T(h) count the balanced binary trees on 2h2h specified leaves preserved by an involution with hh transpositions. This is F(h,2)F(h,2) in the count for circulant graphs. We have T(1)=1T(1)=1 and, for h≥2h\ge2,

T(h)=h!+12(hh/2)T(h/2)2.T(h)=h!+\frac{1}{2}\binom{h}{h/2}T(h/2)^2.

The factorial counts trees whose two halves are exchanged. The half containing the least leaf contains one leaf from each transposition, giving 2h−12^{h-1} choices for that half. Its leaves admit h!/2h−1h!/2^{h-1} trees, each of which determines the reflected tree in the other half. The second term counts the trees whose halves are preserved.

Write r=∑jhjr=\sum_j h_j as a sum of distinct powers of two. There are

A(r)=r!∏jT(hj)hj!A(r)=r!\prod_j\frac{T(h_j)}{h_j!}

ways to distribute rr prescribed reflection pairs among the slots of sizes 2hj2h_j and choose a reflection-invariant tree in each slot. The empty product gives A(0)=1A(0)=1. There are A(k)A(k) anchored reflection-fixed frames in total. The number placing one first is

N1=(k−b/2b/2)T(b/2)A(k−b).N_1=\binom{k-b/2}{b/2}T(b/2)A(k-b).

To see this, the bb sibling edges must form a reflection-invariant matching disjoint from the singleton. Since bb is even, the matching omits the unique edge fixed by reflection, {k,−k}\{k,-k\}. Choose b/2b/2 disjoint edges on the path 1,…,k1,\ldots,k and take their mirrors. After the bb edges are contracted, the resulting leaves form b/2b/2 reflection pairs in the upper tree. The unused pairs fill the remaining slots. The two first-bit counts are therefore A(k)−N1A(k)-N_1 and N1N_1. All integers in this calculation have O(nlog⁡n)O(n\log n) bits.

At the second position (0,2)(0,2) every frame places zero. Swaps within the pairs {0,1}\{0,1\} and {2,3}\{2,3\} preserve all sibling bits, so the next orbit contains all four cross pairs. At least one is a nonedge, since CnC_n contains no four-cycle. On C7C_7, fix the distance pair {i,−i}\{i,-i\} in the two-leaf slot. The four-leaf slot has three possible sibling partitions. Inspecting its cross pairs gives the prefixes 000, 000, 000 for i=2i=2 and 100, 001, 001 for each of i=1,3i=1,3.

Completing the last rows. Let RR consist of all required edges of a prefix on the nn positions. If a vertex has degree above two or a cycle uses fewer than nn vertices, no completion is possible. A spanning cycle can be tested directly. Otherwise RR consists of u=n−∣E(R)∣u=n-|E(R)| paths, counting isolated vertices. Each completion arranges these paths in cyclic order and orients the nontrivial ones. Enumerate the distinct cycles obtained this way, discard those violating prescribed zeros, and keep only cycles YY for which cfQ(Y)=Yc_f^Q(Y)=Y.

By the orbit count under the Sylow base bound, a retained cycle occurs with multiplicity 2n/∣Q∩Aut⁡(Y)∣2n/|Q\cap\operatorname{Aut}(Y)|. Every element of QQ fixes the singleton slot. Of the cycle automorphisms fixing that vertex, the only possibilities are the identity and its reflection. The multiplicity is therefore odd precisely when the reflection preserves the binary frame. A traversal identifies the vertices exchanged by reflection. We then check whether the reflection preserves each level of the binary forest. This gives both child parities in 2O(ulog⁡(u+1))nO(1)2^{O(u\log(u+1))}n^{O(1)} time by recording the next bit of each accepted cycle. With rr vertices left after the completed rows, all 2u2u missing incidences belong to those vertices, so u≤ru\le r. In particular the last O(log⁡n/log⁡log⁡n)O(\log n/\log\log n) rows admit a polynomial test.

Initial prefixes and binary subtrees

Let dd be a power of two with 2≤d≤B2\le d\le B. In each slot take the leaf sets of the subtrees of size dd, or the whole slot if it is smaller. Call these sets cells. The first d−1d-1 positions are (0,1),…,(0,d−1)(0,1),\ldots,(0,d-1), all internal to a cell of the largest slot. The set of pairs internal to these largest-slot cells is QQ-invariant. Until the initial positions have been placed, the orbit of the least remaining position lies in this set. Each call on such an orbit reads only its internal bits. Thus the induced graphs in the framed cells of the largest slot determine the first d−1d-1 placed bits.

A polynomial test for each fixed initial length. A cell type records the binary tree on dd leaves and its induced graph up to tree-preserving isomorphism. For fixed dd the number of types is independent of nn. Enumerate their possible multiplicities mTm_T summing to B/dB/d. To count the choices of disjoint framed cells of these types, take mTm_T numbered copies of each type and count injections of their leaves into the cycle. Within a cell require its edges and forbid its nonedges. Between cells all pairs are unrestricted.

For type TT, add a subset of the forbidden edges to its required edges and give the term the inclusion–exclusion sign of that subset. A vertex of degree above two precludes an embedding. So does a cycle, since B<nB<n. In every other term the graph is a union of paths. Record xcyax^c y^a with the corresponding sign, where cc counts all path components, including isolated vertices, and aa counts the nontrivial ones. Let PTP_T be the resulting polynomial. In ∏TPTmT\prod_T P_T^{m_T}, multiply the coefficient of xcyax^c y^a by

n(c−1)!2a(n−B+c−1c−1)n(c-1)!2^a\binom{n-B+c-1}{c-1}

Choose a clockwise direction. A designated path starts at one of nn cycle positions. Order the others around the cycle, orient the nontrivial paths and distribute the n−Bn-B unused vertices among the gaps. Summing gives the injection count. Divide this integer by ∏TmT!∣Aut⁡(T)∣mT\prod_T m_T! \lvert\operatorname{Aut}(T)\rvert^{m_T}. The factorials forget the ordering of cells of the same type. The automorphism factors forget the isomorphisms to their numbered representatives. The product has degree at most BB in each variable, and its coefficients have polynomial bit length.

It remains to sum over the trees joining the cells. Permuting equal-type cells preserves the test by locality. In each type, partition its mTm_T cells into batches of the sizes in the binary expansion of mTm_T. Put a fixed binary tree on each batch. The product of the automorphism groups of these trees is a 2-group, so only its fixed upper trees contribute to parity. Each batch must occur intact with its prescribed hierarchy. A transposition fixing all other leaves forces the two leaves it exchanges to be siblings. Inductively a swap of two already identified subtrees fixing everything outside them forces them to be siblings as well. Conversely, every balanced tree joining the intact batches is fixed.

If there are ss types, at most ss new batches enter at each size and at most ss trees arrive from the previous size. Pair these trees in all possible ways at each level. At most (2s)!(2s)! choices per level over O(log⁡n)O(\log n) levels give polynomially many trees for fixed dd. For each upper tree, set the edges outside the cells to zero and run placement. Multiply the parity of the number passing the prefix test by the number of choices of cells. The forest outside the largest slot has an odd number of choices, the index of its binary tree group in the symmetric group. Summing over the multiplicities gives the required parity. The degree of the running-time polynomial depends on dd.

A cancellation for growing cells. Suppose B>2dB>2d. Consider anchored frames fixed by reflection in which reflection exchanges the two children of the largest tree. For every prefix of length at most d−1d-1, an even number of these frames give that prefix. This holds also when dd grows with nn.

To prove this, group the distance labels 1,…,k1,\ldots,k according to the reflection orbit of the cell containing ii. The cell containing −i-i lies in the same orbit. Fix the resulting partition of distance labels. For each maximal consecutive interval in one part, interchange ii and −i-i on that interval. These permutations preserve the partition and commute with reflection. They preserve the anchored family under study, including the condition on the two children of the largest tree.

A flip can change adjacencies only across an interval boundary. There the two consecutive labels are in different cell orbits, so none of the changed pairs is internal to a cell. Each flip preserves the set of edges incident with 00 and fixes the edge {k,−k}\{k,-k\} setwise. By locality, each prefix test is constant on orbits of the 22-group generated by the flips. It suffices to consider frames fixed by every flip. If reflection exchanges two cells in such a frame, their distance labels form a single interval. Otherwise a flip of one maximal interval would move only part of a cell to its mirror. Flipping the whole interval exchanges these two cells and fixes all other leaves. The cells must be siblings, since a swap at their least common ancestor moves every leaf below it. Hence reflection preserves every subtree of size at least 2d2d setwise. When B>2dB>2d it cannot exchange the two root children, which proves the cancellation. For B≥8B\ge8 we may take d=B/4d=B/4.

On C17C_{17} the cancellation fails at a later reached prefix. Removing the singleton leaves a path with a unique perfect matching. Contracting its edges to eight leaves reduces the check to the 315=8!/27315=8!/2^7 balanced trees on those leaves. Keep the 5151 preserved by path reversal and apply the canonical placement algorithm to each expanded tree. At the reached prefix 101010^{10}, the zero and one counts are (21,1)(21,1) for exchanged halves and (27,0)(27,0) for preserved halves. Together these give (48,1)(48,1), so the exchanged halves determine the next bit.

Width of a representation on adjacency bits

Let SsS_s be the set of distinct placed cycles extending ss with odd frame multiplicity. A pointwise factorisation represents its indicator as ∑z∏ifi(Y,z)\sum_z \prod_i f_i(Y,z) over F2\mathbb{F}_2 for every assignment of the adjacency bits YeY_e, with auxiliary Boolean variables zz. Summing out all but the next adjacency bit then gives the two child parities.

In a tree decomposition each node carries a set of variables, or bag. Every factor has its variables together in a bag, and the bags containing each variable form a connected subtree. An elimination order of width ww yields bags of size at most w+1w+1.

Proposition (Width at the prefix 00). For n=2a−1≥7n=2^a-1\ge7, the prefix 0000 is reached on CnC_n. Every pointwise factorisation of S00S_{00} on its adjacency bits has bag size Ω(n)\Omega(\sqrt{n}).

Proof. Size of the surviving family. Here k=2b−1k=2b-1. In the first-bit count, b/2b/2 is a power of two. Writing h=b/2h=b/2, the binomial coefficient is (3h−1h)\binom{3h-1}{h}. It is even because, over F2\mathbb{F}_2, the coefficient of xhx^h in (1+x)3h−1=(1+x2h)(1+x)h−1(1+x)^{3h-1}=(1+x^{2h})(1+x)^{h-1} vanishes. The root count is odd, hence the algorithm chooses zero. The second bit always vanishes by the sibling-swap argument above.

There are at least k!/2kk!/2^k distinct members of S00S_{00}. Make every reflection pair {i,−i}\{i,-i\} a sibling pair and choose an arbitrary binary frame on the kk pairs. The number of choices is k!/22kk!/2^{2^k}. Only one reflection pair is a cycle edge, so the largest slot contains a sibling nonedge and the placed prefix is 00. Two anchored frames have the same placed string precisely when a cycle automorphism fixing 0 transports one to the other. Both such automorphisms fix every constructed frame. The strings are therefore distinct, each represented once among anchored fixed frames.

A counting bound for fixed degrees. Let F\mathcal{F} be any family on mm possible edges with a common degree vector DD and q≥1q \ge1 edges per graph. If its indicator has bag size WW, put b′=W+⌈log⁡2(2m+1)⌉b' = W + \lceil\log_2(2m+1) \rceil. We claim that ∣F∣≤(8b′)q|\mathcal{F}| \le(8b')^q.

Attach a leaf for each visible bit to a bag containing it, using an equality to read that bit. Split high-degree bags into binary trees of identical bags, prune branches with no visible leaves, and suppress unary nodes. In the resulting binary tree the mm leaves are the possible edge positions. Across any cut, the matrix of the indicator with rows and columns indexed by assignments on opposite sides has rank at most 2W2^W. Fixing the shared bag variables separates the factors. Summing over their assignments gives at most 2W2^W outer products, also over F2\mathbb{F}_2. A leaf cut has rank at most two.

Each degree vector uu realised on the descendant side requires vector D−uD-u on the other, with degrees taken over the integers. Group rows and columns by these vectors. Distinct realised vectors give disjoint nonzero diagonal blocks, so there are at most 2W2^W of them per cut.

To encode a graph from the family, mark the qq leaves corresponding to its edges. Work upwards, detaching a nonroot subtree as soon as it contains at least b′b' still-attached marks. Each child passed up fewer than b′b' marks, so every resulting piece has at most 2b′2b' marks. At most ⌊q/b′⌋\lfloor q/b' \rfloor cuts were made. Record each cut and its degree vector for the entire original descendant subtree. Padding the list to ⌊q/b′⌋\lfloor q/b' \rfloor entries with a blank symbol gives at most ((2m+1)2W)⌊q/b′⌋≤2q((2m+1)2^W)^{\lfloor q/b' \rfloor} \le2^q possible values.

Subtracting the vectors at the cuts immediately below a piece from its subtree vector (using DD at the root) gives the degrees inside the piece. If it has j>0j>0 marked edges, those degrees specify 2j2j labelled edge ends. At most (2jj)≤(4b′)j\binom{2j}{j} \le(4b')^j pairings need be considered. A piece with no edges has one possible graph. Multiplication over the pieces gives at most (4b′)q(4b')^q graphs per record, proving the claim. Now take m=(n2)m=\binom{n}{2} and q=nq=n. The two bounds give 8b′≥(k!/2k)1/n=Ω(n)8b' \ge(k!/2^k)^{1/n} = \Omega(\sqrt{n}). Subtracting the logarithmic term gives the stated lower bound on WW.

The fixed-length algorithm computes both child parities at 00 in polynomial time. It does so without representing membership in S00S_{00} on all adjacency bits. Whether both child parities can be computed in polynomial time at every reached prefix remains open even for odd cycles. A polynomial-time test for the zero child at every reached prefix on arbitrary graphs would give a logic capturing PTIME by evaluation on the canonical copy.

References

  1. [2]László Babai and Eugene M. Luks (1983). Canonical labeling of graphs. In 15th Annual ACM Symposium on Theory of Computing (STOC), 171–183.DOI
  2. [3]Richard Beigel and John Gill (1992). Counting classes: thresholds, parity, mods, and fewness. Theoretical Computer Science 103(1), 3–23.
  3. [4]Andreas Blass, Yuri Gurevich and Saharon Shelah (2002). On polynomial time computation over unordered structures. Journal of Symbolic Logic 67(3), 1093–1125.DOI
  4. [5]Jin-Yi Cai, Martin Fürer and Neil Immerman (1992). An optimal lower bound on the number of variables for graph identification. Combinatorica 12(4), 389–410.
  5. [6]Kevin J. Compton and Erich Grädel (1996). Logical definability of counting functions. Journal of Computer and System Sciences 53(2), 283–297.
  6. [7]Anuj Dawar, Erich Grädel and Wied Pakusa (2019). Approximations of isomorphism and logics with linear-algebraic operators. In 46th International Colloquium on Automata, Languages, and Programming (ICALP), LIPIcs 132, 112:1–112:14.
  7. [8]Sergei Evdokimov and Ilia Ponomarenko (2004). Circulant graphs: recognizing and isomorphism testing in polynomial time. St. Petersburg Mathematical Journal 15(6), 813–835.
  8. [9]John Faben and Mark Jerrum (2015). The complexity of parity graph homomorphism: an initial investigation. Theory of Computing 11(2), 35–57.
  9. [10]Merrick L. Furst, John E. Hopcroft and Eugene M. Luks (1980). Polynomial-time algorithms for permutation groups. In 21st Annual Symposium on Foundations of Computer Science (FOCS), 36–41.DOI
  10. [11]Vaani Goenka and Aalok Thakkar (2026). Graph and Tensor Canonisation by Modular Counting. Companion manuscript.
  11. [12]Erich Grädel, Martin Grohe, Benedikt Pago and Wied Pakusa (2019). A finite-model-theoretic view on propositional proof complexity. Logical Methods in Computer Science 15(1), 4:1–4:55. Corrected version, 2022.
  12. [13]Erich Grädel and Wied Pakusa (2019). Rank logic is dead, long live rank logic! Journal of Symbolic Logic 84(1), 54–87.DOI
  13. [14]Martin Grohe (2017). Descriptive Complexity, Canonisation, and Definable Graph Structure Theory. Lecture Notes in Logic 47. Cambridge University Press.DOI
  14. [15]Yuri Gurevich (1988). Logic and the challenge of computer science. In Egon Börger, editor, Current Trends in Theoretical Computer Science, 1–57. Computer Science Press.
  15. [16]Yuri Gurevich and Saharon Shelah (1986). Fixed-point extensions of first-order logic. Annals of Pure and Applied Logic 32, 265–280.
  16. [17]Neil Immerman (1986). Relational queries computable in polynomial time. Information and Control 68(1–3), 86–104.DOI
  17. [18]Johannes Köbler and Oleg Verbitsky (2008). From invariants to canonization in parallel. In Computer Science – Theory and Applications (CSR), 216–227.
  18. [20]Juha Kontinen and Heribert Vollmer (2010). On second-order monadic monoidal and groupoidal quantifiers. Logical Methods in Computer Science 6(3), article 25.DOI
  19. [21]Moritz Lichter and Pascal Schweitzer (2024). Choiceless polynomial time with witnessed symmetric choice. Journal of the ACM 71(2), article 7, 1–70.
  20. [22]Moshe Y. Vardi (1982). The complexity of relational query languages (extended abstract). In 14th Annual ACM Symposium on Theory of Computing (STOC), 137–146.DOI
  21. [23]Helmut Wielandt (1969). Permutation Groups through Invariant Relations and Invariant Functions. Lecture notes by Frank Demana, William McWorter and Surinder Sehgal. The Ohio State University, Columbus.

Paper details

vlnc:W_vc2vpmju
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 3

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents