Anneal Semantics Profile Card

Every theorem Anneal checks depends on the operational semantics of Rust Mid-level Intermediate Representation (MIR) formalized in Trusted.MirAst and Trusted.MirSemantics. This profile card pins and discloses that semantic dependency: what Rust fragment Profile v1 and Profile v2 model, how memory and provenance work, where Anneal deliberately diverges from Miri and MiniRust, and what mechanized correspondence and oracle tests certify each profile.

Downstream out-of-TCB tools can cite the canonical content hash below to pin a specific card revision covering the rendered card text (including curated disclosures), extracted Trusted.MirAst / Trusted.MirModel constructors, claim/theorem and file inventories, and upstream reference pins summarized here (as an unbound reference unless explicitly committed by a verification receipt). Volatile per-file Lean proof/source byte digests are intentionally omitted from this committed card to avoid merge-conflict churn across concurrent proof PRs; run --json for the exact source_closure_sha256 and per-file SHA-256 map, and use receipt model_manifest_sha256 / correspondence_provenance_sha256 to pin a specific verification run.

1. Profile Identifiers & Canonical Content Hash

FieldValue
Schemaanneal-semantics-profile-card/1
Canonical Content Hash (SHA-256)95ed0e1080543c962ab2573f1e6f18da2473c1f49e8cfc63286ddde678ba01ec
Lean Toolchain (trusted/lean/lean-toolchain)leanprover/lean4:v4.35.0
Sysroot Foundation Manifest (SHA-256)8b5ba347abb4df0b4c0113ced81ba23099de6a420051b9aa2d8d693134fbceb9
Profile v1 Identifiermir-profile-v1 (mirProfileVersion = 1, locked Pass 2 correspondence)
Profile v2 Identifiermir-profile-v2 (mirProfileVersion = 2, experimental, domain-relativized correspondence)
Tracked Semantic Sources35 trusted/lean/ files (22 Trusted/Mir*), 6 trusted/correspondence/ adapters, 36 correspondence/ proof modules (per-file SHA-256 digests emitted on demand via --json)

Recompute the canonical content hash locally:

python3 -I -B ci/generate_semantics_profile_card.py --print-hash

Check that this card is synchronized with the repository:

python3 -I -B ci/generate_semantics_profile_card.py --check

2. Modeled Rust Fragment (Profile v1 & Profile v2)

Capture (trusted/rustc-capture) extracts Runtime(PostCleanup) MIR with -Zmir-preserve-ub and -Zmir-opt-level=0, selecting Profile v1 (mirProfileVersion = 1) for pointer-free scalar programs and promoting the whole captured program to Profile v2 (mirProfileVersion = 2) whenever any captured body uses a Profile v2 construct. Any unsupported construct fails closed at capture time or faults with FaultKind.unsupported at evaluation time. See docs/alpha.md for the full construct-by-construct support tables.

DimensionProfile v1 (mir-profile-v1)Profile v2 (mir-profile-v2, experimental)
Top-level theorem rootsTrusted.UnitTheorem, Trusted.CrateTheoremTrusted.UnitTheoremV2, Trusted.CrateTheoremV2, envelope roots
Target ABI64-bit little-endian scalar model (pointerWidthBits = 64)64-bit little-endian natural-alignment ABI (1, 2, 4, 8, 16 for i8..i128, 8 for isize/ptrs; rustc struct layouts)
Typesbool, char, i8..i128, u8..u128, isize, usize, (), !, core::cmp::Ordering, (T, bool) overflow pairs, non-generic inhabited fieldless enumsAdds single-level &T/&mut T/*const T/*mut T, &str, [T] slices, fixed arrays [T; N], structs (incl. recursive via Box/Vec), payload enums, Option, Result, Range*, tuples, Vec<T>, Box<P>, bounded intra-body &&T/& &mut T
Memory & aliasingValue-level scalar locals + caller return allocation id reservation (no user pointers/refs)Byte-level CallerMemory + stack/heap allocations, per-byte Option AllocId provenance, no Tree Borrows or Stacked Borrows aliasing model yet (refuses bodies mixing refs and non-FakeForPtrMetadata raw pointers)
Calls & stdlib contractsNon-generic intra-crate direct calls; closed core::num wrapping_*/unchecked_* sysrootCallsAdds CoreCallOp (65 closed core/alloc contracts), AllocContracts (Vec/Box with infallible Global allocator), Drop glue, --panic abort safe aborts
Correspondence statusLocked in Pass 2: 25 locked lean-miri claims; kernel-replayed (unlocked statements): 39 MiniRust theorems (58 spec anchors)Unlocked / domain-relativized: SafetyRefinementV2On over canary & extended (conservative-edge) domains; BiFaultEquivV2On over canary domain only (provably false on the extended domain); no universal locked claim yet

Extracted Trusted.MirAst & Trusted.MirModel Surface

Counts and constructors extracted directly from trusted/lean/Trusted/MirAst/ and trusted/lean/Trusted/MirModel.lean:

InductiveCountConstructors
IntWidth6i8, i16, i32, i64, i128, isize
FaultKind2undefined, unsupported
AllocByte2uninit, init
MirTy24bool, int, unit, never, char, ordering, enum, tuple, ref, rawPtr, slice, str, array, vec, box, rangeTo, rangeFrom, range, option, struct_, recAdt, recSelf, adtEnum, unsupported
UnOp3not, neg, ptrMetadata
BinOp26add, addUnchecked, addWithOverflow, sub, subUnchecked, subWithOverflow, mul, mulUnchecked, mulWithOverflow, div, rem, bitXor, bitAnd, bitOr, shl, shlUnchecked, shr, shrUnchecked, eq, lt, le, ne, ge, gt, cmp, offset
CastKind6intToInt, ptrToPtr, intToPtr, unsize, boxAsRef, unsupported
Rvalue20use, binaryOp, unaryOp, cast, discriminant, useRetag, ref, addressOf, fakeAddressOf, aggregateTuple, aggregateArray, repeat_, aggregateRangeTo, aggregateRangeFrom, aggregateRange, aggregateOption, aggregateStruct, aggregateAdtEnum, aggregateOrdering, unsupported
StatementKind6assign, storageLive, storageDead, nop, placeMention, unsupported
AssertKind8overflow, overflowNeg, divByZero, remByZero, boundsCheck, misalignedPtrDeref, nullPtrDeref, unsupported
TerminatorKind13goto, switchInt, return_, unreachable, unwindResume, assert, call, coreCall, sysrootCall, callNe, callVia, drop, unsupported
CoreCallOp65sliceLen, sliceGetUncheckedRangeTo, sliceGetUncheckedRangeFrom, sliceGetUncheckedRange, sliceGetUncheckedIndex, sliceIndexRange, sliceIndexRangeFrom, sliceIsEmpty, sliceSplitAt, numIsMultipleOf, numNextMultipleOf, numDivCeil, numCheckedAdd, numCheckedMul, numCheckedSub, numCheckedShl, numSaturatingAdd, numWrappingShl, numWrappingShr, numLeadingZeros, numCountOnes, numTrailingZeros, numNextPowerOfTwo, numOverflowingAdd, numOverflowingSub, numOverflowingMul, cmpMin, cmpMax, memReplace, memSizeOf, optionIsSome, optionIsNone, optionTake, optionUnwrap, tryBranchResult, tryBranchOption, fromResidualResult, fromResidualOption, defaultVal, refIntPartialEq, unitPartialEq, ptrAdd, usizeUncheckedSub, intToLeBytes, intFromLeBytes, arrayEq, panicAbort, vecNew, vecWithCapacity, vecLen, vecPush, vecResize, vecExtendFromSlice, vecIndex, vecIndexMut, vecDeref, vecDerefMut, vecReserve, boxFromVec, boxDeref, boxDerefMut, boxClone, boxNew, partialEqNe, scalarClone

3. Memory Model, Provenance, and Aliasing Status

Anneal's byte-level memory model is defined in Trusted.MirModel and Trusted.MirSemantics.Memory:

  • Abstract bytes (AllocByte): Every allocation stores a list of abstract bytes (AllocByte.uninit or AllocByte.init byte prov), recording both initialization state and optional per-byte allocation provenance (Option AllocId). Multi-byte integers encode little-endian (TargetEndian.little); byte codec equivalence with lean-miri's Allocation.{writeScalar,readScalar,writeUninit} is proved by BytesCodecMatchesMiriClaim.
  • Allocations and lifetimes (MemoryState, CallerMemory): Allocation IDs start at 1 (reserving 1 for the caller return place, matching rustc's AllocId(NonZero<u64>)) and increase monotonically without reuse. Freed stack/heap allocations remain recorded with live = false, so stale accesses fault with FaultKind.undefined. Read-only constants allocate immutable (.shared) memory blocks.
  • Provenance (PtrVal): Pointers carry allocId : Option AllocId, offsetBytes : UInt64, and width : IntWidth. Dereferences and pointer offsets check allocation liveness, bounds, alignment, and mutability. Integer-to-pointer casts (.cast .intToPtr from usize) always produce provenance-less pointers (allocId = none) and otherwise fault.
  • Explicit Aliasing Status — No Tree Borrows Model Yet: Profile v2 does not yet implement Tree Borrows (or Stacked Borrows). In Trusted/Correspondence/State.lean (mkRefMiriStackState / mkRefMiriFrame) and ProfileV2RefMachine.lean (initRefStateV2), the reference machine initializes with borrowTracker := none, and Trusted.MirSemantics tracks allocation mutability rather than per-tag borrow-tree permissions. To remain conservative without an aliasing state machine:
    1. Profile v2 refuses bodies whose locals mix references (&T/&mut T, including Box<P>) and non-FakeForPtrMetadata raw pointers.
    2. Entry hypotheses (ValidEntryArgsV2) enforce live, aligned, initialized, recursively valid (ownedValidInMem) reference arguments and pairwise-disjoint top-level mutable reference/owned buffer spans.
    3. Raw-pointer arguments carry no aliasing permission tracking; callers must pass raw pointers whose provenance permits the function's accesses, and receipts disclose callerRawPtrAliasing and callerMemoryThreadIsolation assumptions explicitly.
  • Global Allocator Assumption: Vec/Box operations in AllocContracts.lean assume infallible allocation (the OOM handle_alloc_error path is not modeled and is disclosed in receipts).

4. Pinned Reference Models & Differential Oracles

Reference / OraclePinned RevisionPin Manifest Digest (SHA-256)Scope & Evidence
lean-miri (https://github.com/proofs-rs/lean-miri.git)c92d1d9754c9dd585b6b9d6949ae67e5e4665d6a (upstream leanprover/lean4:v4.35.0, build leanprover/lean4:v4.35.0)25d3fc84545a82a2951919c2d555c88a106a8f007719285f29898209029d6922160 closure modules, 13 audited local patches, 25 locked Pass 2 claims
MiniRust (https://github.com/minirust/minirust)d821c6e3a3d358fa8a556774dc12b4aa5d0d65ed (2026-07-27T07:10:24Z)80f29fd72245f630e54a4d8c467f80b6a1e90c968a1495c9dde386d9003a4fbf30 pinned upstream files (manifest 1d32e2b77d4d), 58 anchored spec laws, 39 theorems in Anneal.MiniRustProof
Miri UB Oracle (rust-lang/miri)36d14d1151d146c267c50033a20bf75d0f85fa45 (rustc nightly-2026-05-31 f8a08b688cbe, x86_64-unknown-linux-gnu)787e7d5ea39574648ecd07e7cd2307f4536ba458865b88a8dc606a9202ba913a512 upstream fail files / 571 units, max_unsound_accepts = 0, min_caught_ub = 6, Tier-B mins: mir_ub_caught=13, mir_valid_control=1, rust_ub_caught=17, rust_ub_fail_closed=13, rust_valid_control=3

5. Known Divergences from Miri & MiniRust (with Evidence)

Every known semantic divergence is either a conservative rejection (Anneal faults .unsupported or .undefined where Miri/MiniRust may succeed, preserving soundness) or an explicitly disclosed modeling boundary recorded in receipts:

#Divergence / BoundaryDirection vs. Miri / MiniRustEvidence in Repository
1Zero-offset BinOp.offset on OOB provenance pointer (ptr.offset(0) when offset exceeds allocation size)Conservative (Anneal faults; lean-miri accepts zero-byte offset)ProfileV2EdgeWitnesses.lean: conservative_edge1_zero_offset_oob_separation, not_biFaultEquivV2_encodeProg
2Provenance-less null ZST dereference (*(0 as *const ()))Conservative (Anneal faults; lean-miri accepts zero-sized read)ProfileV2EdgeWitnesses.lean: conservative_edge2_null_zst_deref_separation
3Mutability-upgrading raw-pointer cast (*const T as *mut T)Conservative (Anneal refuses; Miri permits cast under provenance rules)ProfileV2EdgeWitnesses.lean: conservative_edge3_const_to_mut_cast_separation
4No Tree Borrows / Stacked Borrows aliasing tracker in Profile v2 (borrowTracker = none)Disclosed boundary + conservative body filter (refuses mixed ref/raw-ptr bodies; raw-ptr caller aliasing disclosed in receipts)State.lean (borrowTracker := none), ProfileV2RefMachine.lean (initRefStateV2), ProfileV2C3AndBundles.lean (profileV2_entry_ref_and_provenance_isolation), docs/alpha.md
5Profile v2 universal correspondence gap (newer extensions: fixed-array aggregate/repeat, rodata, constantIndex, unsize, intToLeBytes, arrayEq, arbitrary --panic abort)Unlocked / domain-relativized (SafetyRefinementV2On proved on canary & extended domains; universal SafetyRefinementV2Bundle uninstantiated)ProfileV2Correspondence.lean, ProfileV2C3AndBundles.lean (profileV2CanaryDomain_safetyRefinement, profileV2ExtendedDomain_safetyRefinement, profileV2ExtendedDomain_not_biFaultEquiv, profileV2_panic_abort_preserves_callerMem)
6Single-threaded caller memory & infallible Global allocator (no concurrency/atomics; OOM handle_alloc_error not modeled)Disclosed boundary (recorded in receipt assumptions; concurrent/atomic constructs fail closed)docs/alpha.md, Trusted.MirSemantics.AllocContracts
7Differential Miri UB oracle coverage (upstream tests/fail corpus)Zero unsound accepts enforced (max_unsound_accepts = 0; unmodeled UB tests fail closed rather than passing)ci/miri_oracle_pin.json, ci/run_miri_ub_oracle.py

6. Conservative Refinement Policy

Anneal does not fork Rust semantics as an alternative language specification. Instead, Anneal enforces a conservative semantic refinement policy (see docs/mir-correspondence-strategy.md):

  1. Fail-closed two-fault split: Every execution in $M_{\text{anneal}}$ distinguishes FaultKind.undefined (modeled Rust UB) from FaultKind.unsupported (unmodeled construct or stricter conservative guard). Both faults falsify WellFormed / WellFormedV2, so a verified program can never reach either fault.
  2. UB transfer and behavioral inclusion (scoped by profile): The target refinement invariant requires that for every well-formed program-query pair $(p, q)$ in $M_{\text{anneal}}$, the reference machine $M_{\text{ref}}$ (lean-miri or MiniRust) is also well-formed (UB-free) and satisfies $\mathsf{Behavior}{\text{ref}}(p, q) \subseteq \mathsf{Behavior}{\text{anneal}}(p, q)$. Today, unconditional transfer to lean-miri is locked in Pass 2 for Profile v1 via the 25 claims in Section 7; Profile v2 transfer is proved only over the canary and extended domains (SafetyRefinementV2On, unlocked); and MiniRust correspondence (Anneal.MiniRustProof) is kernel-replayed with unlocked statements.
  3. Conservative asymmetry permitted; unsound relaxation forbidden: Anneal may conservatively reject valid Rust edge cases (such as Edges 1–3 above, where BiFaultEquivV2Bundle is provably false while SafetyRefinementV2On holds), but must never silently admit an execution that exhibits UB in Miri or MiniRust.
  4. Pinned, auditable disclosure: Every change to extracted Trusted.MirAst / Trusted.MirModel constructors, locked *Claim or MiniRust theorem inventories, tracked file inventories, pinned upstream manifests, or curated disclosures in this card alters the canonical content hash in Section 1 and fails the required, path-filtered semantics-profile-card-sync check in ci/checks.toml until this card is regenerated and reviewed. Per-file Lean proof/source byte digests are emitted on demand via --json (source_closure_sha256) rather than committed here, and capture-side profile selection in trusted/rustc-capture/ is pinned per run by capture_binary_sha256 in receipts.

7. Correspondence Inventory

  • Locked Pass 2 lean-miri claims (25 in Trusted/Correspondence.lean): BehaviorIffRefBehaviorClaim, BehaviorOfRefBehaviorClaim, BytesCodecMatchesMiriClaim, CorrespondenceAtChoicesClaim, CorrespondenceClaim, DecodeProgEncodeProgClaim, DivergesIffRefDivergesClaim, EncodeProgTypesCanonicalClaim, EncodeRvalueBinaryOpIffClaim, EncodeRvalueUnaryOpIffClaim, EncodeStmtAssignIffClaim, EncodeStmtNoDormantNoopsClaim, EvalRefStepEqClaim, FaultEquivalenceAtChoicesClaim, FaultEquivalenceClaim, InitRefStateSimClaim, MiriMoveDeinitWiringClaim, PurePanicHooksNoInjectionClaim, RefBehaviorOfBehaviorClaim, RefStateUniqueOfSimulationInvClaim, RefStepSoundForAllowedStepClaim, RefWellFormedOfWellFormedClaim, SimOfRefReachesClaim, SimOfRefStepClaim, StateUniqueOfSimulationInvClaim.
  • MiniRust proof exports (39 kernel-replayed theorems with unlocked statements in MiniRustProof.lean; CI anneal-audit permits {propext, Classical.choice, Quot.sound} while the stricter {propext, Quot.sound} purity check ci/check_minirust_pin.py --check-axioms is local/manual): minirust_forward_sim_holds, minirust_bi_fault_equiv_holds, minirust_spec_anchors_count (58 anchors), plus 36 supporting lemmas and non-vacuity witnesses.
  • Pass 2 correspondence adapters (6 files in trusted/correspondence/): Correspondence.lean, Codec.lean, Config.lean, Eval.lean, Simulation.lean, State.lean.
  • Correspondence proof modules (36 files in correspondence/): exact per-file SHA-256 digests are emitted on demand via python3 -I -B ci/generate_semantics_profile_card.py --json (source_closure_sha256).