Files
bookspec/spec/entry.md
T
swaitsandClaude Fable 5.1 790ec8c0e6 feat(bookspec): the specification text and an example for the ledger's own laws (P13 step 4)
bookspec/spec holds the first edition: the model and the five laws
(00-model.md) and one file per area, each B-rule a section with its
status, a MUST/MAY statement, sources pinned either to a vendored source
with a verbatim quotation or to an exact external paragraph, its symbolic
form, its examples and its applicability. B-39, B-40, B-43 and B-45 are
reserved sections (allocated, not yet stated in rules.md); B-44 is stated
in rules.md and now carries its bookspec id and CONVENTION status.

Eight new examples show the laws that had none, each figure worked by
hand: an unbalanced entry is refused (Pacioli ch. 36, Pub. 583), a
negative or zero line is refused, a fraction of a cent is refused (ISO
4217), a child account takes its parent's type, the trial balance and the
accounting equation on one small book (cash 6550.25 = loan 2000 + capital
5000 + (sales 750.50 - rent 1200.25)), a reversal leaves the original
standing and a second reversal is refused, a close sweeps revenue and
expenses into Retained Earnings (3999) and the closed quarter takes no
late entry, and cents add exactly. The refusal vocabulary gains
unbalanced, negative_amount, zero_amount, too_few_lines,
finer_than_minor_unit, parent_type_mismatch, already_reversed and
period_closed; a refused entry may carry a non-positive amount.

The checker's spec.rs fails the build on a rule without its section, a
statement without MUST/SHOULD/MAY, a pin that is not verbatim in its
vendored source, examples that differ from the catalogue, or more than 60
pages.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp
2026-10-29 12:51:30 -06:00

3.7 KiB

Area: entry

The mechanics of one entry: its lines, their sides and amounts.

BS-entry-1: Every entry is a double entry: debits equal credits (B-1)

  • Status: AUTHORITY
  • Statement: An entry MUST have at least two lines, and the sum of its debit lines MUST equal the sum of its credit lines exactly, with no tolerance. An entry that does not MUST be refused whole: it posts nothing, and leaves no partial entry behind.
  • Sources:
    • vendored sources/pacioli-1494.md: "All entries made in the ledger have to be double entries"
    • vendored sources/irs-records.md: "the total debits must equal the total credits"
  • Symbolic form: for an entry with lines (s_i, a_i), a_i > 0: n >= 2 and sum{a_i : s_i = debit} = sum{a_i : s_i = credit}.
  • Examples: entry-an-unbalanced-entry-is-refused, statement-the-books-balance-and-the-equation-holds
  • Applicability: every entity, basis and jurisdiction.

BS-entry-2: A line's amount is positive; its side gives the direction (B-2)

  • Status: CONVENTION
  • Statement: A line's amount MUST be greater than zero, and its side, never its sign, MUST give the direction money moves. A line with a negative or zero amount MUST be refused.
  • Sources:
    • vendored sources/pacioli-1494.md: "All the creditors must appear in the Ledger at the right hand side, and all the debtors at the left."
  • Symbolic form: a_i > 0; signed(i) = +a_i if s_i = debit, -a_i if s_i = credit.
  • Examples: entry-a-line-amount-is-positive
  • Applicability: every engine. No authority forbids a negative amount outright; one way to write each line is chosen so every line reads one way.

BS-entry-3: Exact amounts in the books; rounding only on returns (B-21)

  • Status: AUTHORITY
  • Statement: The books MUST keep every amount exactly, and a sum of amounts MUST be their exact sum. Rounding MUST NOT occur inside the books; where a rule needs a rounded figure (an allocation, a return line), it names the rounding mode and rounds only the total.
  • Sources:
    • vendored sources/irs-partnerships.md: "include cents when adding the amounts and round off only the total"
  • Symbolic form: amounts are elements of Z * u (u the currency's smallest unit); + is exact on them.
  • Examples: entry-cents-add-exactly
  • Applicability: every engine. Binary floating point is not an implementation of this rule.

BS-entry-4: What new commands take: four-digit years, amounts a line can carry (B-28)

  • Status: CONVENTION
  • Statement: A command MUST take only dates in 0001-01-01 through 9999-12-31 written YYYY-MM-DD, and amounts no larger than one quadrillion with at most ten decimal places; anything else MUST be refused, never wrapped or truncated. Replaying books already written MUST NOT apply these bounds.
  • Sources:
    • external: ISO 8601-1:2019 section 5.2.2.1, calendar dates with four-digit years in the basic profile
  • Symbolic form: date in [0001-01-01, 9999-12-31]; |amount| <= 10^15; scale(amount) <= 10.
  • Examples: none yet. The example schema writes dates as YYYY-MM-DD already (a malformed date fails the schema), so a refusal example needs a command whose input can be out of range; the first edition has none.
  • Applicability: commands only; replay of existing books is exempt (posted is forever).

BS-entry-5: Drafts and evidence (B-43)

  • Status: reserved
  • Statement: Reserved: allocated in the wanderbooks plan (8.0.3) for the draft states of unit P4, not yet stated in docs/spec/rules.md. Its identifier and area are fixed so a later edition fills it in without moving another number.
  • Sources:
    • none yet
  • Symbolic form: none yet.
  • Examples: none yet
  • Applicability: none yet.