proofs.rs

Report #4 — Correct decimal formatting for all supported integers on x86_64

creusot 0.11.0-dev+itoa-toolpatch

4 verified claims · 0 findings

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

nyuichi · 2026-10-04 02:21 UTC

Revision v4 · v3 · v2 · v1

Overview

itoa formats an integer into a fixed stack buffer and returns a borrowed string containing its decimal representation. For every value of u8, u16, u32, u64, u128, i8, i16, i32, i64, i128, usize and isize on the verified x86_64 target, Buffer::format produces the canonical decimal text: zero is "0", other values have no leading zeroes, and negative values have exactly one leading minus sign. This includes the minimum signed values, including i128::MIN. The guarantee applies to the adapted source identified below, under the memory-view and core-library assumptions stated here.

The recorded integrated proofs cover the actual public method and all concrete integer writers, in both default and all-features configurations. They establish that output fits the type's MAX_STR_LEN, occupies an initialized suffix of the buffer, and consists of ASCII bytes valid as UTF-8. The optimized reciprocal division, decimal-pair lookup, 16-digit chunk encoder and u128 multiplication helper have proved bodies; formatting arithmetic is not assumed. In particular, the multiplication helper returns floor(x*y/2^128). These are proofs for arbitrary values of the supported types, rather than a finite collection of formatting examples. The writer contracts accept prior buffer contents and preserve slots outside their output, supporting reuse after earlier calls. Under the same assumptions, the proved runtime path is panic-free: bounds, overflow and checked-conversion obligations are discharged, and the public unreachable_unchecked branch is shown unreachable.

Verification required tool fixes for Rust unsigned narrowing casts and bitvector reasoning. The compiler patch translates narrowing to remainder modulo 2^the destination width, matching Rust's truncation semantics; Why3 driver changes activate the corresponding 64- and 128-bit integer-to-bitvector encodings. A right-shift lemma with a usable trigger is derived from the existing generic shift equation. Recorded narrowing, high-half and shift witnesses and the derived-lemma result validate these targeted changes. A custom Z3 driver also removes the Power_sum premise to avoid excessive quantifier instantiation: inspected standard and pruned solver tasks differ only by that premise, retaining the same goal, so this strengthens the obligation rather than assuming the desired result. These checks support the patched model used here; they are not a comprehensive validation of the verifier.

Findings (0)

No findings reported.

APIs (4)

Associated functions

impl Buffer

pub fn new() -> Buffer

Methods

impl Buffer

pub fn format<I: Integer>(self: &mut Self, i: I) -> &str

Trait implementations

impl core::clone::Clone for Buffer

pub fn clone(self: &Self) -> Self

impl core::default::Default for Buffer

pub fn default() -> Buffer

Evidence

https://github.com/nyuichi/rust-crate-proofs/blob/ae01d2538298d1873485477ef1ccc85a111a6925/itoa/1.0.18/RUNTIME_VERIFICATION.md

Reproduce

Toolchain source metadata: not recorded.

Run locally

git clone -- https://github.com/nyuichi/rust-crate-proofs report-4-source-1
git -C report-4-source-1 checkout --detach ae01d2538298d1873485477ef1ccc85a111a6925
git -C report-4-source-1 submodule update --init --recursive --checkout
cd report-4-source-1/itoa/1.0.18

env RUSTUP_HOME=/workspace/proof-tools/rustup CARGO_HOME=/workspace/proof-tools/cargo CREUSOT_DATA_HOME=/workspace/proof-tools/creusot-data XDG_CONFIG_HOME=/workspace/proof-tools/config XDG_CACHE_HOME=/workspace/proof-tools/cache WHY3_BASE_DATA=/workspace/proof-tools/creusot-data/_opam/share/why3 CARGO_TARGET_DIR=/workspace/proof-tools/targets/itoa-publication LD_LIBRARY_PATH=/workspace/proof-tools/system/usr/lib/x86_64-linux-gnu PATH=/workspace/proof-tools/autoconf/bin:/workspace/proof-tools/system/usr/bin:/workspace/proof-tools:/workspace/proof-tools/creusot-data/bin:/workspace/proof-tools/cargo/bin:/home/agent/.local/bin:/opt/codex/runtimes/codex-primary-runtime/dependencies/bin/override:/opt/codex/runtimes/codex-primary-runtime/dependencies/python/bin:/opt/codex/runtimes/codex-primary-runtime/dependencies/node/bin:/opt/codex/runtimes/codex-primary-runtime/dependencies/bin:/opt/codex/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/agent/.local/bin:/opt/codex/runtimes/codex-primary-runtime/dependencies/bin/fallback ../../tools/creusot-toolpatch/scripts/run-proof.sh bash -c 'set -e
cargo creusot --simple-triggers=false prove --no-cache verif/itoa_rlib/runtime/impl_Buffer/format.coma verif/itoa_rlib/runtime/impl_Buffer/new.coma verif/itoa_rlib/runtime/impl_Clone_for_Buffer/clone.coma verif/itoa_rlib/runtime/impl_Default_for_Buffer/default.coma
cargo creusot --simple-triggers=false prove --no-cache verif/itoa_rlib/runtime/impl_Buffer/format.coma verif/itoa_rlib/runtime/impl_Buffer/new.coma verif/itoa_rlib/runtime/impl_Clone_for_Buffer/clone.coma verif/itoa_rlib/runtime/impl_Default_for_Buffer/default.coma -- --all-features'

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 · 21 checks passed · 0 failed

2026-10-04T02:20:05.430614+00:00 · 20.0 seconds · Exit code 0

Recorded on the author’s machine.

CheckResultClaim
itoa::Buffer::format: all 3 VCs proved (default); observed in embedded focused proof log.
itoa::runtime.impl_Buffer.format
PassedClaim #1
itoa::Buffer::format: all 5 VCs proved (all-features); observed in embedded focused proof log.
itoa::runtime.impl_Buffer.format
PassedClaim #1
itoa::Buffer::format: /Coma/vc_closure0 proved by z3@4.15.3 (final all-features session).
itoa::runtime.impl_Buffer.format
PassedClaim #1
itoa::Buffer::format: /Coma/vc_forget___NoPanic proved by z3@4.15.3 (final all-features session).
itoa::runtime.impl_Buffer.format
PassedClaim #1
itoa::Buffer::format: /Coma/vc_format_I proved by z3@4.15.3 (final all-features session).
itoa::runtime.impl_Buffer.format
PassedClaim #1
itoa::Buffer::format: /Coma/vc_len proved by z3@4.15.3 (final all-features session).
itoa::runtime.impl_Buffer.format
PassedClaim #1
itoa::Buffer::format: /Coma/vc_write_I proved by z3@4.15.3 (final all-features session).
itoa::runtime.impl_Buffer.format
PassedClaim #1
itoa::Buffer::new: all 2 VCs proved (default); observed in embedded focused proof log.
itoa::runtime.impl_Buffer.new
PassedClaim #2
itoa::Buffer::new: all 4 VCs proved (all-features); observed in embedded focused proof log.
itoa::runtime.impl_Buffer.new
PassedClaim #2
itoa::Buffer::new: /Coma/vc_closure0 proved by z3@4.15.3 (final all-features session).
itoa::runtime.impl_Buffer.new
PassedClaim #2
itoa::Buffer::new: /Coma/vc_forget___NoPanic proved by z3@4.15.3 (final all-features session).
itoa::runtime.impl_Buffer.new
PassedClaim #2
itoa::Buffer::new: /Coma/vc_new proved by z3@4.15.3 (final all-features session).
itoa::runtime.impl_Buffer.new
PassedClaim #2
itoa::Buffer::new: /Coma/vc_uninit_u8 proved by z3@4.15.3 (final all-features session).
itoa::runtime.impl_Buffer.new
PassedClaim #2
<itoa::Buffer as Clone>::clone: all 2 VCs proved (default); observed in embedded focused proof log.
itoa::runtime.impl_Clone_for_Buffer.clone
PassedClaim #3
<itoa::Buffer as Clone>::clone: all 2 VCs proved (all-features); observed in embedded focused proof log.
itoa::runtime.impl_Clone_for_Buffer.clone
PassedClaim #3
<itoa::Buffer as Clone>::clone: /Coma/vc_clone_Buffer proved by z3@4.15.3 (final all-features session).
itoa::runtime.impl_Clone_for_Buffer.clone
PassedClaim #3
<itoa::Buffer as Clone>::clone: /Coma/vc_new proved by z3@4.15.3 (final all-features session).
itoa::runtime.impl_Clone_for_Buffer.clone
PassedClaim #3
<itoa::Buffer as Default>::default: all 2 VCs proved (default); observed in embedded focused proof log.
itoa::runtime.impl_Default_for_Buffer.default
PassedClaim #4
<itoa::Buffer as Default>::default: all 2 VCs proved (all-features); observed in embedded focused proof log.
itoa::runtime.impl_Default_for_Buffer.default
PassedClaim #4
<itoa::Buffer as Default>::default: /Coma/vc_default_Buffer proved by z3@4.15.3 (final all-features session).
itoa::runtime.impl_Default_for_Buffer.default
PassedClaim #4
<itoa::Buffer as Default>::default: /Coma/vc_new proved by z3@4.15.3 (final all-features session).
itoa::runtime.impl_Default_for_Buffer.default
PassedClaim #4
Execution details
Started
2026-10-04T02:20:05.430614+00:00
Finished
2026-10-04T02:20:25.469433+00:00
Platform
linux x86_64
Rust compiler
rustc 1.95.0-nightly (6a979b3e3 2026-02-26)
Working directory
itoa/1.0.18
Environment overrides
RUSTUP_HOME=/workspace/proof-tools/rustup CARGO_HOME=/workspace/proof-tools/cargo CREUSOT_DATA_HOME=/workspace/proof-tools/creusot-data XDG_CONFIG_HOME=/workspace/proof-tools/config XDG_CACHE_HOME=/workspace/proof-tools/cache WHY3_BASE_DATA=/workspace/proof-tools/creusot-data/_opam/share/why3 CARGO_TARGET_DIR=/workspace/proof-tools/targets/itoa-publication LD_LIBRARY_PATH=/workspace/proof-tools/system/usr/lib/x86_64-linux-gnu PATH=/workspace/proof-tools/autoconf/bin:/workspace/proof-tools/system/usr/bin:/workspace/proof-tools:/workspace/proof-tools/creusot-data/bin:/workspace/proof-tools/cargo/bin:/home/agent/.local/bin:/opt/codex/runtimes/codex-primary-runtime/dependencies/bin/override:/opt/codex/runtimes/codex-primary-runtime/dependencies/python/bin:/opt/codex/runtimes/codex-primary-runtime/dependencies/node/bin:/opt/codex/runtimes/codex-primary-runtime/dependencies/bin:/opt/codex/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/agent/.local/bin:/opt/codex/runtimes/codex-primary-runtime/dependencies/bin/fallback
Git repository
https://github.com/nyuichi/rust-crate-proofs
Git commit
ae01d2538298d1873485477ef1ccc85a111a6925
Diagnostics & logs
=== stdoutStderr ===
Proof resources: jobs=1, memory=1024 MiB per prover; shared lock held
warning: unnecessary parentheses around function argument
   --> src/ascii.rs:190:17
    |
190 |                 (if i == 0 {
    |                 ^
...
194 |                 }));
    |                  ^
    |
    = note: `#[warn(unused_parens)]` (part of `#[warn(unused)]`) on by default
help: remove these parentheses
    |
190 ~                 if i == 0 {
191 |                     joined[i] == first
192 |                 } else {
193 |                     joined[i] == tail[i - 1]
194 ~                 } );
    |

warning: unnecessary parentheses around function argument
   --> src/ascii.rs:197:17
    |
197 |                 (if i == 0 {
    |                 ^
...
201 |                 }));
    |                  ^
    |
help: remove these parentheses
    |
197 ~                 if i == 0 {
198 |                     bytes[i] == first
199 |                 } else {
200 |                     tail[i - 1] == bytes[i]
201 ~                 } );
    |

warning: unused import: `proof_assert`
 --> src/math.rs:1:35
  |
1 | use creusot_std::prelude::{logic, proof_assert, requires, ensures, Int};
  |                                   ^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default

warning: unused import: `creusot_std::prelude::View`
 --> src/signed_primitive_models.rs:2:5
  |
2 | use creusot_std::prelude::View;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `check_u16_fmt_call_site` is never used
   --> src/runtime.rs:978:4
    |
978 | fn check_u16_fmt_call_site(n: u16) {
    |    ^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: function `check_signed_i8_write` is never used
    --> src/runtime.rs:1729:4
     |
1729 | fn check_signed_i8_write(value: i8) {
     |    ^^^^^^^^^^^^^^^^^^^^^

warning: function `check_signed_i16_write` is never used
    --> src/runtime.rs:1915:55
     |
1915 |     i16, u16, signed_write_i16, write_u16_suffix_i16, check_signed_i16_write,
     |                                                       ^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this warning originates in the macro `impl_small_signed_formatter` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: function `check_signed_i32_write` is never used
    --> src/runtime.rs:1920:55
     |
1920 |     i32, u32, signed_write_i32, write_u32_suffix_i32, check_signed_i32_write,
     |                                                       ^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this warning originates in the macro `impl_small_signed_formatter` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: function `check_signed_i64_write` is never used
    --> src/runtime.rs:1925:55
     |
1925 |     i64, u64, signed_write_i64, write_u64_suffix_i64, check_signed_i64_write,
     |                                                       ^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this warning originates in the macro `impl_small_signed_formatter` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: function `i128_min_formatted_output_witness` is never used
    --> src/runtime.rs:1954:4
     |
1954 | fn i128_min_formatted_output_witness() -> [MaybeUninit<u8>; 40] {
     |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `mulhi_limb_reconstruction` is never used
  --> src/u128_ext.rs:76:4
   |
76 | fn mulhi_limb_reconstruction(
   |    ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `limb_at_most_max` is never used
   --> src/u128_ext.rs:197:4
    |
197 | fn limb_at_most_max(x: Int) {
    |    ^^^^^^^^^^^^^^^^

warning: function `quotient_half_fits` is never used
   --> src/u128_ext.rs:207:4
    |
207 | fn quotient_half_fits(n: Int) {
    |    ^^^^^^^^^^^^^^^^^^

warning: function `cross_product_plus_carry_fits` is never used
   --> src/u128_ext.rs:227:4
    |
227 | fn cross_product_plus_carry_fits(x_lo: Int, y_lo: Int, y_hi: Int) {
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `mulhi_product_congruence` is never used
   --> src/u128_ext.rs:285:4
    |
285 | fn mulhi_product_congruence(x: Int, y: Int, a: Int, b: Int) -> Int {
    |    ^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `computer_division_matches_shift51` is never used
   --> src/u128_ext.rs:662:15
    |
662 | pub(super) fn computer_division_matches_shift51(n: Int) -> bool {
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `write_model` is never used
   --> src/verification.rs:424:8
    |
424 | pub fn write_model(values: Seq<Int>, n: Int, end: Int) -> Seq<Int> {
    |        ^^^^^^^^^^^

warning: function `write_model_unfold` is never used
   --> src/verification.rs:441:4
    |
441 | fn write_model_unfold(values: Seq<Int>, n: Int, end: Int) {}
    |    ^^^^^^^^^^^^^^^^^^

warning: function `write_model_preserves_len` is never used
   --> src/verification.rs:449:4
    |
449 | fn write_model_preserves_len(values: Seq<Int>, n: Int, end: Int) {
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `write_model_is_decimal` is never used
   --> src/verification.rs:465:4
    |
465 | fn write_model_is_decimal(values: Seq<Int>, n: Int, end: Int) {
    |    ^^^^^^^^^^^^^^^^^^^^^^

warning: struct `Buffer` is never constructed
   --> src/verification.rs:770:12
    |
770 | pub struct Buffer {
    |            ^^^^^^

warning: associated items `new` and `format` are never used
   --> src/verification.rs:775:12
    |
774 | impl Buffer {
    | ----------- associated items in this implementation
775 |     pub fn new() -> Buffer {
    |            ^^^
...
781 |     pub fn format<I: Integer>(&mut self, i: I) -> &str {
    |            ^^^^^^

warning: function `write_byte` is never used
   --> src/verification.rs:864:4
    |
864 | fn write_byte(buf: &mut [u8], index: usize, byte: u8) {
    |    ^^^^^^^^^^

warning: function `write_unsigned` is never used
   --> src/verification.rs:883:4
    |
883 | fn write_unsigned(n: u128, buf: &mut [u8], end: usize) -> usize {
    |    ^^^^^^^^^^^^^^

warning: function `decimal_slice_to_str` is never used
   --> src/verification.rs:939:11
    |
939 | unsafe fn decimal_slice_to_str(buf: &[u8], start: usize) -> &str {
    |           ^^^^^^^^^^^^^^^^^^^^

warning: function `fixed_width_decimal_values_split_width` is never used
    --> src/verification.rs:1328:15
     |
1328 | pub(crate) fn fixed_width_decimal_values_split_width(
     |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `fixed_width_decimal_values_split_16x16` is never used
    --> src/verification.rs:1524:15
     |
1524 | pub(crate) fn fixed_width_decimal_values_split_16x16(n: Int) {
     |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `decimal_values_len_ge_39` is never used
    --> src/verification.rs:1576:15
     |
1576 | pub(crate) fn decimal_values_len_ge_39(n: Int) {
     |               ^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `decimal_values_len_ge_7` is never used
    --> src/verification.rs:1623:15
     |
1623 | pub(crate) fn decimal_values_len_ge_7(n: Int) {
     |               ^^^^^^^^^^^^^^^^^^^^^^^

warning: function `i128_min_magnitude_model` is never used
    --> src/verification.rs:1633:15
     |
1633 | pub(crate) fn i128_min_magnitude_model() -> Int {
     |               ^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `i128_min_unsigned_magnitude` is never used
    --> src/verification.rs:1638:15
     |
1638 | pub(crate) fn i128_min_unsigned_magnitude() -> u128 {
     |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `i128_min_unsigned_decimal_len` is never used
    --> src/verification.rs:1648:15
     |
1648 | pub(crate) fn i128_min_unsigned_decimal_len() -> u128 {
     |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `i128_min_signed_decimal_model` is never used
    --> src/verification.rs:1708:15
     |
1708 | pub(crate) fn i128_min_signed_decimal_model() {
     |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `itoa-proof` (lib) generated 33 warnings (run `cargo fix --lib -p itoa-proof` to apply 4 suggestions)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.06s
Library verif.itoa_rlib.runtime.impl_Buffer.new: ✔ (2)
Library verif.itoa_rlib.runtime.impl_Buffer.format: ✔ (3)
Library verif.itoa_rlib.runtime.impl_Clone_for_Buffer.clone: ✔ (2)
Library verif.itoa_rlib.runtime.impl_Default_for_Buffer.default: ✔ (2)
   Compiling no-panic v0.1.37
   Compiling syn v3.0.6
    Checking itoa-proof v1.0.18 (/workspace/itoa-publication-source/itoa/1.0.18)
warning: unused import: `no_panic::no_panic`
 --> src/u128_ext.rs:2:5
  |
2 | use no_panic::no_panic;
  |     ^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default

warning: unnecessary parentheses around function argument
   --> src/ascii.rs:190:17
    |
190 |                 (if i == 0 {
    |                 ^
...
194 |                 }));
    |                  ^
    |
    = note: `#[warn(unused_parens)]` (part of `#[warn(unused)]`) on by default
help: remove these parentheses
    |
190 ~                 if i == 0 {
191 |                     joined[i] == first
192 |                 } else {
193 |                     joined[i] == tail[i - 1]
194 ~                 } );
    |

warning: unnecessary parentheses around function argument
   --> src/ascii.rs:197:17
    |
197 |                 (if i == 0 {
    |                 ^
...
201 |                 }));
    |                  ^
    |
help: remove these parentheses
    |
197 ~                 if i == 0 {
198 |                     bytes[i] == first
199 |                 } else {
200 |                     tail[i - 1] == bytes[i]
201 ~                 } );
    |

warning: unused import: `proof_assert`
 --> src/math.rs:1:35
  |
1 | use creusot_std::prelude::{logic, proof_assert, requires, ensures, Int};
  |                                   ^^^^^^^^^^^^

warning: unused import: `creusot_std::prelude::View`
 --> src/signed_primitive_models.rs:2:5
  |
2 | use creusot_std::prelude::View;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `check_u16_fmt_call_site` is never used
   --> src/runtime.rs:978:4
    |
978 | fn check_u16_fmt_call_site(n: u16) {
    |    ^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: function `check_signed_i8_write` is never used
    --> src/runtime.rs:1729:4
     |
1729 | fn check_signed_i8_write(value: i8) {
     |    ^^^^^^^^^^^^^^^^^^^^^

warning: function `check_signed_i16_write` is never used
    --> src/runtime.rs:1915:55
     |
1915 |     i16, u16, signed_write_i16, write_u16_suffix_i16, check_signed_i16_write,
     |                                                       ^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this warning originates in the macro `impl_small_signed_formatter` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: function `check_signed_i32_write` is never used
    --> src/runtime.rs:1920:55
     |
1920 |     i32, u32, signed_write_i32, write_u32_suffix_i32, check_signed_i32_write,
     |                                                       ^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this warning originates in the macro `impl_small_signed_formatter` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: function `check_signed_i64_write` is never used
    --> src/runtime.rs:1925:55
     |
1925 |     i64, u64, signed_write_i64, write_u64_suffix_i64, check_signed_i64_write,
     |                                                       ^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this warning originates in the macro `impl_small_signed_formatter` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: function `i128_min_formatted_output_witness` is never used
    --> src/runtime.rs:1954:4
     |
1954 | fn i128_min_formatted_output_witness() -> [MaybeUninit<u8>; 40] {
     |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `mulhi_limb_reconstruction` is never used
  --> src/u128_ext.rs:76:4
   |
76 | fn mulhi_limb_reconstruction(
   |    ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `limb_at_most_max` is never used
   --> src/u128_ext.rs:197:4
    |
197 | fn limb_at_most_max(x: Int) {
    |    ^^^^^^^^^^^^^^^^

warning: function `quotient_half_fits` is never used
   --> src/u128_ext.rs:207:4
    |
207 | fn quotient_half_fits(n: Int) {
    |    ^^^^^^^^^^^^^^^^^^

warning: function `cross_product_plus_carry_fits` is never used
   --> src/u128_ext.rs:227:4
    |
227 | fn cross_product_plus_carry_fits(x_lo: Int, y_lo: Int, y_hi: Int) {
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `mulhi_product_congruence` is never used
   --> src/u128_ext.rs:285:4
    |
285 | fn mulhi_product_congruence(x: Int, y: Int, a: Int, b: Int) -> Int {
    |    ^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `computer_division_matches_shift51` is never used
   --> src/u128_ext.rs:662:15
    |
662 | pub(super) fn computer_division_matches_shift51(n: Int) -> bool {
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `write_model` is never used
   --> src/verification.rs:424:8
    |
424 | pub fn write_model(values: Seq<Int>, n: Int, end: Int) -> Seq<Int> {
    |        ^^^^^^^^^^^

warning: function `write_model_unfold` is never used
   --> src/verification.rs:441:4
    |
441 | fn write_model_unfold(values: Seq<Int>, n: Int, end: Int) {}
    |    ^^^^^^^^^^^^^^^^^^

warning: function `write_model_preserves_len` is never used
   --> src/verification.rs:449:4
    |
449 | fn write_model_preserves_len(values: Seq<Int>, n: Int, end: Int) {
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `write_model_is_decimal` is never used
   --> src/verification.rs:465:4
    |
465 | fn write_model_is_decimal(values: Seq<Int>, n: Int, end: Int) {
    |    ^^^^^^^^^^^^^^^^^^^^^^

warning: struct `Buffer` is never constructed
   --> src/verification.rs:770:12
    |
770 | pub struct Buffer {
    |            ^^^^^^

warning: associated items `new` and `format` are never used
   --> src/verification.rs:775:12
    |
774 | impl Buffer {
    | ----------- associated items in this implementation
775 |     pub fn new() -> Buffer {
    |            ^^^
...
781 |     pub fn format<I: Integer>(&mut self, i: I) -> &str {
    |            ^^^^^^

warning: function `write_byte` is never used
   --> src/verification.rs:864:4
    |
864 | fn write_byte(buf: &mut [u8], index: usize, byte: u8) {
    |    ^^^^^^^^^^

warning: function `write_unsigned` is never used
   --> src/verification.rs:883:4
    |
883 | fn write_unsigned(n: u128, buf: &mut [u8], end: usize) -> usize {
    |    ^^^^^^^^^^^^^^

warning: function `decimal_slice_to_str` is never used
   --> src/verification.rs:939:11
    |
939 | unsafe fn decimal_slice_to_str(buf: &[u8], start: usize) -> &str {
    |           ^^^^^^^^^^^^^^^^^^^^

warning: function `fixed_width_decimal_values_split_width` is never used
    --> src/verification.rs:1328:15
     |
1328 | pub(crate) fn fixed_width_decimal_values_split_width(
     |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `fixed_width_decimal_values_split_16x16` is never used
    --> src/verification.rs:1524:15
     |
1524 | pub(crate) fn fixed_width_decimal_values_split_16x16(n: Int) {
     |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `decimal_values_len_ge_39` is never used
    --> src/verification.rs:1576:15
     |
1576 | pub(crate) fn decimal_values_len_ge_39(n: Int) {
     |               ^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `decimal_values_len_ge_7` is never used
    --> src/verification.rs:1623:15
     |
1623 | pub(crate) fn decimal_values_len_ge_7(n: Int) {
     |               ^^^^^^^^^^^^^^^^^^^^^^^

warning: function `i128_min_magnitude_model` is never used
    --> src/verification.rs:1633:15
     |
1633 | pub(crate) fn i128_min_magnitude_model() -> Int {
     |               ^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `i128_min_unsigned_magnitude` is never used
    --> src/verification.rs:1638:15
     |
1638 | pub(crate) fn i128_min_unsigned_magnitude() -> u128 {
     |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `i128_min_unsigned_decimal_len` is never used
    --> src/verification.rs:1648:15
     |
1648 | pub(crate) fn i128_min_unsigned_decimal_len() -> u128 {
     |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `i128_min_signed_decimal_model` is never used
    --> src/verification.rs:1708:15
     |
1708 | pub(crate) fn i128_min_signed_decimal_model() {
     |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `itoa-proof` (lib) generated 34 warnings (run `cargo fix --lib -p itoa-proof` to apply 5 suggestions)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 7.56s
Library verif.itoa_rlib.runtime.impl_Buffer.new: ✔ (4)
Library verif.itoa_rlib.runtime.impl_Buffer.format: ✔ (5)
Library verif.itoa_rlib.runtime.impl_Clone_for_Buffer.clone: ✔ (2)
Library verif.itoa_rlib.runtime.impl_Default_for_Buffer.default: ✔ (2)
Environment

Source: rust-crate-proofs revision 775aba9c0dfb532b4a2176b490341477a75b6fd1, itoa/1.0.18 (local package itoa-proof, library itoa). Recorded integrated default and all-features runs use nightly-2026-02-27, patched Creusot 0.11.0-dev at 437d3d8d00b8114d7a3b4f7b8738d594a395f5bc, Why3 1.8.2+git at 2c0f2992af85f82f3eda0f158dcf10e62e0db875, Why3find v1.2.0+dev, Z3 4.15.3 and CVC5 1.3.1. All features includes optional no-panic. The archived run and matching source blob hashes are linked below. Reproduction uses the repository run-proof.sh wrapper with the crate-local verify-all.bash. No proof or native build was rerun for this report.

Evidence references:
Source provenance and release archive identity: https://github.com/nyuichi/rust-crate-proofs/blob/775aba9c0dfb532b4a2176b490341477a75b6fd1/itoa/1.0.18/PROVENANCE.md
Public formatter, writers and trusted slice view: https://github.com/nyuichi/rust-crate-proofs/blob/775aba9c0dfb532b4a2176b490341477a75b6fd1/itoa/1.0.18/src/runtime.rs
Canonical decimal specification: https://github.com/nyuichi/rust-crate-proofs/blob/775aba9c0dfb532b4a2176b490341477a75b6fd1/itoa/1.0.18/src/verification.rs
Runtime proof report and source blob identities: https://github.com/nyuichi/rust-crate-proofs/blob/775aba9c0dfb532b4a2176b490341477a75b6fd1/tools/creusot-toolpatch/proofs/runtime-boundary-bridge/REPORT.md
Archived integrated default/all-features results: https://github.com/nyuichi/rust-crate-proofs/blob/775aba9c0dfb532b4a2176b490341477a75b6fd1/tools/creusot-toolpatch/proofs/runtime-boundary-bridge/integrated/fullsuite.log.gz
Boundary rationale and remaining trust: https://github.com/nyuichi/rust-crate-proofs/blob/775aba9c0dfb532b4a2176b490341477a75b6fd1/itoa/1.0.18/RUNTIME_BOUNDARY_BRIDGE.md
Core contracts and memory ledger: https://github.com/nyuichi/rust-crate-proofs/blob/775aba9c0dfb532b4a2176b490341477a75b6fd1/itoa/1.0.18/RUNTIME_MEMORY_LEDGER.md
Tool patch implementation, witnesses and version records: https://github.com/nyuichi/rust-crate-proofs/blob/775aba9c0dfb532b4a2176b490341477a75b6fd1/tools/creusot-toolpatch/README.md
Active proof wrapper: https://github.com/nyuichi/rust-crate-proofs/blob/775aba9c0dfb532b4a2176b490341477a75b6fd1/tools/creusot-toolpatch/scripts/run-proof.sh
Proved multiplication helper and standard/pruned SMT exports: https://github.com/nyuichi/rust-crate-proofs/blob/775aba9c0dfb532b4a2176b490341477a75b6fd1/tools/creusot-toolpatch/proofs/phase4-conditional/mulhi-second-attempt/pow2-composition/REPORT.md
Native test evidence: https://github.com/nyuichi/rust-crate-proofs/blob/775aba9c0dfb532b4a2176b490341477a75b6fd1/tools/creusot-toolpatch/proofs/runtime-boundary-bridge/native/README.md

What is trusted

The sole local trusted operation is assume_init_slice, which casts a borrowed slice of MaybeUninit<u8> to a borrowed slice of u8. Its caller proves that every selected slot is initialized; its assumed contract preserves the slice length and each byte, without assuming decimal correctness or ASCII. Source reasoning supports this narrow boundary: MaybeUninit<u8> has u8's size and alignment, the cast retains the slice metadata, every u8 bit pattern is valid, and the returned shared borrow is tied to the input borrow. The conversion allocates nothing and selects only the suffix proved initialized. This reasoning is not a formal proof of the raw view or physical memory-permission transfer, which remain trusted and are necessary for the returned string guarantee.

The proof also relies on external contracts for core operations, including MaybeUninit writes, unchecked slice selection, array indexing and slice-to-array borrowing, signed unsigned_abs, and from_utf8_unchecked. Callers prove the relevant initialization, bounds, exact lengths and UTF-8 conditions. The array contracts describe the same elements and preserve changes through the borrowed view; unsigned_abs gives the mathematical magnitude even at signed MIN, consistent with core's wrapping absolute-value implementation. The string conversion is assumed to retain bytes when its proved UTF-8 precondition holds. These contracts describe narrow standard operations, but their runtime core bodies are not proved by this crate verification.

Technical limitations

This is verification of a source adaptation of itoa 1.0.18, not formal equivalence to the published release. To let Creusot analyze the public path, each writer replaces the original raw typed-prefix view with a checked prefix slice-to-array conversion; its exact length and successful unwrap are proved. The initialized byte-slice reinterpretation is factored into the trusted helper described above. These changes retain the buffer, selected output bytes and optimized arithmetic by source reasoning, but release-to-adaptation equivalence has not been formally established. Proof-only decimal-table data is checked byte-for-byte against the ordinary-build table by a compile-time assertion. Three private no-panic checker annotations were removed because their helpers require caller-proved bounds; their executable bodies were unchanged, and public checker annotations remain.

The proof target is x86_64; 16- and 32-bit pointer-sized implementations are not covered. The established output, initialization and panic properties do not constitute a complete proof of Rust memory safety, notably at the trusted slice conversion. No claim is made that an unpatched toolchain reproduces these results. Native regression checks supplement the proof but do not expand its target or input coverage.

Tool limitations

Pinned derivative of Creusot 0.11.0-dev at commit 437d3d8d00b8114d7a3b4f7b8738d594a395f5bc, with the backend narrowing-cast compatibility patch and Why3 overlay/driver changes documented in https://github.com/nyuichi/rust-crate-proofs/tree/ae01d2538298d1873485477ef1ccc85a111a6925/tools/creusot-toolpatch (use the full immutable source commit in each report). This is not upstream Creusot 0.13.0. Verification is relative to supplied contracts, standard-library models, trusted boundaries, selected compilation configuration, and target architecture. Successful proofs do not constitute a complete Rust undefined-behavior or physical memory-permission proof. Allocation failure is outside the guarantees. Each report must disclose its local trusted helpers and source accommodations.

Updated 2026-10-04 02:12 UTC

creusot 0.11.0-dev+itoa-toolpatch — version details

Dependencies (2)

CrateReports
criterion ^0.8 · dev · cfg(not(miri))—
no-panic ^0.1 · optional—

Comments (0)

No comments.

Sign in to comment.