# Workflow and artifact comparison

Adoption criteria and conditional trials for bounded copying, packed bitsets
and private queues use the [release endpoint](../../language/first-release/#release-boundary).
[PLAN.md](../../plan/) tracks active work.

<a id="commissioning-disposition"></a>

## Comparison prerequisites

Commission only with a consumer blocked by the retained route, checked primitive and
representation laws, reproducible implementations, an independent baseline, and
an estimate with a stop threshold. Add a suffixed [checklist item](../../plan/#checklist-conventions).
Use pinned Sail or qualify its replacement under the [whole-system contract](../../extensions/unified-source-contract/).

## First-release qualification and adoption

Assess the [bounded first release](../../language/first-release/#release-boundary) along three dimensions.

| Decision | Acceptance and stop rule |
| --- | --- |
| Technical feasibility | Checked concrete primitive/representation laws plus a source-connected useful component at its declared endpoint. Missing laws, vacuous entry states, or exhausted investigation budgets halt dependent work with a named blocker. A weaker endpoint cannot pass. |
| Recurring developer value | Measure authoring, annotation, review, and repair separately across an independent client, contract change, representation change, and semantics-preserving refactor. Record diagnostics/checking latency, resource costs, and unsupported patterns; hidden manual rewrites or repeated proof reconstruction count against the result. Freeze tasks, baseline, and material-benefit criteria before observing results. |
| Product adoption | Record establishment, shared maintenance, per-client costs, and measured target envelopes. Projected amortization must state workload and uncertainty; two initial small clients need not repay all foundations. Must identify an independently reviewed useful benefit and acceptable recurring cost without weakening mandatory guarantees. |

Preserve correctness, authority, confidentiality, declared termination and progress, and hard admission limits. Compare performance at the same
endpoint and target. Optimizations may trade size, cycles or reserved space within a separately reviewed envelope. Report all affected cases and
dimensions, including regressions. Averages cannot excuse safety or hard-budget failures. A performance verdict requires target data.

For the bounded-copy comparison, expanding beyond the two clients requires a
measured net saving after charging their share of setup and maintenance. For
the release adoption decision, freeze the actual workloads, required evidence,
target limits and benefit thresholds before the trial. [Accounting and decision thresholds](#accounting-and-decision-thresholds)

### What a caller can prove from the public contract

Before building, the held-out author freezes legal inputs and resource permissions
independently of provider preconditions, plus per-exit observations, a distinguishing
input and provider choices. Weaken a law
and find a legal input permitting two outcomes. Require the independent expectation
to reject the wrong result and the original proof to lose its guarantee. Restore
the law and replay. [Wrong-store case](#change-and-weakening-probes)

For compatibility, prove old legal calls meet new preconditions and that every reachable exit preserves promised values, resources, effects and
termination. Test a stricter precondition that excludes an old witness. Requiring four readable bytes excludes the validator's legal three-byte packet
with disjoint writable eight-byte destination and removes its framing-error guarantee.

Build the caller using only published laws and computational definitions. Repeat after private representation changes with renewed locks and artifact
evidence. Log repaired provider laws, caller edits and private facts learned. Credit proof reuse when the unchanged caller code and proof replay.
[Provider proof work](#representation-transfer-comparison)

### Reviewing a public contract change

Diff locked interfaces and evidence by changed claim and affected caller. Record gained and lost premises, results, authority, effects, leakage,
progress and bounds. Show transitive assumption changes and paths, including trusted foreign dependencies added behind an unchanged signature.

The source comparison binds each solver-trusted obligation to the authored
declaration containing its source location. Changing that declaration's
syntax appears as a removed assumption and an introduced one, even when the
public contract and normalized obligation name still agree.
The ledger names the fully qualified authored declaration for assumptions
owned directly by a public declaration. Trust expansion on an unchanged
public declaration remains visible when the same comparison adds or changes
other public declarations.

The ledger also compares the foreign, environmental and project assumptions
declared in locked package inputs. It records each assumption's kind, name,
provenance, owning package, dependency path and declaration scope. A new
premise, a change of provenance or a broader scope counts as expanded trust,
even when the frozen caller replays against both releases. Narrowing a
package-wide premise to a declaration preserves its prior coverage there.
Selectors resolve against declarations in the owning package. An unresolved
selector or malformed assumption input refuses the comparison.
[Assurance policy](../../extensions/assurance-profiles/)

Prove [prior caller obligations](#what-a-caller-can-prove-from-the-public-contract) at the claimed endpoint. Discharge new premises from prior
assumptions with checked evidence or leave them open. Apply [API evolution rules](../../language/first-release/#public-api-evolution) to intentional
changes. Independent review checks for weaker behavior even when compatibility checks pass.

The locked package comparison accepts frozen caller bytes through
`--client-source` or a module selected by `--client-module` whose exact bytes
agree in both locks. If the source names a locked module in either build, its
bytes must match that module. A `--client-rocq-check` needs either form of caller
input. The replay record identifies the common source and optional check by
digest. A source-verified compatibility verdict requires successful Rocq and
`rocqchk` replay of the selected caller or caller-domain witnesses. An authored
comparison without such a replay reports `review-incomplete` when it finds no invalid input,
breaking change or trust-policy violation. The verdict covers the obligations
exercised by the replay. [Package comparison command](https://github.com/symbiogenesis/HoldFast/blob/main/tools/README.md#commands)

When an authored prior postcondition changes or disappears, the comparison
checks that the frozen caller's generated proof uses that clause from the
resolved opaque declaration. The candidate caller must replay against a
postcondition of the same declaration. A successful call or an unrelated
proof leaves review incomplete. The report identifies the used and uncovered
clauses by their one-based order within each declaration's `ensures` clauses.

Each changed precondition needs an admitted caller-domain witness for its
declaration on both sides of the comparison. The witness makes a direct call
to the resolved public declaration, and the comparison records its module on
each side. A witness given as an expected refusal must be refused by both
versions. Admission by either version fails the expectation and blocks a
compatibility verdict.

The comparison reports the first contradictory entry requirement for each
affected public callable, with its declaration, source location and release.
A private helper's empty domain and an impossible postcondition antecedent
remain available as authoring diagnostics.

Exercise both kinds of change across two clients.

- Keep the valid short-packet input and test two changes to the validator's
  preconditions. Requiring four readable bytes removes the short-input witness.
  Contradictory entry bounds eliminate all legal inputs. Both changes fail
  compatibility with the old contract. [Packet validator](../../language/first-release/#first-slice-qualification)
- For the importing client, keep reachable exit witnesses and a wrong result
  that a weakened promise admits. Replay with the provider opaque. Replace
  one discharged premise with a declared external assumption and check that
  the review names the assumption, the affected claim, and the violated policy.
  Then restore the original proof and assumptions.

#### Reusing a retained caller proof

For an unchanged caller and contract, retain one caller proof and the pins of
its exact subject. Check each implementation under its own lock and supply its
conformance proof when instantiating the retained caller theorem. Replay the
same caller proof bytes for both bindings. Report the caller and contract
identities, each provider's lock and proof identity, and the kernel assumptions.
The [retained caller trial](../../tooling/elaboration-prototype/#retained-caller-proof-trial)
checks this at the source-verified endpoint. Deployment requires fresh
[exact-image evidence](../compiler-route-contract/#equivalent-artifact-endpoint)
for each new native realization.

#### Reusing a compiled caller

Freeze one caller object, its checked proof, and a public ABI that hides the
provider's private layout. Bind two separately checked providers to that ABI.
Record the unchanged caller object and proof identities, each provider's
object and evidence identities, and the resolved call destinations in both
images. Verify the ABI, layout and relocation obligations for each link under
its target and context premises. Refuse an incompatible ABI, a changed call
destination, and a receipt for the other image. Each installed image must earn
its own [exact-artifact admission](../compiler-route-contract/#equivalent-artifact-endpoint).

The [retained native caller trial](https://github.com/symbiogenesis/HoldFast/blob/main/tools/README.md#retained-native-caller-trial)
checks the separate-compilation boundary on the host. It compiles the frozen
copy-service observation client once, cold-replays the HoldFast sources for
two `RingHeader` layouts, and runs the caller against both native links. The
report binds the objects and images and checks the direct calls against the
object relocations. The deployed proof and purecap ABI are obligations of the
target trial.

### Cost of the verified abstraction

Match the handwritten baseline's behavior, guarantees, resource bounds, target, ABI and backend. Trace surviving checks, failure branches, copies and
allocation to lowering and the [admitted image](../compiler-route-contract/#equivalent-artifact-endpoint). Review lowered calls and inlined bodies. A
proof-only argument, stored witness or branch fails erasure.

Report code bytes, stack, peak storage, traffic and cycles on agreed exit paths using instruments or checked bounds. Charge proof checking to
developer effort. Apply frozen thresholds once equivalent baseline and target measurements exist.

### Packed bitset qualification trial

A [bitset design comparison](https://willcrichton.net/notes/verus-lean-bitset/)
motivates a conditional held-out exercise of packed machine words, erased
dependent bounds and in-place iteration. Use this fixture when the represented
[scalar](../../plan/#q25aw), [ownership](../../plan/#q25ay) and
[lowering](../../plan/#q25az) producers support a named consumer that needs
these operations. Freeze the contract, independent baseline, relevant evidence
endpoint, bounds, budget and stop criteria under the
[commissioning prerequisites](#comparison-prerequisites). This adds neither
a release gate nor a third adoption client to the packet and copy-service
trials. Missing support remains a named blocker for this trial, not a reason to
expand the release.

Freeze an independently reviewed extensional set model over the finite domain
`[0, domain)`, the admitted inputs, public operations and their observations
before adaptation. For the packed provider, prove that the represented word
count is the ceiling of the domain divided by the fixed word width, each
initialized word corresponds to membership of the indices it covers, and all
padding outside the domain is zero. Prove representability
of word counts, byte extents, indices, and allocation or storage requirements;
do not rely on a possibly overflowing addition before ceiling division.
Distinguish a maximum arithmetic input from a feasible storage witness.
Use reusable machine-word and quotient/remainder lemmas with checked
arithmetic and bit-operation semantics. In particular, do not shift by the
word width when treating a domain that ends at a word boundary. Keep runtime
lengths that drive computation and erase bounds evidence. The representation
remains private to the provider.

Require empty construction, membership, insertion and subset testing to agree
with the frozen set model. Prove equivalence of wordwise and extensional
subset tests using the padding law. Use a destination with exclusive access
and a disjoint shared source for union over equal domains. Equal word counts do
not imply equal domains (for example, domains 1 and 64). Prove domain
equality separately; self-aliasing is outside this contract. In a single
pass, union updates the destination in place to model the set union of the
two entry values, preserves both domains, the source and the unrelated frame,
restores every borrowed element loan, and reports a change if and only if the
abstract destination set differs from its entry value. Prove that bitwise OR preserves
zero padding and keep unaffected invariant conjuncts active under
[selective lifting](../../language/reference/#contracts). Establish the
initialized extent and padding invariant on every return. Compare the
idiomatic paired iteration (lending each mutable destination word alongside
its shared source word) with a matched indexed loop. Require checked
prefix/suffix, footprint and restoration laws, using the existing
[iteration contract](../../language/first-release/#sequence-models-and-iteration).
Record unsupported paired iteration rather than assuming every iterator
composes or replacing it silently with indexing.

Freeze legal witnesses including empty, duplicate insertion, equal, proper
subset, disjoint and partially overlapping sets. At 64-bit word width include
domains 0, 1, 63, 64 and 65, with members at the final legal index and
across word boundaries. Cover the largest arithmetic domain and
representability boundaries symbolically, without enormous concrete
allocations.
Exercise malformed padding, mismatched domains, out-of-range indices,
overflow, a shift by the word width, overlapping storage grants and
uninitialized words as negative neighbors at the intended invariant,
precondition or representation boundary.
For admitted calls, independently reject a wrong change flag, a missing word
update, a padding mutation, an unrelated write or a lost restoration. A false
precondition must not pass the proof by removing a legal witness. Follow the
existing [capacity-invariance gate](../../language/first-release/#qualification)
for represented storage and proof/certificate structure rather than unrolling
one proof per element.

Audit the cost of proof and abstraction using the
[proof review and replay rules](#proof-search-and-replay-under-change) and
[measurement protocol](#measurement-record-and-sampling). Freeze a private
representation change and replay the same opaque caller proof with renewed
provider conformance and artifact evidence under the
[retained caller protocol](#reusing-a-retained-caller-proof). Use the same
public membership and union laws; do not require callers to know the packing.
For an eliminated bounds check, trace its discharged proof to the actual
operation; record surviving redundant checks and retain checks still required
by representation or admission. Compare proof-only edits for equality of the
erased executable and inspect actual lowering, representation layout, storage
traffic, traversal count, allocation
and remaining checks against the matched single-pass baseline. Require the
packed union to introduce no auxiliary allocation, boxed elements, second
traversal or runtime proof witnesses; report any regression. A source proof or
host execution does not establish those costs at the
[exact-artifact endpoint](../compiler-route-contract/#equivalent-artifact-endpoint).
Report costs and benefits only at matched
[evidence endpoints](#review-and-evidence-endpoints); apply the
[cost-of-abstraction contract](#cost-of-the-verified-abstraction)
with frozen thresholds, not a claim that Lean or Verus has matching target
assurance.

### Representation-transfer comparison

The package trial's representation-change probe begins with standard Rocq relations, explicit transport lemmas, and generalized rewriting over a client-needed pure value representation. Freeze public laws, baseline, and repeated steps before comparing automation; reprove changed instance laws, replay generic caller theorems unchanged, and track handwritten transport, generated terms, review, and repair separately. CHERI memory, ownership, and primitive laws keep their foundation owners.

[CoqEAL/Trocq candidates](../verification-strategy/#existing-tooling-and-implementation-owners) (including Trocq's [TOPLAS 2025](https://doi.org/10.1145/3737283) modular parametricity transfer without univalence or extra axioms) become options only if that baseline exposes recurring automatable work and a new checklist item prices their prover/plugin closure, port, licence reading, and maintenance under the locked prover/assumption policy. Stop on budget exhaustion, unresolved compatibility/assumptions, or missed predeclared maintenance-benefit criteria (retaining native transport and checked lemmas). Generated proofs must establish the exact same relations and client laws without stronger preconditions or weaker results.

#### Bounded FIFO ring trial and disposition

[proof_transfer_trial.v](https://github.com/symbiogenesis/HoldFast/blob/main/tools/rocq/proof_transfer_trial.v) (`ProofTransferTrial`, 13 audited theorems, zero axioms under `Print Assumptions` and `rocqchk`, zero `graded_cbv_span_carrier` imports) and [proof_transfer_trial.py](https://github.com/symbiogenesis/HoldFast/blob/main/tools/toolchain/proof_transfer_trial.py) compare the native explicit-relation baseline (`ring_rel`, `native_transfer_fifo`, `native_transfer_count`, `native_transfer_full_refusal`, 134 handwritten LOC) against HoldFast's in-tree [QuotientTransfer](../../extensions/quotients-relational-sessions/#surface-quotients-adaptt-and-trocq-transfer) candidate (`RepCast` + `TrocqRel` `R2b`/`R4`, `trocq_transfer_fifo`, `trocq_transfer_count`, `trocq_transfer_full_refusal`, `trocq_r4_equiv_fifo`, 103 handwritten LOC, 1,724 emitted Gallina bytes) across a representation change from an abstract `ListRing` to a wraparound head/count/fixed-array `CircularRing` with identical client laws and preconditions, plus negative controls (`insufficient_class_refused` and `broken_relation_counterexample`). Under the locked [Rocq 9.3.0 opam closure](https://github.com/symbiogenesis/HoldFast/blob/main/tools/opam/rocq.lock) (`rocq-core.9.3.0`, `rocq-stdlib.9.2.0`, 35 packages, zero plugins), warm cached Rocq compile and `rocqchk` timings are 10.50 ms and 16.05 ms respectively (cold `proof_transfer_trial.v` compile + `rocqchk`: 1.88 s and 8.34 s).

| Candidate | Version | License | Required plugin / library closure | Locked Rocq 9.3.0 compatible | Disposition |
| --- | --- | --- | --- | --- | --- |
| CoqEAL | `2.0.3` | CeCILL-B / MIT | MathComp + Hierarchy-Builder + ParamCoq | No | Declined |
| Trocq | `0.2.0` / TOPLAS 2025 | MIT | Coq-Elpi + Hierarchy-Builder plugin | No | Declined |
| HoldFast `QuotientTransfer` | in-tree (`Q25cg`/`Q25ep`) | Apache-2.0 | `rocq-core 9.3.0` + `rocq-stdlib 9.2.0` (minimal CIC, zero plugins/axioms) | Yes | Adopted |

**Disposition:** Keep the native explicit-relation baseline in the package trial and adopt HoldFast's zero-axiom in-tree `QuotientTransfer` (`R0`–`R4`) for parametric transfer; decline pulling CoqEAL or Trocq-Elpi plugins into the locked Rocq 9.3.0 TCB. [Trial tests](https://github.com/symbiogenesis/HoldFast/blob/main/tools/tests/test_holdfast_proof_transfer_trial.py)

## Clients and baseline evidence

**P (parser destination initialization)** fills a fixed destination and checks
a ring descriptor copied into it once. **S (private service staging)** is the
held-out client. It copies from a disjoint source into private storage.

Use the [VerifiedOS foundation map](https://github.com/symbiogenesis/VerifiedOS/blob/main/docs/hardware/cheri-foundation-map.md) for producers, representations, and gaps; [DescriptorCheck](https://github.com/symbiogenesis/VerifiedOS/blob/main/tools/bedrock2-lowering/DescriptorCheck.v) models the read-only header check, and [CopyRingService](https://github.com/symbiogenesis/VerifiedOS/blob/main/proofs/CopyRingService.v) specifies abstract read counts/extent. Entry requires runnable byte-copy baselines at the endpoint, checked CHERI byte and scoped resource laws, and actual ring/staging declarations. Freeze immutable revisions and digests; mark missing inputs `unavailable`.

### Freeze and independence

For P, freeze operational definition, intended behavior, implementation, theorem subjects, and assumptions before adaptation; baseline author works independently of generated output, and authoring costs require contemporaneous records.

For S, freeze and hash interface, generic theorems, concrete instance, and qualified environment before adaptation. If S informs the interface, reclassify it as development and name a fresh held-out consumer, owner, baseline, and budget with independent pre-observation review.

Name experiment author, baseline author, and a reviewer independent of implementations and oracle checks; observe [licensing rules](https://github.com/symbiogenesis/HoldFast/blob/main/COPYRIGHT.md#terms-this-tree-does-not-carry) for incorporated tools.

## Operational subset and observations

Use total, sequential byte code with fixed destination capacity, runtime length, erased bounds, explicit failures and a scoped callback loan. Each
candidate has one executable definition and independent behavior review. Track provenance and regenerate generated code, representations and proofs.

Keep runtime lengths and discriminants. Bind byte order, word widths/overflow, capability provenance/bounds/permissions, initialization, layout and
owner-to-byte correspondence to admitted CHERI semantics.

Freeze capacity `C`, stable readable source extent, exclusive destination and source/destination disjointness. Check capacity, indices, lengths,
relative bounds and symbolic overflows. Derive target inputs from the frozen owner to avoid copying layout constants.

### P: composed positive client

P combines the selected mechanisms in one executable definition and theorem:

1. Enter a scoped callback with destination owner, stable source read authority, and runtime length `n`; validate `n` against source extent and `C` before any source read, destination index, or pointer calculation.
2. Zero-fill the entire destination using a total repeatable callback returning `0`, capturing only stable public values with no competing destination loan, allocation, or external effect (invocation count matches destination bound; capture and write permissions proved separately).
3. On invalid `n`, return the declared invalid result with the initialized destination owner restored. Otherwise copy the source prefix once into the private destination and run descriptor validation strictly against the private destination.
4. Return success carrying runtime `n`, its bound witness, and initialized destination owner, or invalid carrying the initialized owner and failure evidence. Neither exit leaks the scoped loan or alters destination capacity, and success excludes session-table validation left to the receiver.

Every exit preserves the source and unrelated frame, fully initializes the
destination, and restores ownership once. When `n` is admitted, the destination
holds the copied prefix followed by zeros, even if `Descriptor.descriptor_check`
rejects the header. When `n` is refused, the destination stays zero-filled and
there are no source reads. Resolve any differences in failure-path writes before
freezing the trial.

Exercises R-05-124 destination initialization, R-12-012a receiver validation, and selected descriptor encodings; full parser, session validation, cross-compartment init, Byzantine peers, and atomic-snapshot theorems remain out of scope.

### S: held-out staging client

S applies the frozen generic disjoint-copy interface to private staging. Its baseline locks M7.1's lifetime, capacity, initial state, result, and exact failure status against `svc_op_record` (left open in the statement artifact). Freeze payload extent `d` separately from storage capacity `C`, prove `d <= C`, and test both boundaries (staging slack allows no larger payload). From an initialized destination, copy admitted `n` bytes preserving suffix, source, and unrelated frame, returning the owner on both success and failure; rejected lengths/extents refuse with no source read or destination write.

Success payload equals the first acquired source prefix (verify `copy_once` by varying a modeled later image with fixed prefix). Adversarial atomic snapshots, concurrent SPSC, publication, notification, cancellation, DMA, and revocation require separate connection evidence.

Compare each client strictly to its matched baseline (preserving P/S init differences); generic operations must support both without client-specific CHERI facts in the generic theorem.

## Selected composition and rejection cases

Every row below must compose in P; missing mechanisms mark the trial unavailable until separately owned and priced (isolated feature examples supply no evidence).

| Interaction in P | Positive obligation | Well-formed negative neighbor and intended failure |
| --- | --- | --- |
| Stable indices and erasure | Runtime `n`, fixed `C`, erased `n <= C` witness in bounded copy; retain success/error tag | Erase `n` while branching on it, or reuse bound witness after changing bound: fail phase/stale-bound check |
| Mutation and dependency | Fill/copy update contents while preserving shape; consume old content facts | Justify final payload from pre-fill snapshot: fail memory representation or postcondition |
| Scoped loans and results | Both branches return full owner and end loan | Return loan in error payload, or error without owner: fail escape/restoration |
| Reusable callable, effects and count | Invoke zero-byte callback across loop indices with permitted captures, no external effect | Call consuming callable twice; hide captured destination write/alloc; alias capture with exclusive output: fail usage/effect/disjointness |
| Typestate and branch joins | Fill establishes whole init before either exit; result variants carry distinct bound/status facts | Skip fill iteration yet claim whole init, read uninit byte, or claim success on error: fail init or branch postcondition |
| Name and instance resolution | Local renames, qualified buffer ops, and unrelated imports preserve resolved constants | Silent representation/effect instance switch: require preserved meaning or explicit ambiguity |
| Dependent computation and automation | Compute bounded cases; replay equation lemmas and exact transitive assumption audit | Global UIP, open generated obligations, or stuck concrete term: fail assumption, completeness, or computation |

Use the locked prover's existing definition/conversion rules (proved equality for the selected decidable index is allowed; global axioms are not). Saved search reconstructions must replay without the search service.

Straight-line borrow inference, returning a loan beyond the callback, disjoint-field/nested reborrow inference, resizing, suspension, cancellation, handlers, concurrency, general grades, and a new frontend are **unavailable in this pilot**. General isolation, observation policy, and binary-leakage composition are **outside its source claim** ([core design](../../language/core-design/) covers wider mechanisms); SPSC, DMA, and atomic snapshots are **inapplicable to the sequential slice**, not proved absent.

### Expected behavior, witnesses and mutations

Before candidate proofs start, an independent reviewer freezes expected bytes/status and checks from contract/format (never treating the candidate as its own oracle). Supply inhabited entry states covering:

- Empty, 1-byte, full, and `C + 1` inputs (S also tests `d` and `d + 1` with nonzero staging slack; P covers all operation variants and truncated field positions).
- Last valid and first invalid indices; malformed tag, direction, content, and optional-deadline discriminants; invalid flag; distinct distinguishable byte positions to catch swapped reads/stores.
- Receiver-relative offset/length boundaries and word-width wraparound (retain proof case and report unexecutable large cases as unavailable rather than shrinking inputs).
- Destination residue distinct from source bytes, nonempty surrounding frames, adjacent disjoint ranges, and rejected overlap; verify source and frame bytes on all exits.

Freeze syntactically valid wrong-store, off-by-one, omitted-fill, bad-failure-result, and second-image mutations reaching target obligations; classify malformed/stillborn, intended kill, unrelated failure, timeout, unsupported, and survivor (any survivor fails). Use [oracle, seed and QuickChick](https://github.com/symbiogenesis/VerifiedOS/blob/main/tools/README.md#the-three-generators-and-what-each-answers) where supported with independent spec review and test guards kept out of theorem premises. Name per-guarantee theorems (dropping a frame theorem while keeping op laws must fail P); profile flags and source ownership alone give no adversarial isolation.

### Change and weakening probes

Shrink P's accepted bound from `C` to `C - 1` (nonzero `C`, needing an inhabited `n = C` witness). Old claims/cached feedback must turn stale/fail pre-repair; re-review expected tables, regenerate, renew source/representation/artifact evidence, record all edits, and apply the same edit to baseline before comparing repair cost.

Drop S's copied-prefix equality while keeping bounds, init, frame, and status: wrong-store passes the weaker spec but must fail independent nonuniform expected-byte checks (otherwise record a spec gap and refuse; inhabitance, proof completion, and memory safety cannot close it).

Test semantics-preserving local rename + helper extraction, unrelated import, and law-preserving instance representation change: reprove changed instance laws and replay generic theorems unchanged. Separate saved-term replay from tactic/search rediscovery (seed, limit, reconstructed proof). Changed source maps, constants, representations, contracts, or dependencies invalidate evidence despite unchanged goal spelling; new holes, admissions, or undeclared assumptions fail R-05-018a/R-05-018b under exact R-05-163.

## Measurement record and sampling

Generate a report from the machine logs and retain the raw logs, units,
predicates, instrument revisions, and uncertainty. Use `unknown` for missing
values and `n/a` for inapplicable fields. Record zero when the evidence
establishes zero.

| Record family | Required identity or observation |
| --- | --- |
| Trial | Contract/review revision, P/S identity and development/held-out status, named authors/reviewer, entry decision, case selection |
| Source | Baseline/candidate source closure + commit; operational def + independent behavior; representation/erasure; source maps, resolved names, elaboration/desugaring, imported contracts |
| Proof | Rocq/library/plugin versions + config; interface/instance digests; theorem constants + transitive assumptions; batch, assumption, `rocqchk` evidence; search seeds/limits |
| Target | Profile, pinned Sail term/config; compiler, optimizer, assembler, linker, composer versions/flags; ABI, link context, layout; memory classes/slots; final image + evidence digests |
| Effort | Event records (setup, learning, authoring, review, failure diagnosis, regeneration, proof repair, shared maintenance); diffs across source/contract/glue/proof; duplicate executable tracking |
| Host measurements | Diagnostic latency; cold and warm batch/kernel replay elapsed, CPU, max RSS; worker count, machine, cache state |
| Target measurements | Per-case code bytes, stack, peak storage, alloc/runtime support, memory accesses, target cycles with derivation/instrument |
| Decisions | All positive/negative outcomes, first failed obligation, mutation class, change invalidation, spec-gap status, endpoint cost comparison, decision |

Record UTC event ordering with monotonic intervals (`actor`, `owner`, `category`, `start/end`, `id`); pause authoring during unattended builds, charge diagnosis separately, keep overlaps unsummed, and log all agent attempts plus integrator review.

Observe authoring and held-out adaptation once with original logs (learned repetition invalidates independence). Time batch artifacts via 1 cold + 1 unreported warmup + 5 warm runs; replay positive/edit/negative diagnostic sequences 5x alternating workflow order; report raw durations, nearest-rank p95, median, max, and environment IDs (re-run only interrupted rounds, labeling both). Diagnostic latency spans edit completion to source-bound feedback on first unsatisfied obligation (`stale`/`unfinished` resolve no obligation; timeouts keep `timed-out`, not cached success). Batch/latency timings never substitute for acceptance or authoring effort.

Compare C#/Dafny and Rust/Verus only on matching bounded algorithms/behaviors, logging unsupported features, manual restoration, and endpoint (weaker endpoints allow navigation/location/latency comparison only, never CHERI authoring claims; commissions no install, port, or LSP).

### Proof search and replay under change

Before editing, freeze the enabled checking tiers, solver settings and limits
on inference, search and kernel replay. Apply the same limits to candidate
e-graph tools, the in-tree SMT checker and the Rocq proof harness. Replay with
search disabled and audit the resulting assumptions. When a limit is exhausted,
report the open proposition, source site, local facts and limit. Record latency,
remaining goals, proof changes and fresh replay time. Hosted applications set
their own limits. The copying pilot has fixed thresholds.
[Checking tiers](../verification-strategy/#layered-proof-and-staging) ·
[Proof harness](../completion-log/#q25fp-stand-up-agentic-rocq-proof-engineering-harness) ·
[Pilot thresholds](#accounting-and-decision-thresholds)

Review generated and handwritten proofs for maintainability as well as
discharge. Preserve the independently reviewed public contracts and intended
executable abstraction: avoid inlining, redundant copies of operational
definitions, flattened iteration, or additional runtime work solely to make
search succeed. Keep the independent behavior specification distinct from
duplicate operational code. Allow justified refactors preserving the frozen
behavior, evidence and resource bounds; record every such rewrite and its
justification, review effort, additional annotations, reused versus
repeated proof facts, and proof/implementation edits under the change probes.
Keep general lemmas at their semantic owner, with explicitly scoped automation
and controlled unfolding; local proof facts must retain their establishing
path and dependencies. Automatic context enrichment proves facts from
existing authority and valid snapshots, never creates a loan or permission.
Report goals with meaningful local hypotheses and source locations rather
than requiring the author to reconstruct the search context. Review AI-suggested contract edits independently, and charge all agent
attempts, discarded proofs and human review to discovery and repair. Passing
kernel replay is necessary but does not replace this review.

For the packet and independent package trial, track per-goal discharge methods, consumed defs/instances/assumptions, replayable certificates, and exact source/target/checker bindings, exercising:

1. Replay saved evidence cleanly with search off; log certificate replay separately from proof discovery.
2. Change a semantic dependency while preserving goal syntax: show staleness pre-replay; replaying an old certificate for a different proposition must fail at that obligation (cached success flags prove nothing).
3. Exhaust automatic search on a provable goal; insert the missing lemma at the reported site and replay within the same limit.
4. Reprove a private provider representation preserving public laws and recheck the unchanged caller; report rediscovered vs replayed proofs and per-side repair effort under [invalidation rules](../../language/core-design/#typed-holes-and-invalidation).

#### SMT solver trial

Freeze the packet and copy-service obligations, premises, representations,
tool revisions, options, limits and decision thresholds. Record which goals
fall outside the supported quantifier-free fragment. For each eligible goal,
HoldFast generates a certificate for its in-tree Rocq checker. In a separate
comparison on the same formulas, cvc5 emits CPC proofs for Ethos and Alethe
proofs for Carcara. Z3 supplies a comparison verdict. Confirm counterexamples
against the original obligations. The WSL trial records each checker's results
and the exact tool and dependency versions.
[Supported fragment](../verification-strategy/#certificate-producing-smt) ·
[Trial results](../completion-log/#q25fe-trial-certificate-producing-smt-on-release-obligations) ·
[External tool inventory](https://github.com/symbiogenesis/HoldFast/blob/main/THIRD-PARTY.md#q25fp-and-q25fe-local-wsl-development-tools)

Bind saved evidence to the exact source obligation, premises, semantic
dependencies, encoding, certificate and checker identities. Replay with search
disabled in the locked Rocq environment and audit the transitive assumptions.
Exercise a false neighboring goal, a certificate for an encoding with an altered
bound or word width, a changed dependency with identical goal text, an
unsupported rule or unresolved proof hole, and a timed-out search. Each control
must leave its obligation open at the expected site.

Report Rocq-accepted discharge counts, remaining goals by reason, proof search
and cold and warm replay times, certificate sizes, and manual proof effort.
Use the frozen thresholds and the cost of maintaining the exact solver and
checker closure to decide whether to offer an optional host tool. The
[first-release endpoint](../../language/first-release/#release-boundary) remains
independent of the trial and packaging decision.

## Accounting and decision thresholds

Freeze selection thresholds pre-run; protocol changes require a new identity and fresh runs.

| Parameter | Threshold | Ground and interpretation |
| --- | --- | --- |
| Correctness and evidence | All positives hit endpoint; all negatives fail intended obligation; zero new assumptions, stale accepts, or undetected weakenings | Conjunctive guarantee; safety failures never average out |
| Interactive diagnostic latency | p95 <= 2 s on frozen incremental sequence | Local edit-loop usability distinct from batch replay cost |
| Replay limit | Warm <= 10 min; cold <= 30 min | Bounds edit/rebuild loop (timeouts stay undecided; repeated timeouts reject adoption) |
| Held-out recurring effort | Candidate upper bound <= 0.90x matched baseline lower bound (incl. learning, adaptation, review, probes) | Predeclared margin above recording uncertainty, not a forecast |
| Full accounting boundary | Conservative `NetSaved` > 0 at endpoint | Both pilot clients must repay attributable setup and shared work pre-expansion |
| Native footprint and runtime support | Stack/peak storage <= baseline; zero new alloc/runtime support; hard bounds unchanged | Prevents buying speed with a larger resource envelope |
| Native code and cycles | Executable code size and per-case cycles <= 1.05x baseline; zero hard-bound regressions | Experimental ratio exposing per-dimension failures |
| Selected optimization | Cycles <= unoptimized on all cases; total optimized code bytes <= unoptimized | Retains only Pareto-dominating optimizations unless separately reviewed |

Account for all attributable work from initial qualification through P, S, and
the change probes at the claimed endpoint. Close the source ledger first, then
add measured artifact work. `NetSaved` is the total matched baseline effort
minus candidate effort, library establishment, shared maintenance, and concrete
instance work. Charge each cost once in the ledger below and credit only
measured consumers, targets, and edits. [Reuse criteria](../verification-strategy/#where-time-might-be-saved)

| Term or shared cost | Unique owner and treatment |
| --- | --- |
| Library/interface establishment `L` | Proof-tool qualification, interface design, initial learning counted once |
| Shared maintenance `M` | Common interface/tooling owner; client repair stays on client series |
| Concrete instance `P_j` | Concrete/foundation work counted once at consuming endpoint (investigation separate from implementation) |
| Baseline client effort `B_i` | Q2b (P) and M7.1 (S): matched source, proof, review, maintenance, baseline prerequisites |
| Candidate client effort `A_i` | Measured adaptation + maintenance incl. learning, integration, review (S shared adaptation counted once) |
| Representation, lowering and final evidence | Representation/lowering/optimization/artifact producers' evidence; artifact comparison pays own integration |

Separate full establishment, post-freeze remaining work, and recurring maintenance; count common foundations once via transparent allocation; keep sunk baseline costs intact (another owner's needed source-to-byte work is not sunk); missing history makes full-establishment comparison `unknown`.

Report attended human hours, summed agent hours, machine elapsed time, CPU
time, and calendar duration separately. Identify the trial series and evidence
endpoint for each claim. Compute conservative `NetSaved` from baseline lower
bounds and upper bounds on all costs deducted. If any bound is missing, report
`unknown`. Define how the trial counts duplicate executable source files and
changed operational lines. Accepted candidates have one executable implementation.

Correctness/evidence failure rejects integration; missed effort/native thresholds reject expansion at that endpoint while keeping component proofs; missing logs/unsupported interactions/insufficient timings leave the trial **unopened or undecided** (unmeasured future projections never shrink estimates).

## Target and production artifact protocol

Freeze a P/S-capable CHERI target and producer closure under the provisional profile and compiler duties, recording revisions, full options, representation, ABI, code/data placement, memory classes, link env, and schedule (missing fields block comparison).

Match target, backend, and env identically across manual/generated pairs (incl. refused inputs); compare optimized vs retained unoptimized output from the same source closure varying only eligible optimization switches (cross-backend comparisons belong in [compiler-route comparison](../compiler-route-contract/)).

Measure code bytes, stack, per-class peak storage, runtime/alloc support, and memory/capability traffic alongside functional model behavior. Cycles require a timing-annotated model (not retirements, host wall time, or unqualified counters). Replay deterministic initial states verifying identical results/cycles; worst-case claims need exhaustive finite coverage or checked bounds (sampled maxima and symbolic overflow proofs are not WCET).

Requires accepted workflow results, reviewed fault model where applicable, and compiler/optimization/assembly/link/image/admission evidence at the [exact artifact endpoint](../compiler-route-contract/#equivalent-artifact-endpoint). Promote the exact exercised optimized image bound to fresh source, image validation, admission, resource, and security evidence (any byte/relocation/link/config change invalidates and blocks until renewed; digest checks identity only; never recompile/patch/rewrite accepted bytes).

Apply [Q1's limits](https://github.com/symbiogenesis/VerifiedOS/blob/main/docs/implementation/contracts/product-gate.md#2-the-limits) keeping `host_elapsed`, `target_model_cycles`, `fpga_observed`, and `silicon_measured` separate (latency/operating-point evidence needed to convert cycles to wall time; pilot proves no unexercised product workload).

## Review and evidence endpoints

Require legal entry witnesses, intended failures and frozen expectations that
reject wrong outcomes. **Source-verified** requires source proofs.
**Artifact-connected** adds checked lowering and linking to exact bytes.
**Production-qualified** adds admission, resources, security and target evidence.
Hardware refinement and silicon measurements have separate endpoints.

## Private linked queue trial

The [post-release trial](../../plan/#q25ea) uses an independent FIFO client that enqueues owned values, borrows the front and dequeues. A full
enqueue returns the offered value and preserves the queue. Publish capacity, sequence and per-exit ownership. Use address-stable nodes with private
capability links. Prove the live chain models the sequence, the tail terminates it, live and free slots partition the pool, and front views borrow
live payloads. Head and tail may alias on a singleton.

Freeze empty, singleton, multi-node and full witnesses. Drain and reuse a singleton slot, then enqueue and drain multiple values. Check FIFO order,
returned ownership and the frame. Require a live front borrow to block removal and name both sites. End the borrow and repeat. A tail pointing to a
freed singleton must fail the invariant. Change slot order, reprove provider laws and replay the unchanged client.

Match capacity, guarantees, target and admission against an independent baseline. Under the [measurement protocol](#measurement-record-and-sampling),
freeze thresholds for loads, stores, branches, runtime calls, code bytes, peak storage, capacity checks, overhead and provider/caller effort.
Concurrent readers need a separate estimate and proof of delayed readers, ordering, linearization and quiescence. [Sharing and
reclamation](../../extensions/interior-mutability/#immutable-publication-and-reclamation)
