关于「代码可复现性衰减:依赖漂移的风险率与逐字输出回归」,《书库冲突检测、可复现与纠删码》给出的定量结论是什么?
结论:第四章用风险率模型说明,纯标准库程序的半衰期为 34.7 年,带五个依赖的程序只有 2.2 年,每年逐字比对输出能把每百段程序十年中无人知晓的失效年压到 9.21。
数据口径:书中的书库规模、错误率、风险率与故障率均为示意参数;全部计算由书中程序生成;本书不是法律、财务、采购或存储服务建议。 第一章把书库画成知识图谱,说明卷数越多错误越难藏身:示意书库到 200 卷时,0.9821 的偏差定义处在可以被另一卷反驳的位置。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 2.2, 34.7
| deps half-life S(5) S(10) S(20) | |
| 0 | 34.7 0.9048 0.8187 0.6703 |
| 1 | 8.7 0.6703 0.4493 0.2019 |
| 3 | 3.5 0.3679 0.1353 0.0183 |
| 5 | 2.2 0.2019 0.0408 0.0017 |
| 10 | 1.1 0.0450 0.0020 0.0000 |
| 20 | 0.6 0.0022 0.0000 0.0000 |
| library of 3,400 programs, expected still reproducing at year 10: | |
| standard library only | 2,784 |
| five dependencies each | 139 |
| 0.6 of programs with five | 1,197 |
| half-life ratio, none against five dependencies 16.0 |
查看完整验算程序
# Chapter 4. p41: a constant-hazard model of reproducibility decay. A
# program stops reproducing its printed output at rate H0 per year from
# changes in the language and standard library, plus HD per year for
# each third-party dependency it imports (directly or transitively).
# Survival S(t) = exp(-(H0 + d HD) t); half-life ln 2 / (H0 + d HD).
# H0 = 0.02 and HD = 0.06 are illustrative, not measured rates. The last
# lines count expected survivors in a library of 200 volumes with 17
# programs each.
import math
H0, HD = 0.02, 0.06
PROGS = 200 * 17
def surv(d, t):
return math.exp(-(H0 + d * HD) * t)
print("{:>5} {:>10} {:>10} {:>10} {:>10}".format(
"deps", "half-life", "S(5)", "S(10)", "S(20)"))
for d in (0, 1, 3, 5, 10, 20):
print("{:>5} {:>10.1f} {:>10.4f} {:>10.4f} {:>10.4f}".format(
d, math.log(2) / (H0 + d * HD), surv(d, 5), surv(d, 10),
surv(d, 20)))
print("library of {:,} programs, expected still reproducing at year 10:"
.format(PROGS))
print(" standard library only {:>8,.0f}".format(PROGS * surv(0, 10)))
print(" five dependencies each {:>8,.0f}".format(PROGS * surv(5, 10)))
mix = math.fsum([0.4 * surv(0, 10), 0.6 * surv(5, 10)])
print(" 0.6 of programs with five {:>8,.0f}".format(PROGS * mix))
print("half-life ratio, none against five dependencies {:.1f}".format(
(H0 + 5 * HD) / H0))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《超大规模双语专著库跨卷定理冲突检测、代码可复现性衰减防腐与冷存储纠删码》第 4 章「代码可复现性衰减:依赖漂移的风险率与逐字输出回归」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-182 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026182,
author = {Fan, Yafu},
title = {Cross-Volume Theorem-Conflict Detection in Large Bilingual Monograph Libraries, Anti-Decay of Code Reproducibility and Erasure-Coded Cold Storage},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}