Requirements · Preparation 2

Preparation 2

32 open

64-bit target · Overflow checks enabled

Scope, assumptions and build configuration

Each verdict applies to its stated requirement and conditions, the composed model, and the listed assumptions. Read the assumptions

Requirements and conditions

These requirements concern the program version shown here and its composed model, under the selected configuration and assumptions. Their verdicts appear below.

Selected targetx86_64-unknown-linux-gnu
Pointer width64
Overflow checksTrue
Debug assertionsenabled
Cargo features
  • {
      "name": "dec2flt-model",
      "version": "0.1.0",
      "source": "workspace:Cargo.toml",
      "features": [
        "default"
      ]
    }
Extraction profiledev

Totality

dec2flt
Totality. For every Rust string, the function terminates normally with a result or parsing error, without panicking.

Exact rounding

dec2flt
Exact rounding. On acceptance of any numeric literal, the returned float is its exact value rounded to binary64.
Configuration and exclusions — authored setup excerpts
The package is pinned to nightly-2026-06-01 for x86_64-unknown-linux-gnu. Cargo default features are empty, so optimize_for_size is disabled and the ordinary native shortcut remains enabled. The setup check uses the development profile, whose debug assertions are enabled; overflow-checks = true is explicit for both development and release profiles. On this target SSE2 is available and the supplied fpu code selects its no-op precision-setting branch.
* The standalone namespace shell and local error type provide only missing package context. BiasedFp is re-exported for goal-facing access; visibility does not alter execution. * Unobserved formatting bounds/derives are removed. The redundant Copy supertrait on CastInto is removed because every use is already through Int: Copy. Compile-time float formulae are replaced by their exact integer values, negative canonical NaNs by the corresponding exact bit constructors, float power tables by matches over the same exact bit patterns, and the generic integer decoder by identical primitive-specialized decoders. Lemire::from_u64 is opaque only at the unsupported primitive cast; its assertion, guards, callers, and all surrounding computation remain visible. * Direct Mul, Div, and Neg bounds/calls restate operations already implied by Lemire so Charon resolves their output type. Closure-based digit scans, borrow-sensitive slice-pattern loops, reverse iteration, and returns from nested loops are rewritten as indexed scans, small transparent helpers, or delayed returns with the same order, bounds, checked arithmetic, and state transitions. The comments in common.rs, decimal.rs, decimal_seq.rs, parse.rs, and slow.rs give the local correspondence arguments. * dec2flt_with_trace is the single instrumented dispatcher implementation; public dec2flt is exactly its result projection. It records already computed helper inputs/results, guards, branch facts, the selected pair, assembly word/result, and lexical sign application. The expanded short-circuit condition leaves the checked mantissa + 1 and second helper call under exactly their supplied guard and preserves all call order and return values. * For the approved f64-only boundary, only the u64 Int implementation and the f64 Float, FloatExt, and Lemire implementations are active. The u16/u32 instances and f16/f32 implementations are outside every GOAL. Add, PartialEq, PartialOrd, Default, and Clone are unused Float requirements and are removed; Copy, Mul, Div, and Neg remain. This exclusion changes no f64 public/helper/trace body, native-path decision, checked arithmetic, debug assertion, return value, float bits, NaN classification, or trace observation.
work/extraction.json selects the one library package work/crate, with empty Cargo, Charon, and Aeneas argument lists. It therefore produces the one root generated Lean module chosen by the preparation tool and introduces no extra crate, executable behavior, or installed Lean import. The generic parser and helper bodies remain in the source boundary, with only the f64 primitive instances retained for the required specialization.
All 32 supplied GOALs remain in scope. Source functions are quantified over every source-valid Rust value: byte slices obey the configured 64-bit Rust slice/reference invariant, including total byte size at most isize::MAX, and Rust strings additionally contain valid UTF-8. No smaller convenience length bound is assumed. ASCII literal premises used later must imply these source validity conditions. The purely mathematical classification and rounding GOALs retain their stated finite-string and nonnegative-real domains.
* An empty original string returns the empty-input error before any helper call. A sign-only string returns the invalid-input error after sign removal. Neither path selects a raw pair. * For a nonempty body, parse_number(body) is called first. If it returns None, parse_inf_nan::<f64>(body, negative) is called. Its Some result is returned directly as a special float, while None produces the invalid error. Both paths select no raw pair. * If parse_number returns Some(num0), the dispatcher copies that record and replaces its negative field by the lexical negative. Because optimize_for_size is disabled, it calls num.try_fast_path::<f64>(). A Some(value) is returned directly. This native shortcut selects no BiasedFp for final assembly. * After a None native result, the first integer-tier call is compute_float::<f64>(num.exponent, num.mantissa); call its result fp1. Ordinarily fp1 becomes the current pair. If num.many_digits is true and fp1.p_biased >= 0, short-circuit evaluation makes the second call compute_float::<f64>(num.exponent, num.mantissa + 1); call its result fp2. If fp1 != fp2, the dispatcher preserves fp1.m but sets the current pair's p_biased to -1, thereby forcing deferral. If they are equal, it retains fp1. When many_digits is false or fp1.p_biased < 0, the second call is not made. * If the current pair has p_biased < 0, including the forced-deferral case, parse_long_mantissa::<f64>(body) is called and its result replaces the entire current pair. Otherwise the current integer-tier pair is retained. The resulting pair is the selected raw pair passed to biased_fp_to_float::<f64>. The assembly result is still an unsigned magnitude at this point; only afterwards does the dispatcher negate it when num.negative is true and return it.

These results apply to the stated requirements, builds and platform premises. Trust and assumptions · Exact requirement collection

Requirements and results

32 requirements. Open a requirement for its full statement, proof or counterexample, and related source.

Requirements for dec2flt appear first. Supporting specifications and helper contracts follow.

RequirementPreparation 2
Totality

For every Rust string, the function terminates normally with a result or parsing error, without panicking.

Open — Totality
Exact rounding

On acceptance of any numeric literal, the returned float is its exact value rounded to binary64.

Open — Exact rounding
Numeric acceptance

Every numeric literal returns Ok.

Open — Numeric acceptance
Invalid rejection

Every string outside the numeric and special literal grammar returns Err.

Open — Invalid rejection
NaN acceptance

Every NaN literal returns Ok of a float satisfying is_nan().

Open — NaN acceptance
Accumulated-value diagnostic

Every accepted numeric literal is rounded to its accumulated-exponent value.

Open — Accumulated-value diagnostic
Equal-target bridge

On acceptance of a numeric literal whose exact and accumulated-exponent values have the same rounding target, the result has that target and the literal's lexical sign.

Open — Equal-target bridge
Infinity

Every infinity literal returns Ok of the infinity with its lexical sign.

Open — Infinity
No spurious NaNs

Every successful result for an input other than a NaN literal is not NaN.

Open — No spurious NaNs
Numeric sign

Every successful numeric result has the literal's lexical sign, including results that underflow to zero or overflow to infinity.

Open — Numeric sign
Selected exponent range

On a successful numeric parse, each raw pair selected by the dispatcher for final float assembly has a biased exponent in 0..=2047.

Open — Selected exponent range
Selected magnitude sign

On a successful numeric parse, the assembled word of each raw pair selected for final float assembly has a clear sign bit.

Open — Selected magnitude sign
Signed zero

On acceptance, a numeric literal denoting zero returns zero with its lexical sign.

Open — Signed zero
Abstract composition

The lexical and conversion component contracts admit implementations. …

Open — Abstract composition
Component compliance

The actual source components satisfy the contracts used in abstract composition, including preservation of the input's rounding target. …

Open — Component compliance
Supporting specifications and helper contracts
Classification totality

Mathematical specification Classification totality. …

Open — Classification totality
Rounding totality

Mathematical specification Rounding totality. …

Open — Rounding totality
Numeric acceptance

Every nonempty byte slice forming an unsigned numeric literal returns Some.

Open — Numeric acceptance
Invalid rejection

Every nonempty byte slice that is not an unsigned numeric literal returns None.

Open — Invalid rejection
Rejection

For every byte slice and either value of the separate sign argument, an input other than an unsigned inf, infinity, or nan keyword returns None.

Open — Rejection
Assembly correspondence

For every BiasedFp, the function returns normally with float bits equal to the bitwise OR of its mantissa and its biased exponent cast to u64 using Rust semantics and shifted left by 52. …

Open — Assembly correspondence
Classification determinism

Mathematical specification Classification determinism. …

Open — Classification determinism
Significand digit

Mathematical specification Significand digit. …

Open — Significand digit
Exponent agreement

Mathematical specification Exponent agreement. …

Open — Exponent agreement
Correctness or defer

For all i64 exponents q and all u64 mantissas w, a normal result is either a pair with negative biased exponent (deferral) or a pair whose assembled word is the nonnegative binary64 rounding of the exact value w * 10^q.

Open — Correctness or defer
Native correctness or defer

For every Decimal record, on normal return, the result is either None or Some of the binary64 rounding of the exact mantissa * 10^exponent, with the record's sign. …

Open — Native correctness or defer
Accumulated-value diagnostic

For every unsigned numeric literal, a returned record with many_digits = false represents its accumulated-exponent value exactly as mantissa * 10^exponent. …

Open — Accumulated-value diagnostic
Record bounds

For every nonempty byte slice, any returned record has negative = false and mantissa < 10^19.

Open — Record bounds
Rounding determinism

Mathematical specification Rounding determinism. …

Open — Rounding determinism
Full-significand diagnostic

For every unsigned numeric literal, a normal result is a pair whose assembled word is the nonnegative binary64 rounding of its accumulated-exponent value, retaining the full significand's contribution to rounding.

Open — Full-significand diagnostic
Infinity

For every byte slice and either value of the separate sign argument, an unsigned infinity keyword returns Some infinity with that sign.

Open — Infinity
NaN

For every byte slice and either value of the separate sign argument, an unsigned NaN keyword returns Some of a NaN.

Open — NaN

Full proof structure

Browse all 237 theorems and definitions

Read the Lean and prose explanations, and follow the dependencies between declarations.