HoldFast loan-analysis diagnostic
The diagnostic proposes loan ends and reports conflicts and obligations from explicit flow facts. Source acceptance needs additional checks. Core promotion contract
Input and composition
The Python API accepts a finite control-flow graph with named owners, field
projections, named invariant clauses and parent-linked shared or exclusive
loans. lower_function and lower_module build graphs from schema-2 ASTs.
analyze_function and analyze_module combine lowering and analysis.
Events cover loans, receiver reservation and activation, accesses, moves,
capture bindings, uses, per-conjunct invariant opening and closing
(open ... lifts), outcome-specific returns and unsupported suspension.
Boxes, optional values, cells, callbacks and protocol wrappers use the same
explicit loan and capture facts. Call names, source spelling and pointer
inequality give no authority, owner identity or field partition. Unknown
overlap leaves an obligation.
For supported implicit ref calls such as buf.Update(buf.length), reserve
before the read and activate after it. A live overlapping view conflicts
at activation. Fixed-field receiver views reserve and activate one loan for
each selected field. Indexed and growth-sensitive views require a separate
range proof.
Receiver timing ·
Fixtures
Names must be unambiguous per path. Children stay within parent footprints and shared parents grant only shared children. Validation rejects missing references, duplicate node identities, malformed edges, self-loops, irreducible cycles and nodes without a path to an exit. Supported natural loops reach a header fixpoint by propagating demand and state across back edges. Diagnostic locations follow forward edges within a traversal. Source termination has separate requirements. Loop rules
The analyzer combines backward demand with forward abstract interpretation.
Joins and loop headers merge states with equal handles, loan routes and
footprints, invariant debts, owner availability and relevant binder history.
Conditionals with only ended local loans therefore need one state per join.
Limits bounds owners, nodes, captures and work. Its path limit bounds
distinct join states and terminal reports. Exhaustion raises
AnalysisRefusalError before publication.
Analyzer ·
Promotion contract
Inference and obligations
States track captures, active and suspended loans and per-conjunct debts. A handle with different incoming grants retains distinct states. Equivalent states share subsequent flow and combine prior issues and restoration evidence. Backward demand follows transitive captures and loan ancestry. Forward analysis detects competing access, use before creation or after move, and invalid reborrows. Infer ends at last use, descendants first. Each end records a restoration obligation with path and location. Restoration proof, cleanup, tracked disposal and verdict handling remain separate duties.
For a symbolic bound such as a + m <= b, the diagnostic needs an earlier
proof that m > 0 on the same path before it records a and b as
distinct. Whole-value writes to m, including through a mutable argument,
invalidate that positivity fact. Dynamic offset guards involving shadowed
names leave separation to a separate proof.
The diagnostic records strict index separation where a non-strict comparison
is false, for example on the continuation after if (i >= j) { return ...; }.
Each short-circuit failure edge carries only the facts established along that
edge. For i <= j && i >= j, either failure proves the indices distinct.
If an unrelated conjunct can fail with equal indices, the diagnostic retains
an overlap obligation on that path.
Each link of a comparison chain
adds facts to its own success or failure edge. The next operand is evaluated
once and only after the preceding comparison succeeds. A later operand can
use separation established by an earlier link, and writes to either index
invalidate the fact before the next comparison or the branch body.
Every while guard runs before either successor. The true edge contributes
facts to the loop body, and the false edge contributes facts to normal exit.
An explicit break carries the facts at the break site to the exit join.
Control-flow cases
Access needs a grant unsuspended by overlapping descendants. Disjoint fields stay accessible, and unknown projections or aliases leave overlap obligations. Nested member and index accesses retain the route of the originating handle through grouping. Index expressions are evaluated in projection order. A copied scalar can outlive the loan, and a competing grant before the last projected read reports the original grant, the competing grant and the use. Core loan rules · Source and Rocq replay
An explicit return summary can transfer a shared view of a declared borrowed parameter, retaining ancestor restoration duties and suspending overlapping parent access. Scoped ancestry survives moves, nested reborrows, wrapper captures and unscoped descendant returns. The error sibling restores locally. Local-owner or exclusive escapes produce diagnostics. Returned closures must include transitive captures. Suspension and open invariants leave unsupported cases or open obligations.
Reports record conflicts, obligations and path-specific ends and escapes. Source acceptance requires checked restoration, captures, effects and interpretation.
Using the diagnostic
loans.py exposes immutable graph/event
records and analyze(owners, graph, limits). Run its focused behavioral checks
with python tools/run.py test --only test_holdfast_loans --jobs 1 on Windows
or python3 tools/run.py test --only test_holdfast_loans --jobs 1 on Linux.
The graph below models one path that returns a view and another that writes
to its backing after the view becomes dead.
from toolchain.loans import Access, Borrow, Graph, Loan, Node, Owner, Place, Return, analyze
input_place = Place("input")
report = analyze((Owner("input", borrowed=True),), Graph("lend", (
Node("lend", Borrow(Loan("view", "input", input_place)), ("ready", "error")),
Node("ready", Return("Ready", ("view",))),
Node("error", Access(input_place, "write"), ("rejected",)),
Node("rejected", Return("Rejected")),
)))
The Ready path retains the shared view and suspended parent footprint. On
Rejected, no later use demands the view: its proposed end precedes the write,
and its restoration remains an unresolved obligation. PathReport keeps those
outcomes separate. Issue describes a detected conflict or unsupported operation;
Obligation and Restoration retain unresolved premises. AnalysisRefusalError
means malformed input or incomplete exploration and returns no report.
Use reads through a handle's retained loans or reads an owner root. Bind
retains captures without accessing their contents. Move transfers a
descriptor's availability.
Drop removes availability without running resource disposal or extending a
dead loan's demand. Moving an owner root is an explicit Access(..., "move");
partial owner moves remain unsupported. Array projections use "*" and retain
explicit overlap/containment obligations. Whether a Graph is constructed
directly or lowered from a schema-2 surface AST via lower_function /
lower_module, its owner and projection facts remain explicit inputs rather
than proved source semantics.
Acceptance
The loan tests check structural refusals, path-local demand, move and transitive capture accounting, symbolic overlap, restoration order and returned outcomes. The join fixtures exercise three alternative exclusive routes and a write that conflicts with only one incoming footprint. An independent branch-demand oracle checks conflict and restoration locations while varying each branch's reads and writes. Unsupported operations and budget exhaustion have distinct refusal cases.
The abstract resource certificate supplies
successor points from the graph entry to a declared exit. Replay checks each
edge and executes the instruction stored at its source point. The
scoped lending replay
checks the last write and restoration on connected paths of the explicit
else variant of the mixed-exit fixture.
With a fixed abstract owner element and frame, it refuses a regrant after
removing either back-edge restoration and refuses an exit after removing either
break restoration. Controls also remove edges and attempt an overlapping direct
owner write while the element loan is active.
Conditional borrowing comparison
The first release requires proof-backed separation and path-sensitive loan analysis in ordinary builds. These comparisons exercise the current mathematical frontend and measure precision and cost on specific workloads. Default borrow checking A comparison under client qualification freezes independently reviewed client behavior, expected decisions and the compared guarantee endpoints. Pin the compiler/analyzer revision and configuration, explicitly distinguishing original Polonius from Polonius Alpha. Pin the selected Ante design and identify its implemented subset; a design example supplies no compiler verdict. Supplied graph diagnostics and source checking have different endpoints.
Run python tools/run.py holdfast-borrow-compare with the pinned Rust nightly
installed through rustup and its host linker available. The command checks the
compiler revision, replays the default and the explicit NLL, legacy Polonius
and Polonius Alpha modes, and validates diagnostic codes and source lines. It runs
the observation tests for accepted configurations and records the fixture
digests and compiler flags. The higher-ranked callback replay also runs with the
next-generation trait solver. Recorded comparison
Nested row invalidation
The nested-row client starts with three nonempty rows. It borrows row i,
clears row j and observes the first byte of the borrowed row after the
clear. The indices must be below two and different. The observation includes
all three rows after the operation, with a third row to check the frame.
Equal or out-of-range indices leave every row unchanged and produce no byte.
On the default mathematical frontend, the Nat inequality justifies the
shared in rows[i] and exclusive ref rows[j] arguments to the helper. The
coincident and guard-free controls are refused at the exclusive argument.
Rocq checks the returned byte and restored vector for arbitrary row contents
and indices in the emitted model. The pinned Rust modes and Ante reject the
direct and coincident forms. Rust's split_at_mut rewrite and Ante's
separate named row owners pass the 16 observation pairs. The HoldFast result
ends at the mathematical model. HoldFast fixture ·
Rocq replay ·
Rust fixture ·
Ante direct fixture ·
Ante rewrite
On the default mathematical frontend, local element borrows (let x = in coll[i];
and let x = ref coll[i];) over Vec<T, n>, Seq<T>, Span<byte>, and
Slots<T, capacity> are also checked directly without helper-call workarounds.
At each later read or write of a bound element borrow, the elaborator checks that
reachable owner updates preserve the element index and that any conflicting peer
borrows created afterwards on the current or joined control-flow paths have proved
index separation.
Direct indexed fixture ·
Direct indexed replay
On a lane with Cargo and a C compiler, add --ante-checkout CHECKOUT to the
comparison command. It verifies the pinned checkout and submodule,
builds the compiler from an isolated copy with its lockfile and C backend,
checks both invalidation diagnostics at the live read and executes the
accepted rewrite. Run
python3 tools/run.py test --only holdfast_borrow_comparison --require-toolchain
on the guest for the HoldFast verdict and kernel replay.
Ante prerequisite
Branch-local view use
A shared one-byte slice of values[i] is created before a branch. On one
path the caller reads through the slice, overwrites values[i] and returns
the saved byte. On the other path the guard i != 0 proves that the write to
values[0] preserves the slice before the caller reads it. When i == 0
on that path the caller skips the write. The default mathematical frontend
checks the reachable owner write history at each read. Using the view after
the first path's overwrite or changing the second write to values[i] is
refused at the affected read.
HoldFast fixture ·
Checked replay
The four pinned Rust modes reject the direct spelling at the disjoint write
and reject both overlapping controls. The safe rewrite splits at i on the
path where the view remains live. It uses split_at_mut's usual bounds
check and passes the shared returned-byte, writeback and frame observations
for all 16 tested inputs.
Rust fixture
Lending filtering loops with borrowed returns
The range-loop fixture marks skipped elements on the continue path and can
return early with a read-only Span<byte> borrowed from its ref owner.
The mathematical elaborator checks the loop invariant at entry and on each
iteration. It checks that writes on the returning path preserve the slice.
The generated NatFold uses a Unit + R tag to freeze the result and owner
writeback after an early return and includes the fallthrough exit.
Lending filter source ·
Lending filter replay
A lending filter can return a view and initialize a separate out parameter.
The hit initializes the selected index before returning the view. Exhaustion,
including an empty range, initializes the index on the fallthrough path. The
checker applies the same initialization obligation to early and fallthrough
returns in a while loop.
Parameter modes ·
Initialization replay
A lending range with explicit branches checks the current index against the
range bounds. On break, it checks the invariants at that index. On a
continuation, it checks them at the next index and proves that any declared
measure decreases. A conditional continue skips the remainder of its
iteration, including a later break, and carries its writeback to the next
iteration. Separate continue, break and early return guards before a
borrowed return retain their writeback on exit. The statements that follow
each guard are checked under its false condition. An exhaustive Boolean match
with unguarded true and false arms uses the same path checks, regardless
of arm order. When one arm always exits through break, continue, or
return, the remaining body is checked under the surviving arm's guard and
writeback. This includes nested blocks and
nested conditionals whose arms both exit. The surviving arm's local names
expire and its using resources are disposed before the remaining body.
A symbolic break or continue crossing an iteration-local using boundary
is refused at the resource declaration. A using scope that encloses the
whole loop permits those loop exits.
A borrowed return must survive the writes on its path.
Scoped cleanup
Rocq checks the view, descriptor restoration, byte writeback and frame for a hit, a break, an early error return, exhaustion and an empty range starting at the upper bound. Source · Replay
A while loop can carry a shared borrowed input while updating a separate
record. Its early return checks the borrow's declared region. Returning an
input from an unrelated region is refused at that return. Rocq checks the
returned byte, record writeback and untouched field in the emitted model on
early, ordinary and zero-trip exits.
Source ·
Replay
A returning while can also carry a mutable Span<byte> parameter. Active
iterations require a positive termination measure. Each continuing path must
preserve the invariant and strictly decrease that measure. The mathematical
replay checks descriptor restoration, the updated prefix and untouched bytes,
and caller reuse on early, ordinary and zero-iteration exits.
Source ·
Replay
Symbolic mutable Span<byte> collection iteration supports successive
top-level Boolean guards whose true branches end with break or continue.
An explicit else can pair a break on one branch with a continue on the
other. Both paths write back and restore the element loan before leaving the
iteration. A break leaves later elements untouched. Every back edge restores
the element loan before the next grant.
Rocq checks the returned count, the owner bytes after either break, normal
completion and empty iteration, and the frame outside the iterated range.
Guarded break source ·
Mixed exit source ·
Mixed exit replay
Symbolic Span separation
For indexed call arguments into the same collection, any exclusive loan needs
proved index separation from overlapping candidates. For two slice views, the
checker compares their footprints relative to the same owner. The guard
i < j && j < 4 allows a shared loan at i and an exclusive loan at j.
Rocq checks the result, writeback, preserved frame, and unchanged failure
state. The pinned Rust modes reject the direct call and its coincident neighbor.
Their split_at_mut rewrite passes.
HoldFast replay ·
Rust fixture
For view[i] beside owner[j], the checker adds every slice offset to i.
.ReadOnly() preserves the offset and extent. For example, after two slices
starting at offset 1, separation from owner index j requires
j != 2usize + i. An earlier write or fill must preserve a slice on every
reachable branch. A pending update from another mutable argument can leave
the check unresolved.
Owner-coordinate replay
If different branches select different slices, the checker verifies readability, bounds, and owner-relative separation on every path reaching the call. A conditional return checks that intervening writes miss the returned slice and that an error exit restores the owner. Correlated call replay · Conditional return replay
When a joined path keeps a view of values[i], the checker checks each branch's
writes against the branch facts. Writing index 1 when i == 0 and index 0
otherwise preserves the view. Writing index i fails. Rocq checks the result,
writeback, and frame. The pinned Rust modes reject the direct form and
accept a rewrite with a runtime get_disjoint_mut check.
HoldFast replay ·
Rust fixture
The correlated-return fixture selects the slice at index 0 on one branch and index 1 on the other. A write to the opposite index preserves each slice. A write to the selected index or a write controlled by an independent condition fails. The pinned Rust modes reject the direct form and accept moving view creation into each branch. Correlated return replay · Rust fixture
A range loop can write 9 to every index in [0, n) while a shared view at
index 3 remains live. The bound n <= 3 establishes separation.
With only n <= 4, the return fails because the loop can overwrite index 3.
.Fill follows the same half-open interval rule for empty and adjacent ranges.
Rocq checks the original byte, updated bytes, and unchanged error state.
HoldFast fixture ·
Kernel replay
foreach (ref byte element in values) over a symbolic-length Span<byte>
lends elements in order and writes back before ending each loan. break
writes back the current element, checks the exit invariant, and leaves later
elements untouched. Competing accesses and retained views fail.
Lending replay ·
Early-break replay
A guarded if (condition) { ...; continue; } writes back the current element
before lending the next one. Only the fallthrough path executes the rest of the
body. The loan graph records the last write on each path, and Rocq checks the
count, byte writeback and untouched frame for the elaborated loop.
Guarded continue replay
A type-qualified interface call that returns an exclusive associated item
from one named ref argument retains that argument's loan until the item's
last use. The pair cursor writes through one item, lends again, and writes
through the next item. Rocq checks the complete owner state for either
starting step. Moving the first write after the next lend is refused at the
second grant. The four pinned Rust modes agree on both decisions, with Ante
outside the implemented comparison subset for this case.
HoldFast replay ·
Rust fixture
The mathematical elaborator, region solver, and loan analyzer also exercise these cases.
| Case | What the fixture checks |
|---|---|
| Locations and regions | Location-sensitive origins and subsets, covariance for in, invariance for ref and shared ref, explicit Outlives<'a, 'b>, and disambiguation between region parameters. |
| Higher-ranked callbacks and associated items | FnMut and FnOnce bind fresh regions. A result cannot escape through an outer capture. A lending iterator resolves its associated item through its implementation. Callback replay · Iterator and callback replay |
| Exclusive returns and nested writes | Prophecy and writeback for conditional and loop returns, nested reborrows, and partial field moves with reinitialization. Exclusive return replay · Loop cursor replay · Partial move replay |
| Aliased mutation | shared ref and the store-threaded cell models invalidate facts about overlapping storage and preserve disjoint facts. The checks cover shape-stable scalars, fields and elements, union updates that preserve the tag, and a Slots.Push with available capacity. Shared mutation replay |
| Symbolic separation | Preconditions and assertions establish index separation. Distinct branches keep their own facts. Disjoint subslices and two-dimensional indices allow independent writes, including under r1 != r2 || c1 != c2. Subslice writeback replay · Field and two-dimensional replay |
| Reservations and diagnostics | Two-phase receiver calls check reservation and activation. Conflicts identify the loan origin, competing use, and last use or proposed end. Receiver replay |
| Resource certificates and comparisons | Rocq replays the loan certificates and audits the soundness statements. The comparison matrix records the Rust and Ante configurations and decisions for paired cases. Certificate replay · Soundness audit · Comparison suite |
A while loop can carry an exclusive loan of a fixed nested record field.
The mathematical replay checks the returned byte and full restored owner on
the empty, early-return and ordinary exits. A caller writes through the restored
owner after each outcome. Writing the enclosing record field
while the loan remains live is refused at the write. Rebinding a loan declared
outside the loop requires a represented loan route across the back edge. The
frontend reports that case at the rebinding assignment.
Carried loan replay
For loop restructuring comparisons, keep the original loop and move one use past the write for the conflicting case (freezing place, last use, and expected restoration per path). Recent 2025–2026 analyses and proof-engineering comparators include:
- MoveLight regex path summaries (OOPSLA 2026 · Lean artifact) summarize structural projections across borrows. Retain explicit control-flow liveness and checked index and range arithmetic.
- Wu, Wang, and Chen forward Polonius abstract interpretation (Nov 2026 preprint): compare write-site alias decisions on the common fragment and record preserved places/CFG edges.
- Local commutation diagrams (Reynaud Michez, JFLA 2026): structural proof-engineering comparator for HoldFast's mechanized CFG soundness (
tools/rocq/loan_soundness.v). - Creusot's scaled prophecy encoding (Denis et al., HAL
hal-04816198): reference for preventing ghost-state and prophecy causality loops when combiningghost/trackedstate withrestores/finalcontracts. - RefinedRust OOPSLA 2026 (Gäher et al., DOI
10.1145/3839484): Iris/Rocq comparator for traits, closures, and iterators composed over low-level memory.
Record unexpressible features (e.g., HoldFast-specific resource exits), replay exit restorations, and benchmark against the same budgets. Separate loan reasoning from generic resolution across:
| Client | Required distinction |
|---|---|
| Returned view on one branch, owner updated on its sibling | Update after view's last use succeeds; update before view use conflicts. |
| Iterator lending a mutable element from its receiver | Next iteration proceeds after prior loan ends; overlapping element loans conflict. |
| Generic callback valid for each fresh input lifetime | Noncapturing identity view returns input loan; storing view in longer-lived state violates callback contract. |
| Generic iterator with an associated item | Resolve item equality via independently imported instance, report genuine ambiguity, and preserve both outcomes under import reordering. |
Pin the Rust edition, revision, flags, and dependency closure. Use ordinary
receiver rules for receiver cases, the pinned Polonius modes for loan cases,
and the next-generation solver for generic cases. Record required proofs,
annotations, unsafe, runtime checks, and rewrites.
Rust two-phase borrowing ·
Rust trait solving
Report accepted, semantically rejected, unsupported, and incomplete cases. An open obligation remains incomplete even when the diagnostic finds no conflict. A parse or unrelated type failure gives no borrowing verdict. Claim a precision gain only when HoldFast accepts a matched case that the baseline rejects on borrowing grounds, replays the required guarantees, and rejects the corresponding conflict. Record graph size, branches, captures, budgets, and cases that exhaust a budget. Limit findings to the tested workloads and evidence endpoints. Measurement and sampling
Borrow research trials
holdfast-borrow-compare --mfdd [CHOICES] compares ordinary finite-graph
analysis with reduced decision diagrams over branch choices on a generated
acyclic graph. Each choice swaps two exclusive field grants. The second
workload writes to a place overlapped by a grant on one incoming route.
Analysis compares path-specific conflicts, grant and use locations, and
restoration destinations. The compact witness records a branch choice for
the conflict and retains a guard for each restoration. The report samples
time, peak Python allocations, and serialized witness bytes on the same graph.
The solvers count different operations and the expanded witness comparison
still enumerates paths. The trial supports one to eight choices.
Map family decision diagrams ·
Place Capability Graphs ·
Trial
holdfast-borrow-compare --research-origins compares derivatives of
tree.next*.payload against explicit field loans for enclosing, nested,
and sibling writes. It also compares the region solver with a forward
analysis that reports invalidation at a later use. Both recover the invalidating
write when a transferred loan is used on that branch. Both accept a write
on the sibling branch that exits without another use. The trial covers a
fixed field repetition and local origin transfer.
Projection and origin trial ·
Forward abstract interpretation
holdfast-parser build-package WORKSPACE LOCK --borrow-origins includes
possible input roots observed at each source exit.
Direct calls to the resolved built-in Ok and Err constructors identify
their corresponding exits. Unclassified exits have a null outcome. An empty
observed_inputs list supplies no negative provenance guarantee. Alternative
routes at one source span can contribute to the same observation. The build
checks the source, loan analysis, and locked module graph before publication.
Callers rely on the declared region and restoration contracts for permission.
Return-origin report ·
Vx borrow clauses
holdfast-borrow-compare --swiftc PATH checks
an input-derived view, sequential iterator access, and attempted escape or
overlap of a view whose lifetime depends on the iterator. The tool reports
an unavailable or different compiler as unsupported.
Swift comparison runner ·
Swift borrowing iteration
The movable owning handle trial models transferring a release duty to a cleanup holder while a child loan remains live. The child grants determine when the holder can dispose of the fixed backing. The trial checks normal and early exits, writeback and frame, and refuses early disposal, relocation, and duplicate cleanup. The source rules for transferring a release duty through a closure require their own capture and lowering derivations. Borrowability calculus
Opaque loan interfaces
The minimum outcome tag study derives how many public cleanup orders a caller needs and how that number changes when a producer combines independent returns.
The model treats a callee and a caller that exchange view descriptors with a fixed public layout while keeping the route choice private. For one public outcome, the callee has a fixed inventory of returned handles and its contract accounts for every feasible route. The caller may branch on an already represented outcome. Each branch checks all routes with that outcome. If the caller can observe a route distinction and branch on it, the model needs that observation in the public outcome.
Restoration. A closed handle stays closed. Closing a handle requires its dependent handles to be closed first. Direct owner access requires the handles blocking that access to be closed. Each command has a fixed public target and the script accumulates the same closed handles on every feasible route where it can run. Access leaves the inventory and routes fixed. Consequently, the pointwise union of prerequisite sets accepts a script exactly when every route accepts it. If two private routes disagree about which of two handles must close first, the combined interface permits neither initial close. A represented outcome can identify a route and recover its valid order. When every prerequisite is a public handle, each deduplicated requirement list has at most as many entries as the public inventory. Restoration theorem · Size bound
Source-event budgets. For one backing owner, associate each feasible route with the subset of returned handles that refer to that backing. Each handle has a fixed nonnegative count of a named event, such as a source read through the handle. The owner receives the sum over that route's subset. A finite, nonempty route summary admits exactly the same upper-bound queries as another summary if and only if their downward closures under subset inclusion are equal. Equivalently, retaining the inclusion-maximal subsets is sufficient. To distinguish different closures, ask for one event per handle in a subset that only one closure covers. Its bound is the subset's cardinality in that closure and strictly smaller in the other. Feasibility is tracked separately. Budget characterization
For example, two shared views can select one buffer each, swapping which view points to which buffer. A second implementation can select the same buffer for both views. The per-handle possible and necessary origins agree. Reading once through each view has a tight bound of one event per backing for the first contract and two for the second. Marginal comparison · Budget comparison
Composition. A caller may bind two shared formal inputs to the same actual backing. A query asks whether a single feasible forwarding map sends every selected handle into a given set of origins. Two forwarding contracts compose by passing an intermediate subset between their queries, provided every pair of feasible maps for the two calls is jointly feasible. Contracts with identical weighted bounds for every singleton formal origin can give bounds of one and two when two formals share a backing. If the two calls instead share a private choice, their joint feasibility relation determines the composition. Composition theorem · Aliased actuals example · Shared choice example
Exact balance. For each of n independent pairs of lanes, a callee
chooses a route and charges one event to the selected lane. A continuation
charges an event to the other lane of each pair. Exactly one event per lane
is guaranteed precisely when the callee's charge and route agree at every
pair. Each sound summary case formed as an independent product of a route
set and a charge set can cover at most one of the 2^n feasible pairs. A
disjunction needs 2^n such cases. The joint relation has a linear-size
description using one shared bit and two fixed charge alternatives per pair.
Exact balance and lower bound
The Rocq trials model public handles, fixed close and access scripts, and
route-independent event demands within each public outcome. The exact balance
trial models the arithmetic of a complementary continuation. Its execution
would need a represented descriptor that supports the complementary operation
and a checked proof of disjointness. These event counts belong to HoldFast's
trace dimension. Relating them to a binder's NatExact or NatBound demand,
or to a machine observation, requires its own correspondence proof.
Resource dimensions ·
Package trial
The comparison targets the precision and size of independently published loan summaries. Place Capability Graphs already encode path choices and modular borrow flows. Viper handles quantified permissions, Outcome Separation Logic can express joint outcomes, and RaRust uses prophecy potentials for amortized costs through borrows. Granule integrates ownership with graded typing, and dependent multiplicities already express value-indexed demand. The downward-closed summary is a finite instance of the lower powerdomain for possible outcomes. Place Capability Graphs · Viper quantified permissions · Outcome Separation Logic · RaRust · Granule ownership · Dependent multiplicities · Powerdomains and modality
Replay with python tools/run.py test --only test_holdfast_loan_interfaces --require-toolchain
on Windows, or use python3 on Linux and WSL. The suite audits the named
theorems and their kernel dependencies.
Replay suite
Two-phase receiver qualification
Release qualification checks the
two-phase receiver rule with
buf.Update(buf.ReadCount()) on a whole-object receiver and a by-value count.
Compare traces with a count snapshot where the earlier read observes the same
state. Include a computed receiver, an effectful argument before the read, and
a failure before activation after an earlier ownership transfer. Check that the
receiver and each reached argument are evaluated once in source order, and
replay the resource predicate on each exit.
Use neighboring calls with an overlapping mutation or move during argument
evaluation, a shared argument or capture live at activation, and an explicit
ref argument followed by an overlapping read. Each fails at its responsible
permission check. The corresponding disjoint named-view case succeeds even
when the shared loan is retained. Promotion requires source correspondence and
the core borrow obligations.
A record can declare a fixed view such as view Payload = Left, Right;.
An executable method with in this.Payload receives a shared grant for
each field. A method with ref this.Payload reserves an exclusive grant
for each field before argument evaluation and activates the grants before
entry. The body accesses the receiver through explicit selected fields.
Writeback updates only those fields in the caller. The mathematical slice
checks scalar results and exclusive receivers on records with independent
fields and no declared record invariants.
Fixture ·
Frame replay