Code Logic-Flow Quality Evaluation on the Structure–Symbol Sample Space: Revalidation, Project-Level Scoring, and Prospective Validation under the Three-Dimensional Formalism (v2)
Year: 2026
Type: preprint
Abstract: Background: Code defect detection can be formalized as statistical inference on a structure–symbol sample space (p,τ,P(τ∣p))(p,τ,P(τ∣p)), where the structure pp is an abstract-syntax-tree (AST) path and the symbol ττ is the token at the path's end. Tool v1 (2026-08) used the spike density of local irreversibility ΔSΔS, bidirectional scores, and a logic-convergence score as its core metrics, validated retrospectively on three open-source projects (musl, libuv, libtiff) with fix-commit defect labels. The theory has since undergone key revisions: the three-dimensional formalism v3.1 establishes determinism HH, directionality ΔSΔS, and anchoring AA as the three orthogonal dimensions of a logical system, and the probabilistic-cloud state machine v3.1 corrects the shot-noise-floor conventions and derives the "pseudo-anchor ceiling" structurally. Methods: This paper reproduces every v1 metric on the original labels and adds three theory-aligned metric layers: determinism HfHf; directionality via the symmetric Jensen–Shannon (JS) form, shot-noise-calibrated spike density, and the over-shot-noise ratio RxRx; and anchoring via the anchor deficit DADA, the consistency anomaly YfYf, and below-null flags (the "consistency + attribution" mapping of Criterion 3). The unequal-sample generalization of the shot-noise floor, E[JS]=(d−1)(1/NA+1/NB)/8E[JS]=(d−1)(1/NA+1/NB)/8, is confirmed by Monte Carlo simulation (correction record R1). We further implement project-level logic scoring Q=0.4CA+0.35CD+0.25CHQ=0.4CA+0.35CD+0.25CH (self-evaluation, evolution tracking, and import evaluation), a CI gate artifact, and a C/C++/Python multi-language configuration layer. Results: (1) v1 metrics reproduce nearly exactly (deviations < 1% to < 6%); (2) the new metrics are effective across projects — DADA and XfXf reach p∼10−8p∼10−8–10−1710−17 on libtiff and libuv, below-null flagging rates separate defect functions from controls (libtiff 29.6% vs 2.1%, p=2.5×10−44p=2.5×10−44), and negative controls pass; (3) prospective validation (temporal hold-out: 12 cutoff snapshots × 80-commit future windows, 13,113 functions): below-null flags (JS layer, z>2z>2) achieve 11.3% precision and lift = 2.04 (Fisher p=0.022p=0.022) for future real modifications — the tool retains roughly two-fold discriminative power under fully prospective conditions; (4) sensitivity analyses show the conclusions are robust to the z threshold (1.5–3.0), the spike multiplier (k∈{2,4,6,8}k∈{2,4,6,8}), and the Q weights (66 combinations); (5) project-level scoring ranks zlib≈musl > libuv > libtiff, consistent with project quality reputation, and evolution trajectories are stable. Conclusions: The structure–symbol theory receives empirical support in the code domain at three levels — defect detection, project scoring, and prospective prediction. The anchoring dimension is the discriminative layer missing from v1, and the pseudo-anchor ceiling (null-relative judgment outperforming absolute values) obtains a code-domain numerical instance. Every conclusion is tagged as a theorem citation, a numerical verification (N), a modeling assumption (M), or a modeling choice (S). Keywords: structure–symbol sample space; code defect detection; fix-commit validation; conditional entropy; Jensen–Shannon divergence; anchor deficit; shot-noise floor; prospective validation; temporal hold-out; project-level scoring; negative control 背景:代码缺陷检测可形式化为结构–符号样本空间 (p,τ,P(τ∣p))(p,τ,P(τ∣p)) 上的统计推断问题:结构 pp 为抽象语法树(AST)路径,符号 ττ 为路径末端 token。工具 v1(2026-08)以局部不可逆度尖峰密度、双向评分与逻辑收敛度为核心指标,在 musl、libuv、libtiff 三个开源项目上以修复提交(fix commits)为缺陷标注完成了回顾性验证。此后理论经历关键修订:三维形式体系 v3.1 将逻辑系统确立为确定性 HH、方向性 ΔSΔS、锚定 AA 三个正交维度;概率云状态机 v3.1 修正散粒噪声下限约定并给出"伪锚天花板"的结构性推导。 方法:本文在原始标注上对 v1 做逐指标复现,并新增三个理论维度指标层——确定性维 HfHf;方向性维 Jensen–Shannon(JS)对称形式、散粒下限标定的尖峰密度与超散粒比 RxRx;锚定维锚定亏欠 DADA、一致性异常 YfYf 与 below-null 标记(准则 3 的"一致性 + 归因"两段式映射)。散粒下限的非等样本推广 E[JS]=(d−1)(1/NA+1/NB)/8E[JS]=(d−1)(1/NA+1/NB)/8 经蒙特卡洛数值验证确定(修正记录 R1)。进一步实现项目级逻辑评分 Q=0.4CA+0.35CD+0.25CHQ=0.4CA+0.35CD+0.25CH(自评、演化跟进、导入评估三种模式)、CI 门禁工件与 C/C++/Python 三语法配置层。 结果:(1) v1 指标近乎精确复现(偏差 < 1% 至 < 6%);(2) 新指标跨项目有效——DADA、XfXf 在 libtiff、libuv 上达到 p∼10−8p∼10−8–10−1710−17,below-null 标记率缺陷组对对照组显著(libtiff 29.6% 对 2.1%,p=2.5×10−44p=2.5×10−44),阴性对照总体通过;(3) 前瞻性验证(时间留出设计,12 个截止点 × 未来 80 提交窗口,13,113 个函数):below-null(JS 层,z>2z>2)标记对未来真实修改的命中精度 11.3%、提升度 lift = 2.04、Fisher p=0.022p=0.022——工具在完全前瞻条件下保持约 2 倍判别力;(4) 敏感性分析表明结论对 z 阈值(1.5–3.0)、尖峰倍数(k∈{2,4,6,8}k∈{2,4,6,8})与 QQ 权重(66 组合)稳健;(5) 项目级评分排序 zlib≈musl>libuv>libtiff 与质量声誉一致,演化轨迹稳定。 结论:结构–符号样本空间理论在代码域的缺陷检测、项目评分与前瞻预测三个层面均获实证支持;锚定维是 v1 缺失的判别维度;伪锚天花板(相对空值判定优于绝对值判定)在代码域获得数值实例。全部结论标注为定理引用、数值验证(N)、建模假设(M)或建模选择(S)之一。 关键词:结构–符号样本空间;代码缺陷检测;修复提交验证;条件熵;Jensen–Shannon 散度;锚定亏欠;散粒噪声下限;前瞻性验证;时间留出;项目级评分;阴性对照
Author: chen, kaifa
Language: English
Subfield: Information Systems
Field: Computer Science
Domain: Physical Sciences
Open Access status: green
OpenAlex ID: W7204727170
