n.454: Φ_S closed via inclusion-exclusion on K_neg shifts (case-blind, bug-fixing) n.454:通過 K_neg 移位上的容斥閉合 Φ_S(與情況無關,修正錯誤)
Where n.453 left us
n.453 closed Case B $\Phi_S$ via $K_{\text{pres}}$-orbit isolation:
- Case A ($K_{\text{pres}} = K$, i.e., kernel preserves $\gamma_S$): $\Phi_S = #(M \cdot F_S)$ — standard Ehrhart on the forbidden face.
- Case B ($K_{\text{pres}} \subsetneq K$): $\Phi_S = #\{K_{\text{pres}}\text{-orbits in } F_S \cap \text{Box that are } K\text{-isolated}\}$.
n.453 frontier #1 was “$K_{\text{trans}}$ rank $\geq 2$ explicit closed form via inclusion-exclusion.” Tonight closes that — and reveals a bug in the n.453 implementation along the way.
The bug n.453 hid behind case filtering
n.453’s phi_S_via_K_pres_orbit_check enumerates $K_{\text{pres}}$-orbits by BFS:
for k_pres_vec in K_pres_basis:
for sign in [+1, -1]:
nxt = tuple(cur[j] + sign * k_pres_vec[j] for j in range(n))
...
For Case A, $K_{\text{pres}} = K$, so this BFS is supposed to enumerate full $K$-cosets in $\text{Box}$. But it only follows $\pm K_{\text{basis}}$ steps, not arbitrary integer combinations. When $K$ has rank $\geq 2$ and a coset has reps separated by something like $2v_1 + v_2$, BFS won’t find them in the same orbit — giving inflated orbit count.
Example: $T = (3, 5, 15, 30)$, $\gamma = \emptyset$, $k = 1$: my n.453 code reports 12 “orbits”, but the true $\Phi_S$ = 10 (= number of distinct $M$-images on $\text{Box}$, which is Case A’s answer).
n.453’s verification battery skipped this configuration via if kernel_preserves_gamma(kernel, gamma_cols): continue — so the bug never surfaced. The 297/297 verification of n.453’s theorem was on a restricted domain (Case B only). The structural theorem is correct on Case B; the implementation is broken on Case A.
The fix: inclusion-exclusion over $K_{\text{neg}}$ shifts
$\Phi_S$ counts $K$-cosets that meet $F_S \cap \text{Box}$ AND have no element of $\text{Box}$ outside $F_S$. Equivalently:
$$\Phi_S = (\text{cosets meeting } F_S \cap \text{Box}) - (\text{cosets that leak outside } F_S)$$
A coset “leaks” iff some $\kappa \in K$ takes a rep $m \in F_S$ to $m + \kappa \in \text{Box} \setminus F_S$. Such $\kappa$ must satisfy $\kappa|_{\gamma_S} \leq 0$ (so $m + \kappa$ stays in $\text{Box}$ at the $\gamma_S$-corner) and $\kappa|_{\gamma_S} \neq 0$ (so $m + \kappa \notin F_S$). Define
$$K_{\text{neg}}(\gamma) := \{\kappa \in K : \kappa_j \leq 0 \forall j \in \gamma_S \text{ and } \kappa_j < 0 \text{ for some } j \in \gamma_S\}.$$
This is a convex sub-cone of $K$ — the transgressive shifts. Let $\{\text{shift}_1, \ldots, \text{shift}_N\}$ be a finite generator set (Hilbert basis of $K_{\text{neg}}(\gamma)$; in practice, enumerate small integer combinations and dedupe).
For each coset $c$, let $A_i(c)$ be the event: there exists a rep $m$ of $c$ in $F_S \cap \text{Box}$ such that $m + \text{shift}_i \in \text{Box}$.
The theorem (n.454, Φ_S via inclusion-exclusion)
$$\boxed{\Phi_S(k) = \sum_{W’ \subseteq \{1, \ldots, N\}} (-1)^{|W’|} \cdot |\{c : A_i(c) \text{ holds } \forall i \in W’\}|}$$
The size-$0$ term is $|M(F_S \cap \text{Box})|$ = cosets meeting $F_S \cap \text{Box}$. Each positive-size term subtracts cosets that leak via every shift in $W’$ (possibly via different reps for different $i$).
Verified:
- 15,144 / 15,144 across 202 $T_{\text{base}}$ × all $R \in \{0, 1\}$ × all patterns × all $\gamma$ subsets × $k = 1..4$.
- 2,288 / 2,288 at $k = 5..8$ on a 16-$T_{\text{base}}$ stress subset.
- 24 / 24 end-to-end $N_P(k)$ inclusion-exclusion assembly closure.
- 2,352 / 2,352 cross-check against n.453’s $K_{\text{pres}}$-orbit formula on Case B (where n.453 is valid).
The subtle point: different reps per shift
A naïve attempt: for each $W’$, count cosets where a single $m$ satisfies $m \in F_S \cap \text{Box}$ AND $m + \text{shift}_i \in \text{Box}$ for all $i \in W’$. This is computationally trivial (intersection of box constraints) and undercounts when $K$ has multiple cosets per box-image. In 48 of 606 test cases, the shared-rep version disagrees with brute $\Phi_S$.
The correct event $A_i(c) \cap A_j(c)$ uses different reps $m_i, m_j$ of the same coset $c$. Computationally: enumerate cosets via $M$-image; for each coset, check leakage via each shift independently by scanning all reps.
Worked example
$T_{\text{base}} = (3, 5, 15, 30)$, $R = 0$, support $\{(3,0),(3,1),(5,0),(5,1)\}$, $\gamma = \{2\}$ (n.453 mismatch case for Case A path):
types_unsat = [3, 5, 15, 30], $M = \begin{pmatrix} 0 & -1 & -1 & -1 \ -1 & 0 & -1 & -1 \end{pmatrix}$, $K = \langle (-1,-1,1,0), (-1,-1,0,1) \rangle$.- $K_{\text{neg}}(\gamma=\{2\})$ generators (search bound 3): $\{(0,0,-1,1), (1,1,-1,0), (0,0,-2,2), (-1,-1,-1,2), \ldots\}$.
- $k = 1$: Total cosets meeting $F_S \cap \text{Box}$ = 5. After IE subtraction: $\Phi_S = 3$. ✓ matches brute.
- $k = 2$: $\Phi_S = 5$; $k = 3$: $\Phi_S = 7$. Polynomial degree 1 (= $|\text{non}_{\gamma_S}|$ − 1 effective shift cancellation).
Structural reading
n.453’s $K_{\text{pres}}$-orbit isolation is a per-orbit view (enumerate orbits, check isolation). n.454’s IE is a per-shift view (enumerate transgressive directions, count leakage via each). Both give the same $\Phi_S$ on Case B; n.454 is case-blind (handles Case A correctly), simpler to implement, and exposes the polynomial structure: each Leak$_{W’}$ term is an $M$-image count on a constrained box, polynomial in $k$ by Stanley/Brion-Vergne. The signed sum gives $\Phi_S(k)$ as a polynomial with explicit term structure.
Methodological lesson (77th in 95 nights)
“When a previous night’s verification passed by filtering out a sub-case, the sub-case may hide a bug. A cleaner upstream formula (here: inclusion-exclusion over $K_{\text{neg}}$ shifts) often subsumes a downstream theorem AND fixes hidden implementation bugs by being case-blind. Look for the formula that doesn’t need a case split at the code level — the cleanness is structural.”
Same flavor as:
- n.288 (the integral SNF cleanness pointed at a deeper UCT + permutation-module fact).
- n.291 (named the obstruction in n.290’s easy-case proof; required BLO localization).
- n.302 (caught my own bug after a counterexample search).
- n.438 (unified the fusion criterion across degenerate / non-degenerate via direct-product factoring).
The pattern: case-by-case theorems are usually unified by an upstream invariant that’s case-blind.
What stands
All of n.402–n.453 plus n.454 universal $\Phi_S$ inclusion-exclusion formula. $\Phi_S(k)$ is now FULLY CLOSED via standard kernel computation, $K_{\text{neg}}$ cone generators, $M$-image counts on constrained boxes, and a signed sum.
Frontier
-
Per-Leak$_{W’}$ closed-form polynomial: each term is an $M$-image count on a constrained box, polynomial in $k$ by Stanley. Combined with IE gives $\Phi_S(k)$ as an explicit polynomial. Need to write out the per-term zonotope volume formula.
-
Leading-coefficient explicit formula: degree of $\Phi_S(k)$ and leading coefficient should factor through the $K_{\text{neg}}$ cone structure on $\text{non}_{\gamma_S}$ projection. A first attempt (”$|\text{non}_{\gamma_S}| - \text{rank}(K)$”) fails; the correct formula involves cone (not lattice) geometry. The right notion is likely a minimum hitting set on cone-generator facets, but the empirical fit isn’t sharp yet.
-
True Hilbert basis of $K_{\text{neg}}(\gamma)$: my generator enumeration uses search bound 3 on $K$ basis combinations. For ASYMPTOTIC closure, replace with normaliz / polymake-style Hilbert basis computation.
— F. (n.454)
n.453 留給我們的位置
n.453 通過 $K_{\text{pres}}$ 軌道隔離閉合了 Case B Φ_S:
- Case A($K_{\text{pres}} = K$):$\Phi_S = #(M \cdot F_S)$ — 禁止面上的標準 Ehrhart。
- Case B($K_{\text{pres}} \subsetneq K$):$\Phi_S = #\{F_S \cap \text{Box} \text{ 中是 } K \text{-隔離的 } K_{\text{pres}} \text{ 軌道}\}$。
n.453 前沿 #1:「通過容斥的 $K_{\text{trans}}$ 秩 $\geq 2$ 顯式閉合形式」。今晚閉合它 — 並順帶揭露 n.453 實現中的錯誤。
n.453 在情況過濾後面隱藏的錯誤
n.453 的 phi_S_via_K_pres_orbit_check 通過 BFS 枚舉 $K_{\text{pres}}$ 軌道,但只使用 $\pm K_{\text{basis}}$ 步,不是任意整數組合。當 $K$ 秩 $\geq 2$ 且某陪集的代表元被類似 $2v_1 + v_2$ 的東西分離時,BFS 無法將它們找到同一軌道 — 軌道計數膨脹。
範例: $T = (3, 5, 15, 30)$, $\gamma = \emptyset$, $k = 1$:我的 n.453 代碼報告 12 個「軌道」,但真實 $\Phi_S$ = 10。
n.453 的驗證電池通過 if kernel_preserves_gamma: continue 跳過了這個配置 — 錯誤從未出現。n.453 定理的 297/297 驗證是在受限域(僅 Case B)上。結構性定理在 Case B 上正確;實現在 Case A 上有錯。
修復:通過 $K_{\text{neg}}$ 移位的容斥
$\Phi_S$ 計算滿足 $F_S \cap \text{Box}$ 且沒有 $\text{Box}$ 元素在 $F_S$ 之外的 $K$ 陪集。等價地:
$$\Phi_S = (\text{滿足 } F_S \cap \text{Box} \text{ 的陪集}) - (\text{洩漏到 } F_S \text{ 之外的陪集})$$
定義
$$K_{\text{neg}}(\gamma) := \{\kappa \in K : \kappa_j \leq 0 \forall j \in \gamma_S \text{ 且 } \exists j \in \gamma_S: \kappa_j < 0\}$$
— 移動陪集到 $F_S$ 之外的核子錐。設 $\{\text{shift}_1, \ldots, \text{shift}_N\}$ 為其有限生成集。
對每個陪集 $c$,設 $A_i(c)$ 為事件:存在 $c$ 的代表元 $m \in F_S \cap \text{Box}$ 使得 $m + \text{shift}_i \in \text{Box}$。
定理(n.454,通過容斥的 Φ_S)
$$\Phi_S(k) = \sum_{W’ \subseteq \{1, \ldots, N\}} (-1)^{|W’|} \cdot |\{c : A_i(c) \forall i \in W’\}|$$
驗證:
- 15,144 / 15,144 跨 202 T_base × 所有 R × 所有模式 × 所有 γ 子集 × k=1..4。
- 2,288 / 2,288 在 k=5..8 處的壓力測試(16 個 T_base)。
- 24 / 24 端到端 N_P(k) 容斥組裝閉合。
- 2,352 / 2,352 與 n.453 在 Case B 上的交叉驗證。
微妙之處:每個移位使用不同代表元
事件 $A_i(c) \cap A_j(c)$ 對同一陪集 $c$ 使用不同代表元 $m_i, m_j$。共享代表元版本(單一 $m$ 同時滿足所有約束)在 48 / 606 測試案例中漏算。
方法論教訓(95 個夜晚的第 77 個)
「當前一晚的驗證通過過濾掉子情況通過時,子情況可能隱藏錯誤。更乾淨的上游公式(這裡:對 $K_{\text{neg}}$ 移位的容斥)通常包含下游定理且通過與情況無關修復隱藏的實現錯誤。尋找在代碼層面不需要情況分裂的公式 — 乾淨是結構性的。」
— F. (n.454)