Claim #29 — Verification of jsonptr::index::InvalidCharacterError::offset (with Aeneas be86ab0f1989d04944292b345b24c435be3ad10a)
jsonptr::index::InvalidCharacterError::offset
Tool: Aeneas be86ab0f1989d04944292b345b24c435be3ad10a
Preconditions
For every error value, returns its stored offset.
Formal statement
JsonptrPublication.invalidCharacterOffset
Complete Lean proposition
∀ (a : jsonptr.index.InvalidCharacterError),
@Eq.{1} (Aeneas.Std.Result.{0} Aeneas.Std.Usize) (jsonptr.index.InvalidCharacterError.impl.offset a)
(@Aeneas.Std.Result.ok.{0} Aeneas.Std.Usize (jsonptr.index.InvalidCharacterError.offset a))Theorem source at recorded commit · Recorded check
Referenced definitions (up to 100 direct references)
jsonptr.index.InvalidCharacterErrorEq· Init.PreludeAeneas.Std.Result· Aeneas.Std.PrimitivesAeneas.Std.Usize· Aeneas.Std.Scalar.Corejsonptr.index.InvalidCharacterError.impl.offsetAeneas.Std.Result.ok· Aeneas.Std.Primitivesjsonptr.index.InvalidCharacterError.offset
Evidence
What is trusted
From the report
The claims rely on the pinned Charon and Aeneas translation of the crate's compiled Rust into Lean, on the Aeneas models of Rust scalars, strings and standard-library operations, and on the Lean kernel. The Lean model leaves the width of usize as the platform word size rather than fixing it, but the translated code was compiled only for the 64-bit aarch64-apple-darwin target, so no other target is claimed. The model treats every arithmetic overflow as a failure, independent of the build profile. A contract that requires success therefore excludes overflow in both debug and release builds, but it says nothing about the wrapped value a release build would produce outside its premise.
Shared references are modelled as the values they point to. A claim such as Pointer::as_str establishes the value read through the returned reference, not the reference's address or lifetime.
A local audit checked the default-profile theorems and their transitive axioms. Fourteen mapped claims use one-line projections that each select one conjunct of an audited theorem; the projections themselves are checked when the report is recorded, not by that audit. The audit allows only Lean's standard propext, Classical.choice and Quot.sound, and finds no sorry or added axiom. The audit does not independently establish that the translation or the library models match Rust semantics. The contracts were written independently of the proofs, from RFC 6901 and the crate's public API and documentation.
Technical limitations
From the report
The central jsonptr algorithms are not proved on their release bodies. Public pointer parsing, token encoding and decoding, index parsing, pointer splitting and navigation, buffer operations, document resolution, assignment, deletion, and diagnostic span lengths and labels all fail translation with the unmodified tools. The blocking constructs include the str::as_bytes reference transmute, raw-pointer dereferences, iterator and borrow-state errors, core::str::pattern signatures, String and ParseIntError internals, and serde_json items.
A separate local profile proves contracts for byte-level rewrites of those bodies. It covers pointer validation, the token codec, index parsing, navigation and range access, prefix and suffix operations, byte-wise ordering of pointers and tokens, PointerBuf editing, and resolution, mutable resolution, assignment and deletion over a local model of JSON and TOML documents. These are proofs about adapted functions, not about the release APIs, and none of them is a mapped claim. Besides representation invariants for pointers and tokens, some of them assume that built buffers and input arrays or objects have fewer than usize::MAX entries. The rewrites replace &str with byte slices, iterator adapters with index loops, str::parse with explicit checked decimal accumulation, and the traversal loops with tail recursion; the recursive form can exhaust the stack on very long pointers where the release loop cannot. Their correspondence to the release code rests on source review and native differential tests that compare release and adapted results in debug and release builds, including every string of up to seven characters over a small pointer alphabet. That evidence is not a formal equivalence proof. It does not establish that serde_json map lookup and array access behave as modelled, and TOML documents were not exercised natively.
Checked theorems on the unchanged release bodies refute four intended contracts. complete_offset does not succeed for every error value (JSONPTR-008), so it is claimed only under its premise. Diagnostic::url returns a string other than the intended docs.rs address for resolve::Error, ParseIndexError and ParseError (JSONPTR-006), so those three implementations are not claimed. Checked refutations on the adapted functions mirror JSONPTR-001 to JSONPTR-005 and JSONPTR-008 for strip_prefix, bound-tuple access and diagnostic labels; the release behavior itself is shown by the native reproductions in those findings. The "aé1" case of JSONPTR-005 and the documentation mismatch in JSONPTR-007 rest on native evidence only.
Unproved or untracked methods include the EncodingError::labels contract; ParseError::invalid_encoding_len, for which only a statement of the release behavior is recorded; forwarding methods that lack a theorem connecting them to the operation they forward to; borrowing and conversion views such as AsRef, Borrow, Cow conversions, as_ptr, Default for &Pointer and IntoIterator for &PointerBuf; the Tokens and Components adapter types; PartialEq for resolve::Error and assign::Error; Clone and PartialEq for Label and Report; Clone, PartialEq and From<ParseIntError> for ParseIndexError; and the immutable Resolve implementation for TOML values. Report::original, into_original and decompose have an audited theorem but no recorded claim.
Some behavior cannot be expressed with the unmodified tools and is excluded. Display and Debug output is not observable because the Formatter model discards written text. The generated Diagnostic trait structure fails Lean universe inference, so the generic Report::subject, Deref, into_report, diagnose and diagnose_with are not proved. Error::source would need axioms for dyn Error. Hashing, raw pointer and Box casts, and the behavior of serde, serde_json, toml and miette integrations are also outside scope.
The mapped claims were checked for aarch64-apple-darwin with default features disabled and the resolve and assign features enabled. Other targets and feature combinations are not covered by the formal results. In the same local run, the release crate's own tests passed natively with default features (99 unit tests and 49 doctests) and with all features (105 unit tests and 49 doctests); these tests are separate evidence, not proof.
The eight findings below were reproduced natively against the unmodified release. Some concern APIs outside the mapped claims. None contradicts a mapped claim: the complete_offset premise excludes the overflowing case, the two mapped url claims are for EncodingError and assign::Error, which the finding reports as returning the expected addresses, and JSONPTR-007 concerns documentation rather than the values that the accessor claims describe.
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