proofs.rs

Report #40 — Selected storage and constructor contracts for utf-8 0.7.6

Aeneas be86ab0f1989d04944292b345b24c435be3ad10a

7 verified claims · 2 findings

Recorded by the author; proofs.rs has not re-run it. How to read a report

MasWag · 2026-11-27 11:58 UTC

Revision v1

Overview

The selected contracts concern buffer storage, decoder construction and cloning. In the translated model, each operation returns successfully in its stated domain. Incomplete::empty produces a zero-filled buffer with length zero; is_empty tests exactly whether the length is zero, including for manually constructed states; and new stores up to four supplied bytes followed by zeros and records their length. The new contract requires an input of at most four bytes. The decoder constructors preserve their supplied callback or reader and initialize an empty incomplete buffer; the buffered reader also starts with zero bytes consumed. Cloning Incomplete or DecodeError preserves the represented value, including the error variant and its fields.

Findings (2)

APIs (7)

Associated functions

impl utf8::BufReadDecoder<B>

pub fn new(buf_read: B) -> Self

impl utf8::Incomplete

pub fn empty() -> Self
pub fn new(bytes: &[u8]) -> Self

impl utf8::LossyDecoder<F>

pub fn new(push_str: F) -> Self

Methods

impl utf8::Incomplete

pub fn is_empty(self: &Self) -> bool

Trait implementations

impl core::clone::Clone for …

fn clone2 implementations

Evidence

https://github.com/MasWag/crate-proofs/tree/5cf14f7365d7b282e769740ee97d156ad5f7d061

Reproduce

Toolchain source metadata: not recorded.

Run locally

git clone -- https://github.com/MasWag/crate-proofs report-40-source-1
git -C report-40-source-1 checkout --detach 5cf14f7365d7b282e769740ee97d156ad5f7d061
git -C report-40-source-1 submodule update --init --recursive --checkout
cd report-40-source-1/utf-8/0.7.6/.work/build/default/aarch64-apple-darwin/proofs

lake build +Proofs

printf '%s' 'import Aeneas
import Proofs
set_option pp.all true
set_option pp.universes true
set_option pp.explicit true
set_option pp.fullNames true
set_option pp.notation false
set_option pp.proofs true
set_option pp.deepTerms true
set_option pp.maxSteps 10000000
-- proofs.rs adapter for Lean 4.35.0 / Aeneas be86ab0f.
-- Uses Lean'\''s environment, Meta telescope and pretty-printer, never source parsing.
open Lean Meta Elab Command
namespace ProofsProbe
meta def moduleOf (env : Environment) (n : Name) : String :=
  match env.getModuleIdxFor? n with
  | some idx => env.header.moduleNames[idx.toNat]!.toString
  | none => ""
meta def pretty (e : Expr) : MetaM String := do
  let s := (← ppExpr e).pretty
  if s.contains '\''⋯'\'' then
    throwError "Lean display contains an omission marker (or literal ⋯); refusing an incomplete proposition"
  if s.utf8ByteSize > 1000000 then throwError "Proposition exceeds 1,000,000-byte recording limit"
  return s
-- The full statement stays explicit; the inspection view uses Lean notation.
meta def readable (e : Expr) : MetaM String :=
  withOptions (fun o =>
    let o := o.setBool `pp.all false
    let o := o.setBool `pp.explicit false
    let o := o.setBool `pp.universes false
    o.setBool `pp.notation true) (pretty e)
-- Only a constant'\''s own tag grants a link; names in plain text are never guessed.
partial def segments (code : Widget.CodeWithInfos) (ref : Option Name := none) : Array Json :=
  match code with
  | .text text => #[Json.mkObj (([("text", toJson text)]) ++
      (ref.toList.map fun n => ("ref", toJson n.toString)))]
  | .append parts => parts.foldl (fun acc part => acc ++ segments part ref) #[]
  | .tag info part =>
    let ref := match info.info.val.info with
      | .ofTermInfo ti => ti.expr.constName?
      | _ => none
    segments part ref
meta def readableFields (key : String) (e : Expr) : MetaM (List (String × Json)) := do
  let text ← readable e
  let base := [(key, toJson text)]
  try
    let code ← withOptions (fun o =>
      let o := o.setBool `pp.all false
      let o := o.setBool `pp.explicit false
      let o := o.setBool `pp.universes false
      let o := o.setBool `pp.notation true
      o.setBool `pp.tagAppFns true) (Widget.ppExprTagged e)
    let parts := segments code
    let joined := String.join (parts.toList.map fun j =>
      (j.getObjValAs? String "text").toOption.getD "")
    if joined != text || parts.size > 10000 || joined.utf8ByteSize > 1000000 then
      return base
    return base ++ [(key ++ "_segments", toJson parts)]
  catch _ => return base
meta def inspect (n : Name) (ty : Expr) (manual : Bool) : MetaM (Option Json) := do
  let env ← getEnv
  forallTelescope ty fun xs conclusion => do
    let programExpr ← try
      let normalized ← Aeneas.Utils.normalizeLetBindings conclusion
      let (expr, _) ← Aeneas.Step.getStepSpecFunArgsExpr normalized
      pure (some expr)
    catch _ => pure none
    if programExpr.isNone && !manual then return none
    let full ← pretty ty
    let program ← match programExpr with
      | some expr => pure (toJson (← readable expr))
      | none => pure Json.null
    let head := toJson (programExpr.bind (·.getAppFn.constName?) |>.map Name.toString)
    let mut binders := #[]
    for x in xs do
      let d ← x.fvarId!.getDecl
      let prop ← isProp d.type
      binders := binders.push (Json.mkObj ((← readableFields "type" d.type) ++ [
        ("name", toJson d.userName.toString),
        ("kind", toJson (if d.binderInfo.isInstImplicit then "instance" else if prop then "hypothesis" else "variable")),
        ("binder", toJson (if d.binderInfo.isInstImplicit then "instance" else if d.binderInfo.isExplicit then "explicit" else "implicit"))]))
    if binders.size > 1000 then throwError "More than 1000 binders"
    let some ranges ← findDeclarationRanges? n | throwError "Missing theorem source range: {n}"
    let axioms ← Lean.collectAxioms n
    let constants := ty.getUsedConstants
    let mut definitions := #[]
    for nm in constants.extract 0 100 do
      let ranges ← findDeclarationRanges? nm
      definitions := definitions.push (Json.mkObj [
        ("name", toJson nm.toString), ("module", toJson (moduleOf env nm)),
        ("source", match ranges with
          | some r => Json.mkObj [("first_line", toJson r.range.pos.line), ("last_line", toJson r.range.endPos.line)]
          | none => Json.null)])
    return some (Json.mkObj ((← readableFields "conclusion" conclusion) ++ [
      ("version", toJson (1 : Nat)), ("theorem", toJson n.toString),
      ("module", toJson (moduleOf env n)), ("statement", toJson full),
      ("binders", toJson binders),
      ("program", program), ("program_head", head),
      ("axioms", toJson (axioms.map Name.toString)),
      ("first_line", toJson ranges.range.pos.line), ("last_line", toJson ranges.range.endPos.line),
      ("definitions", toJson definitions), ("definitions_truncated", toJson (decide (constants.size > 100))),
      ("translation_rerun", toJson false)]))
end ProofsProbe

run_cmd do
  let manual : Array Name := #[`Utf8Proofs.empty_total, `Utf8Proofs.is_empty_total, `Utf8Proofs.new_total, `Utf8Proofs.incomplete_clone_total, `Utf8Proofs.decode_error_clone_total, `Utf8Proofs.lossy_new_total, `Utf8Proofs.bufread_new_total]
  let localModules : Array String := #[]
  let roots : Array Name := #[]
  let env ← getEnv
  let mut closure : Array Name := #[]
  let mut pending := roots.toList
  while !pending.isEmpty do
    let m := pending.head!
    pending := pending.tail!
    if !closure.contains m then
      closure := closure.push m
      if let some idx := env.header.moduleNames.findIdx? (· == m) then
        pending := (env.header.moduleData[idx]!.imports.toList.map (·.module)) ++ pending
  let scope := closure.filter (fun m => localModules.contains m.toString)
  for n in manual do
    match env.find? n with
    | some (.thmInfo _) => pure ()
    | _ => throwError "Expected a theorem: {n}"
  for (n, ci) in env.constants.toList do
    let explicit := manual.contains n
    if explicit || scope.contains (ProofsProbe.moduleOf env n).toName then
      if let .thmInfo th := ci then
        let result ← liftTermElabM <| ProofsProbe.inspect n th.type explicit
        if let some value := result then
          liftIO <| IO.println ("proofs.rs:formal:" ++ value.compress)

run_cmd do
  let theorem_name := `Utf8Proofs.decode_error_clone_total
  match (← getEnv).find? theorem_name with
  | some (.thmInfo _) => pure ()
  | _ => throwError "Expected a theorem: Utf8Proofs.decode_error_clone_total"
  let axioms ← Lean.collectAxioms theorem_name
  for ax in axioms do
    unless [``propext, ``Classical.choice, ``Quot.sound].contains ax do
      throwError "Unapproved axiom in Utf8Proofs.decode_error_clone_total: {ax}"
  liftIO <| IO.println "proofs.rs:checked:Utf8Proofs.decode_error_clone_total"

run_cmd do
  let theorem_name := `Utf8Proofs.incomplete_clone_total
  match (← getEnv).find? theorem_name with
  | some (.thmInfo _) => pure ()
  | _ => throwError "Expected a theorem: Utf8Proofs.incomplete_clone_total"
  let axioms ← Lean.collectAxioms theorem_name
  for ax in axioms do
    unless [``propext, ``Classical.choice, ``Quot.sound].contains ax do
      throwError "Unapproved axiom in Utf8Proofs.incomplete_clone_total: {ax}"
  liftIO <| IO.println "proofs.rs:checked:Utf8Proofs.incomplete_clone_total"

run_cmd do
  let theorem_name := `Utf8Proofs.bufread_new_total
  match (← getEnv).find? theorem_name with
  | some (.thmInfo _) => pure ()
  | _ => throwError "Expected a theorem: Utf8Proofs.bufread_new_total"
  let axioms ← Lean.collectAxioms theorem_name
  for ax in axioms do
    unless [``propext, ``Classical.choice, ``Quot.sound].contains ax do
      throwError "Unapproved axiom in Utf8Proofs.bufread_new_total: {ax}"
  liftIO <| IO.println "proofs.rs:checked:Utf8Proofs.bufread_new_total"

run_cmd do
  let theorem_name := `Utf8Proofs.empty_total
  match (← getEnv).find? theorem_name with
  | some (.thmInfo _) => pure ()
  | _ => throwError "Expected a theorem: Utf8Proofs.empty_total"
  let axioms ← Lean.collectAxioms theorem_name
  for ax in axioms do
    unless [``propext, ``Classical.choice, ``Quot.sound].contains ax do
      throwError "Unapproved axiom in Utf8Proofs.empty_total: {ax}"
  liftIO <| IO.println "proofs.rs:checked:Utf8Proofs.empty_total"

run_cmd do
  let theorem_name := `Utf8Proofs.is_empty_total
  match (← getEnv).find? theorem_name with
  | some (.thmInfo _) => pure ()
  | _ => throwError "Expected a theorem: Utf8Proofs.is_empty_total"
  let axioms ← Lean.collectAxioms theorem_name
  for ax in axioms do
    unless [``propext, ``Classical.choice, ``Quot.sound].contains ax do
      throwError "Unapproved axiom in Utf8Proofs.is_empty_total: {ax}"
  liftIO <| IO.println "proofs.rs:checked:Utf8Proofs.is_empty_total"

run_cmd do
  let theorem_name := `Utf8Proofs.new_total
  match (← getEnv).find? theorem_name with
  | some (.thmInfo _) => pure ()
  | _ => throwError "Expected a theorem: Utf8Proofs.new_total"
  let axioms ← Lean.collectAxioms theorem_name
  for ax in axioms do
    unless [``propext, ``Classical.choice, ``Quot.sound].contains ax do
      throwError "Unapproved axiom in Utf8Proofs.new_total: {ax}"
  liftIO <| IO.println "proofs.rs:checked:Utf8Proofs.new_total"

run_cmd do
  let theorem_name := `Utf8Proofs.lossy_new_total
  match (← getEnv).find? theorem_name with
  | some (.thmInfo _) => pure ()
  | _ => throwError "Expected a theorem: Utf8Proofs.lossy_new_total"
  let axioms ← Lean.collectAxioms theorem_name
  for ax in axioms do
    unless [``propext, ``Classical.choice, ``Quot.sound].contains ax do
      throwError "Unapproved axiom in Utf8Proofs.lossy_new_total: {ax}"
  liftIO <| IO.println "proofs.rs:checked:Utf8Proofs.lossy_new_total"
' | lake env lean --stdin

Checks out the recorded source commit from GitHub. Install the report’s tool version before running.

Source on GitHub · SARIF with logs (.json)

Recorded run

Completed · 7 checks passed · 0 failed

2026-11-27T11:56:32.536084+00:00 · 19.9 seconds · Exit code 0

Recorded on the author’s machine.

CheckResultClaim
Lean checked theorem Utf8Proofs.decode_error_clone_total; axioms limited to propext, Classical.choice, Quot.sound
Utf8Proofs.decode_error_clone_total
PassedClaim #1
Lean checked theorem Utf8Proofs.incomplete_clone_total; axioms limited to propext, Classical.choice, Quot.sound
Utf8Proofs.incomplete_clone_total
PassedClaim #2
Lean checked theorem Utf8Proofs.bufread_new_total; axioms limited to propext, Classical.choice, Quot.sound
Utf8Proofs.bufread_new_total
PassedClaim #3
Lean checked theorem Utf8Proofs.empty_total; axioms limited to propext, Classical.choice, Quot.sound
Utf8Proofs.empty_total
PassedClaim #4
Lean checked theorem Utf8Proofs.is_empty_total; axioms limited to propext, Classical.choice, Quot.sound
Utf8Proofs.is_empty_total
PassedClaim #5
Lean checked theorem Utf8Proofs.new_total; axioms limited to propext, Classical.choice, Quot.sound
Utf8Proofs.new_total
PassedClaim #6
Lean checked theorem Utf8Proofs.lossy_new_total; axioms limited to propext, Classical.choice, Quot.sound
Utf8Proofs.lossy_new_total
PassedClaim #7
Execution details
Started
2026-11-27T11:56:32.536084+00:00
Finished
2026-11-27T11:56:52.421003+00:00
Platform
macos aarch64
Rust compiler
rustc 1.94.1 (e408947bf 2026-03-25) binary: rustc commit-hash: e408947bfd200af42db322daf0fadfe7e26d3bd1 commit-date: 2026-03-25 host: aarch64-apple-darwin release: 1.94.1 LLVM version: 21.1.8
Working directory
utf-8/0.7.6/.work/build/default/aarch64-apple-darwin/proofs
Environment overrides
None recorded
Git repository
https://github.com/MasWag/crate-proofs
Git commit
5cf14f7365d7b282e769740ee97d156ad5f7d061
Diagnostics & logs
=== stdout ===
✔ [1796/1797] Built Utf8 (1.7s)
✔ [1797/1797] Built Proofs (1.7s)
Build completed successfully (1797 jobs).

$ lake env lean --stdin (proofs.rs formal extraction and axiom audit)
proofs.rs:formal:{"axioms":["propext","Classical.choice","Quot.sound"],"binders":[{"binder":"explicit","kind":"variable","name":"state","type":"utf8.Incomplete","type_segments":[{"ref":"utf8.Incomplete","text":"utf8.Incomplete"}]}],"conclusion":"∃ out, utf8.Incomplete.Insts.CoreCloneClone.clone state = Aeneas.Std.Result.ok out ∧ out = state","conclusion_segments":[{"text":"∃ "},{"text":"out"},{"text":", "},{"ref":"utf8.Incomplete.Insts.CoreCloneClone.clone","text":"utf8.Incomplete.Insts.CoreCloneClone.clone"},{"text":" "},{"text":"state"},{"ref":"Eq","text":" = "},{"ref":"Aeneas.Std.Result.ok","text":"Aeneas.Std.Result.ok"},{"text":" "},{"text":"out"},{"ref":"And","text":" ∧ "},{"text":"out"},{"ref":"Eq","text":" = "},{"text":"state"}],"definitions":[{"module":"Utf8","name":"utf8.Incomplete","source":{"first_line":23,"last_line":28}},{"module":"Init.Core","name":"Exists","source":{"first_line":313,"last_line":341}},{"module":"Init.Prelude","name":"And","source":{"first_line":645,"last_line":659}},{"module":"Init.Prelude","name":"Eq","source":{"first_line":46,"last_line":76}},{"module":"Aeneas.Std.Primitives","name":"Aeneas.Std.Result","source":{"first_line":67,"last_line":68}},{"module":"Utf8","name":"utf8.Incomplete.Insts.CoreCloneClone.clone","source":{"first_line":45,"last_line":50}},{"module":"Aeneas.Std.Primitives","name":"Aeneas.Std.Result.ok","source":{"first_line":72,"last_line":72}}],"definitions_truncated":false,"first_line":56,"last_line":58,"module":"Proofs","program":null,"program_head":null,"statement":"∀ (state : utf8.Incomplete),\n  @Exists.{1} utf8.Incomplete fun (out : utf8.Incomplete) =>\n    And\n      (@Eq.{1} (Aeneas.Std.Result.{0} utf8.Incomplete) (utf8.Incomplete.Insts.CoreCloneClone.clone state)\n        (@Aeneas.Std.Result.ok.{0} utf8.Incomplete out))\n      (@Eq.{1} utf8.Incomplete out state)","theorem":"Utf8Proofs.incomplete_clone_total","translation_rerun":false,"version":1}
proofs.rs:formal:{"axioms":["propext","Classical.choice","Quot.sound"],"binders":[{"binder":"explicit","kind":"variable","name":"bytes","type":"Aeneas.Std.Slice Aeneas.Std.U8","type_segments":[{"ref":"Aeneas.Std.Slice","text":"Aeneas.Std.Slice"},{"text":" "},{"ref":"Aeneas.Std.U8","text":"Aeneas.Std.U8"}]},{"binder":"explicit","kind":"hypothesis","name":"bounded","type":"(↑bytes).length ≤ 4","type_segments":[{"text":"(↑"},{"text":"bytes"},{"text":")"},{"text":"."},{"ref":"List.length","text":"length"},{"ref":"LE.le","text":" ≤ "},{"text":"4"}]}],"conclusion":"∃ state,\n  utf8.Incomplete.new bytes = Aeneas.Std.Result.ok state ∧\n    ↑state.buffer = ↑bytes ++ List.replicate (4 - (↑bytes).length) 0#u8 ∧ ↑state.buffer_len = (↑bytes).length","conclusion_segments":[{"text":"∃ "},{"text":"state"},{"text":",\n  "},{"ref":"utf8.Incomplete.new","text":"utf8.Incomplete.new"},{"text":" "},{"text":"bytes"},{"ref":"Eq","text":" = "},{"ref":"Aeneas.Std.Result.ok","text":"Aeneas.Std.Result.ok"},{"text":" "},{"text":"state"},{"ref":"And","text":" ∧\n    "},{"text":"↑"},{"text":"state"},{"text":"."},{"ref":"utf8.Incomplete.buffer","text":"buffer"},{"ref":"Eq","text":" = "},{"text":"↑"},{"text":"bytes"},{"ref":"HAppend.hAppend","text":" ++ "},{"ref":"List.replicate","text":"List.replicate"},{"text":" "},{"ref":"HSub.hSub","text":"("},{"text":"4"},{"ref":"HSub.hSub","text":" - "},{"text":"(↑"},{"text":"bytes"},{"text":")"},{"text":"."},{"ref":"List.length","text":"length"},{"ref":"HSub.hSub","text":")"},{"text":" "},{"text":"0"},{"ref":"Aeneas.Std.U8.ofNat","text":"#u8"},{"ref":"And","text":" ∧ "},{"text":"↑"},{"text":"state"},{"text":"."},{"ref":"utf8.Incomplete.buffer_len","text":"buffer_len"},{"ref":"Eq","text":" = "},{"text":"(↑"},{"text":"bytes"},{"text":")"},{"text":"."},{"ref":"List.length","text":"length"}],"definitions":[{"module":"Aeneas.Std.SliceDef","name":"Aeneas.Std.Slice","source":{"first_line":15,"last_line":19}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.U8","source":{"first_line":669,"last_line":669}},{"module":"Init.Prelude","name":"LE.le","source":{"first_line":1402,"last_line":1402}},{"module":"Init.Prelude","name":"Nat","source":{"first_line":1349,"last_line":1371}},{"module":"Init.Prelude","name":"instLENat","source":{"first_line":2026,"last_line":2027}},{"module":"Init.Prelude","name":"List.length","source":{"first_line":3182,"last_line":3195}},{"module":"Aeneas.Std.SliceDef","name":"Aeneas.Std.Slice.val","source":{"first_line":21,"last_line":22}},{"module":"Init.Prelude","name":"OfNat.ofNat","source":{"first_line":1393,"last_line":1393}},{"module":"Init.Prelude","name":"instOfNatNat","source":{"first_line":1395,"last_line":1397}},{"module":"Init.Core","name":"Exists","source":{"first_line":313,"last_line":341}},{"module":"Utf8","name":"utf8.Incomplete","source":{"first_line":23,"last_line":28}},{"module":"Init.Prelude","name":"And","source":{"first_line":645,"last_line":659}},{"module":"Init.Prelude","name":"Eq","source":{"first_line":46,"last_line":76}},{"module":"Aeneas.Std.Primitives","name":"Aeneas.Std.Result","source":{"first_line":67,"last_line":68}},{"module":"Utf8","name":"utf8.Incomplete.new","source":{"first_line":65,"last_line":78}},{"module":"Aeneas.Std.Primitives","name":"Aeneas.Std.Result.ok","source":{"first_line":72,"last_line":72}},{"module":"Init.Prelude","name":"List","source":{"first_line":3096,"last_line":3115}},{"module":"Aeneas.Std.Array.Array","name":"Aeneas.Std.Array.val","source":{"first_line":32,"last_line":33}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.Usize.ofNat","source":{"first_line":703,"last_line":703}},{"module":"Utf8","name":"utf8.Incomplete._proof_1","source":null},{"module":"Utf8","name":"utf8.Incomplete.buffer","source":{"first_line":27,"last_line":27}},{"module":"Init.Prelude","name":"HAppend.hAppend","source":{"first_line":1564,"last_line":1564}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalar","source":{"first_line":70,"last_line":74}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalarTy.U8","source":{"first_line":33,"last_line":33}},{"module":"Init.Prelude","name":"instHAppendOfAppend","source":{"first_line":1823,"last_line":1825}},{"module":"Init.Data.List.Basic","name":"List.instAppend","source":{"first_line":605,"last_line":605}},{"module":"Init.Data.List.Basic","name":"List.replicate","source":{"first_line":689,"last_line":699}},{"module":"Init.Prelude","name":"HSub.hSub","source":{"first_line":1491,"last_line":1491}},{"module":"Init.Prelude","name":"instHSub","source":{"first_line":1788,"last_line":1790}},{"module":"Init.Prelude","name":"instSubNat","source":{"first_line":2261,"last_line":2262}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.U8.ofNat","source":{"first_line":704,"last_line":704}},{"module":"Init.Prelude","name":"of_decide_eq_true","source":{"first_line":1224,"last_line":1227}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalar.cMax","source":{"first_line":378,"last_line":381}},{"module":"Init.Prelude","name":"Nat.decLe","source":{"first_line":2196,"last_line":2212}},{"module":"Init.Prelude","name":"id","source":{"first_line":119,"last_line":131}},{"module":"Init.Prelude","name":"Bool","source":{"first_line":99,"last_line":111}},{"module":"Init.Prelude","name":"Decidable.decide","source":{"first_line":1158,"last_line":1158}},{"module":"Init.Prelude","name":"Bool.true","source":{"first_line":110,"last_line":111}},{"module":"Init.Prelude","name":"Eq.refl","source":{"first_line":74,"last_line":76}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalar.val","source":{"first_line":76,"last_line":76}},{"module":"Utf8","name":"utf8.Incomplete.buffer_len","source":{"first_line":28,"last_line":28}}],"definitions_truncated":false,"first_line":27,"last_line":42,"module":"Proofs","program":null,"program_head":null,"statement":"∀ (bytes : Aeneas.Std.Slice.{0} Aeneas.Std.U8)\n  (bounded :\n    @LE.le.{0} Nat instLENat (@List.length.{0} Aeneas.Std.U8 (@Aeneas.Std.Slice.val.{0} Aeneas.Std.U8 bytes))\n      (@OfNat.ofNat.{0} Nat (nat_lit 4) (instOfNatNat (nat_lit 4)))),\n  @Exists.{1} utf8.Incomplete fun (state : utf8.Incomplete) =>\n    And\n      (@Eq.{1} (Aeneas.Std.Result.{0} utf8.Incomplete) (utf8.Incomplete.new bytes)\n        (@Aeneas.Std.Result.ok.{0} utf8.Incomplete state))\n      (And\n        (@Eq.{1} (List.{0} Aeneas.Std.U8)\n          (@Aeneas.Std.Array.val.{0} Aeneas.Std.U8\n            (Aeneas.Std.Usize.ofNat (@OfNat.ofNat.{0} Nat (nat_lit 4) (instOfNatNat (nat_lit 4)))\n              utf8.Incomplete._proof_1)\n            (utf8.Incomplete.buffer state))\n          (@HAppend.hAppend.{0, 0, 0} (List.{0} Aeneas.Std.U8) (List.{0} (Aeneas.Std.UScalar Aeneas.Std.UScalarTy.U8))\n            (List.{0} Aeneas.Std.U8)\n            (@instHAppendOfAppend.{0} (List.{0} Aeneas.Std.U8) (@List.instAppend.{0} Aeneas.Std.U8))\n            (@Aeneas.Std.Slice.val.{0} Aeneas.Std.U8 bytes)\n            (@List.replicate.{0} (Aeneas.Std.UScalar Aeneas.Std.UScalarTy.U8)\n              (@HSub.hSub.{0, 0, 0} Nat Nat Nat (@instHSub.{0} Nat instSubNat)\n                (@OfNat.ofNat.{0} Nat (nat_lit 4) (instOfNatNat (nat_lit 4)))\n                (@List.length.{0} Aeneas.Std.U8 (@Aeneas.Std.Slice.val.{0} Aeneas.Std.U8 bytes)))\n              (Aeneas.Std.U8.ofNat (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                (@of_decide_eq_true\n                  (@LE.le.{0} Nat instLENat (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                    (Aeneas.Std.UScalar.cMax Aeneas.Std.UScalarTy.U8))\n                  (Nat.decLe (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                    (Aeneas.Std.UScalar.cMax Aeneas.Std.UScalarTy.U8))\n                  (@id.{0}\n                    (@Eq.{1} Bool\n                      (@Decidable.decide\n                        (@LE.le.{0} Nat instLENat (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                          (Aeneas.Std.UScalar.cMax Aeneas.Std.UScalarTy.U8))\n                        (Nat.decLe (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                          (Aeneas.Std.UScalar.cMax Aeneas.Std.UScalarTy.U8)))\n                      Bool.true)\n                    (@Eq.refl.{1} Bool Bool.true)))))))\n        (@Eq.{1} Nat (@Aeneas.Std.UScalar.val Aeneas.Std.UScalarTy.U8 (utf8.Incomplete.buffer_len state))\n          (@List.length.{0} Aeneas.Std.U8 (@Aeneas.Std.Slice.val.{0} Aeneas.Std.U8 bytes))))","theorem":"Utf8Proofs.new_total","translation_rerun":false,"version":1}
proofs.rs:formal:{"axioms":["propext","Classical.choice","Quot.sound"],"binders":[],"conclusion":"∃ state,\n  utf8.Incomplete.empty = Aeneas.Std.Result.ok state ∧ ↑state.buffer = List.replicate 4 0#u8 ∧ ↑state.buffer_len = 0","conclusion_segments":[{"text":"∃ "},{"text":"state"},{"text":",\n  "},{"ref":"utf8.Incomplete.empty","text":"utf8.Incomplete.empty"},{"ref":"Eq","text":" = "},{"ref":"Aeneas.Std.Result.ok","text":"Aeneas.Std.Result.ok"},{"text":" "},{"text":"state"},{"ref":"And","text":" ∧ "},{"text":"↑"},{"text":"state"},{"text":"."},{"ref":"utf8.Incomplete.buffer","text":"buffer"},{"ref":"Eq","text":" = "},{"ref":"List.replicate","text":"List.replicate"},{"text":" "},{"text":"4"},{"text":" "},{"text":"0"},{"ref":"Aeneas.Std.U8.ofNat","text":"#u8"},{"ref":"And","text":" ∧ "},{"text":"↑"},{"text":"state"},{"text":"."},{"ref":"utf8.Incomplete.buffer_len","text":"buffer_len"},{"ref":"Eq","text":" = "},{"text":"0"}],"definitions":[{"module":"Init.Core","name":"Exists","source":{"first_line":313,"last_line":341}},{"module":"Utf8","name":"utf8.Incomplete","source":{"first_line":23,"last_line":28}},{"module":"Init.Prelude","name":"And","source":{"first_line":645,"last_line":659}},{"module":"Init.Prelude","name":"Eq","source":{"first_line":46,"last_line":76}},{"module":"Aeneas.Std.Primitives","name":"Aeneas.Std.Result","source":{"first_line":67,"last_line":68}},{"module":"Utf8","name":"utf8.Incomplete.empty","source":{"first_line":52,"last_line":57}},{"module":"Aeneas.Std.Primitives","name":"Aeneas.Std.Result.ok","source":{"first_line":72,"last_line":72}},{"module":"Init.Prelude","name":"List","source":{"first_line":3096,"last_line":3115}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.U8","source":{"first_line":669,"last_line":669}},{"module":"Aeneas.Std.Array.Array","name":"Aeneas.Std.Array.val","source":{"first_line":32,"last_line":33}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.Usize.ofNat","source":{"first_line":703,"last_line":703}},{"module":"Init.Prelude","name":"OfNat.ofNat","source":{"first_line":1393,"last_line":1393}},{"module":"Init.Prelude","name":"Nat","source":{"first_line":1349,"last_line":1371}},{"module":"Init.Prelude","name":"instOfNatNat","source":{"first_line":1395,"last_line":1397}},{"module":"Utf8","name":"utf8.Incomplete._proof_1","source":null},{"module":"Utf8","name":"utf8.Incomplete.buffer","source":{"first_line":27,"last_line":27}},{"module":"Init.Data.List.Basic","name":"List.replicate","source":{"first_line":689,"last_line":699}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalar","source":{"first_line":70,"last_line":74}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalarTy.U8","source":{"first_line":33,"last_line":33}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.U8.ofNat","source":{"first_line":704,"last_line":704}},{"module":"Init.Prelude","name":"of_decide_eq_true","source":{"first_line":1224,"last_line":1227}},{"module":"Init.Prelude","name":"LE.le","source":{"first_line":1402,"last_line":1402}},{"module":"Init.Prelude","name":"instLENat","source":{"first_line":2026,"last_line":2027}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalar.cMax","source":{"first_line":378,"last_line":381}},{"module":"Init.Prelude","name":"Nat.decLe","source":{"first_line":2196,"last_line":2212}},{"module":"Init.Prelude","name":"id","source":{"first_line":119,"last_line":131}},{"module":"Init.Prelude","name":"Bool","source":{"first_line":99,"last_line":111}},{"module":"Init.Prelude","name":"Decidable.decide","source":{"first_line":1158,"last_line":1158}},{"module":"Init.Prelude","name":"Bool.true","source":{"first_line":110,"last_line":111}},{"module":"Init.Prelude","name":"Eq.refl","source":{"first_line":74,"last_line":76}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalar.val","source":{"first_line":76,"last_line":76}},{"module":"Utf8","name":"utf8.Incomplete.buffer_len","source":{"first_line":28,"last_line":28}}],"definitions_truncated":false,"first_line":16,"last_line":19,"module":"Proofs","program":null,"program_head":null,"statement":"@Exists.{1} utf8.Incomplete fun (state : utf8.Incomplete) =>\n  And\n    (@Eq.{1} (Aeneas.Std.Result.{0} utf8.Incomplete) utf8.Incomplete.empty\n      (@Aeneas.Std.Result.ok.{0} utf8.Incomplete state))\n    (And\n      (@Eq.{1} (List.{0} Aeneas.Std.U8)\n        (@Aeneas.Std.Array.val.{0} Aeneas.Std.U8\n          (Aeneas.Std.Usize.ofNat (@OfNat.ofNat.{0} Nat (nat_lit 4) (instOfNatNat (nat_lit 4)))\n            utf8.Incomplete._proof_1)\n          (utf8.Incomplete.buffer state))\n        (@List.replicate.{0} (Aeneas.Std.UScalar Aeneas.Std.UScalarTy.U8)\n          (@OfNat.ofNat.{0} Nat (nat_lit 4) (instOfNatNat (nat_lit 4)))\n          (Aeneas.Std.U8.ofNat (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n            (@of_decide_eq_true\n              (@LE.le.{0} Nat instLENat (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                (Aeneas.Std.UScalar.cMax Aeneas.Std.UScalarTy.U8))\n              (Nat.decLe (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                (Aeneas.Std.UScalar.cMax Aeneas.Std.UScalarTy.U8))\n              (@id.{0}\n                (@Eq.{1} Bool\n                  (@Decidable.decide\n                    (@LE.le.{0} Nat instLENat (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                      (Aeneas.Std.UScalar.cMax Aeneas.Std.UScalarTy.U8))\n                    (Nat.decLe (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                      (Aeneas.Std.UScalar.cMax Aeneas.Std.UScalarTy.U8)))\n                  Bool.true)\n                (@Eq.refl.{1} Bool Bool.true))))))\n      (@Eq.{1} Nat (@Aeneas.Std.UScalar.val Aeneas.Std.UScalarTy.U8 (utf8.Incomplete.buffer_len state))\n        (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))))","theorem":"Utf8Proofs.empty_total","translation_rerun":false,"version":1}
proofs.rs:formal:{"axioms":["propext","Classical.choice","Quot.sound"],"binders":[{"binder":"implicit","kind":"variable","name":"B","type":"Type","type_segments":[{"text":"Type"}]},{"binder":"explicit","kind":"variable","name":"reader","type":"B","type_segments":[{"text":"B"}]}],"conclusion":"∃ out,\n  utf8.read.BufReadDecoder.new reader = Aeneas.Std.Result.ok out ∧\n    out.buf_read = reader ∧\n      ↑out.bytes_consumed = 0 ∧ ↑out.incomplete.buffer = List.replicate 4 0#u8 ∧ ↑out.incomplete.buffer_len = 0","conclusion_segments":[{"text":"∃ "},{"text":"out"},{"text":",\n  "},{"ref":"utf8.read.BufReadDecoder.new","text":"utf8.read.BufReadDecoder.new"},{"text":" "},{"text":"reader"},{"ref":"Eq","text":" = "},{"ref":"Aeneas.Std.Result.ok","text":"Aeneas.Std.Result.ok"},{"text":" "},{"text":"out"},{"ref":"And","text":" ∧\n    "},{"text":"out"},{"text":"."},{"ref":"utf8.read.BufReadDecoder.buf_read","text":"buf_read"},{"ref":"Eq","text":" = "},{"text":"reader"},{"ref":"And","text":" ∧\n      "},{"text":"↑"},{"text":"out"},{"text":"."},{"ref":"utf8.read.BufReadDecoder.bytes_consumed","text":"bytes_consumed"},{"ref":"Eq","text":" = "},{"text":"0"},{"ref":"And","text":" ∧ "},{"text":"↑"},{"text":"out"},{"text":"."},{"ref":"utf8.read.BufReadDecoder.incomplete","text":"incomplete"},{"text":"."},{"ref":"utf8.Incomplete.buffer","text":"buffer"},{"ref":"Eq","text":" = "},{"ref":"List.replicate","text":"List.replicate"},{"text":" "},{"text":"4"},{"text":" "},{"text":"0"},{"ref":"Aeneas.Std.U8.ofNat","text":"#u8"},{"ref":"And","text":" ∧ "},{"text":"↑"},{"text":"out"},{"text":"."},{"ref":"utf8.read.BufReadDecoder.incomplete","text":"incomplete"},{"text":"."},{"ref":"utf8.Incomplete.buffer_len","text":"buffer_len"},{"ref":"Eq","text":" = "},{"text":"0"}],"definitions":[{"module":"Init.Core","name":"Exists","source":{"first_line":313,"last_line":341}},{"module":"Utf8","name":"utf8.read.BufReadDecoder","source":{"first_line":106,"last_line":112}},{"module":"Init.Prelude","name":"And","source":{"first_line":645,"last_line":659}},{"module":"Init.Prelude","name":"Eq","source":{"first_line":46,"last_line":76}},{"module":"Aeneas.Std.Primitives","name":"Aeneas.Std.Result","source":{"first_line":67,"last_line":68}},{"module":"Utf8","name":"utf8.read.BufReadDecoder.new","source":{"first_line":114,"last_line":120}},{"module":"Aeneas.Std.Primitives","name":"Aeneas.Std.Result.ok","source":{"first_line":72,"last_line":72}},{"module":"Utf8","name":"utf8.read.BufReadDecoder.buf_read","source":{"first_line":110,"last_line":110}},{"module":"Init.Prelude","name":"Nat","source":{"first_line":1349,"last_line":1371}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalar.val","source":{"first_line":76,"last_line":76}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalarTy.Usize","source":{"first_line":32,"last_line":32}},{"module":"Utf8","name":"utf8.read.BufReadDecoder.bytes_consumed","source":{"first_line":111,"last_line":111}},{"module":"Init.Prelude","name":"OfNat.ofNat","source":{"first_line":1393,"last_line":1393}},{"module":"Init.Prelude","name":"instOfNatNat","source":{"first_line":1395,"last_line":1397}},{"module":"Init.Prelude","name":"List","source":{"first_line":3096,"last_line":3115}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.U8","source":{"first_line":669,"last_line":669}},{"module":"Aeneas.Std.Array.Array","name":"Aeneas.Std.Array.val","source":{"first_line":32,"last_line":33}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.Usize.ofNat","source":{"first_line":703,"last_line":703}},{"module":"Utf8","name":"utf8.Incomplete._proof_1","source":null},{"module":"Utf8","name":"utf8.Incomplete.buffer","source":{"first_line":27,"last_line":27}},{"module":"Utf8","name":"utf8.read.BufReadDecoder.incomplete","source":{"first_line":112,"last_line":112}},{"module":"Init.Data.List.Basic","name":"List.replicate","source":{"first_line":689,"last_line":699}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalar","source":{"first_line":70,"last_line":74}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalarTy.U8","source":{"first_line":33,"last_line":33}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.U8.ofNat","source":{"first_line":704,"last_line":704}},{"module":"Init.Prelude","name":"of_decide_eq_true","source":{"first_line":1224,"last_line":1227}},{"module":"Init.Prelude","name":"LE.le","source":{"first_line":1402,"last_line":1402}},{"module":"Init.Prelude","name":"instLENat","source":{"first_line":2026,"last_line":2027}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalar.cMax","source":{"first_line":378,"last_line":381}},{"module":"Init.Prelude","name":"Nat.decLe","source":{"first_line":2196,"last_line":2212}},{"module":"Init.Prelude","name":"id","source":{"first_line":119,"last_line":131}},{"module":"Init.Prelude","name":"Bool","source":{"first_line":99,"last_line":111}},{"module":"Init.Prelude","name":"Decidable.decide","source":{"first_line":1158,"last_line":1158}},{"module":"Init.Prelude","name":"Bool.true","source":{"first_line":110,"last_line":111}},{"module":"Init.Prelude","name":"Eq.refl","source":{"first_line":74,"last_line":76}},{"module":"Utf8","name":"utf8.Incomplete.buffer_len","source":{"first_line":28,"last_line":28}}],"definitions_truncated":false,"first_line":70,"last_line":75,"module":"Proofs","program":null,"program_head":null,"statement":"∀ {B : Type} (reader : B),\n  @Exists.{1} (utf8.read.BufReadDecoder.{0} B) fun (out : utf8.read.BufReadDecoder.{0} B) =>\n    And\n      (@Eq.{1} (Aeneas.Std.Result.{0} (utf8.read.BufReadDecoder.{0} B)) (@utf8.read.BufReadDecoder.new.{0} B reader)\n        (@Aeneas.Std.Result.ok.{0} (utf8.read.BufReadDecoder.{0} B) out))\n      (And (@Eq.{1} B (@utf8.read.BufReadDecoder.buf_read.{0} B out) reader)\n        (And\n          (@Eq.{1} Nat\n            (@Aeneas.Std.UScalar.val Aeneas.Std.UScalarTy.Usize (@utf8.read.BufReadDecoder.bytes_consumed.{0} B out))\n            (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0))))\n          (And\n            (@Eq.{1} (List.{0} Aeneas.Std.U8)\n              (@Aeneas.Std.Array.val.{0} Aeneas.Std.U8\n                (Aeneas.Std.Usize.ofNat (@OfNat.ofNat.{0} Nat (nat_lit 4) (instOfNatNat (nat_lit 4)))\n                  utf8.Incomplete._proof_1)\n                (utf8.Incomplete.buffer (@utf8.read.BufReadDecoder.incomplete.{0} B out)))\n              (@List.replicate.{0} (Aeneas.Std.UScalar Aeneas.Std.UScalarTy.U8)\n                (@OfNat.ofNat.{0} Nat (nat_lit 4) (instOfNatNat (nat_lit 4)))\n                (Aeneas.Std.U8.ofNat (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                  (@of_decide_eq_true\n                    (@LE.le.{0} Nat instLENat (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                      (Aeneas.Std.UScalar.cMax Aeneas.Std.UScalarTy.U8))\n                    (Nat.decLe (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                      (Aeneas.Std.UScalar.cMax Aeneas.Std.UScalarTy.U8))\n                    (@id.{0}\n                      (@Eq.{1} Bool\n                        (@Decidable.decide\n                          (@LE.le.{0} Nat instLENat (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                            (Aeneas.Std.UScalar.cMax Aeneas.Std.UScalarTy.U8))\n                          (Nat.decLe (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                            (Aeneas.Std.UScalar.cMax Aeneas.Std.UScalarTy.U8)))\n                        Bool.true)\n                      (@Eq.refl.{1} Bool Bool.true))))))\n            (@Eq.{1} Nat\n              (@Aeneas.Std.UScalar.val Aeneas.Std.UScalarTy.U8\n                (utf8.Incomplete.buffer_len (@utf8.read.BufReadDecoder.incomplete.{0} B out)))\n              (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))))))","theorem":"Utf8Proofs.bufread_new_total","translation_rerun":false,"version":1}
proofs.rs:formal:{"axioms":["propext","Classical.choice","Quot.sound"],"binders":[{"binder":"explicit","kind":"variable","name":"error","type":"utf8.DecodeError","type_segments":[{"ref":"utf8.DecodeError","text":"utf8.DecodeError"}]}],"conclusion":"∃ out, utf8.DecodeError.Insts.CoreCloneClone.clone error = Aeneas.Std.Result.ok out ∧ out = error","conclusion_segments":[{"text":"∃ "},{"text":"out"},{"text":", "},{"ref":"utf8.DecodeError.Insts.CoreCloneClone.clone","text":"utf8.DecodeError.Insts.CoreCloneClone.clone"},{"text":" "},{"text":"error"},{"ref":"Eq","text":" = "},{"ref":"Aeneas.Std.Result.ok","text":"Aeneas.Std.Result.ok"},{"text":" "},{"text":"out"},{"ref":"And","text":" ∧ "},{"text":"out"},{"ref":"Eq","text":" = "},{"text":"error"}],"definitions":[{"module":"Utf8","name":"utf8.DecodeError","source":{"first_line":30,"last_line":36}},{"module":"Init.Core","name":"Exists","source":{"first_line":313,"last_line":341}},{"module":"Init.Prelude","name":"And","source":{"first_line":645,"last_line":659}},{"module":"Init.Prelude","name":"Eq","source":{"first_line":46,"last_line":76}},{"module":"Aeneas.Std.Primitives","name":"Aeneas.Std.Result","source":{"first_line":67,"last_line":68}},{"module":"Utf8","name":"utf8.DecodeError.Insts.CoreCloneClone.clone","source":{"first_line":38,"last_line":43}},{"module":"Aeneas.Std.Primitives","name":"Aeneas.Std.Result.ok","source":{"first_line":72,"last_line":72}}],"definitions_truncated":false,"first_line":60,"last_line":62,"module":"Proofs","program":null,"program_head":null,"statement":"∀ (error : utf8.DecodeError),\n  @Exists.{1} utf8.DecodeError fun (out : utf8.DecodeError) =>\n    And\n      (@Eq.{1} (Aeneas.Std.Result.{0} utf8.DecodeError) (utf8.DecodeError.Insts.CoreCloneClone.clone error)\n        (@Aeneas.Std.Result.ok.{0} utf8.DecodeError out))\n      (@Eq.{1} utf8.DecodeError out error)","theorem":"Utf8Proofs.decode_error_clone_total","translation_rerun":false,"version":1}
proofs.rs:formal:{"axioms":["propext","Classical.choice","Quot.sound"],"binders":[{"binder":"explicit","kind":"variable","name":"state","type":"utf8.Incomplete","type_segments":[{"ref":"utf8.Incomplete","text":"utf8.Incomplete"}]}],"conclusion":"∃ empty, state.is_empty = Aeneas.Std.Result.ok empty ∧ (empty = Bool.true ↔ ↑state.buffer_len = 0)","conclusion_segments":[{"text":"∃ "},{"text":"empty"},{"text":", "},{"text":"state"},{"text":"."},{"ref":"utf8.Incomplete.is_empty","text":"is_empty"},{"ref":"Eq","text":" = "},{"ref":"Aeneas.Std.Result.ok","text":"Aeneas.Std.Result.ok"},{"text":" "},{"text":"empty"},{"ref":"And","text":" ∧ "},{"ref":"Iff","text":"("},{"text":"empty"},{"ref":"Eq","text":" = "},{"ref":"Bool.true","text":"Bool.true"},{"ref":"Iff","text":" ↔ "},{"text":"↑"},{"text":"state"},{"text":"."},{"ref":"utf8.Incomplete.buffer_len","text":"buffer_len"},{"ref":"Eq","text":" = "},{"text":"0"},{"ref":"Iff","text":")"}],"definitions":[{"module":"Utf8","name":"utf8.Incomplete","source":{"first_line":23,"last_line":28}},{"module":"Init.Core","name":"Exists","source":{"first_line":313,"last_line":341}},{"module":"Init.Prelude","name":"Bool","source":{"first_line":99,"last_line":111}},{"module":"Init.Prelude","name":"And","source":{"first_line":645,"last_line":659}},{"module":"Init.Prelude","name":"Eq","source":{"first_line":46,"last_line":76}},{"module":"Aeneas.Std.Primitives","name":"Aeneas.Std.Result","source":{"first_line":67,"last_line":68}},{"module":"Utf8","name":"utf8.Incomplete.is_empty","source":{"first_line":59,"last_line":63}},{"module":"Aeneas.Std.Primitives","name":"Aeneas.Std.Result.ok","source":{"first_line":72,"last_line":72}},{"module":"Init.Core","name":"Iff","source":{"first_line":183,"last_line":194}},{"module":"Init.Prelude","name":"Bool.true","source":{"first_line":110,"last_line":111}},{"module":"Init.Prelude","name":"Nat","source":{"first_line":1349,"last_line":1371}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalar.val","source":{"first_line":76,"last_line":76}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalarTy.U8","source":{"first_line":33,"last_line":33}},{"module":"Utf8","name":"utf8.Incomplete.buffer_len","source":{"first_line":28,"last_line":28}},{"module":"Init.Prelude","name":"OfNat.ofNat","source":{"first_line":1393,"last_line":1393}},{"module":"Init.Prelude","name":"instOfNatNat","source":{"first_line":1395,"last_line":1397}}],"definitions_truncated":false,"first_line":21,"last_line":25,"module":"Proofs","program":null,"program_head":null,"statement":"∀ (state : utf8.Incomplete),\n  @Exists.{1} Bool fun (empty : Bool) =>\n    And (@Eq.{1} (Aeneas.Std.Result.{0} Bool) (utf8.Incomplete.is_empty state) (@Aeneas.Std.Result.ok.{0} Bool empty))\n      (Iff (@Eq.{1} Bool empty Bool.true)\n        (@Eq.{1} Nat (@Aeneas.Std.UScalar.val Aeneas.Std.UScalarTy.U8 (utf8.Incomplete.buffer_len state))\n          (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))))","theorem":"Utf8Proofs.is_empty_total","translation_rerun":false,"version":1}
proofs.rs:formal:{"axioms":["propext","Classical.choice","Quot.sound"],"binders":[{"binder":"implicit","kind":"variable","name":"F","type":"Type","type_segments":[{"text":"Type"}]},{"binder":"explicit","kind":"variable","name":"callback","type":"F","type_segments":[{"text":"F"}]}],"conclusion":"∃ out,\n  utf8.lossy.LossyDecoder.new callback = Aeneas.Std.Result.ok out ∧\n    out.push_str = callback ∧ ↑out.incomplete.buffer = List.replicate 4 0#u8 ∧ ↑out.incomplete.buffer_len = 0","conclusion_segments":[{"text":"∃ "},{"text":"out"},{"text":",\n  "},{"ref":"utf8.lossy.LossyDecoder.new","text":"utf8.lossy.LossyDecoder.new"},{"text":" "},{"text":"callback"},{"ref":"Eq","text":" = "},{"ref":"Aeneas.Std.Result.ok","text":"Aeneas.Std.Result.ok"},{"text":" "},{"text":"out"},{"ref":"And","text":" ∧\n    "},{"text":"out"},{"text":"."},{"ref":"utf8.lossy.LossyDecoder.push_str","text":"push_str"},{"ref":"Eq","text":" = "},{"text":"callback"},{"ref":"And","text":" ∧ "},{"text":"↑"},{"text":"out"},{"text":"."},{"ref":"utf8.lossy.LossyDecoder.incomplete","text":"incomplete"},{"text":"."},{"ref":"utf8.Incomplete.buffer","text":"buffer"},{"ref":"Eq","text":" = "},{"ref":"List.replicate","text":"List.replicate"},{"text":" "},{"text":"4"},{"text":" "},{"text":"0"},{"ref":"Aeneas.Std.U8.ofNat","text":"#u8"},{"ref":"And","text":" ∧ "},{"text":"↑"},{"text":"out"},{"text":"."},{"ref":"utf8.lossy.LossyDecoder.incomplete","text":"incomplete"},{"text":"."},{"ref":"utf8.Incomplete.buffer_len","text":"buffer_len"},{"ref":"Eq","text":" = "},{"text":"0"}],"definitions":[{"module":"Init.Core","name":"Exists","source":{"first_line":313,"last_line":341}},{"module":"Utf8","name":"utf8.lossy.LossyDecoder","source":{"first_line":91,"last_line":96}},{"module":"Init.Prelude","name":"And","source":{"first_line":645,"last_line":659}},{"module":"Init.Prelude","name":"Eq","source":{"first_line":46,"last_line":76}},{"module":"Aeneas.Std.Primitives","name":"Aeneas.Std.Result","source":{"first_line":67,"last_line":68}},{"module":"Utf8","name":"utf8.lossy.LossyDecoder.new","source":{"first_line":98,"last_line":104}},{"module":"Aeneas.Std.Primitives","name":"Aeneas.Std.Result.ok","source":{"first_line":72,"last_line":72}},{"module":"Utf8","name":"utf8.lossy.LossyDecoder.push_str","source":{"first_line":95,"last_line":95}},{"module":"Init.Prelude","name":"List","source":{"first_line":3096,"last_line":3115}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.U8","source":{"first_line":669,"last_line":669}},{"module":"Aeneas.Std.Array.Array","name":"Aeneas.Std.Array.val","source":{"first_line":32,"last_line":33}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.Usize.ofNat","source":{"first_line":703,"last_line":703}},{"module":"Init.Prelude","name":"OfNat.ofNat","source":{"first_line":1393,"last_line":1393}},{"module":"Init.Prelude","name":"Nat","source":{"first_line":1349,"last_line":1371}},{"module":"Init.Prelude","name":"instOfNatNat","source":{"first_line":1395,"last_line":1397}},{"module":"Utf8","name":"utf8.Incomplete._proof_1","source":null},{"module":"Utf8","name":"utf8.Incomplete.buffer","source":{"first_line":27,"last_line":27}},{"module":"Utf8","name":"utf8.lossy.LossyDecoder.incomplete","source":{"first_line":96,"last_line":96}},{"module":"Init.Data.List.Basic","name":"List.replicate","source":{"first_line":689,"last_line":699}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalar","source":{"first_line":70,"last_line":74}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalarTy.U8","source":{"first_line":33,"last_line":33}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.U8.ofNat","source":{"first_line":704,"last_line":704}},{"module":"Init.Prelude","name":"of_decide_eq_true","source":{"first_line":1224,"last_line":1227}},{"module":"Init.Prelude","name":"LE.le","source":{"first_line":1402,"last_line":1402}},{"module":"Init.Prelude","name":"instLENat","source":{"first_line":2026,"last_line":2027}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalar.cMax","source":{"first_line":378,"last_line":381}},{"module":"Init.Prelude","name":"Nat.decLe","source":{"first_line":2196,"last_line":2212}},{"module":"Init.Prelude","name":"id","source":{"first_line":119,"last_line":131}},{"module":"Init.Prelude","name":"Bool","source":{"first_line":99,"last_line":111}},{"module":"Init.Prelude","name":"Decidable.decide","source":{"first_line":1158,"last_line":1158}},{"module":"Init.Prelude","name":"Bool.true","source":{"first_line":110,"last_line":111}},{"module":"Init.Prelude","name":"Eq.refl","source":{"first_line":74,"last_line":76}},{"module":"Aeneas.Std.Scalar.Core","name":"Aeneas.Std.UScalar.val","source":{"first_line":76,"last_line":76}},{"module":"Utf8","name":"utf8.Incomplete.buffer_len","source":{"first_line":28,"last_line":28}}],"definitions_truncated":false,"first_line":64,"last_line":68,"module":"Proofs","program":null,"program_head":null,"statement":"∀ {F : Type} (callback : F),\n  @Exists.{1} (utf8.lossy.LossyDecoder.{0} F) fun (out : utf8.lossy.LossyDecoder.{0} F) =>\n    And\n      (@Eq.{1} (Aeneas.Std.Result.{0} (utf8.lossy.LossyDecoder.{0} F)) (@utf8.lossy.LossyDecoder.new.{0} F callback)\n        (@Aeneas.Std.Result.ok.{0} (utf8.lossy.LossyDecoder.{0} F) out))\n      (And (@Eq.{1} F (@utf8.lossy.LossyDecoder.push_str.{0} F out) callback)\n        (And\n          (@Eq.{1} (List.{0} Aeneas.Std.U8)\n            (@Aeneas.Std.Array.val.{0} Aeneas.Std.U8\n              (Aeneas.Std.Usize.ofNat (@OfNat.ofNat.{0} Nat (nat_lit 4) (instOfNatNat (nat_lit 4)))\n                utf8.Incomplete._proof_1)\n              (utf8.Incomplete.buffer (@utf8.lossy.LossyDecoder.incomplete.{0} F out)))\n            (@List.replicate.{0} (Aeneas.Std.UScalar Aeneas.Std.UScalarTy.U8)\n              (@OfNat.ofNat.{0} Nat (nat_lit 4) (instOfNatNat (nat_lit 4)))\n              (Aeneas.Std.U8.ofNat (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                (@of_decide_eq_true\n                  (@LE.le.{0} Nat instLENat (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                    (Aeneas.Std.UScalar.cMax Aeneas.Std.UScalarTy.U8))\n                  (Nat.decLe (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                    (Aeneas.Std.UScalar.cMax Aeneas.Std.UScalarTy.U8))\n                  (@id.{0}\n                    (@Eq.{1} Bool\n                      (@Decidable.decide\n                        (@LE.le.{0} Nat instLENat (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                          (Aeneas.Std.UScalar.cMax Aeneas.Std.UScalarTy.U8))\n                        (Nat.decLe (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))\n                          (Aeneas.Std.UScalar.cMax Aeneas.Std.UScalarTy.U8)))\n                      Bool.true)\n                    (@Eq.refl.{1} Bool Bool.true))))))\n          (@Eq.{1} Nat\n            (@Aeneas.Std.UScalar.val Aeneas.Std.UScalarTy.U8\n              (utf8.Incomplete.buffer_len (@utf8.lossy.LossyDecoder.incomplete.{0} F out)))\n            (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0))))))","theorem":"Utf8Proofs.lossy_new_total","translation_rerun":false,"version":1}

=== stderr ===
Environment

The audited subject is the unchanged crates.io utf-8 0.7.6 release, on aarch64-apple-darwin. Seven public API contracts were checked with unpatched Aeneas and Charon and Lean 4.35.0. A private buffer helper was checked separately. Native tests were run separately from the formal proof.

What is trusted

The selected Rust implementation is translated through Charon and Aeneas and checked by Lean. The guarantees depend on the correctness of that translation, its models of Rust operations, and the Lean kernel. The model represents referenced data by value; the clone result does not establish reference identity. The models and extraction do not by themselves establish all Rust memory-safety properties.

Technical limitations

This is partial coverage: decode, try_complete, the lossy and buffered reader consumers, formatting and error-source accessors are not covered by the selected API claims. In particular, the constructor proofs do not establish UTF-8 decoding or streaming behavior. Incomplete::new is covered only for inputs of at most four bytes. A separate experiment checks private helpers in adapted source under explicit classification premises; it does not establish a release API guarantee or a formal equivalence to release code. A complete formal correspondence proof between Rust execution and the translated model is not provided.

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

Dependencies (0)

No direct dependencies.

Comments (0)

No comments.

Sign in to comment.