proofs.rs

Claim #11 — Verification of <fxhash::FxHasher32 as Hasher>::write (with Aeneas be86ab0f1989d04944292b345b24c435be3ad10a)

<fxhash::FxHasher32 as Hasher>::write

impl Hasher for FxHasher32
pub fn write(self: &mut Self, bytes: &[u8])

Tool: Aeneas be86ab0f1989d04944292b345b24c435be3ad10a

This claim has no explanation of its own. Read the report Overview, and treat the formal statement below as authoritative. See Concepts and terminology.

Preconditions

true

Formal statement

FxHashWriteContracts.fxHasher32_write_exact

for allbytes : Aeneas.Std.Slice Aeneas.Std.U8
then∃ out, fxhash_adapted.FxHasher32.Insts.CoreHashHasher.write self bytes = Aeneas.Std.Result.ok out ∧ out.hash.bv = FxHash.Spec.write32 FxHash.Spec.Endian.little self.hash.bv (List.map Aeneas.Std.UScalar.val ↑bytes)

In Lean notation, ↑ denotes an implicit type conversion (coercion).

Complete Lean proposition
∀ (self : fxhash_adapted.FxHasher32) (bytes : Aeneas.Std.Slice.{0} Aeneas.Std.U8),
  @Exists.{1} fxhash_adapted.FxHasher32 fun (out : fxhash_adapted.FxHasher32) =>
    And
      (@Eq.{1} (Aeneas.Std.Result.{0} fxhash_adapted.FxHasher32)
        (fxhash_adapted.FxHasher32.Insts.CoreHashHasher.write self bytes)
        (@Aeneas.Std.Result.ok.{0} fxhash_adapted.FxHasher32 out))
      (@Eq.{1} (BitVec (@OfNat.ofNat.{0} Nat (nat_lit 32) (instOfNatNat (nat_lit 32))))
        (Aeneas.Std.U32.bv (fxhash_adapted.FxHasher32.hash out))
        (FxHash.Spec.write32 FxHash.Spec.Endian.little (Aeneas.Std.U32.bv (fxhash_adapted.FxHasher32.hash self))
          (@List.map.{0, 0} (Aeneas.Std.UScalar Aeneas.Std.UScalarTy.U8) Nat
            (@Aeneas.Std.UScalar.val Aeneas.Std.UScalarTy.U8) (@Aeneas.Std.Slice.val.{0} Aeneas.Std.U8 bytes))))

Theorem source at recorded commit · Recorded check

Referenced definitions (up to 100 direct references)

Mapping: manual. Translation was not rerun by this recording.

Evidence

https://github.com/MasWag/crate-proofs/blob/61fb46c2ecdd9d404b9bd5b924a8d095dd8b89ce/fxhash/0.2.1/aeneas/profiles/default/proofs/WriteContracts.lean#L29-L37

What is trusted

From the report

These results rely on the Aeneas translation from Rust to Lean, its models of fixed-width arithmetic, slices, arrays, iteration and loop execution, and Lean's checking of the stated theorems. The Lean Usize model width must match the 64-bit Rust extraction target for the native-width claims. Source correspondence is supported by the adaptation check and finite native comparisons described below; it is not itself a formal equivalence theorem.

Technical limitations

From the report

This is partial coverage. Generic Hash composition, collection aliases, inherited Hasher methods, and standard collection behavior are not established by these claims. Hash distribution, collision resistance and cryptographic security are outside scope. The checked target is macOS arm64; other targets and byte orders are not covered by this run.

The model is extracted from derived Rust. The integer .bitxor(word) expression is replaced by ^ word, a private write helper and its call are renamed to avoid a generated-name collision, and guarded native-endian 32- and 64-bit reads are replaced by fixed indexed byte arrays and from_le_bytes. The adapted source rejects non-little-endian targets. A source checker checks these changes. Source review supports equivalence: the XOR uses the same integer operation, the rename preserves the call, and the original length guards make the indexed reads valid and select the same bytes in the same order on the supported little-endian target. Finite differential tests against the release passed in debug and release; neither source review nor testing is a formal equivalence proof.

Tool limitations

Lean backend only, requiring cargo-proofs 0.4.0 or later. The version identifies the official Aeneas Git revision pinned in lake-manifest.json (backends/lean); this revision uses Lean 4.35.0. The recorder checks committed Lean theorem declarations and permits only propext, Classical.choice, and Quot.sound as transitive axioms. It rejects sorryAx and custom axioms, including axiomatized external models. Charon/Aeneas extraction is not rerun. The author must review that the committed functional model matches the recorded Rust source, that the named theorem corresponds to the public API, and that the reported precondition matches the theorem. A checked theorem alone does not establish those links or the adequacy of the specification. The current adapter records the default Cargo configuration, with ordinary Lean module paths and a pinned official Git dependency. Other backends, custom Lake source directories, and local-path Aeneas dependencies are unsupported. See https://proofs.rs/book/aeneas.html and https://github.com/AeneasVerif/aeneas/tree/be86ab0f1989d04944292b345b24c435be3ad10a.

Updated 2026-10-16 00:00 UTC

Aeneas be86ab0f1989d04944292b345b24c435be3ad10a — version details

Read and join the discussion on the report →