Account for the interval a model proposes; never clamp it

M4.3 advances a cohort over one declared interval and deliberately does not model
one. ECOLOGY_MODEL keeps population maths an experiment and asks for several
candidates to be compared, so choosing one here would turn a recommendation into
a locked rule. A model proposes fluxes; this checks the declared result is
exactly what they imply, for counts and for every inventory channel.

Nothing is clamped. A loss larger than what is there refuses the interval and
says whether it was the population or the biomass, so a caller can subdivide;
subtraction is checked against what is present rather than performed and
repaired, so a negative population is never constructed. That is the answer to
the named risk: a clamp is how an interval a model could not integrate becomes a
plausible result, and how a false extinction arrives. Both clamp mutations are
detected by the tests.

Counts carry whole members and owed fractions as one quantity, so a population
below one member is a number rather than a rounding decision. Biomass has no
birth term at all, so a birth cannot bring inventory in and newborns are
necessarily funded from what the cohort holds. Immigration draws from a reservoir
that already held it, so a late transfer is not new production. Conservation runs
through the ledger as one atomic transaction; an interval where nothing moves
submits none.

Two amendments to M4.1 were forced, not chosen. A cohort records the reservoir
backing it, because an advance cannot otherwise know where the inventory is and
passing it alongside would let a caller advance one cohort against another's
store, which comparing balances cannot detect between equal reserves; the
registry now refuses two cohorts sharing one. And a cohort may be vacant, through
a separate factory so vacancy stays deliberate, because a decline to exactly zero
was otherwise unrepresentable and the only way through would have been the clamp
this milestone exists to refuse. A vacant cohort is not an extinction: the
record, its genome, its habitat and its provenance remain and it stays installed.

Fourteen guards confirmed load-bearing by removing each and rerunning. Two of my
own expectations were wrong rather than the code: escrow arithmetic in the
migration test, and a dwindling case that shed all but one femtogram while
declaring a result holding none. The second surfaced a real tension now recorded
in ADR-0038 rather than worked around: a class reduced to a fraction of a member
may hold no reserve, because reserve belongs to members and a fraction is not one
yet, so that biomass has to go somewhere the same interval.

Closure is checked and stability is not, so an interval whose arithmetic balances
and whose ecology is nonsense is accepted. The declared age structure is not
verified to be what ageing would produce, because that needs the within-class
distribution the record discards.

Release 36/36, analysis, ASan 36/36 and clang-format all ran and passed here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-09-24 10:23:09 -04:00
co-authored by Claude Opus 5
parent 0697895e25
commit cabada70c4
16 changed files with 1331 additions and 8 deletions
+34
View File
@@ -193,3 +193,37 @@ only the registry's single-ownership rule bounds what that would mean. Durable
conversion sequence numbers, escrow and crash recovery across a process boundary
are M7 and M8; the before-and-after property proved here holds across a rejection
inside one process.
## Implemented M4.3 interval accounting
[ADR-0038](../adr/0038-interval-accounting.md) implements `AdvancePopulation` as
accounting rather than as a model. The population maths above stays an experiment:
no birth rate, mortality curve, functional response or carrying capacity is chosen
here, so none of the candidate models listed above has been made the only one.
What is enforced is the arithmetic around whichever model runs.
Nothing is clamped. A loss larger than what is present refuses the interval and
names whether it was the population or the biomass, so an unstable interval is
rejected and can be subdivided. Subtraction is checked against what is there
rather than performed and repaired, so a negative population is never constructed.
Counts carry whole members and owed fractions as one scaled quantity, so a density
below one member is still a number and rounding it to zero is not available as a
decision. A population that reaches exactly zero becomes a vacant record, which is
neither absence nor extinction: the genome, the habitat, the owner and the
provenance all remain and the record stays installed. Deleting it would have been
the false extinction this milestone is named against.
Births redistribute funded investment because there is no term by which a birth
could bring biomass in. Immigration draws from a reservoir that already held the
inventory, so a late transfer is not new production. Death returns detritus and
predation transfers once, each to a named counterparty, as one atomic ledger
transaction against the cohort's reservoir.
Three gaps are explicit. Closure is checked and stability is not, so an interval
whose arithmetic balances and whose ecology is nonsense is accepted; comparing
matched ensembles and publishing error envelopes is M4.5. The resulting age
structure is supplied by the caller and is not verified to be what ageing would
produce, because ageing across a class boundary needs the within-class
distribution the declared resolution discards. And emigration escrows into a
reservoir nothing settles with, because `TransferPopulation` does not exist.