proofs.rs

Claim #4 — Verification of toml_write::TomlKeyBuilder::as_unquoted (with Aeneas be86ab0f1989d04944292b345b24c435be3ad10a)

toml_write::TomlKeyBuilder::as_unquoted

Recorded callable · signature and safety not independently recorded.

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

TomlWriteVerification.key_unquoted

thenbuilder.as_unquoted = Aeneas.Std.Result.ok (if builder.metrics.unquoted = Bool.true then Option.some (TomlWriteVerification.keyResult✝ builder Option.none) else Option.none)
Complete Lean proposition
∀ (builder : toml_write.string.TomlKeyBuilder),
  @Eq.{1} (Aeneas.Std.Result.{0} (Option.{0} toml_write.string.TomlKey))
    (toml_write.string.TomlKeyBuilder.as_unquoted builder)
    (@Aeneas.Std.Result.ok.{0} (Option.{0} toml_write.string.TomlKey)
      (@ite.{1} (Option.{0} toml_write.string.TomlKey)
        (@Eq.{1} Bool (toml_write.string.KeyMetrics.unquoted (toml_write.string.TomlKeyBuilder.metrics builder))
          Bool.true)
        (instDecidableEqBool (toml_write.string.KeyMetrics.unquoted (toml_write.string.TomlKeyBuilder.metrics builder))
          Bool.true)
        (@Option.some.{0} toml_write.string.TomlKey
          (_private.BuilderProofs.0.TomlWriteVerification.keyResult builder
            (@Option.none.{0} toml_write.string.Encoding)))
        (@Option.none.{0} toml_write.string.TomlKey)))

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/a5fbf385bb59e2f9e61418b4cb72226a1f6146bf/toml_write/0.1.2/aeneas/profiles/default/proofs/BuilderProofs.lean#L70-L74

What is trusted

From the report

The statements concern Aeneas translations of the selected Rust bodies and rely
on the translation, Rust and standard-library models, and Lean's kernel. For the key and string
scans, the supplied models of str::as_bytes and str::is_empty assume that the
immutable byte slice is exactly the input string's modeled bytes and that emptiness
agrees with that byte sequence. Rust's str supplies the UTF-8 validity guarantee;
the Lean string model itself is a byte sequence. These operations are not proved
against the Rust standard library here. For release default methods, relating the
original Option::or_else and unwrap_or_else closure behavior to the mathematical
option chain is a reviewed semantic assumption; the closures were not extracted.
The pure option-chain equivalences themselves are checked in Lean.

Technical limitations

From the report

The bounded string-constructor success statement excludes quote runs longer than
255; the complementary failure theorem uses checked arithmetic. Native release
profile behavior differs, as described in the finding. Writing or serializing TOML
output remains outside the selected theorems, so they do not establish valid TOML
output or end-to-end panic freedom. In particular, the formatting model does not
retain the argument text needed to prove the writer's output.

The two default-method bodies are verified on an adaptation, separately from the
12 mapped original release APIs. The patch replaces the lazy option chains with
ordered early-return branches and renames the encoding enum through an alias for
generated Lean compatibility. The independent review relates each branch and
fallback to the original lazy chain, but no extracted release-closure equivalence
theorem is claimed. A native differential check compares all 32 key and 524,288
string cached-metric states with one fixed decoded string; it supplements rather
than replaces that semantic correspondence. Other selected Rust bodies are unchanged
from the pinned release.

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 →