Liking cljdoc? Tell your friends :D

title: Generalized Automaton Exact-Repair Correctness Cost date: 2026-07-31 pgmcp_experiment: generalized-automaton-exact-repair-correctness-cost pgmcp_root: extending-liblevenshtein-automaton-families-4bb97598 scope: Phase 2 prime generalized automaton repair

Generalized Automaton Exact-Repair Correctness Cost

This append-only ledger records the performance cost of replacing the generalized automaton's truncating floating-point accumulator with exact scaled integer arithmetic. It also records the operation-driven acceptance and subsumption repairs that were measured with it. Correctness is the shipping criterion; the experiment asks whether exactness imposes a material runtime penalty and establishes an auditable baseline for future optimization.

The experiment and all 120 primary observations are stored in pgmcp under generalized-automaton-exact-repair-correctness-cost. Experiment 154 was an empty, superseded registration made before the criterion schema was known; it contains no measurements. Experiment 155 is the preregistered record of authority.

Definitions and implementation under test

Let an operation weight be a finite decimal number w, let S be the least common multiple of the weights' decimal denominators, and let C be the accumulated scaled cost. The treatment implements:

C' = C + \operatorname{round}(S w),
\qquad
c = \frac{C}{S}.

CostScale rejects non-finite, negative, inexact, and overflowing conversions. Consequently, the equality and ordering used by the state antichain are exact integer relations. The repair also charges suffix completion through operations from the configured OperationSet; it does not synthesize unit insertion or deletion costs. The standard Levenshtein subsumption offset theorem is enabled only for the exact standard operation set. Other sets conservatively prune only equal-control states with a dominated cost.

The following flow shows what differs between the control and treatment:

Operation weight
    │
    ├── control: truncate `f64` to `usize` ──► accidental zero-cost edges
    │
    └── treatment: exact rational scaling ──► checked integer cost
                                                  │
                                                  ▼
                          operation-driven completion and antichain pruning

Preregistered hypothesis and protocol

FieldPreregistered value
Primary scenariostate_transition/scenarios/one_error
ControlGit archive of 3f362b44012184a222a64d7f95af541fac93f748
TreatmentPhase 2-prime working tree
Expected directionTreatment slower, because more exact states may survive
Statistical testWelch independent-samples test, one-sided greater, alpha = 0.05
Minimum effectCohen's d >= 0.5
Practical envelopeTwo one-sided equivalence tests within -100%..+100%
Samples60 observations per arm after 3 s warm-up
MeasurementCriterion, 8 s measurement, plotting disabled
IsolationDistinct target directories and identical compiler flags
CPUCPU 0 pinned with taskset; performance governor

The two preregistered criteria form a conjunction: the expected slowdown must be statistically and practically detectable, while still remaining inside a two-times latency envelope. This unusual direction is deliberate: the plan predicted a correctness-related regression, so observing a speedup must reject that directional hypothesis rather than silently rewriting it after seeing the data.

Both arms used CARGO_NET_OFFLINE=true and RUSTFLAGS="-C target-cpu=native -C opt-level=3" on an AMD Ryzen Threadripper PRO 5975WX under Linux 7.1.5. Repeated samples and explicit uncertainty follow Kalibera and Jones's systems-benchmarking methodology (DOI 10.1145/2464157.2464160).

Primary result

ArmMean (ns)Median (ns)Standard deviation (ns)Samples
Control2,300.1232,299.6849.41460
Exact repair1,975.5141,968.61013.26460

The treatment was 14.1% faster, contrary to the preregistered expected direction. pgmcp therefore correctly rejected the directional hypothesis:

Statisticpgmcp result
Welch statistic-154.5888
One-sided greater p1.0
Cohen's d-28.2239
Mean-difference 95% interval (ns)[-328.7715, -320.4457]
Equivalence-envelope p0.0, passed
Mann-Whitney p0.0
Cliff's delta-1.0

The result rejects only the predicted slowdown. It does not reject the exact repair, whose correctness obligations are independently established by tests and formal proofs. The likely explanation is that checked scaled costs prevent incorrect zero-cost paths from inflating the active-state set on this scenario; this is an inference, not a separately isolated causal measurement.

Exploratory breadth sweep

After the primary decision was frozen, an explicitly exploratory 32-case sweep measured other benchmark groups. Each row reports treatment versus the archived control. These observations are useful for profiling, but they do not change the preregistered decision.

ScenarioControl (ns)Treatment (ns)Change
operation/delete424.286707.695+66.80%
operation/insert563.690892.919+58.41%
operation/match450.747860.057+90.81%
operation/substitute516.318762.780+47.73%
realistic/color-colour932.6851,416.848+51.91%
realistic/definitely2,359.9842,299.578-2.56%
realistic/gray801.1121,058.935+32.18%
realistic/organize1,464.8222,027.390+38.41%
realistic/theater1,306.4181,772.089+35.64%
distance/0459.288602.044+31.08%
distance/11,043.4191,208.420+15.81%
distance/22,304.1091,970.359-14.49%
distance/33,192.8972,748.498-13.92%
input-length/3388.616780.330+100.80%
input-length/5788.4281,313.303+66.57%
input-length/82,120.8111,848.669-12.83%
input-length/122,352.3402,016.021-14.30%
input-length/152,363.4572,030.524-14.09%
scenario/exact1,411.0562,261.877+60.30%
scenario/one-error2,376.4362,004.999-15.63%
scenario/reject-three2,174.9961,214.600-44.16%
scenario/two-errors2,660.1791,775.358-33.26%
word-scale/5649.1761,232.354+89.83%
word-scale/101,459.2522,455.737+68.29%
word-scale/152,291.4033,679.278+60.57%
word-scale/203,093.5684,752.799+53.63%
subsumption/exact-11,136.5431,644.285+44.67%
subsumption/exact-21,588.4082,479.197+56.08%
subsumption/exact-31,703.1863,265.501+91.73%
maximum-state/1344.831571.657+65.78%
maximum-state/21,769.476782.118-55.80%
maximum-state/35,092.8011,047.738-79.43%

Eleven cases improved and 21 regressed. The arithmetic mean change was +28.96%; the geometric mean change was +17.41%. The best case improved by 79.43%, while the worst case was approximately 2.008 times the control. This heterogeneity confirms that future optimization must target measured state-set and operation-dispatch costs, not weaken exact arithmetic or operation-driven semantics.

Correctness and verification evidence

LayerEvidence
Example testsFractional boundary: six operations of weight 0.15 accepted under budget 1; seven rejected
Unit testsExact rescaling, finite/infinite empty-side rates, unsupported arities, operation-driven completion
Property tests2,000 cases each for operation-order minimum, antichain idempotence, empty-side rates, Hamming no-deletion behavior
IntegrationPublic generalized-state and operation-rate suites exercise the exported surface
RocqCompletion charging, exact rescaling, conservative/certified subsumption, antichain and rate invariants
Verus16 verification conditions discharged
SMT12 negated obligations are unsat in both Z3 and cvc5

The formal invariants are intentionally mirrored as property tests. The proof artifacts establish the bounded mathematical model; the randomized tests verify that the Rust representation and operation ordering refine that model.

Decision and retained work

IDVerdictJustification
P2P-CORRECTretainedFractional weights are no longer truncated and completion is derived from the operation set.
P2P-PERFretained with profiling evidenceThe primary treatment was faster and remained inside the preregistered envelope; exploratory regressions identify optimization targets without invalidating correctness.
P2P-SUBSUMEretainedClassical offset pruning is certified only for the standard set; conservative dominance is sound for arbitrary sets.
P2P-ARITYretainedUnsupported operation geometries return a typed error instead of being silently misinterpreted.

Reproduction

The registered benchmark is generalized_automaton_benchmarks. A comparable local run is:

CARGO_NET_OFFLINE=true RUSTFLAGS="-C target-cpu=native -C opt-level=3" \
  taskset -c 0 cargo bench --bench generalized_automaton_benchmarks -- \
  state_transition/scenarios/one_error --warm-up-time 3 \
  --measurement-time 8 --sample-size 60 --noplot

Raw primary observations, arm metadata, frozen criteria, and the server-side decision remain in pgmcp. The repository retains only this compact scientific record and the benchmark source; transient build trees and logs are not source artifacts.

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