卷不动题,随便摆一摆。
组合对象的大小函数对应生成函数的次数。
笛卡尔积:
\[\mathcal{C}=\mathcal{A}\times\mathcal{B}\\C(z)=A(z)\times B(z)
\]
不交并:
\[\mathcal{A}=\mathcal{B}+\mathcal{C}=(\mathcal{E_1}\times\mathcal{B})\cup(\mathcal{E_2}\times C)\\C(z)=A(z)+B(z)
\]
Sequence 构造:
\[\mathcal{B}=\operatorname{SEQ}(\mathcal{A})=\mathcal{E}+A+A^2+\cdots\\B(z)=\frac{1}{1-A(z)}
\]
Cycle 构造:
\[\mathcal{B}=(\operatorname{SEQ}(\mathcal{A})-\mathcal{E})/S
\]
根据 Burnside 引理我们计数置换下不动点的平均数:
\[B(z)=\sum_k\frac{1}{k}\sum_{i=0}^{k-1}A(z^{\frac{k}{\gcd(i,k)}})^{\gcd(i,k)}
=\sum_k\frac{1}{k}\sum_{d\mid k}\varphi(d)A(z^d)^{\frac k d}\\
=\sum_d\frac{\varphi(d)}{d}\sum_{k}\frac{A(z^d)^k}{k}
=\sum_d\frac{\varphi(d)}{d}\ln(\frac{1}{1-A(z^d)})\]
我们预先计算出 \(\ln(\frac{1}{1-A(x)})\),枚举 \(d\) 之后暴力累加 \(\lfloor\frac{n}{d}\rfloor\) 项点值即可。
Multiset 构造:
\[\mathcal{B}=\operatorname{SEQ}(\mathcal{A})/R\\
B(z)=\prod_{a\in A}\sum_k z^{|a|k}=\prod_{a\in A}\frac{1}{1-z^{|a|}}
=\prod_i(\frac{1}{1-z^i})^{A_i}\\
=\exp(\ln(\prod_i(\frac{1}{1-z^i})^{A_i}))
=\exp(\sum_iA_i\ln(\frac{1}{1-z^i}))\\
=\exp(\sum_iA_i\sum_{i\mid k}\frac{ix^k}{k})
=\exp(\sum_k\frac{\sum_kA_iix^{ik}}{ik})\\
=\exp(\sum_k\frac{A(z^k)}{k})\]
Powerset 构造:
Pointing 构造:(选代表元)
\[\mathcal{B}=\operatorname{PET}(\mathcal{A})\\
B(z)=\vartheta A(z)\]