空間域證明包圍論 IV
Proof Trace Compilation 與 Verification Amortization
Spatial-Domain Proof Enclosure IV: Proof Trace Compilation, Closure Bases, and Verification Amortization
Version: v0.1
Date: 2026-08-14
Status: formal research framework / theorem-style reduction; not a claim that proof search generically becomes easier
Canonical source: UTF-8 Markdown; canonical mathematics uses $...$ and $$...$$ only.
摘要
前三篇空間域證明包圍論建立了三個 closure 前提:Paper 01 要求 survivor envelope 永遠保留所有真實反例;Paper 02 要求 representation 不得壓掉 proof-relevant counterexample fibers;Paper 03 要求 local routes 必須有 global cover certificate,必要時再加 structural gluing certificate。至此,一個全域閉合證明可以被描述為一組有 scope、dependency、version 與 replay semantics 的正式證書。
本文處理下一個問題:
當長時間研究已經累積大量 theorem cuts、route certificates、local refutations、coverage certificates 與 gluing artifacts,哪些歷史可以被安全地編譯成後續研究可直接使用的 pruning state,而不必每輪重新支付完整 discovery 與 verification 成本?
本文首先把 proof history 定義為一個 versioned dependency DAG。每個 certificate node 均攜帶 statement、scope、dependencies、representation version、checker、payload 與可排除區域。只有 local checker 通過、所有 dependencies 仍 active、scope 與 representation fingerprint 未失效的節點,才能進入 active proof state。
對一個 closure target ,本文定義其 dependency closure basis:
在 checker compositionality 與 dependency completeness 成立時,重播 足以重建 的有效性;所有不在 target ancestor closure 中的 discovery history 對該 target 的 replay 可以安全歸檔。這不保證 是最小 basis,但建立了第一個可機械抽取的 sound closure basis。
接著本文把已驗證 exclusion certificates 編譯成 Compiled Pruning State。對 route state ,令
為 active exclusion support multiplicity。若
則至少存在一張 active sound certificate 排除 ,因此 可以不重新進入 theorem discovery。若 dependency 失效,本文證明 support-aware rollback theorem:只需要 reopen 那些所有 exclusion supports 都同時失效的點,而不是把整個歷史研究清空。
本文再證明 incremental replay equivalence theorem。若每個 checker 僅依賴其明示父節點、checker 決定性成立且 dependency DAG 完整,則某些 nodes 改變後,只重播其 descendant dirty closure,所得結果與完整從頭 replay 等價。這將「留下痕跡」提升成一個可操作的增量驗證原則。
為避免把快取誤當證明,本文嚴格區分:
Lean proof-state snapshot 可以避免重建 elaborated proof context;proof patterns、verified lemmas 與 closure certificates 則可以承擔邏輯有效性。前者是 operational accelerator,後者才是 proof artifact。
本文最後建立完整攤銷成本模型。若未編譯時每個任務平均成本為 ,compiled hit 成本為 ,hit rate 為 ,一次性建造/basis verification 成本為 ,每任務維護成本為 ,則
與未編譯成本
相比,定義
若
則 break-even condition 為
因此「越來越快」不是免費定理,而是一個可驗證的 amortization condition。本文不提前宣稱 Discovery–Verification Inversion 必然發生;該 phase transition 留給 Paper 05。Paper 04 僅建立使其可以被嚴格測量的 compiled-state、rollback、incremental replay 與成本地基。
關鍵詞
空間域證明包圍;proof trace compilation;closure basis;verification amortization;proof reuse;proof-state snapshot;incremental replay;dependency DAG;stale propagation;rollback;compiled pruning;proof certificate;AI theorem proving
1. 前三篇留下的正式狀態
設原始命題為
真實反例集合為
Paper 01 建立 sound survivor invariant:
每一個 theorem cut 只能在保留所有真反例的前提下更新:
Paper 02 建立 route-domain faithfulness。對
表示壓縮不能靜默丟失 proof-relevant fibers;若表示不 exact,mixed fibers 必須保留、refine 或 whole-fiber certify。
Paper 03 進一步建立 Global Closure Certificate:
因此當前問題不再只是「有沒有很多 theorem」,而是:
2. Fresh literature grounding
2.1 Proof-state snapshotting
Shen 與 Shi 在 2026 年的 Lean 4 工作指出,平行 tactic search 中大量成本可來自每個 branch 重建已經 elaborated 的 proof state。其 snapshotting 方法直接重用 server 中現存的 elaborated state,在其 48 個 miniF2F-v2 benchmark 上報告 5.6--50 倍 wall-time speedup,平均約 14 倍。
本文只取一個原則:
但 snapshot 不等於 theorem certificate。
2.2 Recycling algebraic proof certificates
Kaufmann 與 Hofstadler 在 2025 年提出可重用 algebraic proof patterns。經過一次 PatternNew 驗證後,PatternApply 可在符合 interface 與 substitution constraints 時重新 instantiate 已驗證 proof fragment;其實驗顯示 proof steps、file size、memory 與 checking time 均可下降。
這是本文 certificate compilation 的直接外部類比:
2.3 Proof accumulation and reusable theorem libraries
CircuitProver 在 2026 年把 proving traces 與 verified theorems 蒸餾成可重用 Lean library;63 個 hardware tasks 的實驗中,其 accumulated proof knowledge 在 ablation 中降低 proof length 16.3% 並降低 verification time 23.2%。Rtl2lean 亦建立 hierarchical theorem library,報告 358 個 foundational lemmas 中有 287 個可自動 reuse,reusable lemma ratio 為 80.2%。
這些工作證明「verified knowledge reuse」不是純哲學假設,但其領域是 hardware theorem proving;本文不把這些實驗數字外推成一般數學定律。
2.4 Lifelong theorem proving and scalable verification
LeanAgent 使用 dynamic database 處理持續擴張的 formal knowledge,並研究 stability / backward transfer。AXLE 則顯示大規模 AI theorem proving 需要 strict verification、metadata extraction、multi-version support 與 per-request isolation,而不只是能 compile 一份 Lean 檔案。
這些工作支持本文的一項設計要求:
3. Verified Proof History
Definition 3.1 — Proof History DAG
定義時刻 的 proof history 為有限 DAG:
每個 node 是一個 certificate record:
其中 可為空;只有 exclusion certificates 才需要具體排除區域。
Edge
表示 的 validity 顯式依賴 。
Definition 3.2 — Dependency Completeness
若所有能影響 correctness 的 formal assumptions、representation versions、theorems、coverage objects 與 gluing objects,都透過 或其 fingerprint 顯式記錄,則稱 dependency metadata complete。
這是一項系統義務,不是自動成立的數學真理。
4. Active validity 與 stale state
Definition 4.1 — Locally Valid Node
node 在時刻 locally valid,若:
- ;
- 與當前 problem scope 相容;
- representation contract 仍有效;
- / 與 active environment 相容。
Definition 4.2 — Active Node
遞迴定義: active,若 locally valid,且
active nodes 集合記為
其 complement 中由 dependency 失效造成者稱 stale nodes。
Proposition 4.3 — Descendant Staleness
若 node 失效,而所有 descendant certificates 的 validity 均要求其顯式 dependencies active,則每個依賴 的 descendant 都必須標記為 stale,直到它被重新驗證或改寫 dependency。
Proof
沿 DAG 的 topological order 歸納即可。若 直接依賴 stale node,則 active condition 失敗;再逐層傳播到 descendants。
5. Closure Basis
長時間 discovery history 不等於 final replay 必須重播所有歷史節點。
Definition 5.1 — Target Certificate
令
為我們想重播的 target,例如:
- 某個 local exclusion theorem;
- 某個 cover certificate;
- 某個 boundary certificate;
- 最終 。
Definition 5.2 — Canonical Dependency Closure Basis
令
為 DAG 中所有可到達 的 ancestors。定義:
Theorem 5.3 — Ancestor Closure Sufficiency
假設:
- checker semantics compositional;
- dependency metadata complete;
- 每個 node checker 只讀自身 payload、active environment fingerprint 與直接 parents 的 verified outputs。
則重播
足以得到和完整 history replay 相同的 validity 結果。
Proof
對 的 topological ordering 作歸納。base nodes 不需要外部 history nodes。若所有 parents 已得到與 full replay 相同的 verified outputs,則 compositional deterministic checker 對當前 node 也產生相同結果。由於任何能影響 的 dependency 都在 ancestor closure 內,最終 結果相同。
Remark 5.4 — Basis 不等於 minimum basis
是一個可機械抽取的 sound basis,但不保證 cardinality 或 replay cost 最小。若存在 alternative certificates、redundant cover charts、multiple independent support paths,還可以進一步壓縮。
因此:
本文只要求前者。
6. Compiled Pruning State
Definition 6.1 — Active Exclusion Certificate
若 active node 證明某個 region 與真實反例集 disjoint:
則稱 為 active exclusion certificate。
Definition 6.2 — Support Index
對 route state ,定義 active supports:
定義 support multiplicity:
Definition 6.3 — Compiled Pruning State
定義:
其中 是從 route region / features 到 active exclusion supports 的索引。
Theorem 6.4 — Safe Compiled Pruning
若
且 support index 完整、所有 indexed supports active 且 sound,則
因此 search system 可安全跳過重新 discovery 該 candidate。
Proof
存在 ,故 。由 soundness, 。因此 。
這是 proof trace compilation 最直接的「快速通道」。
7. Support-Aware Rollback
最粗暴的 rollback 是任一 dependency 改變就清空全部 compiled state。這通常沒有必要。
令一組 certificates 由於 version change、scope change 或 dependency failure 被 invalidate。其 staleness descendant closure 記為
令 invalidation 前後 support multiplicity 分別為
Definition 7.1 — Reopen Region
定義:
Theorem 7.2 — Support-Aware Rollback Theorem
在 support index 完整且所有 remaining active supports sound 的前提下,invalidation 後:
- 必須 reopen 或重新 certify;
- 若 ,則 仍可保持 pruned;
- 不需要因一張 certificate 失效而 reopen 所有曾被它覆蓋的 states。
Proof
若 ,仍存在 active sound exclusion certificate 排除 ,由 Theorem 6.4 可繼續 prune。只有當所有 supports 均失效時,舊的 compiled exclusion 不再有 active witness,因此必須重新進入 survivor / verification pipeline。
這使 rollback 從:
轉成:
8. Incremental Replay
Definition 8.1 — Dirty Closure
若 change set 為
定義 dirty closure:
Theorem 8.2 — Incremental Replay Equivalence
假設:
- dependency DAG complete;
- 每個 node checker deterministic;
- checker 只依賴 node payload、declared environment fingerprint 與 direct parent verified outputs;
- 之外的 node payload / environment fingerprint 未改變。
則只重新 replay ,並重用其他 active node 的 verified outputs,得到的整體 active/stale assignment 與 full replay 相同。
Proof
在 topological order 中考慮所有 nodes。不在 的 node 既不是 changed node,也不存在從 到它的 dependency path,因此其 payload、fingerprint 與所有 ancestor verified outputs 均未改變,可安全保留。對 nodes 依 topological order 重新計算;每一步 parents 都已經是正確的新值。因此結果與 full replay 完全一致。
Corollary 8.3 — Incremental GCC Replay
若 不在 ,則其 validity 不受此次 change 影響。
若 ,只需重播其 dirty ancestor support,而不是整份 discovery history。
9. Proof Pattern Compilation
proof reuse 不一定只是重用完整 theorem。某些歷史 proof fragment 可以被抽象成 pattern。
Definition 9.1 — Verified Proof Pattern
定義:
其中:
- :formal inputs;
- :admissible instantiation constraints;
- :formal outputs;
- :一次性驗證過的 proof fragment;
- :每次 reuse 的 instantiation checker。
pattern certification 證明:
Theorem 9.2 — Sound Pattern Reuse
若 pattern certificate active,且新的 instantiation 通過 並滿足 ,則可以直接 commit ,不需要重新 discovery 的內部推導。
這只是 universal instantiation,但它正式區分:
與
後者沒有 soundness 保證。
10. Search-State Compilation 不等於 Proof-Certificate Compilation
本文把 reuse 分成兩層。
10.1 Search-State Compilation
例如:
- elaborated Lean proof state snapshot;
- tactic branch state;
- retrieval index;
- theorem embeddings;
- cached route features;
- heuristic branch scores。
這些可以大幅降低 discovery overhead。
但一般不直接證明:
10.2 Proof-Certificate Compilation
包括:
- kernel-checked theorem;
- independently replayable proof certificate;
- verified proof pattern;
- active exclusion certificate;
- cover certificate;
- boundary / gluing certificate;
- dependency-closed GCC basis。
它們能承擔 logical validity。
因此:
以及:
除非 retrieval result 再連到 active proof certificate。
11. Known / Unknown Gate
先前「已知則編譯,未知則展開」在 SDPE 中可精確改寫。
Definition 11.1 — Compiled Mode
candidate 可進入 Compiled Mode,若:
- route representation certificate active;
- 不屬於 unresolved singular fiber;
- ,或存在其它 active certified route decision;
- relevant boundary / version / dependency gaps 為空。
Definition 11.2 — Exploration Mode
若 candidate 落入:
或其所有 supports stale,則必須回到 Exploration / Verification Mode。
因此:
這不是 AI confidence threshold,而是 certificate-state transition。
12. Verification Amortization
現在正式把「後面可能越來越快」拆成可計算條件。
令未使用 compiled state 時,每一個相關任務平均成本為
其中 是 discovery / reconstruction cost, 是 verification cost。
compiled system 有:
- 一次性 build + basis verification cost ;
- cache / certificate hit rate ;
- hit 時 lookup + replay / instantiation cost ;
- miss 時仍支付 ;
- 每任務平均 maintenance cost 。
則 個任務的 compiled total cost:
baseline:
Theorem 12.1 — Amortization Break-Even
定義每任務淨收益:
若
則在此成本模型下,增加任務數不能攤銷一次性 build cost。
若
則 compiled system 比 baseline 便宜當且僅當:
Proof
因此差值為正恰當且僅當 。
Corollary 12.2 — Asymptotic Average Cost
若 固定,則:
因此一次性建造成本可以被攤薄,但 maintenance 與 per-hit replay 不會因 自動消失。
13. Pattern Verification Amortization
若某個 proof pattern 一次驗證成本為
每次合法 instantiation 檢查成本為
重用 次總 verification cost:
因此平均:
故:
這是最簡單的 certificate amortization theorem。
但如果每次 instantiation 的 environment / scope 都不同到需要完整重驗,則 可以接近 ,此時 reuse 幾乎沒有收益。
14. Closure-Basis Compression Ratio
令完整 discovery history node 數為
target dependency basis 大小為
定義 structural compression ratio:
若
表示大量 discovery history 對 target replay 已非必要。
但 cardinality ratio 不等於 cost ratio。每個 node replay 成本可以差很多,因此更合理的 weighted ratio 為:
其中 可以是 verification time、memory、certificate size 或 trust cost。
15. Incremental Global Closure Certificate
Paper 03 的 本身也應視為 dependency DAG 的 terminal node,而不是一份靜態 PDF。
定義:
為 global closure target。
其 dependency closure basis 至少包含:
- master survivor certificate;
- active RouteCerts;
- cover certificate;
- local refutation certificates;
- boundary certificates;
- required lift certificates;
- constructive mode 下的 gluing certificate;
- dependency/version fingerprints。
若某一 local theorem 改版,只需:
因此 不應是永久布林旗標,而是:
16. Compiled State 與 discovery acceleration 的嚴格邊界
Paper 04 能證明的不是:
本文只證明幾種更窄的 reduction:
- reconstruction avoidance:若 proof state / certificate state 已保存,就不必從頭重建;
- safe pruning:若 candidate 已被 active certificate 排除,就不必重新 discovery;
- basis replay:target 只需重播其 dependency basis;
- incremental replay:change 只需重播 dirty descendants;
- pattern reuse:已驗證 schema 可用便宜 instantiation checker 重用;
- amortization:若 且 reuse 次數超過 break-even,平均成本下降。
真正的:
與
是否出現 phase transition,留到 Paper 05 實驗與形式化。
17. No-Go Ledger
No-Go 17.1 — Cache Equals Proof
cached search state、embedding、retrieval hit、tactic snapshot 都不是 proof certificate。
No-Go 17.2 — Old Certificate Remains Valid Forever
任何 dependency、scope、representation、kernel / checker version 改變都可能使 certificate stale。
No-Go 17.3 — One Stale Certificate Requires Full Reset
若同一 region 仍有其它 active supports,不必 reopen。
No-Go 17.4 — Discovery History Equals Closure Basis
大量歷史探索可能對 final target replay 完全不再需要。
No-Go 17.5 — Closure Basis Automatically Minimal
canonical ancestor basis 只保證 sound,不保證 minimum cost。
No-Go 17.6 — Compiled Mode May Absorb Unknown Regions
未覆蓋 gap、boundary、mixed fiber、stale region 必須保留 Exploration Mode。
No-Go 17.7 — Verification Can Be Skipped After Compilation
編譯只能把 full replay 改成 basis replay / instantiation replay / incremental replay;不能把 logical verification 變成零。
No-Go 17.8 — Hidden Build Cost Can Be Ignored
若只計算 online lookup 而忽略 build、basis verification、maintenance 與 rollback,會製造假的 speedup。
No-Go 17.9 — High Hit Rate Guarantees Speedup
若 maintenance 很高或 ,即使 很高也可能有
No-Go 17.10 — Average Amortization Controls Worst-Case
平均成本下降不保證 frontier theorem 的 worst-case discovery 成本下降。
18. Paper 04 Runtime Contract
Paper 04 對未來 SDPE Runtime 新增以下最低組件:
抽取 target closure basis;
維護 candidate-to-certificate support;
計算 stale descendant closure;
只 reopen support 歸零的 regions;
重播 dirty closure;
保存可實例化 verified proof patterns;
記錄 build、discovery、verification、coverage、glue、maintenance、rollback 與 reuse costs。
完整 pipeline 更新成:
任何 dependency change 則走:
19. 與記憶編譯型計算存在論的接軌
先前「記憶編譯型狀態智能體」提出:昂貴的搜尋、推理、驗證與試錯可以被編譯成可重用的狀態分類、索引、策略與驗證結構;「已知則編譯,未知則展開」則要求未知或漂移狀態退出快速通道。
SDPE Paper 04 將此概念限制成 proof-safe 版本:
只允許 active certificate 支持的區域進入 Compiled Mode。
同樣,先前「快速究竟有多快」要求完整成本帳本,而非只計 online latency。本文的 模型正是 proof-space 的第一個簡化版本。
20. 與解空間幾何的接軌
proof trace compilation 可以被看成對 proof-state / survivor-space geometry 的改寫。
歷史 theorem cuts 不是單純增加文本,而是在建立:
- forbidden regions;
- certified bridges;
- equivalent subproblems;
- terminal closure states;
- reusable patterns;
- low-cost verification channels。
因此有效 proof distance 可能下降。
但 Paper 04 不把這種幾何直覺直接等同於 complexity theorem。只有經過成本 ledger 的 amortization condition 才能稱為實際 speedup。
21. Theorem / Hypothesis / External Input Ledger
21.1 Internal theorems / propositions
- Descendant Staleness;
- Ancestor Closure Sufficiency;
- Safe Compiled Pruning;
- Support-Aware Rollback;
- Incremental Replay Equivalence;
- Sound Pattern Reuse;
- Amortization Break-Even;
- Asymptotic Average Cost;
- Pattern Verification Amortization。
21.2 System assumptions
- dependency metadata complete;
- checker compositionality;
- deterministic replay;
- version / scope fingerprint completeness;
- support index completeness。
這些是 runtime correctness obligations,不可偷偷當成 theorem。
21.3 External technical grounding
- Lean proof-state snapshotting;
- reusable algebraic proof certificates;
- reusable Lean theorem libraries;
- lifelong formal theorem proving;
- scalable strict multi-version proof verification infrastructure。
21.4 Open hypotheses
Paper 04 不證:
它只建立 Paper 05 可以測量此現象所需的 formal state 與 cost primitives。
22. Checker Scope
companion checker 驗證 finite toy models 中:
- dependency ancestor basis replay;
- descendant staleness;
- sound compiled pruning;
- support-aware rollback;
- incremental replay equivalence;
- redundant-history basis compression;
- known / unknown gate;
- amortization break-even algebra;
- pattern verification amortization。
checker 不證一般 theorem proving complexity、AI research acceleration、formalization correctness of arbitrary mathematics,亦不宣稱 discovery cost 必然遞減。
23. Paper 05 的輸入
Paper 04 現在提供可以被觀測的時間序列:
因此下一篇可以真正研究:
核心問題不再只是直覺上的「越證越快」,而是:
同時:
24. Final Status
Paper 01 回答:
Paper 02 回答:
Paper 03 回答:
Paper 04 現在回答:
整個 closure stack 因此成為:
至此,「把痕跡留下來」已不只是 provenance 原則,而被提升成一個正式的計算命題:
則它可以被編譯成 sound pruning 與 incremental verification infrastructure,而不是每輪重新展開整個 proof history。
References
- Austin Shen and Yunong Shi, Keep the Proof State Live: Snapshotting for Efficient Tactic Search in Lean 4, arXiv:2605.25556, 2026.
- Daniela Kaufmann and Clemens Hofstadler, Recycling Algebraic Proof Certificates, arXiv:2507.20267, 2025.
- Ziyi Yang, Wenji Fang, Chen Chen, Zhiyao Xie, Hongce Zhang, CircuitProver: Agentic Lean 4 Theorem Proving with Reusable Circuit Proof Library for Hardware Verification, arXiv:2607.27259, 2026.
- Hongqin Lyu, Junxing Dong, Yonghao Wang, Zhiteng Chao, Tiancheng Wang, Huawei Li, Rtl2lean: Automated RTL-to-Lean Translation with Hierarchical Theorem Generation and Lemma Reuse, arXiv:2607.16855, 2026.
- Adarsh Kumarappan et al., LeanAgent: Lifelong Learning for Formal Theorem Proving, arXiv:2410.06209, 2024.
- Jimmy Xin et al., AXLE: A Cloud Infrastructure for Lean 4 Theorem Proving Utilities, arXiv:2606.26442, 2026.
- Prior SDPE artifact: Paper 01 — Global Quantifiers, Counterexample Domains, and Verifiable Contraction.
- Prior SDPE artifact: Paper 02 — Route-Domain Completeness and Representation Non-Collapse.
- Prior SDPE artifact: Paper 03 — Multidimensional Coverage, Gaps, and Global Closure Certificates.
- Prior internal series artifact: 記憶編譯型計算存在論.
- Prior internal series artifact: 解空間幾何計算論:從 P/NP 二分到概念積分快速通道.