Liking cljdoc? Tell your friends :D

Phase 11: weighted-position collapse gate

Status: fallback implemented; full-suite verification pending.

Pre-registered decision

The expanded plan made the _f64 collapse optional. Its gate was defined before this implementation work:

IDHypothesisDecision rule
F64-H1Position and PositionF64 can share one representation without changing behavior or the integer hot-path layout.Pilot only the two position modules. Continue into state, transition, pool, intersection, and query code only if the pilot preserves behavior under the complete suite.
F64-H2If F64-H1 fails, sharing only the subsumption relation removes meaningful drift at a small blast radius.Retain both representations; factor the Standard/OSA/MergeSplit decision tree through one carrier-generic helper; prove and property-test equivalence to both legacy formulas.

Evidence

The pilot found four load-bearing differences:

DimensionInteger positionWeighted positionConsequence
continuation statesix typed PositionKind values plus an aux byteone Boolean special flagone representation would erase Damerau delta and affine-layer state or add unused weighted state
carrier/APIpublic num_errors: usizepublic accumulated_cost: f64a generic public field would be a breaking rename and would not preserve both APIs
memory contract24-byte compile-time assertion on 64-bit targetsfloating carrier with different padding and orderinga generic payload risks widening the integer transition hot path
semanticsexact integer comparison; true-Damerau and affine variantsepsilon comparison; weighted realignment; no true-Damerau stategeneric storage does not imply one lawful transition or subsumption contract

These are semantic differences, not duplicated syntax. F64-H1 is therefore rejected before changing either representation.

The fallback adds src/cost/subsumption.rs. subsumes_with<M> owns every shared variant-state branch. An internal SubsumptionCost: CostMonoid extension retains the exact carrier-specific comparisons; subtraction and index scaling do not pollute the public monoid contract.

Verification results

EvidenceResult
generated unit-cost equivalence propertypassed
generated weighted epsilon-equivalence propertypassed
focused Rust run2 passed, 0 failed
Rocq generic-carrier equivalencepassed
Verus Rust-shaped exact-unit model2 verified, 0 errors
Z3 unit-integer and weighted-real counterexample search2 unsat
cvc5 unit-integer and weighted-real counterexample search2 unsat

Verdict

IDVerdictJustification
F64-H1rejectedThe representations encode different state machines, public APIs, layouts, and lawful arithmetic. A whole-family collapse would be a redesign rather than deduplication.
F64-H2accepted, subject to the full-suite gateThe shared helper removes the structurally duplicated decision tree while property and formal models preserve the two machine formulas exactly.

No state, transition, pool, intersection, or query family is collapsed. That work remains outside the accepted gate unless future evidence supplies a representation that preserves all four differences above.

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close