A unified DEBK invariant for companies and sole traders
Trade Control is an open‑source production system with an accounting engine built on a simple idea:
that the economic reality of a business is found in its flows — the productive transactions that move goods, services, and cash — rather than in static snapshots of assets.
In this model, every financial transaction mirrors a productive one, with quantity and cash expressed as opposite‑signed flows. This Cash Polarity Principle allows Trade Control to operate at the level of individual transactions, independent of arbitrary reporting periods. From this transaction‑grained representation, the engine can algorithmically reconstruct the asset‑based reporting required by conventional accounting.
The invariant presented in this paper is the bridge between these two mentalities. It shows how a dynamic, flow‑based model can be reconciled exactly with the static, asset‑rooted view of traditional bookkeeping. Because this approach rewrites the core computational logic of accounting, it requires a clear, rigorous proof. This document provides that proof, along with the definitions and reasoning that make the invariant operational inside Trade Control.
This paper states and proves a single DEBK invariant that holds for:
The invariant is expressed entirely in terms of:
Annual profit after tax is reconstructible from balance‑sheet deltas alone, up to a small, well‑understood rounding residual (typically pennies, and 1p in Year 1 for VAT‑registered businesses).
There are no classification‑dependent bridge terms, no hand‑coded “equity movements”, and no tautological definitions. Capital movement is measured directly from the balance sheet.
Each account carries a BalanceConstraintCode:
The invariant uses only accounts with BalanceConstraintCode = 2 to define capital.
This is implemented via LAG over the capital position by year. It is:
Year 1 has no prior year. Instead, we treat:
OpeningPosition:
the net of opening balances on subjects (customers, suppliers, etc.), with sign convention chosen so that a positive value increases the equity bridge.
OpeningAccountPosition:
the net of opening balances on cash/bank accounts (or other designated account type), again with sign convention chosen to align with the equity bridge.
For year ( y > 1 ):
For each year ( y ):
Then:
Losses carried forward are derived from the tax balance and tax rate:
These are used for analysis and disclosure but do not appear directly in the core equity bridge identity.
Year 1 is special because there is no prior year capital snapshot.
We enforce:
The entire initial state of the business is represented by:
For ( y > 1 ):
For each year ( y ), define:
Rearranging:
Variance is a pure rounding residual, typically pennies.
Rearranging the equity bridge gives the core invariant:
In words:
Annual profit after tax is reconstructible from balance‑sheet deltas alone, plus explicit opening terms, up to a small rounding residual.
This holds for:
VAT introduces a three‑stage rounding chain:
In Year 1, this can produce a 1p residual.
For later years, the effect typically disappears or remains within the same tolerance.
Trade Control uses a unified business‑tax model:
The invariant is implemented in the open‑source Trade Control codebase.
The SQL definition of the reconciliation view:
Cash.vwEquityReconciliationByYear
computes:
…exactly as defined in this paper.
This paper establishes a single, unified DEBK invariant that holds for companies and sole traders, VAT‑registered and non‑registered businesses, and any chart of accounts that respects a simple balance‑constraint flag.
The benefits of this approach:
Longer term, this provides:
Trade Control is built on this invariant.
This paper shows why it works — and why it will continue to work as the system grows.
This paper’s reference run uses the scenario runner script:
The script executes four scenarios (profit/loss; VAT on/off) by running App.proc_DatasetSyntheticMIS with configurable settings, including:
@IsCompany (set to either company or sole trader scenarios)@PriceRatio (profit vs loss scenarios)@IsVatRegistered (VAT on/off scenarios)For full source, see EXEC_DatasetSyntheticMIS.sql.
Cash.vwEquityReconciliationByYearCash.vwFlowReconciliationByYearCash.vwProfitAndLossByYearCash.vwBalanceSheetCash.tbPayment, Cash.tbCode, Cash.tbCategorySubject.tbAccountApp.tbYear, App.tbYearPeriodTo prove all four synthetic scenarios (profit/loss; VAT on/off), use:
This script:

Licenced by Trade Control Ltd under a Creative Commons Attribution-NoDerivatives 4.0 International License