Polya Enumeration

lean4-proofcombinatoricsvisualization
PG(x1,,xn)=1GgGx1c1(g)xncn(g)P_G(x_1,\ldots,x_n) = \frac{1}{|G|}\sum_{g\in G}x_1^{c_1(g)}\cdots x_n^{c_n(g)}

Statement

Let GG be a finite group acting on positions {1,,n}\{1,\ldots,n\} via permutations. Each group element gg decomposes into ck(g)c_k(g) cycles of length kk. The cycle index of GG is the polynomial:

ZG(x1,x2,,xn)=1GgGx1c1(g)x2c2(g)xncn(g)Z_G(x_1, x_2, \ldots, x_n) = \frac{1}{|G|} \sum_{g \in G} x_1^{c_1(g)} x_2^{c_2(g)} \cdots x_n^{c_n(g)}

Polya's Enumeration Theorem. If the set of colors has a weight function ww, then the generating function for colorings up to GG-equivalence, weighted by total weight, is obtained by substituting xk=color cw(c)kx_k = \sum_{\text{color } c} w(c)^k into ZGZ_G.

For the unweighted count with mm colors, set each xk=mx_k = m: the number of distinct colorings is ZG(m,m,,m)Z_G(m, m, \ldots, m).

Visualization

2-color necklaces of length 4 under C4={r0,r1,r2,r3}C_4 = \{r^0, r^1, r^2, r^3\}.

Cycle structures of C4C_4 on 4 positions:

ElementCycle typec1,c2,c3,c4c_1, c_2, c_3, c_4x1c1x2c2x4c4x_1^{c_1}x_2^{c_2}x_4^{c_4}
r0r^0 (identity)(1)(2)(3)(4)(1)(2)(3)(4)c1=4c_1=4x14x_1^4
r1r^1 (rotate by 90)(1234)(1234)c4=1c_4=1x41x_4^1
r2r^2 (rotate by 180)(13)(24)(13)(24)c2=2c_2=2x22x_2^2
r3r^3 (rotate by 270)(1432)(1432)c4=1c_4=1x41x_4^1

Cycle index: ZC4=14(x14+x4+x22+x4)Z_{C_4} = \frac{1}{4}(x_1^4 + x_4 + x_2^2 + x_4).

Set xk=2x_k = 2 (two colors) for all kk:

ZC4(2,2,2,2)=14(24+21+22+21)=14(16+2+4+2)=244=6Z_{C_4}(2,2,2,2) = \frac{1}{4}(2^4 + 2^1 + 2^2 + 2^1) = \frac{1}{4}(16 + 2 + 4 + 2) = \frac{24}{4} = 6

The 6 distinct 2-color necklaces of length 4:

RRRR  RRRB  RRBR  RRBB  RBRB  BBBB

Meaning: all-red, one-blue, two-adjacent-blue (= RRRB), two-opposite-blue (= RBRB rotations), three-blue (= RRRB reversed), all-blue.

Expanded list with canonical representative per orbit:

OrbitRepresentativeSize
RRRRRRRR1
1 blue beadBRRR4
2 adjacent blueBBRR4
2 opposite blueBRBR2
3 blue beadsBBBR4
BBBBBBBB1

Total colorings: 1+4+4+2+4+1=16=241+4+4+2+4+1 = 16 = 2^4. Orbits: 6. Check!

Proof Sketch

  1. Start from Burnside. The number of orbits is 1GgXg\frac{1}{|G|}\sum_g |X^g|.
  2. Fixed colorings. A coloring f:positionscolorsf: \text{positions} \to \text{colors} is fixed by permutation gg iff ff is constant on each cycle of gg.
  3. Count fixed colorings. With mm colors and gg having c1+c2+c_1+c_2+\cdots cycles, the number of fixed colorings is mc1(g)+c2(g)+m^{c_1(g)+c_2(g)+\cdots}.
  4. Substitute. Setting xk=mx_k = m in the cycle index gives exactly 1Ggmc(g)\frac{1}{|G|}\sum_g m^{c(g)} where c(g)c(g) is the total number of cycles.
  5. Weighted version. Replace each xkx_k by cw(c)k\sum_c w(c)^k to track color weights.

Connections

Polya enumeration refines Orbit Counting ApplicationsOrbit Counting ApplicationsX/G=1GgGXg|X/G| = \frac{1}{|G|}\sum_{g \in G}|X^g|Necklace, bracelet, and coloring counting via Burnside's lemma — concrete applications of the orbit-counting formula.Read more → into a generating function. It is related to Catalan NumbersCatalan NumbersCn=1n+1(2nn)C_n = \frac{1}{n+1}\binom{2n}{n}The ubiquitous sequence counting balanced parentheses, binary trees, and Dyck pathsRead more → (necklace-like structures) and ultimately connects to Inclusion-Exclusion PrincipleInclusion-Exclusion PrincipleAB=A+BAB|A \cup B| = |A| + |B| - |A \cap B|The size of a union is the alternating sum of intersection sizesRead more → for orbit-size computations. The cycle index is a character of the symmetric group representation theory.

Lean4 Proof

/-- Direct computation: Polya's formula for 2-color necklaces of length 4
    under C_4 gives 6 distinct necklaces.
    (1/4)(2^4 + 2^1 + 2^2 + 2^1) = (16 + 2 + 4 + 2) / 4 = 24 / 4 = 6. -/
theorem polya_c4_two_colors :
    (16 + 2 + 4 + 2) / 4 = 6 := by decide

/-- The 6 orbits sum back to 2^4 = 16 colorings. -/
theorem polya_orbit_sum :
    1 + 4 + 4 + 2 + 4 + 1 = (2 : ) ^ 4 := by decide