---
title: "學習作為帳本流：不變量、投影約束與不可消除結構殘差"
title_en: "Learning as Ledger Flow: Invariants, Projection Constraints, and Irreducible Structural Residuals"
series: "矩陣原生智能與可稽核計算系列"
series_en: "Matrix-Native Intelligence and Auditable Computation Series"
series_id: "EML-MNIAC-2026"
paper_id: "EML-MNIAC-2026-02"
version: "v0.1"
date: "2026-08-16"
language: "zh-Hant"
document_type: "系列第02篇／Constrained Learning／可驗證實驗與解析重構"
status: "Public Draft"
author: "Neo.K（許筌崴）／EveMissLab"
depends_on:
  - "EML-MNIAC-2026-00 矩陣原生智能與可稽核計算總論 v0.1"
  - "EML-MNIAC-2026-01 模型可以住在表格裡嗎？CSV-Native Transformer 與可檢查模型狀態 v0.1"
internal_artifacts:
  - "ledger_experiment.py"
  - "build_xlsx.py"
  - "自適應帳本量化代理框架技術規格.md"
canonical_keywords:
  - Constrained Learning
  - Ledger Flow
  - Invariant
  - Projection Constraint
  - Structural Residual
  - Gradient Projection
  - Exponentiated Gradient
  - Conservation
  - Feasible Set
  - Audit
  - EML-LQ
---

# 學習作為帳本流
## 不變量、投影約束與不可消除結構殘差

**Learning as Ledger Flow:  
Invariants, Projection Constraints, and Irreducible Structural Residuals**

---

## 摘要

本文是《矩陣原生智能與可稽核計算》系列第 02 篇，研究一個位於機器學習、約束最佳化與帳本式計算交界的問題：

> **一個可學習系統是否可以在顯式不變量約束下持續學習？如果約束本身錯了，錯誤會以什麼形式留下？**

本文以早期 `ledger_experiment.py` 為核心。該程式在一個線性回歸問題

$$
Y=XW^\ast
$$

上比較三種訓練制度：

1. `FREE`：普通 gradient descent；
2. `A2-MATCH`：每一步後投影回正確 trace 約束
   $$
   \operatorname{Tr}(W)=\operatorname{Tr}(W^\ast);
   $$
3. `A2-MISMATCH`：每一步後投影回錯誤 trace 約束
   $$
   \operatorname{Tr}(W)=\operatorname{Tr}(W^\ast)+\Delta.
   $$

本文重新執行原始程式，在原始隨機種子與超參數下得到：

```text
FREE             loss   0.0024 ->   0.000000
A2-MATCH         loss   0.0026 ->   0.000000
A2-MISMATCH(+3)  loss   0.0029 ->   0.000172
```

其中真實 trace 約為：

$$
\operatorname{Tr}(W^\ast)\approx -0.7699,
$$

而 mismatch regime 被鎖定於：

$$
\operatorname{Tr}(W)=2.2301\ldots
$$

附近。

更進一步，本文對該實驗推導出解析 constrained optimum。令：

$$
A=X^\top X,
$$

$$
E=W-W^\ast,
$$

並要求：

$$
\operatorname{Tr}(E)=\Delta.
$$

則對原實驗的 mean-squared loss：

$$
L(E)
=
\frac{1}{2mn}
\operatorname{Tr}(E^\top A E),
$$

當 $A$ 正定時，錯誤 trace 約束下的最小可達 loss 為：

$$
\boxed{
L_{\min}
=
\frac{\Delta^2}
{2mn\,\operatorname{Tr}(A^{-1})}.
}
$$

對原始資料：

$$
n=8,\quad
m=400,\quad
\Delta=3,
$$

且：

$$
\operatorname{Tr}(A^{-1})
\approx
8.1659156601,
$$

因此：

$$
\boxed{
L_{\min}
\approx
0.000172209714.
}
$$

與程式的最終 loss 約 $0.000172$ 一致。

因此，本文將早期直覺精確化為：

$$
\boxed{
\text{正確約束不必然妨礙學習；}
}
$$

但：

$$
\boxed{
\text{若真實解不在可行域內，則存在由幾何不相容決定的非零誤差下界。}
}
$$

這個下界不是 optimizer 不夠好造成，而是 feasible set 本身排除了真實解。

本文並進一步將這個結果連接到後續 EML-LQ 的 simplex normalization、乘法更新與 AI 開放閥設計，提出「學習作為帳本流」的統一觀點：**更新是流動、約束是合法域、投影是回到合法域的算子、殘差是模型與制度不相容的證書。**

---

# 1. 問題：守恆會不會殺死學習？

## 1.1 最容易犯的兩個極端

當「守恆」或「不變量」被帶入可學習系統時，通常會滑向兩個極端。

第一種是：

> 只要加入守恆，模型就會失去自由度，因此一定學不好。

形式上近似：

$$
Constraint
\Rightarrow
No\ Learning.
$$

第二種則是：

> 只要叫它守恆，任何約束都會提升穩定性。

形式上近似：

$$
Constraint
\Rightarrow
Better\ Learning.
$$

兩者都不成立。

真正的問題是：

$$
\boxed{
W^\ast
\in
\mathcal C
\ ?
}
$$

其中：

- $W^\ast$ 是任務真正需要的解；
- $\mathcal C$ 是系統被允許存在的可行域。

---

# 2. 一般 constrained-learning 形式

設損失函數：

$$
L(W),
$$

而合法狀態集合：

$$
\mathcal C
=
\{
W:
g_i(W)=0,\;
h_j(W)\le 0
\}.
$$

普通 gradient descent：

$$
W_{t+1}^{raw}
=
W_t-\eta_t\nabla L(W_t).
$$

Projected gradient 類方法則寫成：

$$
\boxed{
W_{t+1}
=
P_{\mathcal C}
\left(
W_t-\eta_t\nabla L(W_t)
\right).
}
$$

其中：

$$
P_{\mathcal C}(Z)
=
\arg\min_{W\in\mathcal C}
\|W-Z\|.
$$

從帳本語言來看，可以讀成：

$$
\boxed{
\text{Proposal}
\rightarrow
\text{Projection}
\rightarrow
\text{Legal State}.
}
$$

即：

1. optimizer 先提出更新；
2. 約束層判斷合法域；
3. projection 將狀態帶回合法集合；
4. audit 檢查 invariant 是否成立。

---

# 3. 原始 `ledger_experiment.py`

## 3.1 任務

原始實驗設定：

$$
n=8,
\qquad
m=400,
$$

並產生：

$$
X\in\mathbb R^{m\times n},
$$

$$
W^\ast\in\mathbb R^{n\times n},
$$

$$
Y=XW^\ast.
$$

學習目標：

$$
\min_W
\frac12
\operatorname{mean}
\left[
(XW-Y)^2
\right].
$$

原始程式使用：

$$
600
$$

個 gradient steps，

learning rate：

$$
\eta=0.02.
$$

---

# 4. A2：Trace 作為最小帳本不變量

原始實驗選擇：

$$
\tau(W)
=
\operatorname{Tr}(W).
$$

這不是主張：

> 所有 AI 都應守恆 trace。

它只是選擇一個：

- 易於計算；
- 易於投影；
- 可以精確控制；
- 可以製造 match / mismatch 對照；

的最小線性 invariant。

設目標 trace：

$$
\tau_0.
$$

則 constraint set：

$$
\mathcal C_{\tau_0}
=
\{
W:
\operatorname{Tr}(W)=\tau_0
\}.
$$

---

# 5. Trace Projection

對任意：

$$
W\in\mathbb R^{n\times n},
$$

定義：

$$
a
=
\frac{
\operatorname{Tr}(W)-\tau_0
}{n}.
$$

再令：

$$
\boxed{
P_{\tau_0}(W)
=
W-aI.
}
$$

檢查：

$$
\operatorname{Tr}
\left(
W-aI
\right)
=
\operatorname{Tr}(W)-na
=
\tau_0.
$$

所以：

$$
P_{\tau_0}(W)
\in
\mathcal C_{\tau_0}.
$$

這正是原始程式：

```python
def project_trace(W, tr0):
    a = (np.trace(W) - tr0) / n
    return W - a * np.eye(n)
```

的數學形式。

---

# 6. 三種 regime

## 6.1 FREE

$$
W_{t+1}
=
W_t-\eta\nabla L(W_t).
$$

不限制：

$$
\operatorname{Tr}(W_t).
$$

---

## 6.2 A2-MATCH

令：

$$
\tau_0
=
\operatorname{Tr}(W^\ast).
$$

每一步：

$$
W_{t+1}
=
P_{\tau_0}
\left(
W_t-\eta\nabla L(W_t)
\right).
$$

因為：

$$
W^\ast\in\mathcal C_{\tau_0},
$$

所以真實解仍在 feasible set 中。

---

## 6.3 A2-MISMATCH

令：

$$
\tau_0
=
\operatorname{Tr}(W^\ast)+\Delta,
$$

其中原實驗：

$$
\Delta=3.
$$

此時：

$$
W^\ast
\notin
\mathcal C_{\tau_0}.
$$

因此不管 optimizer 如何更新：

$$
W_t\in\mathcal C_{\tau_0}
$$

都不可能真正到達：

$$
W^\ast.
$$

---

# 7. 原始實驗重新執行

本文使用原始 `ledger_experiment.py`、原始 seed、原始超參數重新執行。

結果：

```text
FREE             loss   0.0024 ->   0.000000 | Tr(W): -0.214 -> -0.770
A2-MATCH         loss   0.0026 ->   0.000000 | Tr(W): -0.770 -> -0.770
A2-MISMATCH(+3)  loss   0.0029 ->   0.000172 | Tr(W):  2.230 ->  2.230

reference: Tr(W_true) = -0.7699
```

因此：

$$
\boxed{
L_{\mathrm{FREE}}
\rightarrow 0,
}
$$

$$
\boxed{
L_{\mathrm{MATCH}}
\rightarrow 0,
}
$$

但：

$$
\boxed{
L_{\mathrm{MISMATCH}}
\rightarrow
1.72\times 10^{-4}
\neq0.
}
$$

這不是 convergence failure。

恰恰相反：

> MISMATCH 很可能已經收斂得很好；只是它收斂到錯誤 feasible set 中的最佳點。

---

# 8. 為什麼 A2-MATCH 不妨礙這個任務？

因為：

$$
W^\ast
\in
\mathcal C_{\operatorname{Tr}(W^\ast)}.
$$

若 unconstrained optimum 唯一且就是：

$$
W^\ast,
$$

則 constrained problem：

$$
\min_{W\in\mathcal C_{\operatorname{Tr}(W^\ast)}}L(W)
$$

仍然包含原始 optimum。

所以：

$$
\boxed{
\min_{W\in\mathcal C}L(W)
=
\min_WL(W)
}
$$

在這個實驗中是可能的。

因此：

$$
\boxed{
Constraint
}
$$

不是自動成本。

真正的成本來自：

$$
\boxed{
Constraint\text{-}Target\ Incompatibility.
}
$$

---

# 9. Mismatch residual 的解析解

這是本文對原始實驗的新解析重構。

令：

$$
E
=
W-W^\ast.
$$

因：

$$
Y=XW^\ast,
$$

所以：

$$
XW-Y
=
XE.
$$

原始 loss 使用 NumPy：

```python
0.5 * np.mean((X @ W - Y) ** 2)
```

因此：

$$
\boxed{
L(E)
=
\frac{1}{2mn}
\|XE\|_F^2.
}
$$

令：

$$
A=X^\top X.
$$

則：

$$
L(E)
=
\frac{1}{2mn}
\operatorname{Tr}
(E^\top A E).
$$

錯誤 trace constraint 為：

$$
\operatorname{Tr}(E)
=
\Delta.
$$

---

# 10. 定理：Trace-Mismatch Floor

## 定理 1 — 線性回歸中的 trace mismatch 精確下界

若：

$$
A=X^\top X
$$

為正定，考慮：

$$
\min_E
\frac{1}{2mn}
\operatorname{Tr}(E^\top A E)
$$

subject to：

$$
\operatorname{Tr}(E)=\Delta.
$$

則最小值為：

$$
\boxed{
L_{\min}
=
\frac{\Delta^2}
{2mn\operatorname{Tr}(A^{-1})}.
}
$$

---

## 證明

將：

$$
E
=
[e_1,\ldots,e_n]
$$

視為 column decomposition。

則：

$$
\operatorname{Tr}(E)
=
\sum_{j=1}^n
e_j^{(j)}.
$$

亦即：

$$
\sum_{j=1}^{n}
q_j^\top e_j
=
\Delta,
$$

其中：

$$
q_j
$$

是第 $j$ 個 standard basis vector。

忽略正比例常數：

$$
\frac{1}{2mn},
$$

考慮 Lagrangian：

$$
\mathcal L
=
\sum_j
e_j^\top A e_j
-
\lambda
\left(
\sum_jq_j^\top e_j-\Delta
\right).
$$

對每個 $e_j$：

$$
2Ae_j-\lambda q_j=0.
$$

因此：

$$
e_j
=
\frac{\lambda}{2}
A^{-1}q_j.
$$

代入 constraint：

$$
\sum_j
q_j^\top
\left(
\frac{\lambda}{2}
A^{-1}q_j
\right)
=
\Delta.
$$

所以：

$$
\frac{\lambda}{2}
\operatorname{Tr}(A^{-1})
=
\Delta.
$$

因此：

$$
\lambda
=
\frac{2\Delta}
{\operatorname{Tr}(A^{-1})}.
$$

再代回 objective：

$$
\sum_j
e_j^\top A e_j
=
\frac{\Delta^2}
{\operatorname{Tr}(A^{-1})}.
$$

故：

$$
\boxed{
L_{\min}
=
\frac{\Delta^2}
{2mn\operatorname{Tr}(A^{-1})}.
}
$$

證畢。

---

# 11. 原始資料的精確 floor

原始 seed 重建得到：

$$
\operatorname{Tr}
\left(
(X^\top X)^{-1}
\right)
\approx
8.165915660145487.
$$

帶入：

$$
m=400,
$$

$$
n=8,
$$

$$
\Delta=3,
$$

得到：

$$
L_{\min}
=
\frac{9}
{
2(400)(8)(8.165915660145487)
}.
$$

因此：

$$
\boxed{
L_{\min}
\approx
0.000172209713953.
}
$$

原始 gradient experiment 最後得到：

$$
L_{\mathrm{final}}
\approx
0.000172.
$$

所以：

$$
\boxed{
L_{\mathrm{final}}
\approx
L_{\min}.
}
$$

這表示 mismatch regime 並不是「卡住」。

它其實已經接近：

$$
\boxed{
\text{錯誤制度允許的最佳答案。}
}
$$

---

# 12. 結構殘差不是 optimizer error

這一點是整篇最重要的概念。

一般訓練誤差可以粗略拆成：

$$
Error
=
Error_{\mathrm{optimization}}
+
Error_{\mathrm{approximation}}
+
Error_{\mathrm{data}}
+
\cdots
$$

本文增加一個概念性分量：

$$
\boxed{
Error_{\mathrm{structural}}
}
$$

它來自：

$$
W^\ast
\notin
\mathcal C.
$$

因此：

$$
\boxed{
Error_{\mathrm{structural}}
=
\min_{W\in\mathcal C}
L(W)
-
\min_WL(W).
}
$$

若 unconstrained optimum loss 為零：

$$
\min_WL(W)=0,
$$

則：

$$
\boxed{
Error_{\mathrm{structural}}
=
\min_{W\in\mathcal C}L(W).
}
$$

在原始 mismatch 實驗中就是：

$$
\boxed{
0.0001722097\ldots
}
$$

---

# 13. 帳本語言中的重新解釋

令狀態：

$$
W_t
$$

視為帳本。

Gradient：

$$
-\eta\nabla L(W_t)
$$

是 proposed flow。

Projection：

$$
P_{\mathcal C}
$$

是合法域修正。

Invariant：

$$
\tau(W_t)=\tau_0
$$

是 ledger rule。

Residual：

$$
R_t
$$

則是：

> 任務要求與制度允許空間之間的張力。

因此可以寫成：

$$
\boxed{
\text{Learning}
=
\text{Flow}
+
\text{Constraint}
+
\text{Projection}
+
\text{Residual Audit}.
}
$$

---

# 14. 「守恆」應該被理解成可行域，不是神祕法則

本文刻意把「守恆」去神祕化。

若：

$$
\tau(W)=\tau_0,
$$

它首先只是定義：

$$
\mathcal C_{\tau_0}.
$$

因此真正研究問題不是：

> 「宇宙是否喜歡守恆？」

而是：

$$
\boxed{
\text{這個 feasible set 是否包含任務需要的解？}
}
$$

如果包含：

$$
W^\ast\in\mathcal C,
$$

constraint 可以：

- 不增加 optimum loss；
- 提供 audit；
- 降低非法狀態；
- 提供可解釋 boundary。

如果不包含：

$$
W^\ast\notin\mathcal C,
$$

則 constraint 會創造：

$$
\boxed{
Structural Bias.
}
$$

---

# 15. 與經典 Projected Gradient 的關係

本文的 trace projection 並不是新的 constrained-optimization 演算法。

Projected gradient 方法的基本思想早已存在：

$$
x_{t+1}
=
P_C
\left(
x_t-\eta\nabla f(x_t)
\right).
$$

本系列真正新增的不是「發明 projection」。

新增的是：

1. 將 projection 解釋為 ledger legality；
2. 將 invariant 暴露為可視 audit；
3. 將 mismatch residual 當成結構證書；
4. 將這種約束方式接入後續 spreadsheet / Agent / AI runtime。

因此：

$$
\boxed{
\text{Optimization Mechanism}
}
$$

與：

$$
\boxed{
\text{Ledger Interpretation / System Architecture}
}
$$

必須分開。

---

# 16. 從 Trace Constraint 到 Simplex Constraint

後來的 EML-LQ 不再使用：

$$
\operatorname{Tr}(W)=\tau_0,
$$

而使用權重向量：

$$
w
=
(w_1,\ldots,w_N)
$$

與 simplex：

$$
\boxed{
\Delta_N
=
\left\{
w_i\ge0,\;
\sum_iw_i=1
\right\}.
}
$$

更新先做：

$$
w_i^{raw}
=
w_i
\exp(\eta r_i),
$$

再：

$$
w_i'
=
\frac{
w_i^{raw}
}{
\sum_jw_j^{raw}
}.
$$

這一步保證：

$$
\sum_iw_i'=1.
$$

因此：

$$
\boxed{
\text{Normalization}
=
\text{Projection / Retraction into the simplex-like legal domain}.
}
$$

這和原始 trace experiment 的精神相同：

> 更新可以自由提出方向，但最終狀態必須回到合法集合。

---

# 17. 與 Exponentiated Gradient 的關係

EML-LQ 使用：

$$
w_i^{raw}
=
w_i
\exp(\eta r_i),
$$

再 normalization。

這類 multiplicative update 與經典 Exponentiated Gradient（EG）家族具有直接近鄰。

因此本文不把：

$$
w_i\exp(\eta r_i)
$$

宣稱為新演算法。

本系列關注的是另外一件事：

$$
\boxed{
\text{把 multiplicative adaptation 與 explicit ledger conservation 結合成可見架構。}
}
$$

也就是：

- update 是 flow；
- normalization 是 conservation；
- $\sum_iw_i$ 是 audit；
- parameter / data source / time 被寫入 history。

---

# 18. 開放閥：Constraint 之外還有 permeability

EML-LQ 再加入：

$$
\eta_t
=
\frac{
\eta_{\mathrm{base}}
}{
1+\lambda\sigma_t
}.
$$

若再接受智能層輸出的：

$$
\delta_t,
$$

則：

$$
\eta_t'
=
\eta_t\delta_t.
$$

此處：

$$
\eta
$$

可以被理解為：

$$
\boxed{
\text{Information Permeability}
}
$$

或「開放閥」。

所以系統並非只有：

$$
Legal / Illegal.
$$

還存在：

$$
\boxed{
\text{How strongly new evidence is allowed to move the state?}
}
$$

這使 constrained learning 從單純 feasible-set projection 進一步變成：

$$
\boxed{
\text{Boundary}
+
\text{Permeability}
+
\text{Flow}.
}
$$

---

# 19. AI 不應直接擁有 invariant

後來 EML-LQ Agent 中：

$$
AI
\rightarrow
\delta_t
$$

只修改：

$$
\eta_t.
$$

但最終：

$$
W_{t+1}
$$

仍必須經：

$$
\sum_iw_i=1
$$

的 Engine constraint。

因此：

$$
\boxed{
\text{Intelligence Layer}
\neq
\text{Invariant Authority}.
}
$$

這是一個重要工程原則。

如果 LLM 可以直接說：

> 「這次我覺得不用守恆。」

那 invariant 就不再是 invariant。

因此：

$$
\boxed{
AI\ Proposal
\rightarrow
Bounded\ Modifier
\rightarrow
Invariant\ Engine.
}
$$

而不是：

$$
AI
\rightarrow
Unrestricted\ Canonical\ State.
$$

---

# 20. Constraint Compatibility Spectrum

實際系統不只存在：

$$
MATCH
$$

與：

$$
MISMATCH.
$$

更一般地，可以定義：

$$
d(W^\ast,\mathcal C)
=
\inf_{W\in\mathcal C}
\|W-W^\ast\|.
$$

若：

$$
d=0,
$$

表示：

$$
W^\ast\in\overline{\mathcal C}.
$$

若：

$$
d>0,
$$

則存在幾何不相容。

所以 constraint compatibility 可以成為連續光譜：

$$
\boxed{
Compatibility
=
f
\left(
d(W^\ast,\mathcal C),
Geometry(\mathcal C),
LossGeometry
\right).
}
$$

這比：

> 「有守恆 / 沒守恆」

更接近真正學習問題。

---

# 21. 多重不變量

實際 Agent / matrix runtime 可能同時要求：

$$
g_1(W)=0,
$$

$$
g_2(W)=0,
$$

$$
h_1(W)\le0,
$$

$$
h_2(W)\le0.
$$

因此：

$$
\mathcal C
=
\bigcap_i
\mathcal C_i.
$$

新風險是：

$$
\boxed{
\mathcal C=\varnothing.
}
$$

也就是制度本身 mutually inconsistent。

此時任何 optimizer 都不可能滿足全部約束。

所以正式系統不只要 audit state，

還要 audit：

$$
\boxed{
\text{Constraint Set Consistency}.
}
$$

---

# 22. Dynamic Invariants

某些 invariant 不必固定為：

$$
\tau(W)=c.
$$

可能：

$$
\tau_t(W)=c_t.
$$

也可能 constraint family 本身演化：

$$
\mathcal C_t.
$$

則 learning dynamics：

$$
W_{t+1}
=
P_{\mathcal C_{t+1}}
\left(
W_t-\eta_t\nabla L_t(W_t)
\right).
$$

此時需要記錄：

- constraint version；
- effective time；
- migration rule；
- old/new feasible-set relation；
- whether past states remain legal。

這直接連向後續：

$$
\boxed{
Versioned Ledger
+
Executable Identity.
}
$$

---

# 23. Constraint 不是只有硬投影

本文目前主要討論 hard constraint：

$$
W\in\mathcal C.
$$

但還有 soft constraint：

$$
L'(W)
=
L(W)
+
\lambda R(W).
$$

以及 penalty / barrier / proximal / mirror-style methods。

因此：

$$
\boxed{
\text{Ledger Constraint}
}
$$

在更一般框架下不必等於：

$$
\boxed{
\text{Euclidean Hard Projection}.
}
$$

未來可以把 constraint enforcement 分類為：

1. hard projection；
2. normalization；
3. penalty；
4. barrier；
5. proximal update；
6. mirror / Bregman update；
7. symbolic legality guard；
8. hybrid human approval。

---

# 24. Constraint Certificate

如果系統宣稱某一步合法，不應只輸出：

```text
PASS
```

而可以輸出：

$$
C_t
=
(
constraint\_id,
version,
value,
target,
residual,
tolerance,
status
).
$$

例如：

```yaml
constraint_id: A2-sum
version: 1.0
value: 1.0000000000
target: 1.0
residual: 2.1e-14
tolerance: 1.0e-10
status: PASS
```

此時：

$$
\boxed{
\text{Constraint}
+
\text{Certificate}
}
$$

才真正適合進入 MLF / MMLC / Agent runtime。

---

# 25. Structural Residual Certificate

對 mismatch，除了：

```text
loss = 0.000172
```

更應保存：

$$
R_{\mathrm{struct}}
=
(
\Delta,
A,
L_{\min},
L_{\mathrm{observed}}
).
$$

若：

$$
L_{\mathrm{observed}}
\approx
L_{\min},
$$

表示：

> optimizer 已接近 constrained optimum，剩餘誤差主要是結構不相容，而非訓練不足。

這對自動研究 Agent 非常重要。

否則 Agent 可能看到 loss 不再下降，就錯誤地：

- 改 optimizer；
- 加 steps；
- 加 learning rate；
- 換模型；

卻永遠無法消除：

$$
\boxed{
Constraint-Induced Floor.
}
$$

---

# 26. 一個更一般的研究判斷器

給定：

$$
L,
\quad
\mathcal C,
\quad
W^\ast\text{ 或 benchmark target},
$$

可以建立：

```text
1. unconstrained solve
2. constrained solve
3. compare optimum gap
4. estimate structural floor
5. verify optimizer gap
6. classify failure
```

形式上：

$$
Gap_{\mathrm{total}}
=
L(W_t)-L^\ast.
$$

拆成：

$$
Gap_{\mathrm{total}}
=
\underbrace{
L(W_t)-L^\ast_{\mathcal C}
}_{OptimizationGap}
+
\underbrace{
L^\ast_{\mathcal C}-L^\ast
}_{StructuralGap}.
$$

即：

$$
\boxed{
TotalGap
=
OptimizationGap
+
StructuralGap.
}
$$

這是本文最值得帶到其他 AI 研究領域的形式。

---

# 27. 與「思維鋼印」問題的形式對應

若一個系統永遠被限制在：

$$
\mathcal C,
$$

而真實解在：

$$
W^\ast\notin\mathcal C,
$$

那麼不論它在：

$$
\mathcal C
$$

內多聰明、多有效率，都只能逼近：

$$
P_{\mathcal C}(W^\ast)
$$

或某個 constrained optimum。

因此在抽象層：

$$
\boxed{
\text{錯誤的先驗合法域}
}
$$

會產生：

$$
\boxed{
\text{不可消除的認知殘差}.
}
$$

這裡「鋼印」不再只是比喻。

它對應：

$$
\boxed{
\text{Hypothesis / State Space Exclusion}.
}
$$

但本文也強調：

> 不是所有限制都是鋼印。

若 constraint 正確：

$$
W^\ast\in\mathcal C,
$$

它反而可能幫助：

- 安全；
- 穩定；
- audit；
- search-space reduction；
- physical legality；
- domain consistency。

---

# 28. 可證偽條件

## F1 — Match Constraint Still Causes Irreducible Gap

若：

$$
W^\ast\in\mathcal C,
$$

但在排除 optimizer failure 後仍存在理論上無法消失的正 gap，

則本文「compatibility」分析不足。

---

## F2 — Mismatch Reaches Zero Loss

若：

$$
W^\ast\notin\mathcal C
$$

且 objective 唯一識別 $W^\ast$，

卻仍能達到：

$$
L=0,
$$

則 constraint / task assumptions 至少一項被錯誤描述。

---

## F3 — Projection Does Not Preserve Invariant

若：

$$
P_{\mathcal C}(W)\notin\mathcal C,
$$

則 projection implementation 失敗。

---

## F4 — Structural Floor Misclassified as Optimization Failure

若 Agent 不斷增加訓練資源，卻沒有檢查：

$$
L^\ast_{\mathcal C}-L^\ast,
$$

則系統缺乏 structural diagnosis。

---

## F5 — Constraint Set Is Empty

若：

$$
\bigcap_i\mathcal C_i=\varnothing,
$$

但 runtime 仍宣稱全 constraint 可同時滿足，

則 governance layer 本身不一致。

---

# 29. 與本系列其他節點的關係

## 29.1 與 Open Model State

第 01 篇回答：

$$
\text{模型狀態能否外部化？}
$$

本文回答：

$$
\text{模型狀態外部化後，合法更新域能否也被顯式化？}
$$

因此：

$$
\boxed{
OpenState
+
ExplicitConstraint.
}
$$

---

## 29.2 與 Spreadsheet Runtime

下一篇將研究：

$$
\boxed{
\text{如何把 state、formula、constraint、audit 放進同一可視工作簿。}
}
$$

---

## 29.3 與 MMLC / MLF

本文的：

$$
ConstraintCertificate
$$

與：

$$
StructuralResidualCertificate
$$

可以自然成為：

- transaction audit；
- provenance event；
- validation record；
- model projection metadata。

---

## 29.4 與 Agent Governance

本文提供一個簡單但關鍵的安全分離：

$$
\boxed{
AI\ proposes;
Engine\ constrains;
Audit\ verifies.
}
$$

這比：

$$
AI\ decides\ everything
$$

更適合長時間自治系統。

---

# 30. 結論

`ledger_experiment.py` 最早問的是：

> **守恆是否會妨礙計算？**

重新執行與解析後，答案已經可以寫得非常精確。

對原始實驗：

$$
\boxed{
\text{正確 trace invariant 沒有提高最終 optimum loss。}
}
$$

而錯誤 trace invariant：

$$
\operatorname{Tr}(W)
=
\operatorname{Tr}(W^\ast)+3
$$

創造的最小 loss 為：

$$
\boxed{
L_{\min}
=
\frac{9}
{2(400)(8)\operatorname{Tr}((X^\top X)^{-1})}
\approx
0.000172209714.
}
$$

實際 gradient training 收斂到：

$$
\boxed{
L_{\mathrm{final}}
\approx0.000172.
}
$$

這表示：

$$
\boxed{
\text{Residual}
\neq
\text{Optimization Failure}.
}
$$

而是：

$$
\boxed{
\text{Residual}
=
\text{Constraint–Target Incompatibility Certificate}.
}
$$

所以本文最終提出：

$$
\boxed{
\textbf{
學習可以被理解為合法狀態空間中的流；
不變量定義可行域；
投影維持合法性；
而不可消除殘差揭露制度與目標之間的結構衝突。
}
}
$$

這就是「學習作為帳本流」的最低數學骨架。

---

# 31. 下一篇

## EML-MNIAC-2026-03

**《試算表作為可見計算環境：狀態、公式、依賴、記憶與稽核》**

下一篇將正式把：

$$
OpenState
+
Constraint
+
Formula
+
Dependency
+
History
$$

放回 Excel / Spreadsheet runtime 中，處理：

- EML-LQ；
- Spreadsheet Ledger；
- workbook state machine；
- Excel-native computation；
- log-coordinate runtime；
- control / execution plane separation 的起點。

---

# 參考資料

## 內部原型

1. EveMissLab, `ledger_experiment.py` — empirical test of Ledger Axiom A2 on a learnable linear system.
2. EveMissLab, `build_xlsx.py` — Adaptive Ledger Quant Meta-Framework / EML-LQ-2026.
3. EveMissLab, 《自適應帳本量化代理框架技術規格》。
4. EML-MNIAC-2026-00, 《矩陣原生智能與可稽核計算》。
5. EML-MNIAC-2026-01, 《模型可以住在表格裡嗎？CSV-Native Transformer 與可檢查模型狀態》。

## 外部方法論近鄰

6. Rosen, J. B. (1961). **The Gradient Projection Method for Nonlinear Programming. Part II. Nonlinear Constraints.** Journal of the Society for Industrial and Applied Mathematics, 9(4), 514–532.  
   https://doi.org/10.1137/0109044

7. Luenberger, D. G. (1972). **The Gradient Projection Method Along Geodesics.** Management Science, 18(11), 620–631.  
   https://doi.org/10.1287/mnsc.18.11.620

8. Kivinen, J., & Warmuth, M. K. (1994/1997). **Exponentiated Gradient versus Gradient Descent for Linear Predictors.** UCSC-CRL-94-16; later Information and Computation.  
   https://tr.soe.ucsc.edu/research/technical-reports/UCSC-CRL-94-16

9. Yang, T., Lin, Q., & Zhang, L. (2017). **A Richer Theory of Convex Constrained Optimization with Reduced Projections and Improved Rates.** ICML / PMLR 70.  
   https://proceedings.mlr.press/v70/yang17f.html

---

**系列狀態：** 第 02 篇完成。  
**下一篇：** EML-MNIAC-2026-03 —《試算表作為可見計算環境：狀態、公式、依賴、記憶與稽核》
