Claim #24 — Verification of leb128fmt::encode_fixed_s32 (with Aeneas be86ab0f1989d04944292b345b24c435be3ad10a)
pub const fn encode_fixed_s32(value: i32) -> Option<[u8; 5]>Tool: Aeneas be86ab0f1989d04944292b345b24c435be3ad10a
Preconditions
true
Formal statement
leb128fmt.signed32.encode_fixed_s32_spec
Complete Lean proposition
∀ (x : Aeneas.Std.I32),
@Exists.{1}
(Aeneas.Std.Array.{0} Aeneas.Std.U8
(Aeneas.Std.Usize.ofNat (@OfNat.ofNat.{0} Nat (nat_lit 5) (instOfNatNat (nat_lit 5)))
leb128fmt.encode_s32_loop0.body._proof_1))
fun
(bytes :
Aeneas.Std.Array.{0} Aeneas.Std.U8
(Aeneas.Std.Usize.ofNat (@OfNat.ofNat.{0} Nat (nat_lit 5) (instOfNatNat (nat_lit 5)))
leb128fmt.encode_s32_loop0.body._proof_1)) =>
And
(@Eq.{1}
(Aeneas.Std.Result.{0}
(Option.{0}
(Aeneas.Std.Array.{0} Aeneas.Std.U8
(Aeneas.Std.Usize.ofNat (@OfNat.ofNat.{0} Nat (nat_lit 5) (instOfNatNat (nat_lit 5)))
leb128fmt.encode_s32_loop0.body._proof_1))))
(leb128fmt.encode_fixed_s32 x)
(@Aeneas.Std.Result.ok.{0}
(Option.{0}
(Aeneas.Std.Array.{0} Aeneas.Std.U8
(Aeneas.Std.Usize.ofNat (@OfNat.ofNat.{0} Nat (nat_lit 5) (instOfNatNat (nat_lit 5)))
leb128fmt.encode_s32_loop0.body._proof_1)))
(@Option.some.{0}
(Aeneas.Std.Array.{0} Aeneas.Std.U8
(Aeneas.Std.Usize.ofNat (@OfNat.ofNat.{0} Nat (nat_lit 5) (instOfNatNat (nat_lit 5)))
leb128fmt.encode_s32_loop0.body._proof_1))
bytes)))
(leb128fmt.signed32.SignedFixedEncoding (@Aeneas.Std.IScalar.val Aeneas.Std.IScalarTy.I32 x) bytes)Theorem source at recorded commit · Recorded check
Referenced definitions (up to 100 direct references)
Aeneas.Std.I32· Aeneas.Std.Scalar.CoreExists· Init.CoreAeneas.Std.Array· Aeneas.Std.Array.ArrayAeneas.Std.U8· Aeneas.Std.Scalar.CoreAeneas.Std.Usize.ofNat· Aeneas.Std.Scalar.CoreOfNat.ofNat· Init.PreludeNat· Init.PreludeinstOfNatNat· Init.Preludeleb128fmt.encode_s32_loop0.body._proof_1· Signed32And· Init.PreludeEq· Init.PreludeAeneas.Std.Result· Aeneas.Std.PrimitivesOption· Init.Preludeleb128fmt.encode_fixed_s32Aeneas.Std.Result.ok· Aeneas.Std.PrimitivesOption.some· Init.Preludeleb128fmt.signed32.SignedFixedEncodingAeneas.Std.IScalar.val· Aeneas.Std.Scalar.CoreAeneas.Std.IScalarTy.I32· Aeneas.Std.Scalar.Core
Evidence
What is trusted
From the report
The concrete writer proofs use a local adapter for the extracted primitive conversions. It erases the generated conversion error payload to the pinned backend’s unit error model; the proofs establish that narrowing the masked payload succeeds and preserves its value, so that error payload is not observed in the proved paths. The adapter also forwards the fixed writer’s length helper to a separately extracted release body. This connection relies on the extracted operations and their correspondence to Rust. The results depend on the correspondence of the pinned Rust-to-Lean translation and Aeneas models for integer arithmetic, shifts, indexing and arrays to the Rust operations, and on Lean's kernel. They do not independently establish that correspondence.
Technical limitations
From the report
The slice claims are restricted to the types, widths and cursor conditions stated above. The unsigned small-width decoder claim describes the implementation's actual behavior, including modeled failure, rather than the intended field-range contract. The actual decoder behavior at multiples of seven is broader than the intended field limit, as the findings illustrate. Parameterized array macro expansions at other widths, error formatting and the full dynamic return signatures of the standard error source and deprecated cause methods remain outside the proved scope. The observers establish only whether those methods return None. The service catalogue does not expose the five locally proved inherited methods clone_from, ne, assert_receiver_is_total_eq, description, and cause; they therefore have no published API claim in this report. Native observations in verification/findings/ are separate from the formal results.
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.
Aeneas be86ab0f1989d04944292b345b24c435be3ad10a — version details