关于「实证闭环:每日收工对账、四柱复式对账器与预注册检验」,《四柱复式守恒代数》给出的定量结论是什么?
结论:第八章给出店主每日收工五步、蒸馏小工具「四柱复式对账器」与预注册的植入错账试验,写明什么结果会推翻核心命题。书中以标注框区分已发表的证据、可运行的 Python 计算(20 段程序)、原典与作者的假说。
数据口径:本书用可运行的程序说明,单式流水本身不含任何检验:在一个示意日上漏记一笔 1,500.00 元的尾款,表格依旧自洽,只有拿银行余额来比才出现差额。 书中参数为示意;全部计算由书中程序生成;本书属于非个人化的会计、税务或法律建议。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。
| acct old in out now evidence | |
| CASH | 1500000 285000 308900 1476100 1473400 |
| STOCK | 420000 272160 170000 522160 524860 |
| AR | 0 150000 150000 0 ok |
| DEP | -380000 100000 135000 -415000 ok |
| REV | 0 0 230000 -230000 - |
| COGS | 0 170000 0 170000 - |
| FX | 0 1240 0 1240 - |
| SHIP | 0 15500 0 15500 ok |
| CAP | -1540000 0 0 -1540000 - |
| trial balance 0 | unbalanced entries none | |
| gaps (book - evidence): CASH +2700, STOCK -2700 | |
| hint: CASH gap 2700 divisible by 9 | |
| hint: STOCK gap -2700 divisible by 9 | |
| hint: entries touching all of CASH,STOCK: T03,T10 | |
| verdict: investigate |
查看完整验算程序
# Chapter 8. p81: the daily close of a buying agent, as one function.
# Model: the checker of the distilled tool. Input: opening balances,
# the day's entries (each must add to zero), and outside balances for
# the accounts that have evidence. Output: the four pillars of every
# account, the trial balance, each account's gap against evidence,
# and search hints: a gap divisible by 9 suggests a transposed or
# slid figure; an entry whose size equals the gap (or half of it) is
# the first suspect; entries touching every gapped account come next.
# Demo: the p12 day with T03 keyed as 175860 instead of 178560 in
# both legs. Integer fen; exact.
ACCTS = ("CASH", "STOCK", "AR", "DEP", "REV", "COGS", "FX", "SHIP",
"CAP")
OPEN = {"CASH": 1500000, "STOCK": 420000, "AR": 0, "DEP": -380000,
"REV": 0, "COGS": 0, "FX": 0, "SHIP": 0, "CAP": -1540000}
DAY = [
("T01", (("CASH", 60000), ("DEP", -60000))),
("T02", (("CASH", 45000), ("DEP", -45000))),
("T03", (("STOCK", 175860), ("CASH", -175860))),
("T04", (("FX", 1240), ("CASH", -1240))),
("T05", (("SHIP", 12000), ("CASH", -12000))),
("T06", (("DEP", 80000), ("AR", 150000), ("REV", -230000))),
("T07", (("COGS", 170000), ("STOCK", -170000))),
("T08", (("CASH", 150000), ("AR", -150000))),
("T09", (("DEP", 20000), ("CASH", -20000))),
("T10", (("STOCK", 96300), ("CASH", -96300))),
("T11", (("SHIP", 3500), ("CASH", -3500))),
("T12", (("CASH", 30000), ("DEP", -30000))),
]
EVIDENCE = {"CASH": 1473400, "STOCK": 524860, "AR": 0, "DEP": -415000,
"SHIP": 15500}
def close(opening, entries, evidence):
dr = dict.fromkeys(opening, 0)
cr = dict.fromkeys(opening, 0)
unbalanced = []
for tag, legs in entries:
net = 0
for a, m in legs:
net += m
if m > 0:
dr[a] += m
else:
cr[a] -= m
if net:
unbalanced.append(tag)
now = {a: opening[a] + dr[a] - cr[a] for a in opening}
tb = 0
for a in opening:
tb += now[a]
gaps = {a: now[a] - evidence[a] for a in sorted(evidence)
if now[a] != evidence[a]}
hints = []
for a, g in gaps.items():
if g % 9 == 0:
hints.append("{} gap {} divisible by 9".format(a, g))
for tag, legs in entries:
for b, m in legs:
if b == a and abs(m) in (abs(g), abs(g) // 2):
hints.append("{} gap matches {} leg".format(a, tag))
if gaps:
both = [tag for tag, legs in entries
if set(gaps) <= {b for b, _ in legs}]
hints.append("entries touching all of {}: {}".format(
",".join(gaps), ",".join(both) or "none"))
return dr, cr, now, tb, unbalanced, gaps, hints
if __name__ == "__main__":
dr, cr, now, tb, unb, gaps, hints = close(OPEN, DAY, EVIDENCE)
print("acct old in out now evidence")
for a in ACCTS:
ev = EVIDENCE.get(a)
print("{:5s} {:>11d} {:>8d} {:>8d} {:>9d} {:>10s}".format(
a, OPEN[a], dr[a], cr[a], now[a],
"-" if ev is None else ("ok" if ev == now[a] else str(ev))))
print("trial balance {} | unbalanced entries {}".format(
tb, unb or "none"))
print("gaps (book - evidence): {}".format(
", ".join("{} {:+d}".format(a, g) for a, g in gaps.items())))
for h in hints:
print("hint: " + h)
print("verdict: {}".format(
"pass" if not gaps and tb == 0 and not unb else "investigate"))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《四柱结算与复式记账的守恒代数、代购流水零差错对账不变量母典》第 8 章「实证闭环:每日收工对账、四柱复式对账器与预注册检验」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-318 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026318,
author = {Fan, Yafu},
title = {The Conservation Algebra of Four-Pillar Settlement and Double-Entry Bookkeeping: Invariants for Error-Free Reconciliation of Buying-Agent Ledgers},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}