关于「实证闭环:月度体检与预注册检验」,《单兵零信任母典》给出的定量结论是什么?
结论:检验一:正态近似,需要 67 起事件;拒绝原假设之门槛,是至少 41 起根因为凭据;可按精确二项分布算,检验力只有 0.7841,不足 0.8。往上逐个试,精确检验力,首次达标之样本量,是 69 起事件,门槛 42 起,检验力 0.8021。方案登记 69 起。
数据口径:全书只写防守,不写任何攻击、入侵、绕过或规避检测手法;书中主机、域名、令牌全为合成,参数为示意,全部计算由书中程序生成;本书为非个人化经营分析,不构成安全审计或法律意见,任何生产变更须经人工复核放行。 书中以标注框区分已发表之证据、可运行之 Python 计算(20 段程序)、原典与作者之假说。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.7841, 0.8, 0.8021, 41, 42, 67
| test 1: incidents needed n | 67 |
| reject H0 if > | 41 credential-rooted; exact power 0.7841 |
| first n with exact power > | 0.8: 69, reject at >= 42, power 0.8021 |
| test 2: shops per arm n | 435 (total 870) |
| test 3: paired drills n | 32 |
| z values | 1.6449 1.9600 0.8416 |
查看完整验算程序
# Chapter 8. p82: sample sizes for the pre-registered tests.
# Test 1 (core claim): among incidents at small tunneled shops, the share
# whose root cause is a credential exceeds one half. H0 p = 0.5,
# H1 p = 0.65, one-sided alpha 0.05, power 0.8. Normal approximation:
# n = ((z_a sqrt(p0 q0) + z_b sqrt(p1 q1)) / (p1 - p0))^2,
# then exact binomial power at that n (sum of binomial terms by fsum).
# Test 2 (intervention): yearly rate of incidents with loss, 0.10 in
# shops that keep broad long-lived tokens versus 0.05 in shops that move
# to scoped short-lived tokens; two-sided alpha 0.05, power 0.8:
# n = (z_{a/2} sqrt(2 pbar qbar) + z_b sqrt(p1 q1 + p2 q2))^2 / d^2.
# Test 3 (drill): paired log-ratio of stop-bleed times before and after
# scripting, SD of differences 1.0 (illustrative), detect a shift of
# 0.5: n = ((z_{a/2} + z_b) sd / shift)^2. All effect sizes illustrative.
import math
from statistics import NormalDist
Z = NormalDist()
def n_one(p0, p1, alpha, power):
za, zb = Z.inv_cdf(1.0 - alpha), Z.inv_cdf(power)
top = math.fsum([za * math.sqrt(p0 * (1.0 - p0)),
zb * math.sqrt(p1 * (1.0 - p1))])
return math.ceil((top / (p1 - p0)) ** 2)
def exact_power(n, p0, p1, alpha):
tail = [math.comb(n, k) * p0 ** k * (1.0 - p0) ** (n - k)
for k in range(n + 1)]
crit = next(c for c in range(n + 1)
if math.fsum(tail[c:]) <= alpha)
return crit, math.fsum(math.comb(n, k) * p1 ** k * (1.0 - p1) **
(n - k) for k in range(crit, n + 1))
def n_two(p1, p2, alpha, power):
za, zb = Z.inv_cdf(1.0 - alpha / 2.0), Z.inv_cdf(power)
pbar = (p1 + p2) / 2.0
top = math.fsum([za * math.sqrt(2.0 * pbar * (1.0 - pbar)),
zb * math.sqrt(math.fsum([p1 * (1.0 - p1),
p2 * (1.0 - p2)]))])
return math.ceil((top / (p1 - p2)) ** 2)
if __name__ == "__main__":
n1 = n_one(0.5, 0.65, 0.05, 0.8)
crit, pw = exact_power(n1, 0.5, 0.65, 0.05)
print("test 1: incidents needed n = {}".format(n1))
print(" reject H0 if >= {} credential-rooted; exact power {:.4f}"
.format(crit, pw))
n_ex = n1
while exact_power(n_ex, 0.5, 0.65, 0.05)[1] < 0.8:
n_ex = n_ex + 1
c_ex, p_ex = exact_power(n_ex, 0.5, 0.65, 0.05)
print(" first n with exact power >= 0.8: {}, reject at >= {},"
" power {:.4f}".format(n_ex, c_ex, p_ex))
n2 = n_two(0.10, 0.05, 0.05, 0.8)
print("test 2: shops per arm n = {:,} (total {:,})".format(n2, 2 * n2))
za, zb = Z.inv_cdf(0.975), Z.inv_cdf(0.8)
n3 = math.ceil(((za + zb) * 1.0 / 0.5) ** 2)
print("test 3: paired drills n = {}".format(n3))
print("z values: {:.4f} {:.4f} {:.4f}".format(Z.inv_cdf(0.95), za, zb))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《单兵硅基帝国零信任网安架构、源站隧道隐身与反爬虫防勒索母典》第 8 章「实证闭环:月度体检与预注册检验」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-336 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026336,
author = {Fan, Yafu},
title = {Zero-Trust Cybersecurity for a One-Commander Silicon Empire: Origin Cloaking, Secret Hygiene and Anti-Scraper Defense},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}