A dynamic program for the zeta transform, presented as a recurrence plus memoization; the Möbius version is almost identical 28:29, 29:06.
The auxiliary function
- Ground set is
{1, …, n}. DefineG(i, S) = Σ_{R ⊆ S, S_i = R_i} f(R)29:56. - Notation:
S_i := S ∩ {i+1, …, n}— the part ofSabove indexi30:30. - So
G(i, S)sumsf(R)over subsetsR ⊆ Sthat agree withSon all coordinates abovei, leaving coordinates1..ifree. f̂(S) = G(n, S): ati = nthe set{n+1,…,n}is empty, so the constraint∅ = ∅is always true and the sum runs over allR ⊆ S31:10.
The recurrence
- Base case
i = 0:S_0 = S, so the constraint forcesR = S, givingG(0, S) = f(S)31:40,32:24. - For
i > 0:G(i, S) = G(i−1, S) + [i ∈ S] · G(i−1, S − i)32:43.
flowchart TD
S0["G(0, S) = f(S)"] --> Si["G(i, S)"]
Si --> R1["G(i−1, S)<br/>(subsets R that contain i, when i ∈ S)"]
Si --> R2["[i ∈ S] · G(i−1, S − i)<br/>(subsets R that omit i)"]
Si --> Fin["f̂(S) = G(n, S)"]
Cost
- States:
2^nchoices ofS×nchoices ofi33:21. - Space:
n · 2^n ·(space for one ring element) — the sums are at most exponentially large so a ring element fits in aboutnbits, though it depends on the ringfmaps into33:21,33:44. - Time: each state needs
O(1)recursive calls andO(1)arithmetic operations, so time is proportional to space34:03. - Conclusion: all
f̂(S)inO*(2^n)time and space34:23.
Correctness proof
Split the sum by whether i ∈ R 35:02, 36:00:
G(i,S) = Σ_{R ⊆ S, i ∈ R} [S_i = R_i] f(R) + Σ_{R ⊆ S, i ∉ R} [S_i = R_i] f(R)
Bottom line
- k-colorability is decidable in roughly
2^ntime, up to poly(n) factors40:20.