Requirements · Preparation 1

Preparation 1

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 shell re-exports core's f64, formatting, operator, and FpCategory items, so primitive operations keep their source meanings. Its local ParseFloatError has the source type's two payload-free error kinds. The goals observe only success versus parsing error, not formatting or error-kind introspection, so the omitted API implementations are observationally irrelevant. The nightly feature gates admit compiler/internal APIs already used by the unchanged source and introduce no runtime behavior.
The optimize_for_size feature is declared but disabled by default. Thus the candidate follows the ordinary source configuration and retains the native shortcut required by the dispatcher goals. Integer overflow checks are explicitly enabled in both Cargo profiles. On the configured x86_64-unknown-linux-gnu target, SSE2 is available and the source selects its no-op precision-setting branch, as it does in core on that target.
* 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.
The Charon IR in observations/check-1790013075764005431/Generated/m.llbc retains this control flow: the disabled feature is a constant-false branch, fp_39 is the first result, _48 is the conditional second result, disagreement writes -1, _55 is the slow replacement, and _58 copies the final pair into biased_fp_to_float. Charon keeps the function generic, so the target is this body instantiated with the extracted f64 Lemire/Float instances rather than a separately emitted monomorphization.

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 1
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 296 theorems and definitions

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