Place Calculi, Partial Moves, and Field-Sensitive Borrowing
Prerequisites. Direct starred prerequisites: none. No later core chapter depends on this route.
Let
Prefix overlap is necessary but does not determine how a move changes the context. Featherweight Rust answers with destructive reads and lexical lifetimes. Oxide v4 answers with loan sets, continuation-aware collection, and an ordered stack. Their signatures and proofs remain separate.
Places overlap by prefixes
For the field-sensitive presentation, let
Definition 48.1 — Overlap and separation¶
Projection paths with different roots are separated. With the same root, two paths overlap when one field sequence is a prefix of the other. Write
Referenced from 2 locations
Thus
Exercise 48.1¶
Classify all six unordered pairs drawn from
Referenced from 4 locations
Featherweight Rust: one frozen ownership core
The core left values, types, and selected terms are
Definition 48.2 — Destructive and nondestructive reads¶
Referenced from 2 locations
These operations are distinguishable even when they return equal integers: copy preserves future access; move consumes the owner.
Typing is flow-sensitive:
Definition 48.3 — Borrow exclusion¶
A unique access to
Referenced from 2 locations
The source core has no named fields, so the next trace belongs to the stated projection extension. It exposes the invariant without enlarging the Featherweight Rust theorem boundary:
Lemma 48.4 — Projection-local invalidation¶
In the projection extension, moving
Referenced from 2 locations
Proof of Lemma 48.4 — Projection-local invalidation
Proof. The environment update descends along the selected field path and replaces that leaf by
Exercise 48.2¶
Starting from
Referenced from 4 locations
The Featherweight Rust safety theorem
A runtime state
Lemma 48.5 — Borrow invariance¶
Suppose
Referenced from 4 locations
Proof of Lemma 48.5 — Borrow invariance
Imported proof. This is Lemma 4.9 on printed p. 29 of [Pea21], at the Featherweight Rust state, store-typing, lifetime, and flow-sensitive typing judgments frozen in this chapter. The source proof is the rule induction given in its Appendix 9.2. Its conclusion is exactly the well-formed extension by the fresh anonymous result binding displayed above; it does not assert well-formedness of
The fresh binding is essential. A result can itself be a borrow; checking only
Theorem 48.6 — Featherweight Rust progress¶
Under the validity, abstraction, and well-formedness assumptions of lemma 48.5, if
Referenced from 4 locations
Proof of Theorem 48.6 — Featherweight Rust progress
Proof. The imported proof is induction on the typing derivation. For copy, move, and assignment, safe abstraction supplies the location demanded by lookup; borrow exclusion rules out the stuck aliasing configurations. A move cannot cross a borrow and therefore reaches an owned location. Congruence rules use the induction hypothesis, and completed blocks either return a value or drop their top frame. ◻
Flow sensitivity changes the form of preservation. The final environment is not intended to abstract every intermediate store.
Theorem 48.7 — Whole-term Featherweight Rust preservation¶
Under the assumptions of theorem 48.6, if
Referenced from 3 locations
Proof of Theorem 48.7 — Whole-term Featherweight Rust preservation
Proof. Induct over the complete evaluation derivation and the typing derivation. The move case removes one owner in both store and output environment. Assignment uses drop preservation before update preservation. Block exit drops the entire local frame and every transitively owned allocation. Borrow invariance, including the anonymous result binding, prevents a returned borrow from naming a dropped local. These cases establish the final abstraction; no claim is made that
Theorem 48.8 — Featherweight Rust type and borrow safety¶
Every well-typed valid state satisfying the hypotheses above evaluates to a terminal valid state in the finite core. If its initial environment is also borrow safe, the core’s final environment is borrow safe: overlapping live borrows contain at most one mutable borrow.
Referenced from 3 locations
Proof of Theorem 48.8 — Featherweight Rust type and borrow safety
Proof. The finite core contains no loop or recursion. Repeated theorem 48.6 therefore reaches a terminal state, and theorem 48.7 types that state. Borrow safety is preserved by the only borrow-creation rules: a mutable borrow requires absence of every overlapping borrow, while a shared borrow requires absence of an overlapping mutable borrow. Move, assignment, and drop create no borrow alias. ◻
The termination premise in that proof concerns program evaluation in the finite calculus. A different problem remains: does the recursive borrow-checking algorithm itself terminate?
Exercise 48.3¶
Attempt to type
Referenced from 4 locations
Repairing checker termination
The recursive function
Definition 48.9 — Linearizable typing¶
A finite typing
Referenced from 2 locations
Equivalently, the dependency digraph
Remark 48.10¶
The termination source prints the ranks of this two-variable example in the opposite order. That assignment contradicts its own
For a left value
Proposition 48.11 — Well-founded lookup measure¶
Every recursive call made by
Referenced from 3 locations
Proof of Proposition 48.11 — Well-founded lookup measure
Proof. To inspect
Theorem 48.12 — Termination of recursive place operations¶
On a linearizable typing,
Referenced from 3 locations
Proof of Theorem 48.12 — Termination of recursive place operations
Proof. Use well-founded induction on
It remains to show that typing does not destroy the ranking invariant.
Lemma 48.13 — Linearizability is preserved¶
Every Featherweight Rust typing rule maps a linearizable input typing to a linearizable output typing.
Referenced from 3 locations
Proof of Lemma 48.13 — Linearizability is preserved
Proof. Rules that do not change
Corollary 48.14 — Borrow checking terminates¶
Starting from the empty typing, the frozen Featherweight Rust typing algorithm terminates.
Referenced from 2 locations
Proof of Corollary 48.14 — Borrow checking terminates
Proof. The empty typing is linearizable. Apply lemma 48.13 at each typing rule and theorem 48.12 at each recursive auxiliary call. The syntax-directed derivation has finitely many rule applications. ◻
Exercise 48.4¶
Give dependency graphs and rankings for
Referenced from 4 locations
Oxide v4 starts a new calculus
Oxide v4 is not a theorem-strengthening extension of Featherweight Rust. It has a different syntax, store, type system, and proof. Its non-dereferencing places
The central typing judgment is
Definition 48.15 — Oxide v4 ownership safety¶
The judgment
Referenced from 2 locations
Consider
Exercise 48.5¶
For live loans
Referenced from 3 locations
Non-lexical loans need the continuation
Lexical scope still determines when a region binding exists, but a concrete region’s loan set may become empty earlier.
Definition 48.16 — Continuation-aware loan collection¶
Referenced from 2 locations
The
Proposition 48.17 — Non-lexical release¶
Suppose
Referenced from 2 locations
Proof of Proposition 48.17 — Non-lexical release
Proof. The metafunction empties exactly the first class of region entries. Ownership safety quantifies over the loans remaining in the region map, so a removed loan contributes no conflict. In the second class the entry is unchanged, and its conflict premises remain available. ◻
Exercise 48.6¶
Let
Referenced from 4 locations
Ordered frames and non-lexical loans coexist
Runtime stores and static stack typings are ordered sequences of frames. Closure values carry their captured frame. Two administrative expressions make the order operational:
Lemma 48.18 — Stack-pop alignment¶
If a well-typed
Referenced from 3 locations
Proof of Lemma 48.18 — Stack-pop alignment
Proof. The dynamic rule matches the final frame constructor of the ordered store. The typing rule matches the final frame constructor of
This lexical last-in–first-out discipline does not make loans lexical:
The exact Oxide v4 safety result
The source proves a place-evaluation lemma between ownership safety and progress: a well-typed place expression evaluates to a location context containing a value of its computed type. This connects static loan reasoning to dynamic moves, copies, borrows, and assignment.
Theorem 48.19 — Oxide v4 progress¶
If
Referenced from 3 locations
Proof of Theorem 48.19 — Oxide v4 progress
Proof. This is Oxide v4 Lemma 3.1. Induction on the typing derivation uses canonical forms. The separate place-evaluation lemma supplies the location and value for moves, copies, borrows, and assignments. Applications either expose a global function or a closure with its captured frame; the latter steps to
Preservation cannot say merely “the type and output environment are equal.” Evaluation may make a region more precise, and taking one branch may leave unused output information.
Theorem 48.20 — Oxide v4 preservation¶
Suppose
and ; ;the v4 region-rewriting judgment relates
to ; and , where the union has the frozen v4 domain and loan-set side conditions.
Referenced from 3 locations
Proof of Theorem 48.20 — Oxide v4 preservation
Proof. This is Oxide v4 Lemma 3.3, with its region-rewriting judgment described rather than replaced by equality. The proof is induction on reduction. Region rewriting, drop and loan collection, well-typed extension, assignment, and safe loan updates each require a value-typing preservation family. Closure bodies make those families necessary: their captured frames must remain typable under every environment transformation. Branch reduction uses
Corollary 48.21 — Oxide v4 type safety¶
If
Referenced from 3 locations
Proof of Corollary 48.21 — Oxide v4 type safety
Proof. Interleave theorem 48.19, theorem 48.20. This is a safety theorem, not a termination theorem. ◻
Frozen boundary and seminar problems
Featherweight Rust contributes the core left-value calculus, safe abstraction, borrow invariance, whole-term preservation, and the finite-core type and borrow safety theorem. The separate termination repair proves totality of its recursive checking operations. Oxide v4 contributes its own place expressions, ordered stack, regions-as-loan-sets, continuation-aware loan collection, progress, preservation, and safety.
Named record fields are convenient sugar for stable numeric projections. They are supported by the chapter artifact, as are finite conflict diagnostics. They are not part of the frozen Featherweight Rust theorem and do not turn Oxide’s tested compiler into a formal equivalence with rustc. Arrays, raw pointers, unsafe code, concurrency, traits, and a production compiler remain outside both proved boundaries.
Suggested first pass.
Begin with exercise 48.1, exercise 48.2, exercise 48.3, exercise 48.4, exercise 48.6. Continue with exercise 48.7. The practical project is an optional second pass.
None of these problems is a prerequisite for a later chapter.
Exercise 48.7¶
Work through the move, mutable-borrow, and block-exit cases of the Featherweight Rust safety proof. For each case, state the input store abstraction, the output environment change, and the borrow-invariance obligation. Explain why this does not prove the named-field extension.
Referenced from 4 locations
Exercise 48.8¶
Reconstruct the Oxide v4 sequencing preservation case. Show where
Referenced from 3 locations
Exercise 48.9¶
Practical project.place-loan-checker Implement in Kappa finite rooted paths, prefix overlap, partial-move availability, qualified loans, and continuation-aware loan collection. The observable corpus must separate sibling fields, block a read of the whole partially moved value, permit the live sibling, reject a unique use under an overlapping shared loan, permit a shared use under overlapping shared loans, and permit a formerly blocked use only after its region is absent from both variables and the continuation. Add a rank checker that rejects a two-node borrow cycle. Mutate prefix overlap into equality; an inline oracle must fail. State why the executions prove neither theorem 48.8 nor corollary 48.21.
Sources.
Featherweight Rust’s frozen core and metatheory are Definitions 3.1–4.8, Lemmas 4.9–4.11, Theorem 4.12, and Corollary 4.14 of [Pea21]. The linearizability repair and termination argument are Definitions 11–12, Propositions 1–2, and Lemmas 1–4 of [PPS22]; the rank reversal in its printed two-variable example is corrected explicitly above. The Oxide system is frozen to arXiv v4: its Lemmas 3.1–3.8 and Theorem E.70 own the Oxide claims [WGPA21]. The v4 tested-semantics corpus is implementation evidence, not a bidirectional theorem relating Oxide and Rust.