Claim #8 — Verification of toml_write::TomlStringBuilder::as_literal (with Aeneas be86ab0f1989d04944292b345b24c435be3ad10a)
toml_write::TomlStringBuilder::as_literal
Tool: Aeneas be86ab0f1989d04944292b345b24c435be3ad10a
Preconditions
true
Formal statement
TomlWriteVerification.string_literal
Complete Lean proposition
∀ (builder : toml_write.string.TomlStringBuilder),
@Eq.{1} (Aeneas.Std.Result.{0} (Option.{0} toml_write.string.TomlString))
(toml_write.string.TomlStringBuilder.as_literal builder)
(@Aeneas.Std.Result.ok.{0} (Option.{0} toml_write.string.TomlString)
(@ite.{1} (Option.{0} toml_write.string.TomlString)
(And
(@Eq.{1} Bool
(toml_write.string.ValueMetrics.escape_codes (toml_write.string.TomlStringBuilder.metrics builder))
Bool.false)
(And
(@Eq.{1} Nat
(@Aeneas.Std.UScalar.val Aeneas.Std.UScalarTy.U8
(toml_write.string.ValueMetrics.max_seq_single_quotes
(toml_write.string.TomlStringBuilder.metrics builder)))
(@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0))))
(@Eq.{1} Bool (toml_write.string.ValueMetrics.newline (toml_write.string.TomlStringBuilder.metrics builder))
Bool.false)))
(@instDecidableAnd
(@Eq.{1} Bool
(toml_write.string.ValueMetrics.escape_codes (toml_write.string.TomlStringBuilder.metrics builder))
Bool.false)
(And
(@Eq.{1} Nat
(@Aeneas.Std.UScalar.val Aeneas.Std.UScalarTy.U8
(toml_write.string.ValueMetrics.max_seq_single_quotes
(toml_write.string.TomlStringBuilder.metrics builder)))
(@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0))))
(@Eq.{1} Bool (toml_write.string.ValueMetrics.newline (toml_write.string.TomlStringBuilder.metrics builder))
Bool.false))
(instDecidableEqBool
(toml_write.string.ValueMetrics.escape_codes (toml_write.string.TomlStringBuilder.metrics builder))
Bool.false)
(@instDecidableAnd
(@Eq.{1} Nat
(@Aeneas.Std.UScalar.val Aeneas.Std.UScalarTy.U8
(toml_write.string.ValueMetrics.max_seq_single_quotes
(toml_write.string.TomlStringBuilder.metrics builder)))
(@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0))))
(@Eq.{1} Bool (toml_write.string.ValueMetrics.newline (toml_write.string.TomlStringBuilder.metrics builder))
Bool.false)
(instDecidableEqNat
(@Aeneas.Std.UScalar.val Aeneas.Std.UScalarTy.U8
(toml_write.string.ValueMetrics.max_seq_single_quotes
(toml_write.string.TomlStringBuilder.metrics builder)))
(@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0))))
(instDecidableEqBool
(toml_write.string.ValueMetrics.newline (toml_write.string.TomlStringBuilder.metrics builder))
Bool.false)))
(@Option.some.{0} toml_write.string.TomlString
(_private.BuilderProofs.0.TomlWriteVerification.stringResult builder
toml_write.string.Encoding.LiteralString))
(@Option.none.{0} toml_write.string.TomlString)))Theorem source at recorded commit · Recorded check
Referenced definitions (up to 100 direct references)
toml_write.string.TomlStringBuilderEq· Init.PreludeAeneas.Std.Result· Aeneas.Std.PrimitivesOption· Init.Preludetoml_write.string.TomlStringtoml_write.string.TomlStringBuilder.as_literalAeneas.Std.Result.ok· Aeneas.Std.Primitivesite· Init.PreludeAnd· Init.PreludeBool· Init.Preludetoml_write.string.ValueMetrics.escape_codestoml_write.string.TomlStringBuilder.metricsBool.false· Init.PreludeNat· Init.PreludeAeneas.Std.UScalar.val· Aeneas.Std.Scalar.CoreAeneas.Std.UScalarTy.U8· Aeneas.Std.Scalar.Coretoml_write.string.ValueMetrics.max_seq_single_quotesOfNat.ofNat· Init.PreludeinstOfNatNat· Init.Preludetoml_write.string.ValueMetrics.newlineinstDecidableAnd· Init.PreludeinstDecidableEqBool· Init.PreludeinstDecidableEqNat· Init.PreludeOption.some· Init.Prelude_private.BuilderProofs.0.TomlWriteVerification.stringResulttoml_write.string.Encoding.LiteralStringOption.none· Init.Prelude
Evidence
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.
Aeneas be86ab0f1989d04944292b345b24c435be3ad10a — version details