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 = X W ∗ Y=XW^\ast Y = X W ∗
上比較三種訓練制度:
FREE:普通 gradient descent;
A2-MATCH:每一步後投影回正確 trace 約束Tr ( W ) = Tr ( W ∗ ) ; \operatorname{Tr}(W)=\operatorname{Tr}(W^\ast); Tr ( W ) = Tr ( W ∗ ) ;
A2-MISMATCH:每一步後投影回錯誤 trace 約束Tr ( W ) = Tr ( W ∗ ) + Δ . \operatorname{Tr}(W)=\operatorname{Tr}(W^\ast)+\Delta. Tr ( W ) = Tr ( W ∗ ) + Δ.
本文重新執行原始程式,在原始隨機種子與超參數下得到:
FREE loss 0.0024 -> 0.000000
A2-MATCH loss 0.0026 -> 0.000000
A2-MISMATCH(+3) loss 0.0029 -> 0.000172
其中真實 trace 約為:
Tr ( W ∗ ) ≈ − 0.7699 , \operatorname{Tr}(W^\ast)\approx -0.7699, Tr ( W ∗ ) ≈ − 0.7699 ,
而 mismatch regime 被鎖定於:
Tr ( W ) = 2.2301 … \operatorname{Tr}(W)=2.2301\ldots Tr ( W ) = 2.2301 …
附近。
更進一步,本文對該實驗推導出解析 constrained optimum。令:
A = X ⊤ X , A=X^\top X, A = X ⊤ X ,
E = W − W ∗ , E=W-W^\ast, E = W − W ∗ ,
並要求:
Tr ( E ) = Δ . \operatorname{Tr}(E)=\Delta. Tr ( E ) = Δ.
則對原實驗的 mean-squared loss:
L ( E ) = 1 2 m n Tr ( E ⊤ A E ) , L(E)
=
\frac{1}{2mn}
\operatorname{Tr}(E^\top A E), L ( E ) = 2 mn 1 Tr ( E ⊤ A E ) ,
當 A A A 正定時,錯誤 trace 約束下的最小可達 loss 為:
L min = Δ 2 2 m n Tr ( A − 1 ) . \boxed{
L_{\min}
=
\frac{\Delta^2}
{2mn\,\operatorname{Tr}(A^{-1})}.
} L m i n = 2 mn Tr ( A − 1 ) Δ 2 .
對原始資料:
n = 8 , m = 400 , Δ = 3 , n=8,\quad
m=400,\quad
\Delta=3, n = 8 , m = 400 , Δ = 3 ,
且:
Tr ( A − 1 ) ≈ 8.1659156601 , \operatorname{Tr}(A^{-1})
\approx
8.1659156601, Tr ( A − 1 ) ≈ 8.1659156601 ,
因此:
L min ≈ 0.000172209714. \boxed{
L_{\min}
\approx
0.000172209714.
} L m i n ≈ 0.000172209714.
與程式的最終 loss 約 0.000172 0.000172 0.000172 一致。
因此,本文將早期直覺精確化為:
正確約束不必然妨礙學習; \boxed{
\text{正確約束不必然妨礙學習;}
} 正確約束不必然妨礙學習;
但:
若真實解不在可行域內,則存在由幾何不相容決定的非零誤差下界。 \boxed{
\text{若真實解不在可行域內,則存在由幾何不相容決定的非零誤差下界。}
} 若真實解不在可行域內,則存在由幾何不相容決定的非零誤差下界。
這個下界不是 optimizer 不夠好造成,而是 feasible set 本身排除了真實解。
本文並進一步將這個結果連接到後續 EML-LQ 的 simplex normalization、乘法更新與 AI 開放閥設計,提出「學習作為帳本流」的統一觀點:更新是流動、約束是合法域、投影是回到合法域的算子、殘差是模型與制度不相容的證書。
1. 問題:守恆會不會殺死學習?
1.1 最容易犯的兩個極端
當「守恆」或「不變量」被帶入可學習系統時,通常會滑向兩個極端。
第一種是:
只要加入守恆,模型就會失去自由度,因此一定學不好。
形式上近似:
C o n s t r a i n t ⇒ N o L e a r n i n g . Constraint
\Rightarrow
No\ Learning. C o n s t r ain t ⇒ N o L e a r nin g .
第二種則是:
只要叫它守恆,任何約束都會提升穩定性。
形式上近似:
C o n s t r a i n t ⇒ B e t t e r L e a r n i n g . Constraint
\Rightarrow
Better\ Learning. C o n s t r ain t ⇒ B e tt er L e a r nin g .
兩者都不成立。
真正的問題是:
W ∗ ∈ C ? \boxed{
W^\ast
\in
\mathcal C
\ ?
} W ∗ ∈ C ?
其中:
W ∗ W^\ast W ∗ 是任務真正需要的解;
C \mathcal C C 是系統被允許存在的可行域。
2. 一般 constrained-learning 形式
設損失函數:
L ( W ) , L(W), L ( W ) ,
而合法狀態集合:
C = { W : g i ( W ) = 0 , h j ( W ) ≤ 0 } . \mathcal C
=
\{
W:
g_i(W)=0,\;
h_j(W)\le 0
\}. C = { W : g i ( W ) = 0 , h j ( W ) ≤ 0 } .
普通 gradient descent:
W t + 1 r a w = W t − η t ∇ L ( W t ) . W_{t+1}^{raw}
=
W_t-\eta_t\nabla L(W_t). W t + 1 r a w = W t − η t ∇ L ( W t ) .
Projected gradient 類方法則寫成:
W t + 1 = P C ( W t − η t ∇ L ( W t ) ) . \boxed{
W_{t+1}
=
P_{\mathcal C}
\left(
W_t-\eta_t\nabla L(W_t)
\right).
} W t + 1 = P C ( W t − η t ∇ L ( W t ) ) .
其中:
P C ( Z ) = arg min W ∈ C ∥ W − Z ∥ . P_{\mathcal C}(Z)
=
\arg\min_{W\in\mathcal C}
\|W-Z\|. P C ( Z ) = arg W ∈ C min ∥ W − Z ∥.
從帳本語言來看,可以讀成:
Proposal → Projection → Legal State . \boxed{
\text{Proposal}
\rightarrow
\text{Projection}
\rightarrow
\text{Legal State}.
} Proposal → Projection → Legal State .
即:
optimizer 先提出更新;
約束層判斷合法域;
projection 將狀態帶回合法集合;
audit 檢查 invariant 是否成立。
3. 原始 ledger_experiment.py
3.1 任務
原始實驗設定:
n = 8 , m = 400 , n=8,
\qquad
m=400, n = 8 , m = 400 ,
並產生:
X ∈ R m × n , X\in\mathbb R^{m\times n}, X ∈ R m × n ,
W ∗ ∈ R n × n , W^\ast\in\mathbb R^{n\times n}, W ∗ ∈ R n × n ,
Y = X W ∗ . Y=XW^\ast. Y = X W ∗ .
學習目標:
min W 1 2 mean [ ( X W − Y ) 2 ] . \min_W
\frac12
\operatorname{mean}
\left[
(XW-Y)^2
\right]. W min 2 1 mean [ ( X W − Y ) 2 ] .
原始程式使用:
600 600 600
個 gradient steps,
learning rate:
η = 0.02. \eta=0.02. η = 0.02.
4. A2:Trace 作為最小帳本不變量
原始實驗選擇:
τ ( W ) = Tr ( W ) . \tau(W)
=
\operatorname{Tr}(W). τ ( W ) = Tr ( W ) .
這不是主張:
所有 AI 都應守恆 trace。
它只是選擇一個:
易於計算;
易於投影;
可以精確控制;
可以製造 match / mismatch 對照;
的最小線性 invariant。
設目標 trace:
τ 0 . \tau_0. τ 0 .
則 constraint set:
C τ 0 = { W : Tr ( W ) = τ 0 } . \mathcal C_{\tau_0}
=
\{
W:
\operatorname{Tr}(W)=\tau_0
\}. C τ 0 = { W : Tr ( W ) = τ 0 } .
5. Trace Projection
對任意:
W ∈ R n × n , W\in\mathbb R^{n\times n}, W ∈ R n × n ,
定義:
a = Tr ( W ) − τ 0 n . a
=
\frac{
\operatorname{Tr}(W)-\tau_0
}{n}. a = n Tr ( W ) − τ 0 .
再令:
P τ 0 ( W ) = W − a I . \boxed{
P_{\tau_0}(W)
=
W-aI.
} P τ 0 ( W ) = W − a I .
檢查:
Tr ( W − a I ) = Tr ( W ) − n a = τ 0 . \operatorname{Tr}
\left(
W-aI
\right)
=
\operatorname{Tr}(W)-na
=
\tau_0. Tr ( W − a I ) = Tr ( W ) − na = τ 0 .
所以:
P τ 0 ( W ) ∈ C τ 0 . P_{\tau_0}(W)
\in
\mathcal C_{\tau_0}. P τ 0 ( W ) ∈ C τ 0 .
這正是原始程式:
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 − η ∇ L ( W t ) . W_{t+1}
=
W_t-\eta\nabla L(W_t). W t + 1 = W t − η ∇ L ( W t ) .
不限制:
Tr ( W t ) . \operatorname{Tr}(W_t). Tr ( W t ) .
6.2 A2-MATCH
令:
τ 0 = Tr ( W ∗ ) . \tau_0
=
\operatorname{Tr}(W^\ast). τ 0 = Tr ( W ∗ ) .
每一步:
W t + 1 = P τ 0 ( W t − η ∇ L ( W t ) ) . W_{t+1}
=
P_{\tau_0}
\left(
W_t-\eta\nabla L(W_t)
\right). W t + 1 = P τ 0 ( W t − η ∇ L ( W t ) ) .
因為:
W ∗ ∈ C τ 0 , W^\ast\in\mathcal C_{\tau_0}, W ∗ ∈ C τ 0 ,
所以真實解仍在 feasible set 中。
6.3 A2-MISMATCH
令:
τ 0 = Tr ( W ∗ ) + Δ , \tau_0
=
\operatorname{Tr}(W^\ast)+\Delta, τ 0 = Tr ( W ∗ ) + Δ ,
其中原實驗:
Δ = 3. \Delta=3. Δ = 3.
此時:
W ∗ ∉ C τ 0 . W^\ast
\notin
\mathcal C_{\tau_0}. W ∗ ∈ / C τ 0 .
因此不管 optimizer 如何更新:
W t ∈ C τ 0 W_t\in\mathcal C_{\tau_0} W t ∈ C τ 0
都不可能真正到達:
W ∗ . W^\ast. W ∗ .
7. 原始實驗重新執行
本文使用原始 ledger_experiment.py、原始 seed、原始超參數重新執行。
結果:
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
因此:
L F R E E → 0 , \boxed{
L_{\mathrm{FREE}}
\rightarrow 0,
} L FREE → 0 ,
L M A T C H → 0 , \boxed{
L_{\mathrm{MATCH}}
\rightarrow 0,
} L MATCH → 0 ,
但:
L M I S M A T C H → 1.72 × 10 − 4 ≠ 0. \boxed{
L_{\mathrm{MISMATCH}}
\rightarrow
1.72\times 10^{-4}
\neq0.
} L MISMATCH → 1.72 × 1 0 − 4 = 0.
這不是 convergence failure。
恰恰相反:
MISMATCH 很可能已經收斂得很好;只是它收斂到錯誤 feasible set 中的最佳點。
8. 為什麼 A2-MATCH 不妨礙這個任務?
因為:
W ∗ ∈ C Tr ( W ∗ ) . W^\ast
\in
\mathcal C_{\operatorname{Tr}(W^\ast)}. W ∗ ∈ C Tr ( W ∗ ) .
若 unconstrained optimum 唯一且就是:
W ∗ , W^\ast, W ∗ ,
則 constrained problem:
min W ∈ C Tr ( W ∗ ) L ( W ) \min_{W\in\mathcal C_{\operatorname{Tr}(W^\ast)}}L(W) W ∈ C Tr ( W ∗ ) min L ( W )
仍然包含原始 optimum。
所以:
min W ∈ C L ( W ) = min W L ( W ) \boxed{
\min_{W\in\mathcal C}L(W)
=
\min_WL(W)
} W ∈ C min L ( W ) = W min L ( W )
在這個實驗中是可能的。
因此:
C o n s t r a i n t \boxed{
Constraint
} C o n s t r ain t
不是自動成本。
真正的成本來自:
C o n s t r a i n t - T a r g e t I n c o m p a t i b i l i t y . \boxed{
Constraint\text{-}Target\ Incompatibility.
} C o n s t r ain t - T a r g e t I n co m p a t ibi l i t y .
9. Mismatch residual 的解析解
這是本文對原始實驗的新解析重構。
令:
E = W − W ∗ . E
=
W-W^\ast. E = W − W ∗ .
因:
Y = X W ∗ , Y=XW^\ast, Y = X W ∗ ,
所以:
X W − Y = X E . XW-Y
=
XE. X W − Y = X E .
原始 loss 使用 NumPy:
0.5 * np.mean((X @ W - Y) ** 2)
因此:
L ( E ) = 1 2 m n ∥ X E ∥ F 2 . \boxed{
L(E)
=
\frac{1}{2mn}
\|XE\|_F^2.
} L ( E ) = 2 mn 1 ∥ X E ∥ F 2 .
令:
A = X ⊤ X . A=X^\top X. A = X ⊤ X .
則:
L ( E ) = 1 2 m n Tr ( E ⊤ A E ) . L(E)
=
\frac{1}{2mn}
\operatorname{Tr}
(E^\top A E). L ( E ) = 2 mn 1 Tr ( E ⊤ A E ) .
錯誤 trace constraint 為:
Tr ( E ) = Δ . \operatorname{Tr}(E)
=
\Delta. Tr ( E ) = Δ.
10. 定理:Trace-Mismatch Floor
定理 1 — 線性回歸中的 trace mismatch 精確下界
若:
A = X ⊤ X A=X^\top X A = X ⊤ X
為正定,考慮:
min E 1 2 m n Tr ( E ⊤ A E ) \min_E
\frac{1}{2mn}
\operatorname{Tr}(E^\top A E) E min 2 mn 1 Tr ( E ⊤ A E )
subject to:
Tr ( E ) = Δ . \operatorname{Tr}(E)=\Delta. Tr ( E ) = Δ.
則最小值為:
L min = Δ 2 2 m n Tr ( A − 1 ) . \boxed{
L_{\min}
=
\frac{\Delta^2}
{2mn\operatorname{Tr}(A^{-1})}.
} L m i n = 2 mn Tr ( A − 1 ) Δ 2 .
證明
將:
E = [ e 1 , … , e n ] E
=
[e_1,\ldots,e_n] E = [ e 1 , … , e n ]
視為 column decomposition。
則:
Tr ( E ) = ∑ j = 1 n e j ( j ) . \operatorname{Tr}(E)
=
\sum_{j=1}^n
e_j^{(j)}. Tr ( E ) = j = 1 ∑ n e j ( j ) .
亦即:
∑ j = 1 n q j ⊤ e j = Δ , \sum_{j=1}^{n}
q_j^\top e_j
=
\Delta, j = 1 ∑ n q j ⊤ e j = Δ ,
其中:
q j q_j q j
是第 j j j 個 standard basis vector。
忽略正比例常數:
1 2 m n , \frac{1}{2mn}, 2 mn 1 ,
考慮 Lagrangian:
L = ∑ j e j ⊤ A e j − λ ( ∑ j q j ⊤ e j − Δ ) . \mathcal L
=
\sum_j
e_j^\top A e_j
-
\lambda
\left(
\sum_jq_j^\top e_j-\Delta
\right). L = j ∑ e j ⊤ A e j − λ ( j ∑ q j ⊤ e j − Δ ) .
對每個 e j e_j e j :
2 A e j − λ q j = 0. 2Ae_j-\lambda q_j=0. 2 A e j − λ q j = 0.
因此:
e j = λ 2 A − 1 q j . e_j
=
\frac{\lambda}{2}
A^{-1}q_j. e j = 2 λ A − 1 q j .
代入 constraint:
∑ j q j ⊤ ( λ 2 A − 1 q j ) = Δ . \sum_j
q_j^\top
\left(
\frac{\lambda}{2}
A^{-1}q_j
\right)
=
\Delta. j ∑ q j ⊤ ( 2 λ A − 1 q j ) = Δ.
所以:
λ 2 Tr ( A − 1 ) = Δ . \frac{\lambda}{2}
\operatorname{Tr}(A^{-1})
=
\Delta. 2 λ Tr ( A − 1 ) = Δ.
因此:
λ = 2 Δ Tr ( A − 1 ) . \lambda
=
\frac{2\Delta}
{\operatorname{Tr}(A^{-1})}. λ = Tr ( A − 1 ) 2Δ .
再代回 objective:
∑ j e j ⊤ A e j = Δ 2 Tr ( A − 1 ) . \sum_j
e_j^\top A e_j
=
\frac{\Delta^2}
{\operatorname{Tr}(A^{-1})}. j ∑ e j ⊤ A e j = Tr ( A − 1 ) Δ 2 .
故:
L min = Δ 2 2 m n Tr ( A − 1 ) . \boxed{
L_{\min}
=
\frac{\Delta^2}
{2mn\operatorname{Tr}(A^{-1})}.
} L m i n = 2 mn Tr ( A − 1 ) Δ 2 .
證畢。
11. 原始資料的精確 floor
原始 seed 重建得到:
Tr ( ( X ⊤ X ) − 1 ) ≈ 8.165915660145487. \operatorname{Tr}
\left(
(X^\top X)^{-1}
\right)
\approx
8.165915660145487. Tr ( ( X ⊤ X ) − 1 ) ≈ 8.165915660145487.
帶入:
m = 400 , m=400, m = 400 ,
n = 8 , n=8, n = 8 ,
Δ = 3 , \Delta=3, Δ = 3 ,
得到:
L min = 9 2 ( 400 ) ( 8 ) ( 8.165915660145487 ) . L_{\min}
=
\frac{9}
{
2(400)(8)(8.165915660145487)
}. L m i n = 2 ( 400 ) ( 8 ) ( 8.165915660145487 ) 9 .
因此:
L min ≈ 0.000172209713953. \boxed{
L_{\min}
\approx
0.000172209713953.
} L m i n ≈ 0.000172209713953.
原始 gradient experiment 最後得到:
L f i n a l ≈ 0.000172. L_{\mathrm{final}}
\approx
0.000172. L final ≈ 0.000172.
所以:
L f i n a l ≈ L min . \boxed{
L_{\mathrm{final}}
\approx
L_{\min}.
} L final ≈ L m i n .
這表示 mismatch regime 並不是「卡住」。
它其實已經接近:
錯誤制度允許的最佳答案。 \boxed{
\text{錯誤制度允許的最佳答案。}
} 錯誤制度允許的最佳答案。
12. 結構殘差不是 optimizer error
這一點是整篇最重要的概念。
一般訓練誤差可以粗略拆成:
E r r o r = E r r o r o p t i m i z a t i o n + E r r o r a p p r o x i m a t i o n + E r r o r d a t a + ⋯ Error
=
Error_{\mathrm{optimization}}
+
Error_{\mathrm{approximation}}
+
Error_{\mathrm{data}}
+
\cdots E r r or = E r r o r optimization + E r r o r approximation + E r r o r data + ⋯
本文增加一個概念性分量:
E r r o r s t r u c t u r a l \boxed{
Error_{\mathrm{structural}}
} E r r o r structural
它來自:
W ∗ ∉ C . W^\ast
\notin
\mathcal C. W ∗ ∈ / C .
因此:
E r r o r s t r u c t u r a l = min W ∈ C L ( W ) − min W L ( W ) . \boxed{
Error_{\mathrm{structural}}
=
\min_{W\in\mathcal C}
L(W)
-
\min_WL(W).
} E r r o r structural = W ∈ C min L ( W ) − W min L ( W ) .
若 unconstrained optimum loss 為零:
min W L ( W ) = 0 , \min_WL(W)=0, W min L ( W ) = 0 ,
則:
E r r o r s t r u c t u r a l = min W ∈ C L ( W ) . \boxed{
Error_{\mathrm{structural}}
=
\min_{W\in\mathcal C}L(W).
} E r r o r structural = W ∈ C min L ( W ) .
在原始 mismatch 實驗中就是:
0.0001722097 … \boxed{
0.0001722097\ldots
} 0.0001722097 …
13. 帳本語言中的重新解釋
令狀態:
W t W_t W t
視為帳本。
Gradient:
− η ∇ L ( W t ) -\eta\nabla L(W_t) − η ∇ L ( W t )
是 proposed flow。
Projection:
P C P_{\mathcal C} P C
是合法域修正。
Invariant:
τ ( W t ) = τ 0 \tau(W_t)=\tau_0 τ ( W t ) = τ 0
是 ledger rule。
Residual:
R t R_t R t
則是:
任務要求與制度允許空間之間的張力。
因此可以寫成:
Learning = Flow + Constraint + Projection + Residual Audit . \boxed{
\text{Learning}
=
\text{Flow}
+
\text{Constraint}
+
\text{Projection}
+
\text{Residual Audit}.
} Learning = Flow + Constraint + Projection + Residual Audit .
14. 「守恆」應該被理解成可行域,不是神祕法則
本文刻意把「守恆」去神祕化。
若:
τ ( W ) = τ 0 , \tau(W)=\tau_0, τ ( W ) = τ 0 ,
它首先只是定義:
C τ 0 . \mathcal C_{\tau_0}. C τ 0 .
因此真正研究問題不是:
「宇宙是否喜歡守恆?」
而是:
這個 feasible set 是否包含任務需要的解? \boxed{
\text{這個 feasible set 是否包含任務需要的解?}
} 這個 feasible set 是否包含任務需要的解?
如果包含:
W ∗ ∈ C , W^\ast\in\mathcal C, W ∗ ∈ C ,
constraint 可以:
不增加 optimum loss;
提供 audit;
降低非法狀態;
提供可解釋 boundary。
如果不包含:
W ∗ ∉ C , W^\ast\notin\mathcal C, W ∗ ∈ / C ,
則 constraint 會創造:
S t r u c t u r a l B i a s . \boxed{
Structural Bias.
} S t r u c t u r a l B ia s .
15. 與經典 Projected Gradient 的關係
本文的 trace projection 並不是新的 constrained-optimization 演算法。
Projected gradient 方法的基本思想早已存在:
x t + 1 = P C ( x t − η ∇ f ( x t ) ) . x_{t+1}
=
P_C
\left(
x_t-\eta\nabla f(x_t)
\right). x t + 1 = P C ( x t − η ∇ f ( x t ) ) .
本系列真正新增的不是「發明 projection」。
新增的是:
將 projection 解釋為 ledger legality;
將 invariant 暴露為可視 audit;
將 mismatch residual 當成結構證書;
將這種約束方式接入後續 spreadsheet / Agent / AI runtime。
因此:
Optimization Mechanism \boxed{
\text{Optimization Mechanism}
} Optimization Mechanism
與:
Ledger Interpretation / System Architecture \boxed{
\text{Ledger Interpretation / System Architecture}
} Ledger Interpretation / System Architecture
必須分開。
16. 從 Trace Constraint 到 Simplex Constraint
後來的 EML-LQ 不再使用:
Tr ( W ) = τ 0 , \operatorname{Tr}(W)=\tau_0, Tr ( W ) = τ 0 ,
而使用權重向量:
w = ( w 1 , … , w N ) w
=
(w_1,\ldots,w_N) w = ( w 1 , … , w N )
與 simplex:
Δ N = { w i ≥ 0 , ∑ i w i = 1 } . \boxed{
\Delta_N
=
\left\{
w_i\ge0,\;
\sum_iw_i=1
\right\}.
} Δ N = { w i ≥ 0 , i ∑ w i = 1 } .
更新先做:
w i r a w = w i exp ( η r i ) , w_i^{raw}
=
w_i
\exp(\eta r_i), w i r a w = w i exp ( η r i ) ,
再:
w i ′ = w i r a w ∑ j w j r a w . w_i'
=
\frac{
w_i^{raw}
}{
\sum_jw_j^{raw}
}. w i ′ = ∑ j w j r a w w i r a w .
這一步保證:
∑ i w i ′ = 1. \sum_iw_i'=1. i ∑ w i ′ = 1.
因此:
Normalization = Projection / Retraction into the simplex-like legal domain . \boxed{
\text{Normalization}
=
\text{Projection / Retraction into the simplex-like legal domain}.
} Normalization = Projection / Retraction into the simplex-like legal domain .
這和原始 trace experiment 的精神相同:
更新可以自由提出方向,但最終狀態必須回到合法集合。
17. 與 Exponentiated Gradient 的關係
EML-LQ 使用:
w i r a w = w i exp ( η r i ) , w_i^{raw}
=
w_i
\exp(\eta r_i), w i r a w = w i exp ( η r i ) ,
再 normalization。
這類 multiplicative update 與經典 Exponentiated Gradient(EG)家族具有直接近鄰。
因此本文不把:
w i exp ( η r i ) w_i\exp(\eta r_i) w i exp ( η r i )
宣稱為新演算法。
本系列關注的是另外一件事:
把 multiplicative adaptation 與 explicit ledger conservation 結合成可見架構。 \boxed{
\text{把 multiplicative adaptation 與 explicit ledger conservation 結合成可見架構。}
} 把 multiplicative adaptation 與 explicit ledger conservation 結合成可見架構。
也就是:
update 是 flow;
normalization 是 conservation;
∑ i w i \sum_iw_i ∑ i w i 是 audit;
parameter / data source / time 被寫入 history。
18. 開放閥:Constraint 之外還有 permeability
EML-LQ 再加入:
η t = η b a s e 1 + λ σ t . \eta_t
=
\frac{
\eta_{\mathrm{base}}
}{
1+\lambda\sigma_t
}. η t = 1 + λ σ t η base .
若再接受智能層輸出的:
δ t , \delta_t, δ t ,
則:
η t ′ = η t δ t . \eta_t'
=
\eta_t\delta_t. η t ′ = η t δ t .
此處:
η \eta η
可以被理解為:
Information Permeability \boxed{
\text{Information Permeability}
} Information Permeability
或「開放閥」。
所以系統並非只有:
L e g a l / I l l e g a l . Legal / Illegal. L e g a l / I l l e g a l .
還存在:
How strongly new evidence is allowed to move the state? \boxed{
\text{How strongly new evidence is allowed to move the state?}
} How strongly new evidence is allowed to move the state?
這使 constrained learning 從單純 feasible-set projection 進一步變成:
Boundary + Permeability + Flow . \boxed{
\text{Boundary}
+
\text{Permeability}
+
\text{Flow}.
} Boundary + Permeability + Flow .
19. AI 不應直接擁有 invariant
後來 EML-LQ Agent 中:
A I → δ t AI
\rightarrow
\delta_t A I → δ t
只修改:
η t . \eta_t. η t .
但最終:
W t + 1 W_{t+1} W t + 1
仍必須經:
∑ i w i = 1 \sum_iw_i=1 i ∑ w i = 1
的 Engine constraint。
因此:
Intelligence Layer ≠ Invariant Authority . \boxed{
\text{Intelligence Layer}
\neq
\text{Invariant Authority}.
} Intelligence Layer = Invariant Authority .
這是一個重要工程原則。
如果 LLM 可以直接說:
「這次我覺得不用守恆。」
那 invariant 就不再是 invariant。
因此:
A I P r o p o s a l → B o u n d e d M o d i f i e r → I n v a r i a n t E n g i n e . \boxed{
AI\ Proposal
\rightarrow
Bounded\ Modifier
\rightarrow
Invariant\ Engine.
} A I P r o p os a l → B o u n d e d M o d i f i er → I n v a r ian t E n g in e .
而不是:
A I → U n r e s t r i c t e d C a n o n i c a l S t a t e . AI
\rightarrow
Unrestricted\ Canonical\ State. A I → U n r es t r i c t e d C an o ni c a l S t a t e .
20. Constraint Compatibility Spectrum
實際系統不只存在:
M A T C H MATCH M A T C H
與:
M I S M A T C H . MISMATCH. M I S M A T C H .
更一般地,可以定義:
d ( W ∗ , C ) = inf W ∈ C ∥ W − W ∗ ∥ . d(W^\ast,\mathcal C)
=
\inf_{W\in\mathcal C}
\|W-W^\ast\|. d ( W ∗ , C ) = W ∈ C inf ∥ W − W ∗ ∥.
若:
d = 0 , d=0, d = 0 ,
表示:
W ∗ ∈ C ‾ . W^\ast\in\overline{\mathcal C}. W ∗ ∈ C .
若:
d > 0 , d>0, d > 0 ,
則存在幾何不相容。
所以 constraint compatibility 可以成為連續光譜:
C o m p a t i b i l i t y = f ( d ( W ∗ , C ) , G e o m e t r y ( C ) , L o s s G e o m e t r y ) . \boxed{
Compatibility
=
f
\left(
d(W^\ast,\mathcal C),
Geometry(\mathcal C),
LossGeometry
\right).
} C o m p a t ibi l i t y = f ( d ( W ∗ , C ) , G eo m e t r y ( C ) , L oss G eo m e t r y ) .
這比:
「有守恆 / 沒守恆」
更接近真正學習問題。
21. 多重不變量
實際 Agent / matrix runtime 可能同時要求:
g 1 ( W ) = 0 , g_1(W)=0, g 1 ( W ) = 0 ,
g 2 ( W ) = 0 , g_2(W)=0, g 2 ( W ) = 0 ,
h 1 ( W ) ≤ 0 , h_1(W)\le0, h 1 ( W ) ≤ 0 ,
h 2 ( W ) ≤ 0. h_2(W)\le0. h 2 ( W ) ≤ 0.
因此:
C = ⋂ i C i . \mathcal C
=
\bigcap_i
\mathcal C_i. C = i ⋂ C i .
新風險是:
C = ∅ . \boxed{
\mathcal C=\varnothing.
} C = ∅ .
也就是制度本身 mutually inconsistent。
此時任何 optimizer 都不可能滿足全部約束。
所以正式系統不只要 audit state,
還要 audit:
Constraint Set Consistency . \boxed{
\text{Constraint Set Consistency}.
} Constraint Set Consistency .
22. Dynamic Invariants
某些 invariant 不必固定為:
τ ( W ) = c . \tau(W)=c. τ ( W ) = c .
可能:
τ t ( W ) = c t . \tau_t(W)=c_t. τ t ( W ) = c t .
也可能 constraint family 本身演化:
C t . \mathcal C_t. C t .
則 learning dynamics:
W t + 1 = P C t + 1 ( W t − η t ∇ L t ( W t ) ) . W_{t+1}
=
P_{\mathcal C_{t+1}}
\left(
W_t-\eta_t\nabla L_t(W_t)
\right). W t + 1 = P C t + 1 ( W t − η t ∇ L t ( W t ) ) .
此時需要記錄:
constraint version;
effective time;
migration rule;
old/new feasible-set relation;
whether past states remain legal。
這直接連向後續:
V e r s i o n e d L e d g e r + E x e c u t a b l e I d e n t i t y . \boxed{
Versioned Ledger
+
Executable Identity.
} V er s i o n e d L e d g er + E x ec u t ab l e I d e n t i t y .
23. Constraint 不是只有硬投影
本文目前主要討論 hard constraint:
W ∈ C . W\in\mathcal C. W ∈ C .
但還有 soft constraint:
L ′ ( W ) = L ( W ) + λ R ( W ) . L'(W)
=
L(W)
+
\lambda R(W). L ′ ( W ) = L ( W ) + λ R ( W ) .
以及 penalty / barrier / proximal / mirror-style methods。
因此:
Ledger Constraint \boxed{
\text{Ledger Constraint}
} Ledger Constraint
在更一般框架下不必等於:
Euclidean Hard Projection . \boxed{
\text{Euclidean Hard Projection}.
} Euclidean Hard Projection .
未來可以把 constraint enforcement 分類為:
hard projection;
normalization;
penalty;
barrier;
proximal update;
mirror / Bregman update;
symbolic legality guard;
hybrid human approval。
24. Constraint Certificate
如果系統宣稱某一步合法,不應只輸出:
PASS
而可以輸出:
C t = ( c o n s t r a i n t _ i d , v e r s i o n , v a l u e , t a r g e t , r e s i d u a l , t o l e r a n c e , s t a t u s ) . C_t
=
(
constraint\_id,
version,
value,
target,
residual,
tolerance,
status
). C t = ( co n s t r ain t _ i d , v er s i o n , v a l u e , t a r g e t , r es i d u a l , t o l er an ce , s t a t u s ) .
例如:
constraint_id: A2-sum
version: 1.0
value: 1.0000000000
target: 1.0
residual: 2.1e-14
tolerance: 1.0e-10
status: PASS
此時:
Constraint + Certificate \boxed{
\text{Constraint}
+
\text{Certificate}
} Constraint + Certificate
才真正適合進入 MLF / MMLC / Agent runtime。
25. Structural Residual Certificate
對 mismatch,除了:
loss = 0.000172
更應保存:
R s t r u c t = ( Δ , A , L min , L o b s e r v e d ) . R_{\mathrm{struct}}
=
(
\Delta,
A,
L_{\min},
L_{\mathrm{observed}}
). R struct = ( Δ , A , L m i n , L observed ) .
若:
L o b s e r v e d ≈ L min , L_{\mathrm{observed}}
\approx
L_{\min}, L observed ≈ L m i n ,
表示:
optimizer 已接近 constrained optimum,剩餘誤差主要是結構不相容,而非訓練不足。
這對自動研究 Agent 非常重要。
否則 Agent 可能看到 loss 不再下降,就錯誤地:
改 optimizer;
加 steps;
加 learning rate;
換模型;
卻永遠無法消除:
C o n s t r a i n t − I n d u c e d F l o o r . \boxed{
Constraint-Induced Floor.
} C o n s t r ain t − I n d u ce d F l oor .
26. 一個更一般的研究判斷器
給定:
L , C , W ∗ 或 benchmark target , L,
\quad
\mathcal C,
\quad
W^\ast\text{ 或 benchmark target}, L , C , W ∗ 或 benchmark target ,
可以建立:
1. unconstrained solve
2. constrained solve
3. compare optimum gap
4. estimate structural floor
5. verify optimizer gap
6. classify failure
形式上:
G a p t o t a l = L ( W t ) − L ∗ . Gap_{\mathrm{total}}
=
L(W_t)-L^\ast. G a p total = L ( W t ) − L ∗ .
拆成:
G a p t o t a l = L ( W t ) − L C ∗ ⏟ O p t i m i z a t i o n G a p + L C ∗ − L ∗ ⏟ S t r u c t u r a l G a p . Gap_{\mathrm{total}}
=
\underbrace{
L(W_t)-L^\ast_{\mathcal C}
}_{OptimizationGap}
+
\underbrace{
L^\ast_{\mathcal C}-L^\ast
}_{StructuralGap}. G a p total = O pt imi z a t i o n G a p L ( W t ) − L C ∗ + S t r u c t u r a l G a p L C ∗ − L ∗ .
即:
T o t a l G a p = O p t i m i z a t i o n G a p + S t r u c t u r a l G a p . \boxed{
TotalGap
=
OptimizationGap
+
StructuralGap.
} T o t a l G a p = O pt imi z a t i o n G a p + S t r u c t u r a l G a p .
這是本文最值得帶到其他 AI 研究領域的形式。
27. 與「思維鋼印」問題的形式對應
若一個系統永遠被限制在:
C , \mathcal C, C ,
而真實解在:
W ∗ ∉ C , W^\ast\notin\mathcal C, W ∗ ∈ / C ,
那麼不論它在:
C \mathcal C C
內多聰明、多有效率,都只能逼近:
P C ( W ∗ ) P_{\mathcal C}(W^\ast) P C ( W ∗ )
或某個 constrained optimum。
因此在抽象層:
錯誤的先驗合法域 \boxed{
\text{錯誤的先驗合法域}
} 錯誤的先驗合法域
會產生:
不可消除的認知殘差 . \boxed{
\text{不可消除的認知殘差}.
} 不可消除的認知殘差 .
這裡「鋼印」不再只是比喻。
它對應:
Hypothesis / State Space Exclusion . \boxed{
\text{Hypothesis / State Space Exclusion}.
} Hypothesis / State Space Exclusion .
但本文也強調:
不是所有限制都是鋼印。
若 constraint 正確:
W ∗ ∈ C , W^\ast\in\mathcal C, W ∗ ∈ C ,
它反而可能幫助:
安全;
穩定;
audit;
search-space reduction;
physical legality;
domain consistency。
28. 可證偽條件
F1 — Match Constraint Still Causes Irreducible Gap
若:
W ∗ ∈ C , W^\ast\in\mathcal C, W ∗ ∈ C ,
但在排除 optimizer failure 後仍存在理論上無法消失的正 gap,
則本文「compatibility」分析不足。
F2 — Mismatch Reaches Zero Loss
若:
W ∗ ∉ C W^\ast\notin\mathcal C W ∗ ∈ / C
且 objective 唯一識別 W ∗ W^\ast W ∗ ,
卻仍能達到:
L = 0 , L=0, L = 0 ,
則 constraint / task assumptions 至少一項被錯誤描述。
F3 — Projection Does Not Preserve Invariant
若:
P C ( W ) ∉ C , P_{\mathcal C}(W)\notin\mathcal C, P C ( W ) ∈ / C ,
則 projection implementation 失敗。
F4 — Structural Floor Misclassified as Optimization Failure
若 Agent 不斷增加訓練資源,卻沒有檢查:
L C ∗ − L ∗ , L^\ast_{\mathcal C}-L^\ast, L C ∗ − L ∗ ,
則系統缺乏 structural diagnosis。
F5 — Constraint Set Is Empty
若:
⋂ i C i = ∅ , \bigcap_i\mathcal C_i=\varnothing, i ⋂ C i = ∅ ,
但 runtime 仍宣稱全 constraint 可同時滿足,
則 governance layer 本身不一致。
29. 與本系列其他節點的關係
29.1 與 Open Model State
第 01 篇回答:
模型狀態能否外部化? \text{模型狀態能否外部化?} 模型狀態能否外部化?
本文回答:
模型狀態外部化後,合法更新域能否也被顯式化? \text{模型狀態外部化後,合法更新域能否也被顯式化?} 模型狀態外部化後,合法更新域能否也被顯式化?
因此:
O p e n S t a t e + E x p l i c i t C o n s t r a i n t . \boxed{
OpenState
+
ExplicitConstraint.
} O p e n S t a t e + E x pl i c i tC o n s t r ain t .
29.2 與 Spreadsheet Runtime
下一篇將研究:
如何把 state、formula、constraint、audit 放進同一可視工作簿。 \boxed{
\text{如何把 state、formula、constraint、audit 放進同一可視工作簿。}
} 如何把 state 、 formula 、 constraint 、 audit 放進同一可視工作簿。
29.3 與 MMLC / MLF
本文的:
C o n s t r a i n t C e r t i f i c a t e ConstraintCertificate C o n s t r ain tC er t i f i c a t e
與:
S t r u c t u r a l R e s i d u a l C e r t i f i c a t e StructuralResidualCertificate S t r u c t u r a l R es i d u a l C er t i f i c a t e
可以自然成為:
transaction audit;
provenance event;
validation record;
model projection metadata。
29.4 與 Agent Governance
本文提供一個簡單但關鍵的安全分離:
A I p r o p o s e s ; E n g i n e c o n s t r a i n s ; A u d i t v e r i f i e s . \boxed{
AI\ proposes;
Engine\ constrains;
Audit\ verifies.
} A I p r o p oses ; E n g in e co n s t r ain s ; A u d i t v er i f i es .
這比:
A I d e c i d e s e v e r y t h i n g AI\ decides\ everything A I d ec i d es e v er y t hin g
更適合長時間自治系統。
30. 結論
ledger_experiment.py 最早問的是:
守恆是否會妨礙計算?
重新執行與解析後,答案已經可以寫得非常精確。
對原始實驗:
正確 trace invariant 沒有提高最終 optimum loss。 \boxed{
\text{正確 trace invariant 沒有提高最終 optimum loss。}
} 正確 trace invariant 沒有提高最終 optimum loss 。
而錯誤 trace invariant:
Tr ( W ) = Tr ( W ∗ ) + 3 \operatorname{Tr}(W)
=
\operatorname{Tr}(W^\ast)+3 Tr ( W ) = Tr ( W ∗ ) + 3
創造的最小 loss 為:
L min = 9 2 ( 400 ) ( 8 ) Tr ( ( X ⊤ X ) − 1 ) ≈ 0.000172209714. \boxed{
L_{\min}
=
\frac{9}
{2(400)(8)\operatorname{Tr}((X^\top X)^{-1})}
\approx
0.000172209714.
} L m i n = 2 ( 400 ) ( 8 ) Tr (( X ⊤ X ) − 1 ) 9 ≈ 0.000172209714.
實際 gradient training 收斂到:
L f i n a l ≈ 0.000172. \boxed{
L_{\mathrm{final}}
\approx0.000172.
} L final ≈ 0.000172.
這表示:
Residual ≠ Optimization Failure . \boxed{
\text{Residual}
\neq
\text{Optimization Failure}.
} Residual = Optimization Failure .
而是:
Residual = Constraint–Target Incompatibility Certificate . \boxed{
\text{Residual}
=
\text{Constraint–Target Incompatibility Certificate}.
} Residual = Constraint–Target Incompatibility Certificate .
所以本文最終提出:
學習可以被理解為合法狀態空間中的流; 不變量定義可行域; 投影維持合法性; 而不可消除殘差揭露制度與目標之間的結構衝突。 \boxed{
\textbf{
學習可以被理解為合法狀態空間中的流;
不變量定義可行域;
投影維持合法性;
而不可消除殘差揭露制度與目標之間的結構衝突。
}
} 學習可以被理解為合法狀態空間中的流; 不變量定義可行域; 投影維持合法性; 而不可消除殘差揭露制度與目標之間的結構衝突。
這就是「學習作為帳本流」的最低數學骨架。
31. 下一篇
EML-MNIAC-2026-03
《試算表作為可見計算環境:狀態、公式、依賴、記憶與稽核》
下一篇將正式把:
O p e n S t a t e + C o n s t r a i n t + F o r m u l a + D e p e n d e n c y + H i s t o r y OpenState
+
Constraint
+
Formula
+
Dependency
+
History O p e n S t a t e + C o n s t r ain t + F or m u l a + D e p e n d e n cy + H i s t or y
放回 Excel / Spreadsheet runtime 中,處理:
EML-LQ;
Spreadsheet Ledger;
workbook state machine;
Excel-native computation;
log-coordinate runtime;
control / execution plane separation 的起點。
參考資料
內部原型
EveMissLab, ledger_experiment.py — empirical test of Ledger Axiom A2 on a learnable linear system.
EveMissLab, build_xlsx.py — Adaptive Ledger Quant Meta-Framework / EML-LQ-2026.
EveMissLab, 《自適應帳本量化代理框架技術規格》。
EML-MNIAC-2026-00, 《矩陣原生智能與可稽核計算》。
EML-MNIAC-2026-01, 《模型可以住在表格裡嗎?CSV-Native Transformer 與可檢查模型狀態》。
外部方法論近鄰
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
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
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
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 —《試算表作為可見計算環境:狀態、公式、依賴、記憶與稽核》