Round shares down and ages up, so a round trip never pays

M4.4 turns whole members of a cohort back into identified individuals, and does
nothing else: no habitat transfer, no persistence, no resolution-equivalence
claim. Materialization is instantaneous at the cohort's current tick, because
advancing time is M4.3's interval.

The named risk is that re-materialization becomes free healing, and it has two
separable sources. The arithmetic one is closed outright. A drawn member gets its
class share by integer division rounded down, because rounding up would create
biomass, and a class drawn empty hands over everything it held because a class
with no members may keep no reserve. A residual is never drawable, so an expected
density cannot become an individual.

Age is taken as the oldest the class admits. The exact age is unrecoverable, so
the question is only which direction to be wrong in, and every other answer makes
oscillation profitable: a member re-materialized at the bottom of its class is
younger than it was, and repeating that is immortality. Taking the top means a
round trip can only age someone. Both of these are the risk rather than ordinary
validation, and both mutations are detected: rounding the share up, and drawing
the age from the class floor.

The second source is the declared resolution itself and is stated rather than
mitigated. Members inside a class are indistinguishable by construction, so
collapsing a starving member with a well-provisioned one and materializing both
returns two average members, healing the first at the second's expense. The tests
demonstrate both halves instead of only the flattering one: a round trip is exact
when each class holds one member, and a coarse class conserves the total while
averaging the individuals. Conservation of the total is not evidence that any
individual is right, and the mitigation is the caller's choice of classes when it
collapses, not anything this code can recover.

Materialization produces exactly the record a collapse consumes, so the two
compose and are tested against each other rather than described as inverses. The
oscillation test runs twelve cycles and asserts every cycle that the conserved
total never moves, nobody holds more than the richest starting member held, and
nobody is younger than last cycle; it ends by asserting everyone has been pushed
to a class ceiling, which records the cost of the age rule rather than claiming
it away.

Release 37/37, analysis, ASan 37/37 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 15:41:49 -04:00
co-authored by Claude Opus 5
parent cabada70c4
commit 380d609f06
10 changed files with 1095 additions and 3 deletions
+10
View File
@@ -131,6 +131,16 @@ cohort already holds. It amends ADR-0036 twice: a cohort records the reservoir
backing it, and may be vacant, because a decline to exactly zero had to be
representable.
M4.4 turns whole members back into individuals (ADR-0039). A drawn member gets its
class share by integer division rounded down, because rounding up would create
biomass, and a class drawn empty hands over everything it held rather than leaving
a reserve nobody owns. A residual is never drawable: an expected density is not an
available individual. Age is taken as the oldest the class admits, so a round trip
can only age someone and oscillation is strictly lossy rather than a way to reset
age. The smoothing the declared resolution causes is demonstrated rather than
hidden: a round trip is exact when each class holds one member and averages within
a coarse class, and the mitigation is the caller's choice of classes.
M3.6 closes M3 by making the pieces meet (ADR-0035): `strategy_for` turns a genome
into the `StrategyConfig` the M2.6 driver already takes, founders are pre-diverged
variants of one ancestor admitted to the archive, and `evo-sim --ensemble` runs
+34 -2
View File
@@ -7,7 +7,7 @@ persistent simulation server. The founding vision remains unchanged.
## Completed implementation
- Vision, architectural pillars, risks, open-question register, architecture
diagrams, biological contracts, engineering constitution and 38 ADRs.
diagrams, biological contracts, engineering constitution and 39 ADRs.
Proposed/deferred choices remain distinct from accepted proof decisions.
- M0–M4 task breakdowns with dependencies, acceptance evidence and risks,
plus M5–M14 gates in [ROADMAP.md](ROADMAP.md).
@@ -61,7 +61,7 @@ for the bounded proof; the general production ECS remains a later measured choic
| Priority | Work | Completion evidence |
|---|---|---|
| 1 | M4.4 materialize representatives | Withdraw exact shares and residuals while preserving genome identity |
| 1 | M4.5 validate resolution equivalence | Collapse 100, advance 10,000 ticks, materialize; conservation exact and distributions within a documented tolerance |
| 2 | Revisit the ADR-0031/0032 reproduction cost model | Reproduction is affordable only at the genome schema's floor; decide whether that is intended before M4 builds cohorts on it |
| Delivery gate | Add/update the dev workload when a deployable increment needs it; Argo is ready | Observe Job/pod completion separately from image publication; no World0 changes |
@@ -416,3 +416,35 @@ with, since `TransferPopulation` does not exist. All fourteen guards, including
both clamp mutations, were confirmed load-bearing by removing each and observing a
failing run. Native Release, analysis, ASan and formatting passed 36/36; Linux CI
has not run yet.
M4.4 turns whole members of a cohort back into identified individuals (ADR-0039),
and does nothing else: no transfer between habitats, no persistence and no
resolution-equivalence claim, which is M4.5. Materialization is instantaneous, at
the cohort's current tick, because advancing time is M4.3's interval.
The named risk is that re-materialization becomes free healing, and it has two
separable sources. The arithmetic one is closed outright: a drawn member receives
its class share by integer division rounded down, because rounding up would create
biomass, and a class drawn empty hands over everything it held because a class with
no members may keep no reserve. A residual is never drawable, so an expected
fractional density cannot become an individual. Age is taken as the oldest the
class admits rather than the youngest or a seeded choice within it: the exact age
is unrecoverable, so the question is which direction to be wrong in, and every
other answer lets an adversary who picks when to convert roll back towards youth.
A round trip can therefore only age someone, and oscillation is strictly lossy.
The second source is the declared resolution itself and is stated rather than
mitigated. Members inside one class are indistinguishable by construction, so
collapsing a starving member with a well-provisioned one and materializing both
returns two average members; the starving one has been healed at the other's
expense. The tests demonstrate both halves of this rather than only the flattering
one: a round trip is exact when each class holds one member, and a coarse class
conserves the total while averaging the individuals. The mitigation is the
caller's choice of classes when it collapses, not anything this code can recover.
Materialization produces exactly the record a collapse consumes, so the two
compose and are tested against each other instead of being described as inverses.
Eleven guards were confirmed load-bearing by removing each and observing a failing
run, including the two that are the risk itself: rounding shares up, and drawing
ages from the bottom of a class. Native Release, analysis, ASan and formatting
passed 37/37; Linux CI has not run yet.
@@ -0,0 +1,130 @@
# ADR-0039: Materializing representatives without making a round trip profitable
## Status
Adopted for M4.4. It turns whole members of a cohort back into identified
individuals and does nothing else: no transfer between habitats, no persistence,
and no resolution-equivalence claim, which is M4.5. No M1 to M3 contract changes,
and ADR-0036, ADR-0037 and ADR-0038 are unchanged.
## Context
M4.2 goes one way. Without the other, a collapsed cohort is a dead end and nothing
can check that collapsing was faithful. The risk named for this step is that
re-materialization becomes free healing, and ECOLOGY_MODEL adds the related
prohibitions: a conversion may not reset age, injury, fertility or incubation, an
expected fractional density is not an available individual, and materialization
stays bounded by funded biomass.
Free healing has two quite different sources and they need separating. One is
arithmetic: handing out more than is debited, or rounding a share upward. That is
preventable outright. The other is the declared resolution itself: members inside
one class are indistinguishable by construction, so collapsing a starving member
together with a well-provisioned one and materializing both returns two average
members. The starving one has been healed at the other's expense. No accounting
can recover what the resolution discarded, and pretending otherwise would be worse
than saying so.
## Decision
Materialization is instantaneous. It happens at the cohort's current tick and
never advances it, because advancing time is ADR-0038's interval and this is not
one. The revision still advances, so the registry's ordering rules apply
unchanged.
Only whole members materialize. A residual is a fraction that is owed and not
present, so it can never become an individual; it stays with the cohort. This is
ECOLOGY_MODEL's rule that an expected fractional density differs from an available
individual, enforced rather than described.
A drawn member receives its class's share, computed as integer division of the
class reserve by the class count, per channel, rounded down. Rounding down is the
whole point: rounding up would create biomass, and a share is never more than the
class held. The remainder stays with the class, except where a class is drawn
empty, in which case it hands over everything it held, one extra unit each to the
first members, because a class with no members may not keep a reserve and leaving
it would be biomass owned by nobody. A full draw therefore yields at most one unit
per member more than a partial one; that is an ordering artifact, it is bounded by
the class count, and it can never exceed what the class held.
Age is taken as the oldest the class admits, not the youngest and not a seeded
choice within it. The exact age is not recoverable, so the question is which
direction to be wrong in, and every other answer makes oscillation profitable: a
member re-materialized at the bottom of its class is younger than it was, and
repeating that is immortality. Taking the top means a round trip can only age
someone. Oscillation is then strictly lossy in age rather than free, which is the
behaviour to want from an exploit.
Conservation runs through the ledger, as in ADR-0037 and ADR-0038. One atomic
transaction debits the cohort's reservoir and credits each member's, and each
member's reservoir must be empty first, so a member's reserve is the whole of what
backs it rather than a part sharing a store with inventory nobody counted. That is
the same rule the destination of a collapse has.
What the resolution discards is stated, not mitigated. A round trip is exact when
each class holds one member and smooths within a class otherwise, and the tests
demonstrate both rather than only the flattering one. The available mitigation is
the declared resolution itself: a caller that needs a member's own reserve
preserved declares narrower classes when it collapses.
## Alternatives Considered
Choosing an age with a seeded draw inside the class is what ECOLOGY_MODEL's
"seeded rule" suggests for counts, and it is average-neutral, but it lets an
adversary who controls when to convert re-roll towards youth; the conservative
bound does not. Rounding shares to nearest would sometimes hand out more than was
debited. Handing the remainder to the last drawn member rather than spreading it
concentrates an arbitrary advantage. Refusing to draw a class empty unless its
reserve divides exactly would make ordinary states unconvertible. Letting a
fraction materialize as a member with a proportional share would turn an expected
density into an individual, which the model forbids. Reconstructing a member's
original reserve from provenance would require keeping per-member records, which
is the individual representation a cohort exists to replace.
## Benefits
A round trip can never return more than was debited, in any channel, and never
returns anyone younger. Materialization produces exactly the record a collapse
consumes, so the two compose and can be tested against each other directly. The
smoothing that the declared resolution causes is measurable and named rather than
hidden, and a caller can eliminate it by choosing its classes.
## Costs
Round-tripping ages members by up to the width of their class, which is a real
distortion in the conservative direction. A full draw yields slightly more per
member than a partial one. Ages are drawn from class bounds, so repeated
conversion pushes a population towards class ceilings. The caller supplies one
empty reservoir per materialized member, which is bookkeeping it has to do. Nothing
reconstructs injury, fertility or incubation, because a cohort never carried them.
## Risks
Materialization is not the inverse of collapse and this ADR does not claim it is.
Within a class the two are lossy in both directions, and conservation of the total
is not evidence that any individual is right; M4.5 is where matched ensembles are
compared. The conservative age rule is a defence against oscillation, not a model
of ageing, and it will make a population look older than it is under repeated
conversion. A materialized member carries the cohort's genome and its provenance
and nothing else, so it has no parentage, no history and no condition, and none of
that may be invented later from a statistical membership. Ownership remains a
single-process invariant and nothing is serialized.
## Consequences
Test that a drawn member receives the floor share and that the remainder stays
with the class, that a class drawn empty hands over everything it held, and that
neither a residual nor a fraction of a member can be drawn. Test that ages come
from the top of the class and that a round trip never returns anyone younger. Test
that a round trip is exact when each class holds one member, and that with a
coarse class the total is conserved while individual reserves are smoothed, so the
loss is demonstrated rather than implied absent. Test repeated oscillation over
many cycles: the conserved total never moves, no member ever holds more than the
largest starting member held, and ages never decrease. Test scarcity, where a
class holding nothing materializes members holding nothing rather than refusing or
inventing. Test that drawing more than a class holds, an unknown or repeated class,
a reservoir that is not empty, a repeated reservoir, a stale view and a wrong owner
are each refused, and that every rejection leaves the ledger and the registry
unchanged. No genome schema, mutation catalog, archive, ledger, episode driver,
ensemble, cohort record, collapse, interval accounting, renderer or deployment
changes.
+1
View File
@@ -31,6 +31,7 @@ Each record has the eight required sections.
0036 defines the tier 2 cohort, its declared resolution and exclusive ownership.
0037 collapses individuals into a cohort as one sampled, ledger-exact transaction.
0038 accounts a proposed interval, refusing rather than clamping, without picking a model.
0039 materializes representatives on shares that round down and ages that never fall.
Every dependency adoption records exact version/commit and integrity hash,
transitive license obligations, maintenance/security review, owner and removal
+35
View File
@@ -227,3 +227,38 @@ 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.
## Implemented M4.4 materialization
[ADR-0039](../adr/0039-materialize-representatives.md) implements
`PlanMaterialize` and `CommitMaterialize` for one cohort in one process.
`TransferPopulation` remains a contract nothing implements, and no
resolution-equivalence claim is made here.
Representatives are debited cohort shares, as this document requires, and never
anything else. A drawn member receives its class share by integer division rounded
down; rounding up would create biomass. A class drawn empty hands over everything
it held, because a class with no members may keep no reserve. A residual is never
drawable, so an expected fractional density stays distinct from an available
individual.
Age is carried, not reset, in the only direction that is safe when the exact value
is unrecoverable: a member materializes at the oldest age its class admits. Every
other rule lets an adversary who chooses when to convert roll back towards youth,
and repeating that is immortality. A round trip can therefore only age someone, so
oscillation is strictly lossy rather than free. This is a defence, not a model of
ageing, and under repeated conversion it will make a population look older than it
is.
What the declared resolution discards is stated rather than mitigated. Within one
class members are indistinguishable, so collapsing a starving member together with
a well-provisioned one and materializing both returns two average members, healing
the first at the second's expense. Conservation of the total is not evidence that
any individual is right. A round trip is exact when each class holds one member,
and the mitigation available to a caller is to declare narrower classes when it
collapses; nothing here can recover what a coarse class threw away.
A materialized member carries the cohort's genome, its habitat and a fresh
identity, and nothing else. It has no parentage, no history and no condition,
because a cohort never carried them, and none of that may later be invented from a
statistical membership.
+58
View File
@@ -1134,3 +1134,61 @@ The proof golden `d61ad5bf0c928c76`, the ecosystem fingerprint
genome fixture are unchanged, and the other 33 tests pass untouched. No deployment
manifest or image pin changed. Linux validation is pending; no Gitea result is
claimed since `b01a824`.
## M4.4 materialization
Executed on this Windows host (2026-09-24): Release configure, build and `ctest`
37/37; the analysis preset (clang-tidy 19, warnings as errors) built clean; the
ASan preset configured, built and ran 37/37; `clang-format` 19.1.5 reported no
violations. All four checks ran and passed on the committed tree. No Clang or GCC
compile happens on this host, so Linux CI remains the first such result.
`evo-materialize-tests` covers ten properties: that a drawn member receives the
floor share while the rounding remainder stays with the class, that a class drawn
empty hands over everything it held, that neither a residual nor a member that is
not there can be drawn, that taking everyone leaves a vacant record rather than an
extinction, that ages come from the top of a class and are stable when regathered,
that a round trip is exact at one member per class, that a coarse class conserves
the total while smoothing individuals, that repeated oscillation never pays, that
malformed draws and stale views are refused without changing anything, and that a
moved-from plan is whole.
The oscillation test runs twelve collapse and materialize cycles over three
members of unequal reserve and asserts three things every cycle: the ledger's
conserved total never moves, no member ever holds more than the largest starting
member held, and no member is younger than the corresponding member of the
previous cycle. Those three together are what stops a round trip being a way to
heal or to reset age. It also ends by asserting every member has been pushed to a
class ceiling, which records the cost of the conservative age rule rather than
leaving it as a claim.
Eleven guards were confirmed load-bearing by removing each in turn and rerunning.
Two of them are the named risk rather than ordinary validation, and both are
detected: rounding the share up instead of down, which creates biomass, and
drawing ages from the bottom of the class instead of the top, which returns
members younger than they were and makes oscillation profitable.
The free-healing risk has two sources and only one is closed. The arithmetic
source is prevented outright and tested. The other is the declared resolution
itself: within a class members are indistinguishable, so a coarse class heals a
starving member at a well-provisioned member's expense while conserving the total
exactly. That is not fixable by accounting and is asserted rather than avoided,
with a companion test showing a round trip is exact when each class holds one
member. Reading conservation of the total as evidence that any individual is right
would be a mistake this pair of tests exists to prevent.
Coverage limits. Materialization is not claimed to be the inverse of collapse and
no test asserts that it is beyond the one-member-per-class case. Nothing checks
that a proposed draw is ecologically sensible. A full draw yields at most one unit
per member more than a partial one, which is an ordering artifact bounded by the
class count and is not separately tested at every count. Injury, fertility and
incubation are not reconstructed because a cohort never carried them. Ownership
remains a single-process invariant, emigration escrow is still unsettled, and
nothing is serialized. The overflow and ledger-failure branches are reachable only
past bounds the tests do not build.
No existing behaviour changed. The proof golden `d61ad5bf0c928c76`, the ecosystem
fingerprint `2cd4a15f9fbe9949`, the ensemble fingerprint `5ec59d390909b526` and
the frozen genome fixture are unchanged, and the other 36 tests pass untouched. No
deployment manifest or image pin changed. Linux validation is pending; no Gitea
result is claimed since `b01a824`.