5D Library › 梦境意象二分图、确定性哈希牌卡与潜意识先验激活 · English

第八章 牌卡应用的审计与预注册试验

任何用户都能做的审计

哈希牌组(第三章)使两类不当行为可以被发现。第一类是重抽:让用户,或应用代替用户,一直重抽直到牌面好看。第二类是运营者的悄悄替换。对付第二类的办法是「先承诺、后揭示」的日志:每天午夜,应用公布当天秘密盐值的 SHA-256 摘要;第二天公开盐值,任何人都可以核对摘要,并用用户、日期、盐值与问题重算日志中的每一次解读。

推导

# Chapter 8. p15: Auditing a card app. (1) Redraws: if 27 of 54 cards
# read as "positive" and a user may redraw a negative card up to r
# times, the share of positive readings is 1 - 0.5**(r + 1). (2) A
# commit-reveal log: the app publishes SHA-256 of each day's salt in
# advance; afterwards anyone can recompute every top card from user,
# date, salt and question. An operator who quietly redrew a negative
# card for 5% of 1,000 users (seed 89) is caught by recomputation.
import hashlib
import random

DECK = ["{}{:02d}".format(s, r) for s in "FWAE" for r in range(1, 14)]
DECK += ["JK1", "JK2"]
POSITIVE = set(DECK[0::2])

def top_card(user, date, salt, question):
    q = hashlib.sha256(question.encode("utf-8")).hexdigest()
    seed = hashlib.sha256("{}|{}|{}|{}".format(user, date, salt, q)
                          .encode("utf-8")).digest()
    w = int.from_bytes(hashlib.sha256(seed).digest()[:4], "big")
    limit = (2 ** 32 // 54) * 54
    k = 0
    while w >= limit:
        k += 1
        w = int.from_bytes(hashlib.sha256(seed + bytes([k])).digest()[:4],
                           "big")
    return DECK[w % 54]

if __name__ == "__main__":
    for r in range(4):
        print("   redraws allowed {}: positive share {:.3f}".format(
            r, 1 - 0.5 ** (r + 1)))
    salt = "s-2026-11-09"
    commit = hashlib.sha256(salt.encode()).hexdigest()
    print("   commitment published at midnight: {}...".format(commit[:24]))
    rng = random.Random(89)
    log, doctored = [], 0
    for u in range(1000):
        user, q = "u{:04d}".format(u), "What should I start today?"
        card = top_card(user, "2026-11-09", salt, q)
        if card not in POSITIVE and rng.random() < 0.05:
            card = rng.choice(sorted(POSITIVE))
            doctored += 1
        log.append((user, q, card))
    ok = hashlib.sha256(salt.encode()).hexdigest() == commit
    bad = sum(1 for user, q, card in log
              if top_card(user, "2026-11-09", salt, q) != card)
    print("   salt matches commitment: {}; doctored {}, caught {}".format(
        ok, doctored, bad))
    pos = sum(1 for _, _, c in log if c in POSITIVE) / 1000
    print("   positive share in the log {:.3f} (fair 0.500)".format(pos))
#    redraws allowed 0: positive share 0.500
#    redraws allowed 1: positive share 0.750
#    redraws allowed 2: positive share 0.875
#    redraws allowed 3: positive share 0.938
#    commitment published at midnight: 29e32d586fb225d412fe1adb...
#    salt matches commitment: True; doctored 25, caught 25
#    positive share in the log 0.533 (fair 0.500)

如果一半的牌算「正面」,允许负面牌重抽一次,0.750 的解读会是正面;两次,0.875;三次,0.938。每一次重抽在单次解读中都看不出来,汇总起来却一目了然。在 1,000 名用户的模拟日志中,运营者为其中 5% 替换负面牌,共篡改 25 次解读;公开的盐值与事先公布的承诺相符,重算抓出了全部 25 次。日志中正面牌的比例是 0.533,公平值是 0.500,单看这个比例并不能证明篡改;重算可以。

预注册试验

值得检验的主张,是第六章的行为学主张,以及为完整起见的预知主张。试验分三组,为期四周:每日一张神谕牌、每日一个随机任务编号(主动对照,除了没有图像,其余完全相同)、不借助任何东西;结果指标是每周开始的工作时段数,取自时间记录。

推导

# Chapter 8. p16: Sample sizes for a pre-registered three-arm trial.
# Arms: a daily oracle card, a daily random task number (active
# control), no aid; 4 weeks; outcome: work blocks started per week.
# Two comparisons, so two-sided alpha 0.025 each, power 0.80, normal
# approximation n = 2 (z_a + z_b)^2 / d^2 per arm. Equivalence of card
# and number (TOST, margin d = 0.2, alpha 0.05, power 0.90). And a test
# of "the card foretells the day": hit rate 1/54 by chance against a
# claimed 1/40, one-sided alpha 0.001, power 0.90.
import math
from statistics import NormalDist

Z = NormalDist().inv_cdf

def n_two(d, alpha, power):
    return math.ceil(2 * (Z(1 - alpha / 2) + Z(power)) ** 2 / d ** 2)

if __name__ == "__main__":
    for d in (0.2, 0.3, 0.5):
        print("   effect d={:.1f}: {} people per arm".format(
            d, n_two(d, 0.025, 0.80)))
    tost = math.ceil(2 * (Z(0.95) + Z(0.95)) ** 2 / 0.2 ** 2)
    print("   card vs number equivalent within d=0.2: {} per arm".format(
        tost))
    p0, p1 = 1 / 54, 1 / 40
    za, zb = Z(1 - 0.001), Z(0.90)
    n = ((za * math.sqrt(p0 * (1 - p0)) + zb * math.sqrt(p1 * (1 - p1)))
         / (p1 - p0)) ** 2
    print("   hit rate 1/54 vs 1/40: {:,} scored draws".format(
        math.ceil(n)))
#    effect d=0.2: 476 people per arm
#    effect d=0.3: 212 people per arm
#    effect d=0.5: 77 people per arm
#    card vs number equivalent within d=0.2: 542 per arm
#    hit rate 1/54 vs 1/40: 9,054 scored draws

要在两次比较下检出牌与任一其他组之间 d = 0.2 的差别,每组需要 476 人;d = 0.3 需要 212 人;d = 0.5 需要 77 人。要证明牌与普通编号在 d = 0.2 之内等效,每组需要 542 人。要检验「牌能预示当天」的主张,由不知情的评判者判为命中或落空,偶然命中率 54 分之一对所称的 40 分之一,在单侧显著性水平 0.001 下需要 9,054 次评分抽牌。

注

任何牌卡或解梦应用的四步核查。 第一,索取输入与算法,自己重算一次解读;确定性的服务可以核查,不透明的服务不能(p05)。第二,寻找重抽,包括「再问一次」按钮,并计数(p15)。第三,判断准确度之前,先记四周的「吻合与否」日记(p10)。第四,如果应用帮助你开始工作,各用两周把它与硬币或普通计划比较:经得起这个比较,帮助才是真实的(p11)。

假说 · 尚未验证

预注册预测(尚未验证): 神谕牌与随机任务编号在每周开始的时段数上的差别不超过 d = 0.2,且两者都高于不借助任何东西。不知情评判者对牌的预示的命中率不超过 54 分之一。什么会证明它错: 牌胜过编号超过 d = 0.2,或者评判的命中率显著高于偶然。

全书小结

解梦词典是一张二分图,宽松的解读让几乎每个意象都与几乎每件人生事务相邻(p01);类似 REM 的扩散过程不需要任何讯息就会产生远距离组合(p02)。允许反向应验,梦一周之内凭偶然就有 0.918 的应验率(p03);日间残留遇上每周作息,七天前的残留有 0.735 的应验率(p04)。SHA-256 种子加上拒绝采样与德斯坦菲尔德洗牌,得到一副公平、可重现的 54 张牌(p05),三种常见失误会使它偏斜(p06)。改一个字符就得到毫不相干的解读(p07),455 名用户就有一半机会撞上相同的三张牌(p08)。每日一张牌凭偶然在 0.395 的日子里吻合至少一件事,却被记成 0.746 的日子应验(p09、p10)。无论它对行动有什么帮助,硬币同样能做到,计划做得更好(p11、p12)。六梦、王符的方法与荣格的圣甲虫,最好读作关于做梦者、关于机会数量的陈述(p13、p14)。

Fan, Y. (2026). Dream Motif Bipartite Graphs, Deterministic Oracle Decks and Subconscious Prior Activation: REM Semantic Spreading, SHA-256 Fisher-Yates Permutations and Retroactive Coincidence Rates [梦境意象二分图、确定性哈希牌卡与潜意识先验激活] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090233 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).