What does Four Pillars and Double Entry conclude, in numbers, about “Closing the Loop: the Daily Close, the Four-Pillar Double-Entry Reconciler and a Pre-registered Test”?
Answer: Chapter 8 gives the owner's five-step daily close, the distilled Four-Pillar Double-Entry Reconciler and a pre-registered planted-error trial, stating which results would overturn the central claim. Marked boxes separate published evidence, runnable Python calculations (20 programs), classical sources and the author's hypotheses.
Scope of the numbers: With runnable programs this book shows that a single-entry list contains no test of itself: on an illustrative day, leave out a balance payment of 1,500.00 yuan and the spreadsheet stays perfectly consistent; a gap appears only against the bank balance. Parameters are illustrative; all calculations are generated by the book's programs; the book is general analysis, not individualised accounting, tax or legal advice.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it.
| 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 |
Show the full program
# 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"))Single source and citation
Fan, Y. (2026). The Conservation Algebra of Four-Pillar Settlement and Double-Entry Bookkeeping: Invariants for Error-Free Reconciliation of Buying-Agent Ledgers (Version 1.0.0), Chapter 8: Closing the Loop: the Daily Close, the Four-Pillar Double-Entry Reconciler and a Pre-registered Test. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 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}
}Other chapter answers in this book
- Chapter 1 · What a Single-Entry List Cannot See: Conservation Tests Only Against a Count
- Chapter 2 · The Detection Matrix of Nine Error Types: What the Trial Balance Catches and What It Lets Through
- Chapter 3 · The Algebra of Location: Incidence Matrix, Null Space and the Closing Window
- Chapter 4 · Exact Arithmetic: Integer Fen, an Exchange-Difference Account and Largest-Remainder Sharing
- Chapter 5 · Accounts for a Buying Agent: Four Pillars for Every Account and Seven Daily Invariants
- Chapter 6 · How Many Orders to Re-check Each Week: Discovery Sampling and Value Strata
- Chapter 7 · Eastern and Western Sources: the Song Four-Pillar Settlement and Pacioli's Three Books