← Archive
lm-004721 · 2026-10

可執行語義圖:脫離原始碼後的程式重建與再執行

下載 MD 檔 ⬇

可執行語義圖:脫離原始碼後的程式重建與再執行

Executable Semantic Graph: Program Reconstruction and Re-Execution Beyond Source Code

系列: 程式底空間與本體反演系列(Program Base Space and Ontology Inversion, PBSOI)
篇次: Paper 05
版本: v0.1
作者: Neo.K
機構: EveMissLab
日期: 2026-09-14
狀態: 執行模型理論初稿/PoC 理論化版本

公司: 一言諾科技有限公司


摘要

前述 PBSOI 系列已依序建立程式底空間、程式碼誘導語義圖、程式本體反演與共通程式底空間。這些工作仍可被理解為分析層:程式碼被轉換成圖,圖被用來理解、比較或驗證程式。然而,若圖只是輔助理解的衍生物,則原始碼仍然保有最終的執行特權。本文進一步提出更強的問題:若一個語義圖已保存足夠的控制、資料、狀態、效果與操作語義,那麼程式是否可以在原始碼被移除後,直接由圖重新執行?

本文提出「可執行語義圖」(Executable Semantic Graph, ESG),將其定義為具備完整或條件完整執行語義的程式圖。本文區分分析圖與執行圖,提出操作節點、控制節點、狀態節點、資料邊、效果邊、入口與出口、執行環境契約、錯誤語義及外部邊界等必要結構,並建立圖執行器:

EG:(G,X,Ω)→Y\mathcal E_G : (G,X,\Omega) \rightarrow Y

其中 GG 為語義圖、 XX 為輸入、 Ω\Omega 為執行環境, YY 為輸出與效果。

本文進一步形式化「source-independent execution」:若原始程式 CLC_L 被反演為圖 GG,且在指定語境 C\mathcal C 下滿足:

∀x∈XC,Exec⁡L(CL,x)≡CEG(G,x)\forall x\in X_{\mathcal C}, \quad \operatorname{Exec}_L(C_L,x) \equiv_{\mathcal C} \mathcal E_G(G,x)

則稱 GG 在 C\mathcal C 下為 CLC_L 的可執行語義重建。此等價不要求圖保存原始變數名稱、原始語法或函式庫拼寫,只要求保留所宣告的語義不變量。

本文同時討論可執行語義圖與 SSA、IR、bytecode、dataflow runtime、workflow graph 的關係,並強調本研究不主張所有程式都應改以圖執行,也不主張任意 CISG 都天然可執行。真正的研究問題是:哪些程式語義是執行所必需、哪些只是表面資訊、哪些可以被正規化、哪些必須保留為語言特定殘差或外部執行契約?

本系列先前的小型 PoC 已在受限 Python 語義子集中完成兩項測試:一個包含算術、局部狀態與條件分支的函式,以及 RepoLumen 的 _transition_id 函式,均可由原始碼自動轉換為語義圖,之後在獨立 runtime 目錄中移除 compiler 與原始函式 source,只載入圖與 generic graph runtime 重新執行;隨機測試分別達到 10000/1000010000/10000 與 1000/10001000/1000 一致。本文將此結果視為「受限語義可脫離原始碼執行」的存在性證據,而非任意程式可完全圖化執行的普遍證明。

本文的核心命題是:

若程式語義可以被完整或條件完整地保存於一個可驗證結構中,那麼原始碼可以從「唯一執行來源」退化為「程式語義結構的一種投影與編輯介面」。


關鍵詞

可執行語義圖、Executable Semantic Graph、ESG、程式底空間、CISG、程式本體反演、Graph Runtime、語義執行、source-independent execution、跨語言執行、語義重建、中介表示


一、問題的提出

1.1 圖如果只能看,仍然不是程式

前述 CISG 可將 repository 轉換為:

GC=(V,E,TV,TE,A,Q,Γ)G_C = (V,E,T_V,T_E,A,Q,\Gamma)

並用於:

  • 程式理解;
  • dependency analysis;
  • change impact;
  • anomaly detection;
  • function motif;
  • architecture comparison。

但若執行時仍必須回到:

CLC_L

則圖的地位仍然是:

Derived View\text{Derived View}

而非:

Executable Representation\text{Executable Representation}

因此一個更強的問題自然出現:

Graph 能否不依賴原始碼直接執行?\boxed{ \text{Graph 能否不依賴原始碼直接執行?} }

1.2 這個問題其實不是「圖能不能執行」

現有世界早已有:

  • dataflow graph;
  • computation graph;
  • workflow graph;
  • bytecode graph;
  • automata;
  • state machine;
  • Petri net;
  • TensorFlow graph;
  • compiler IR。

所以「圖可以執行」本身毫不新奇。

本文真正研究的是:

由既存程式碼反演出的語義圖,能否在去除原始碼後仍保持足夠語義,使其成為同一程式的另一個可執行投影?

也就是:

CL→ρLG→EGYC_L \xrightarrow{\rho_L} G \xrightarrow{\mathcal E_G} Y

而中間可以:

CL\cancel{C_L}

二、分析圖與執行圖的區分

2.1 分析圖

一般 CISG 可以只保存:

  • function;
  • call;
  • module;
  • dependency;
  • branch hint;
  • effect hint。

此時:

GanalysisG_{\mathrm{analysis}}

可能足以回答:

哪個函式呼叫哪個函式?

但不足以回答:

給定輸入 xx,實際應算出什麼?


2.2 執行圖

定義可執行語義圖:

GE=(VE,EE,ΣE,ΩE,ΛE,ΓE)G_E = ( V_E, E_E, \Sigma_E, \Omega_E, \Lambda_E, \Gamma_E )

其中:

  • VEV_E:可執行節點;
  • EEE_E:具執行語義的邊;
  • ΣE\Sigma_E:狀態與環境;
  • ΩE\Omega_E:操作集合;
  • ΛE\Lambda_E:控制與排程規則;
  • ΓE\Gamma_E:證據、來源、版本與語義契約。

只有當:

Semantics⁡(GE)\operatorname{Semantics}(G_E)

足以決定執行時,圖才是 ESG。

因此:

CISG⇏ESG\boxed{ \text{CISG} \not\Rightarrow \text{ESG} }

但可以存在轉換:

Lower⁡E:GC→GE\operatorname{Lower}_{E} : G_C \rightarrow G_E

三、可執行語義圖的基本元素

3.1 輸入節點

定義:

VinputV_{\mathrm{input}}

表示外部提供的值。

例如:

v0=Arg⁡(0)v_0=\operatorname{Arg}(0)

3.2 常數節點

vc=Const⁡(c)v_c = \operatorname{Const}(c)

例如:

Const⁡(10)\operatorname{Const}(10)

3.3 操作節點

定義:

o∈ΩEo \in \Omega_E

例如:

ADD⁡\operatorname{ADD} MUL⁡\operatorname{MUL} GT⁡\operatorname{GT} SHA256⁡\operatorname{SHA256} UTF8⁡\operatorname{UTF8}

重要的是:

SHA256⁡\operatorname{SHA256}

不必等同於 Python 的:

hashlib.sha256

或 Rust 的:

Sha256::digest

它是一個正規化操作語義。


3.4 控制節點

例如:

Branch⁡(c,t,f)\operatorname{Branch}(c,t,f)

表示:

c=true⇒tc=\text{true} \Rightarrow t c=false⇒fc=\text{false} \Rightarrow f

也可以有:

Loop⁡\operatorname{Loop} Switch⁡\operatorname{Switch} Try⁡\operatorname{Try} Throw⁡\operatorname{Throw} Return⁡\operatorname{Return}

3.5 狀態節點

純函式圖可以只處理:

x→yx\rightarrow y

但現實程式大量依賴狀態:

St→St+1S_t \rightarrow S_{t+1}

因此 ESG 必須能表示:

Read⁡(S,k)\operatorname{Read}(S,k) Write⁡(S,k,v)\operatorname{Write}(S,k,v) Mutate⁡(S,ϕ)\operatorname{Mutate}(S,\phi)

3.6 效果節點

例如:

FileWrite⁡\operatorname{FileWrite} DBQuery⁡\operatorname{DBQuery} NetworkRequest⁡\operatorname{NetworkRequest} SpawnProcess⁡\operatorname{SpawnProcess}

這些操作不能只被當作普通純函式。

因此:

ΩE=Ωpure∪Ωstate∪Ωeffect\Omega_E = \Omega_{\mathrm{pure}} \cup \Omega_{\mathrm{state}} \cup \Omega_{\mathrm{effect}}

四、圖執行器

4.1 基本形式

定義:

EG:(G,X,Σ,Ω)→(Y,Σ′,F)\mathcal E_G : (G,X,\Sigma,\Omega) \rightarrow (Y,\Sigma',F)

其中:

  • GG:可執行語義圖;
  • XX:輸入;
  • Σ\Sigma:初始狀態;
  • Ω\Omega:允許操作與執行環境;
  • YY:輸出;
  • Σ′\Sigma':執行後狀態;
  • FF:外部效果。

因此程式執行不是只有:

x→yx\rightarrow y

更完整是:

(X,Σ)→(Y,Σ′,F)(X,\Sigma) \rightarrow (Y,\Sigma',F)

4.2 純運算模式

對純函式:

EG(G,x)=y\mathcal E_G(G,x) = y

可直接沿 dependency 執行。


4.3 控制流模式

若存在 branch:

b=GT⁡(x,10)b = \operatorname{GT}(x,10)

則:

b→Branch⁡b \rightarrow \operatorname{Branch}

並依條件啟用不同子圖。


4.4 狀態機模式

對 stateful 程式:

(G,Σt)→Σt+1(G,\Sigma_t) \rightarrow \Sigma_{t+1}

執行器必須保存:

  • write order;
  • transaction;
  • rollback;
  • visibility;
  • synchronization。

五、Source-Independent Execution

5.1 定義

給定 source:

CLC_L

反演:

ρL(CL)=G\rho_L(C_L)=G

若存在語境:

C\mathcal C

使:

∀x∈XC,Exec⁡L(CL,x)≡CEG(G,x)\forall x\in X_{\mathcal C}, \quad \operatorname{Exec}_L(C_L,x) \equiv_{\mathcal C} \mathcal E_G(G,x)

則稱:

GG

是 CLC_L 在 C\mathcal C 下的可執行語義重建。


5.2 原始碼移除條件

真正的 source-independent experiment 應要求:

  1. 圖已生成;
  2. compiler / parser 不參與 runtime;
  3. 原始函式 source 不存在於 runtime package;
  4. runtime 只讀取 canonical graph;
  5. 輸出與指定語義一致。

因此:

CL→G→CL→EG(G)C_L \rightarrow G \rightarrow \cancel{C_L} \rightarrow \mathcal E_G(G)

才是真正有意義的測試。


六、語義等價不是字串等價

6.1 不需要保存原變數名稱

例如:

base

可以消失。

圖只需要保存:

v7v_7

以及:

v7=ADD⁡(MUL⁡(v0,3),v1)v_7 = \operatorname{ADD} ( \operatorname{MUL}(v_0,3), v_1 )

只要 variable name 不影響語義:

Name Preservation\text{Name Preservation}

不是必要條件。


6.2 不需要保存原 library spelling

例如:

hashlib.sha256

可正規化為:

SHA256⁡\operatorname{SHA256}

因此:

Surface API Identity≠Semantic Operation Identity\text{Surface API Identity} \neq \text{Semantic Operation Identity}

6.3 必須保存不可忽略語義

例如:

  • overflow;
  • integer width;
  • evaluation order;
  • error behavior;
  • ownership;
  • effects。

若這些會影響所宣告的等價語境,就不能消失。


七、第一輪 PoC

7.1 Arithmetic + Branch

第一個實驗包含:

  • 兩個輸入;
  • local intermediate;
  • multiplication;
  • addition;
  • comparison;
  • conditional branch;
  • two returns。

source 被轉成語義圖後,graph runtime 直接執行。

隨機測試:

10000/1000010000/10000

與原函式一致。


7.2 RepoLumen _transition_id

第二個實驗採用 RepoLumen 真實函式:

_transition_id(from_snapshot_id, to_snapshot_id)

其行為被反演為:

ARG⁡0→STR⁡\operatorname{ARG}_0 \rightarrow \operatorname{STR} ARG⁡1→STR⁡\operatorname{ARG}_1 \rightarrow \operatorname{STR} (ARG⁡0,"\0",ARG⁡1)→CONCAT⁡(\operatorname{ARG}_0,"\backslash0",\operatorname{ARG}_1) \rightarrow \operatorname{CONCAT}

再:

UTF8⁡→SHA256⁡→HEX⁡→SLICE⁡0:24→PREFIX⁡("hist_")\operatorname{UTF8} \rightarrow \operatorname{SHA256} \rightarrow \operatorname{HEX} \rightarrow \operatorname{SLICE}_{0:24} \rightarrow \operatorname{PREFIX}(\text{"hist\_"})

隨機測試:

1000/10001000/1000

一致。


7.3 物理隔離測試

另外建立 runtime-only directory,其中只有:

  • graph runtime;
  • graph JSON;
  • runner。

不包含:

  • source compiler;
  • AST compiler;
  • original function source。

圖仍可產生預期輸出。

因此至少在此受限語義子集中:

C→G→C→E(G)\boxed{ C \rightarrow G \rightarrow \cancel{C} \rightarrow E(G) }

實驗成立。


八、PoC 證明了什麼,沒有證明什麼

8.1 已支持

PoC 支持:

∃S\exists \mathcal S

其中 S\mathcal S 是某個非平凡程式語義子集,使:

C→G→E(G)C \rightarrow G \rightarrow E(G)

可在 source 移除後保持行為。


8.2 尚未支持

它尚未證明:

∀C,∃G\forall C, \quad \exists G

可完全忠實執行任意程式。

尤其尚未完整處理:

  • aliasing;
  • pointer;
  • closures;
  • generator;
  • coroutine;
  • reflection;
  • dynamic dispatch;
  • concurrency;
  • signal;
  • external I/O;
  • native extension;
  • undefined behavior;
  • self-modifying code。

所以本文主張的是存在性與研究方向,而不是已完成 universal graph machine。


九、SSA 與 ESG

9.1 SSA 的重要性

若:

x = x + 1
x = x * 2

直接以 mutable variable 表示,資料關係較模糊。

SSA 可改為:

x1=ADD⁡(x0,1)x_1 = \operatorname{ADD}(x_0,1) x2=MUL⁡(x1,2)x_2 = \operatorname{MUL}(x_1,2)

使 dependency 明確。


9.2 Phi Node

對 branch:

x1=f(a)x_1=f(a)

或:

x2=g(a)x_2=g(a)

合併:

x3=ϕ(x1,x2)x_3 = \phi(x_1,x_2)

因此:

PHI⁡\operatorname{PHI}

可以成為 ESG 的基本 operation。


十、記憶體與別名

10.1 Value Graph 不足以描述真實程式

若:

a = obj
b = obj
b.x = 3

則:

aa

與:

bb

可能指向同一 state region。

因此必須表示:

Alias⁡(a,b)\operatorname{Alias}(a,b)

或更一般:

PointsTo⁡(v,S)\operatorname{PointsTo}(v,S)

10.2 Memory State

可定義:

MtM_t

則 load:

(v,Mt)→LOAD⁡x(v,M_t) \xrightarrow{\operatorname{LOAD}} x

store:

(Mt,a,v)→STORE⁡Mt+1(M_t,a,v) \xrightarrow{\operatorname{STORE}} M_{t+1}

10.3 語言特定記憶體殘差

Rust borrow rule、C raw pointer、GC reference 不應被全部壓成同一個 generic memory edge。

所以 ESG 應容許:

Mcommon+MLspecificM_{\mathrm{common}} + M_L^{\mathrm{specific}}

與 Paper 04 的 CPBS 一致。


十一、效果系統

11.1 純計算與效果必須區分

f(x)=x+1f(x) = x+1

與:

f(x)=WriteFile⁡(x)f(x) = \operatorname{WriteFile}(x)

不能只看輸入輸出形狀。

因此可設:

EffectType⁡(v)\operatorname{EffectType}(v)

例如:

  • pure;
  • state;
  • I/O;
  • network;
  • database;
  • nondeterministic;
  • privileged。

11.2 Effect Boundary

若 ESG 到達:

BnetworkB_{\mathrm{network}}

則 runtime 必須有合法 adapter:

AnetworkA_{\mathrm{network}}

否則:

EG\mathcal E_G

應停止或進入模擬模式。


十二、執行環境契約

12.1 ESG 不是自足宇宙

即使沒有 source,仍然需要:

Ω\Omega

表示執行環境。

例如 SHA256 的語義可以由 runtime primitive 提供。


12.2 Primitive Contract

對 operation:

oo

需要:

K(o)=(input type,output type,effect,failure,determinism)K(o) = ( \text{input type}, \text{output type}, \text{effect}, \text{failure}, \text{determinism} )

12.3 未註冊操作

若圖包含:

o∗o^\ast

但:

o∗∉Ωo^\ast \notin \Omega

則:

EG(G)\mathcal E_G(G)

不得偷偷猜測。

應返回:

UnresolvedOperation⁡(o∗)\operatorname{UnresolvedOperation}(o^\ast)

十三、例外與錯誤語義

13.1 Error 不是一般 Return

若原語言:

raise Error

不能簡單正規化成:

Return⁡(Error)\operatorname{Return}(\text{Error})

除非語境允許。


13.2 Error Edge

可以表示:

o→errorho \xrightarrow{\mathrm{error}} h

其中:

hh

是 handler。

若無 handler:

o→errorBuncaughto \xrightarrow{\mathrm{error}} B_{\mathrm{uncaught}}

十四、並行與時間

14.1 順序圖不足以描述並行

若:

A∥BA \parallel B

則不能強制建立:

A→BA\rightarrow B

或:

B→AB\rightarrow A

14.2 Happens-Before

可加入:

A≺hbBA \prec_{\mathrm{hb}} B

表示 happens-before。


14.3 排程器

可執行圖需要:

ΛE\Lambda_E

指定:

  • deterministic schedule;
  • cooperative schedule;
  • thread runtime;
  • event loop;
  • distributed scheduler。

十五、圖本身能否成為 Canonical Source

15.1 弱版本

弱版本主張:

圖可以作為可執行 artifact,但 source 仍是 canonical source。

即:

C→GC \rightarrow G

15.2 強版本

強版本主張:

G∗G^\ast

成為 canonical program ontology。

各種語言只是:

πL(G∗)\pi_L(G^\ast)

於是:

G∗→CPythonG^\ast \rightarrow C_{\mathrm{Python}} G∗→CRustG^\ast \rightarrow C_{\mathrm{Rust}} G∗→CWASMG^\ast \rightarrow C_{\mathrm{WASM}}

15.3 本文目前只支持條件版本

本文不直接宣稱:

G∗G^\ast

已足以取代所有 source。

目前只提出:

在可明確指定語義子集與執行契約下,圖可成為獨立執行來源。\boxed{ \text{在可明確指定語義子集與執行契約下,圖可成為獨立執行來源。} }

十六、從 ESG 再生成原始碼

16.1 Reprojection

若:

GEG_E

保存足夠語義,可定義:

πL:GE→CL\pi_L : G_E \rightarrow C_L

16.2 不要求原樣重建

若原始碼:

a = x + 1

重建為:

result = 1 + x

在指定交換律語境下仍可能等價。

所以:

Reproject⁡(G)≠RecoverOriginalText⁡(C)\operatorname{Reproject}(G) \neq \operatorname{RecoverOriginalText}(C)

16.3 Text Identity 與 Program Identity

因此:

C1≠C2C_1\neq C_2

但可能:

ρ(C1)≡ρ(C2)\rho(C_1) \equiv \rho(C_2)

這再次支持:

Program Identity≠Source Text Identity\text{Program Identity} \neq \text{Source Text Identity}

十七、可執行語義圖的驗證

17.1 Differential Execution

給定原程式與圖:

CC

與:

GG

生成測試:

XTX_T

比較:

Exec⁡(C,x)\operatorname{Exec}(C,x)

與:

EG(G,x)\mathcal E_G(G,x)

17.2 Property-Based Testing

可大量生成:

xix_i

驗證:

∀i,P(Exec⁡(C,xi),EG(G,xi))\forall i, \quad P( \operatorname{Exec}(C,x_i), \mathcal E_G(G,x_i) )

17.3 Symbolic Equivalence

對受限語義子集,可進一步研究:

SMT⁡\operatorname{SMT}

或 symbolic execution。


17.4 Effect Equivalence

不只比較 return value:

YC=YGY_C=Y_G

還要比較:

FC≡FGF_C \equiv F_G

與:

ΣC′≡ΣG′\Sigma_C' \equiv \Sigma_G'

十八、ESG 與傳統 IR 的差異

18.1 相似處

ESG 與 compiler IR 都可能具有:

  • SSA;
  • basic block;
  • typed op;
  • control flow;
  • effect。

18.2 差異處

ESG 額外強調:

  • provenance;
  • source-independent knowledge identity;
  • uncertainty;
  • unresolved boundary;
  • multi-language normalization;
  • ontology inversion;
  • re-projection;
  • human / AI semantic inspection。

因此 ESG 的目標不是只服務:

Compilation\text{Compilation}

而是同時服務:

Execution+Understanding+Verification+Transformation\text{Execution} + \text{Understanding} + \text{Verification} + \text{Transformation}

十九、安全與治理

19.1 圖執行不應直接獲得所有能力

效果節點應受:

Capability⁡\operatorname{Capability}

控制。

例如:

FileDelete⁡\operatorname{FileDelete}

必須具有:

Cap⁡filesystem−delete\operatorname{Cap}_{\mathrm{filesystem-delete}}

19.2 Graph Signing

可定義:

Sign⁡(G,ID⁡(G))\operatorname{Sign}(G,\operatorname{ID}(G))

確保:

  • 圖未被修改;
  • runtime 知道版本;
  • source-to-graph provenance 可追溯。

19.3 Graph Mutation

若 runtime 或 AI 修改:

G→G′G \rightarrow G'

應產生:

ΔG\Delta G

並重新驗證。


二十、可證偽條件

20.1 行為不可保存

若對一個明確受限語義子集,反演後的圖仍無法在合理實作下保持:

Exec⁡(C)≡EG(G)\operatorname{Exec}(C) \equiv \mathcal E_G(G)

則 ESG 的可執行重建命題在該子集失敗。


20.2 必須攜帶原 source 才能執行

若 runtime 實際上仍需要:

  • original source;
  • AST parser;
  • language runtime eval;

才能工作,則不能稱 source-independent execution。


20.3 正規化破壞語義

若:

N(G)N(G)

為了跨語言統一而改變:

  • overflow;
  • ordering;
  • effects;
  • errors;
  • state;

則可執行共同圖失敗。


20.4 Graph runtime 成本失控

若:

TG≫TCT_G \gg T_C

且無法透過 compilation / JIT / graph optimization 改善,ESG 可能只適合作為 analysis IR,而非 runtime representation。


二十一、核心命題

命題 1:條件可執行命題

存在非平凡程式子集:

S\mathcal S

使:

C∈S⇒∃G:EG(G)≡Exec⁡(C)C\in\mathcal S \Rightarrow \exists G: \mathcal E_G(G) \equiv \operatorname{Exec}(C)

命題 2:原始碼可移除命題

對符合條件的 GG:

C→G→C→E(G)C \rightarrow G \rightarrow \cancel{C} \rightarrow E(G)

可以成立。


命題 3:語義而非文字保存命題

執行等價不要求:

TextIdentity\text{TextIdentity}

而要求:

SemanticInvariantPreservation\text{SemanticInvariantPreservation}

命題 4:CISG 非天然可執行命題

GC⇏GEG_C \not\Rightarrow G_E

需要額外 lowering、operation semantics 與 runtime contract。


命題 5:效果一級化命題

Effects\text{Effects}

必須作為執行語義一級結構,而不是附註。


命題 6:執行環境顯式命題

EG\mathcal E_G

必須顯式依賴:

Ω\Omega

而非假設所有 primitive 自然存在。


命題 7:可再投影命題

若 GEG_E 語義足夠完整,可以研究:

GE→CLG_E \rightarrow C_L

使 source 成為圖的可生成投影。


命題 8:圖可成為程式工件命題

在受限條件下:

GEG_E

可以不再只是程式分析結果,而成為:

Executable Program Artifact\boxed{ \text{Executable Program Artifact} }

二十二、後續工程路線

下一階段應依序加入:

  1. SSA;
  2. explicit data-flow;
  3. explicit state region;
  4. error edges;
  5. effect typing;
  6. external capability contract;
  7. alias / points-to;
  8. async / concurrency subset。

測試應逐步從:

pure deterministic functions\text{pure deterministic functions}

擴張到:

stateful deterministic programs\text{stateful deterministic programs}

再到:

bounded effects\text{bounded effects}

最後才碰:

dynamic / concurrent systems\text{dynamic / concurrent systems}

二十三、與下一篇的關係

Paper 06 將研究:

D(GC)→ΔD(G_C) \rightarrow \Delta

即:

當程式已經被恢復成結構圖後,哪些 Bug、異常與架構缺陷可以直接變成圖論、約束求解與狀態可達性問題?

Paper 05 建立:

GG

可以具有真正執行語義。

Paper 06 則進一步利用:

GG

作為缺陷計算的直接輸入。


二十四、結論

本文提出「可執行語義圖」ESG,研究由程式碼反演出的語義結構在何種條件下可以脫離原始碼獨立執行。

本文不主張:

所有原始碼都應消失\text{所有原始碼都應消失}

也不主張:

所有 CISG 都可直接執行\text{所有 CISG 都可直接執行}

而是建立一個更精確的命題:

只要一個結構保存了執行所需的充分語義,它就可以成為程式的獨立執行表示。\boxed{ \text{只要一個結構保存了執行所需的充分語義,它就可以成為程式的獨立執行表示。} }

因此:

CL→ρLGE→EG(Y,Σ′,F)C_L \xrightarrow{\rho_L} G_E \xrightarrow{\mathcal E_G} (Y,\Sigma',F)

可以成為一條完整程式路徑。

在此架構中,原始碼的角色開始改變。

它仍然可以是:

  • 人類編輯面;
  • diff 介面;
  • 版本控制工件;
  • 語言生態接口;
  • debugging surface。

但它不再必然是:

唯一可執行本體\boxed{ \text{唯一可執行本體} }

如果後續研究能進一步證明不同語言可以:

CA→G∗→CBC_A \rightarrow G^\ast \rightarrow C_B

並且:

G∗G^\ast

本身可執行,那麼程式語言在整個計算體系中的位置將發生根本變化:

Programming Language\text{Programming Language}

將逐步由:

Program Ontology\text{Program Ontology}

轉化為:

Program Ontology 的投影、編輯與交互介面\boxed{ \text{Program Ontology 的投影、編輯與交互介面} }

而可執行語義圖則可能成為連接:

理解,驗證,轉譯,執行\text{理解} , \text{驗證} , \text{轉譯} , \text{執行}

的共同結構層。


參考與前置理論

  1. Neo.K,《程式底空間:從原始碼表徵到計算關係的存在層》,PBSOI Paper 01。
  2. Neo.K,《程式碼誘導語義圖:由實作生成而非由設計繪製的程式節點圖》,PBSOI Paper 02。
  3. Neo.K,《程式本體反演:從可執行投影重建可觀測程式本體》,PBSOI Paper 03。
  4. Neo.K,《共通程式底空間:跨語言語義正規化與表徵收斂》,PBSOI Paper 04。
  5. Neo.K,《多重投影程式論:原始碼不再是程式本體》。
  6. Neo.K,《從程式碼到意圖:程式概念的歷史轉換與後文本時代》。
  7. Neo.K,《基本計算單位的歷史轉換:從指令、函數到張量、意圖與世界狀態》。
  8. EveMissLab,Semantic Graph PoC v0.1。
  9. EveMissLab,CISG RepoLumen PoC v0.1。