关于「状态机穷举:证明带病出版不可达,并找出三种错误设计的最短反例」,《硬门禁与软提示衰减》给出的定量结论是什么?

结论:第五章用状态机穷举证明正确设计下带病出版不可达,绿灯不绑定内容时长度为十的事件序列有 0.1964 会出错。

数据口径:软提醒按比例起作用,各层独立时残余违规率是漏过率之积,示意参数下四层之后仍是 0.0048,不是零;只有确定性的代码门禁能在它自己定义的模式类别之内做到零。 书中参数均为示意;全部计算由书中程序生成。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.1964

LallV1 badshareV0 bad
36410.01560
4256100.03910
640963790.09250
86553695560.14580
1010485762059870.19640
receipt hash ef3d4a204879; after one edit e267f711f459; match False
查看完整验算程序
# Chapter 5. p53: a green light must be bound to the content it judged.
# Count every event sequence of length L over four events (edit_clean,
# edit_dirty, run_gate, publish) that publishes a dirty file at least
# once. V1 keeps a green flag that edits do not clear; V0 binds the
# green receipt to a hash of the content, so any change voids it.
# Dynamic programming over (dirty, green, already_bad); exact counts.
# The last lines show the hash binding on two short texts.
import hashlib

EV = ("edit_clean", "edit_dirty", "run_gate", "publish")


def count(L, bind):
    st = {(0, 0, 0): 1}
    for _ in range(L):
        nx = {}
        for (d, g, bad), c in st.items():
            for ev in EV:
                dd, gg, bb = d, g, bad
                if ev == "edit_clean":
                    dd, gg = 0, (0 if bind else g)
                elif ev == "edit_dirty":
                    dd, gg = 1, (0 if bind else g)
                elif ev == "run_gate":
                    gg = 1 if d == 0 else 0
                elif ev == "publish" and g and d:
                    bb = 1
                nx[(dd, gg, bb)] = nx.get((dd, gg, bb), 0) + c
        st = nx
    return [c for (d, g, b), c in sorted(st.items()) if b]


print("%3s %10s %12s %10s %12s" % ("L", "all", "V1 bad", "share",
                                   "V0 bad"))
for L in (3, 4, 6, 8, 10):
    v1 = count(L, False)
    v0 = count(L, True)
    n1, n0 = 0, 0
    for c in v1:
        n1 += c
    for c in v0:
        n0 += c
    print("%3d %10d %12d %10.4f %12d" % (L, 4 ** L, n1, n1 / 4 ** L,
                                         n0))
a = hashlib.sha256(b"chapter text, version 1").hexdigest()[:12]
b = hashlib.sha256(b"chapter text, version 2").hexdigest()[:12]
print("receipt hash %s; after one edit %s; match %s" % (a, b, a == b))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《客户端生命周期硬门禁工程、软提示遵从率轮次衰减与保存前物理拦截状态机母典》第 5 章「状态机穷举:证明带病出版不可达,并找出三种错误设计的最短反例」(版本 1.0.0). 5D Library. DOI 待发布

DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-256 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026256,
  author    = {Fan, Yafu},
  title     = {Hard Gates across the Client Lifecycle: the Decay of Soft-Prompt Compliance over Turns and State Machines for Interception before Publication},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论