proofs.rs

Claim #19 — Verification of leb128fmt::decode_uint_slice (with Aeneas be86ab0f1989d04944292b345b24c435be3ad10a)

leb128fmt::decode_uint_slice

pub fn decode_uint_slice<T, const BITS: u32>(input: &[u8], pos: &mut usize) -> Result<T, Error> where T: core::ops::Shl<u32, Output = T> + core::ops::BitOrAssign + From<u8> + UInt

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

T = u32 and 7 <= BITS <= 32

Formal statement

leb128fmt.sliceProof.u32_reader_spec

for allwidth : Aeneas.Std.U32
for allbytes : Aeneas.Std.Slice Aeneas.Std.U8
for allstart : Aeneas.Std.Usize
assumehmin : 7 ≤ ↑width
assumehmax : ↑width ≤ 32
then∃ out, leb128fmt_slice_probe.u32_reader width bytes start = Aeneas.Std.Result.ok out ∧ leb128fmt.sliceProof.UIntReaderPost Aeneas.Std.UScalar.val start (leb128fmt.sliceProof.unsignedReadExpected (↑width) bytes start) out

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

Complete Lean proposition
∀ (width : Aeneas.Std.U32) (bytes : Aeneas.Std.Slice.{0} Aeneas.Std.U8) (start : Aeneas.Std.Usize)
  (hmin :
    @LE.le.{0} Nat instLENat (@OfNat.ofNat.{0} Nat (nat_lit 7) (instOfNatNat (nat_lit 7)))
      (@Aeneas.Std.UScalar.val Aeneas.Std.UScalarTy.U32 width))
  (hmax :
    @LE.le.{0} Nat instLENat (@Aeneas.Std.UScalar.val Aeneas.Std.UScalarTy.U32 width)
      (@OfNat.ofNat.{0} Nat (nat_lit 32) (instOfNatNat (nat_lit 32)))),
  @Exists.{1}
    (Prod.{0, 0} (Aeneas.Std.core.result.Result.{0, 0} Aeneas.Std.U32 leb128fmt_slice_probe.leb128fmt.Error)
      Aeneas.Std.Usize)
    fun
      (out :
        Prod.{0, 0} (Aeneas.Std.core.result.Result.{0, 0} Aeneas.Std.U32 leb128fmt_slice_probe.leb128fmt.Error)
          Aeneas.Std.Usize) =>
    And
      (@Eq.{1}
        (Aeneas.Std.Result.{0}
          (Prod.{0, 0} (Aeneas.Std.core.result.Result.{0, 0} Aeneas.Std.U32 leb128fmt_slice_probe.leb128fmt.Error)
            Aeneas.Std.Usize))
        (leb128fmt_slice_probe.u32_reader width bytes start)
        (@Aeneas.Std.Result.ok.{0}
          (Prod.{0, 0} (Aeneas.Std.core.result.Result.{0, 0} Aeneas.Std.U32 leb128fmt_slice_probe.leb128fmt.Error)
            Aeneas.Std.Usize)
          out))
      (@leb128fmt.sliceProof.UIntReaderPost (Aeneas.Std.UScalar Aeneas.Std.UScalarTy.U32)
        (@Aeneas.Std.UScalar.val Aeneas.Std.UScalarTy.U32) start
        (leb128fmt.sliceProof.unsignedReadExpected (@Aeneas.Std.UScalar.val Aeneas.Std.UScalarTy.U32 width) bytes start)
        out)

Theorem source at recorded commit · Recorded check

Referenced definitions (up to 100 direct references)
  • Aeneas.Std.U32 · Aeneas.Std.Scalar.Core
  • Aeneas.Std.Slice · Aeneas.Std.SliceDef
  • Aeneas.Std.U8 · Aeneas.Std.Scalar.Core
  • Aeneas.Std.Usize · Aeneas.Std.Scalar.Core
  • LE.le · Init.Prelude
  • Nat · Init.Prelude
  • instLENat · Init.Prelude
  • OfNat.ofNat · Init.Prelude
  • instOfNatNat · Init.Prelude
  • Aeneas.Std.UScalar.val · Aeneas.Std.Scalar.Core
  • Aeneas.Std.UScalarTy.U32 · Aeneas.Std.Scalar.Core
  • Exists · Init.Core
  • Prod · Init.Prelude
  • Aeneas.Std.core.result.Result · Aeneas.Std.Core.Result
  • leb128fmt_slice_probe.leb128fmt.Error
  • And · Init.Prelude
  • Eq · Init.Prelude
  • Aeneas.Std.Result · Aeneas.Std.Primitives
  • leb128fmt_slice_probe.u32_reader
  • Aeneas.Std.Result.ok · Aeneas.Std.Primitives
  • leb128fmt.sliceProof.UIntReaderPost
  • Aeneas.Std.UScalar · Aeneas.Std.Scalar.Core
  • leb128fmt.sliceProof.unsignedReadExpected

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

Evidence

https://github.com/MasWag/crate-proofs/blob/bb7e96e52ff285bca94443d090899706c2f127ec/leb128fmt/0.1.0/aeneas/profiles/default/proofs/ProofsUIntSliceDecode.lean#L417-L422

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.

Updated 2026-10-16 00:00 UTC

Aeneas be86ab0f1989d04944292b345b24c435be3ad10a — version details

Read and join the discussion on the report →