CURRENT GOAL-VOCABULARY PRIMARY EVIDENCE
Date: 2026-10-09; current source, not predecessor.

COMMAND: sha256sum generated.lean GOAL.md modeling-input/manifest.json upstream/dec2flt/parse.rs crate/dec2flt/parse.rs upstream/dec2flt/decimal_seq.rs crate/dec2flt/decimal_seq.rs upstream/dec2flt/mod.rs crate/dec2flt/mod.rs
438af8398703b81aa311d7885dfb34f1909125bee48b096dacc93baefcc4bcf9  generated.lean
0f19c63a168623bd805c17b753dff6f74a695ff283680c22d356fb623fbb4771  GOAL.md
4b71c7166d09bafef194283156edd10e58f25ffd1a498d785e0af04a600c5b32  modeling-input/manifest.json
a9303bac61a5e8e7b610632925bb0d04483374a91f9ec38a7305fd4a1ca0b5f3  upstream/dec2flt/parse.rs
fb5f09bf0bc9742dae352ae0c3bf6706e8855ff22079765f6233fd16f975b669  crate/dec2flt/parse.rs
7b1b28b8c439afb4628411af12920b7c0ecd19036fa530dc74c6a356ec6e351d  upstream/dec2flt/decimal_seq.rs
193ca485206899f913a3da75b6ac6484ee90b35c3a5d1c7059ae3d5c61110ad9  crate/dec2flt/decimal_seq.rs
7198e238c554b692405537a446b3526ad66805ec2900cd0e299f10c51402a44a  upstream/dec2flt/mod.rs
6ce998fb79493021a6b7af183ba03934fa699ddb6f9c2bfafcea17d26e5c608a  crate/dec2flt/mod.rs

COMMAND: sed -n '3,24p' GOAL.md
## Scope and vocabulary

The subject is the `f64` specialization of Rust's decimal parser and its
helper functions, including executions with integer overflow checks enabled.
Public results are the returned floats and errors.

A numeric literal has an optional leading sign, an ASCII decimal significand
with at least one digit and at most one decimal point, and an optional `e` or
`E` exponent with an optional sign and at least one ASCII digit. Special
literals are `inf`, `infinity`, and `nan`, matched ASCII case-insensitively,
with an optional leading sign. The whole input must match; whitespace and
other extra characters are invalid. An unsigned literal omits the leading
sign, while its exponent may still have a sign.

The exact value of a numeric literal is its ordinary mathematical decimal
value. Rounding means IEEE 754 binary64 round-to-nearest, ties-to-even,
including subnormal results, signed zero, and overflow to infinity.

For auxiliary claims, the **accumulated-exponent value** retains every
significand digit but interprets the explicit exponent using the source's
bounded exponent-accumulation rule. This is an implementation-level diagnostic
value, distinct from the exact value required by the public contract.

COMMAND: nl -ba upstream/dec2flt/parse.rs | sed -n '73,102p'
    73	pub(super) fn parse_scientific(s_ref: &mut &[u8]) -> Option<i64> {
    74	    let mut exponent = 0i64;
    75	    let mut negative = false;
    76	
    77	    let mut s = *s_ref;
    78	
    79	    if let Some((&c, s_next)) = s.split_first() {
    80	        negative = c == b'-';
    81	        if c == b'-' || c == b'+' {
    82	            s = s_next;
    83	        }
    84	    }
    85	
    86	    if matches!(s.first(), Some(&x) if x.is_ascii_digit()) {
    87	        *s_ref = s.parse_digits(|digit| {
    88	            // The exponent is at most 10 * 2^59 - 1, which fits in i64.
    89	            if exponent < (1_i64 << 59) {
    90	                exponent = 10 * exponent + digit as i64;
    91	            }
    92	        });
    93	        if negative { Some(-exponent) } else { Some(exponent) }
    94	    } else {
    95	        *s_ref = s;
    96	        None
    97	    }
    98	}
    99	
   100	/// Parse a partial, non-special floating point number.
   101	///
   102	/// This creates a representation of the float as the

COMMAND: nl -ba crate/dec2flt/parse.rs | sed -n '121,158p'
   121	pub(super) fn parse_scientific(s_ref: &mut &[u8]) -> Option<i64> {
   122	    let mut exponent = 0i64;
   123	    let mut negative = false;
   124	
   125	    let mut s = *s_ref;
   126	
   127	    if let Some((&c, s_next)) = s.split_first() {
   128	        negative = c == b'-';
   129	        if c == b'-' || c == b'+' {
   130	            s = s_next;
   131	        }
   132	    }
   133	
   134	    // `matches!` with a guarded slice pattern triggers an Aeneas internal
   135	    // error.  This short-circuit test reads the same first byte exactly when
   136	    // it exists and therefore preserves both acceptance and evaluation order.
   137	    if !s.is_empty() && s[0].is_ascii_digit() {
   138	        // Specialized form of the revised source callback, shared with the
   139	        // sibling slow parser. The guard tests the pre-update accumulator:
   140	        // one digit can overshoot 2^59, up to 10 * 2^59 - 1, still below
   141	        // i64::MAX. This is not a clamp. Subsequent digits are still consumed
   142	        // and the first nondigit remains in the returned suffix, so the caller
   143	        // performs the same whole-input validation even after updates stop.
   144	        let mut count = 0;
   145	        while count < s.len() && s[count].wrapping_sub(b'0') < 10 {
   146	            let digit = s[count].wrapping_sub(b'0');
   147	            if exponent < (1_i64 << 59) {
   148	                exponent = 10 * exponent + digit as i64;
   149	            }
   150	            count += 1;
   151	        }
   152	        *s_ref = &s[count..];
   153	        if negative { Some(-exponent) } else { Some(exponent) }
   154	    } else {
   155	        *s_ref = s;
   156	        None
   157	    }
   158	}

COMMAND: nl -ba upstream/dec2flt/decimal_seq.rs | sed -n '224,304p'
   224	pub(super) fn final_decimal_point(
   225	    significant_count: usize,
   226	    fractional_count: usize,
   227	    explicit: i64,
   228	) -> i32 {
   229	    if significant_count == 0 {
   230	        return 0;
   231	    }
   232	    let base = significant_count as i64 - fractional_count as i64;
   233	    base.saturating_add(explicit)
   234	        .clamp(-(DecimalSeq::DECIMAL_POINT_RANGE as i64), DecimalSeq::DECIMAL_POINT_RANGE as i64)
   235	        as i32
   236	}
   237	
   238	/// Parse a big integer representation of the float as a decimal.
   239	pub fn parse_decimal_seq(mut s: &[u8]) -> DecimalSeq {
   240	    let mut d = DecimalSeq::default();
   241	    let start = s;
   242	    let mut fractional_count = 0;
   243	
   244	    while let Some((&b'0', s_next)) = s.split_first() {
   245	        s = s_next;
   246	    }
   247	
   248	    s = s.parse_digits(|digit| d.try_add_digit(digit));
   249	
   250	    if let Some((b'.', s_next)) = s.split_first() {
   251	        s = s_next;
   252	        let first = s;
   253	        // Skip leading zeros.
   254	        if d.num_digits == 0 {
   255	            while let Some((&b'0', s_next)) = s.split_first() {
   256	                s = s_next;
   257	            }
   258	        }
   259	        while s.len() >= 8 && d.num_digits + 8 < DecimalSeq::MAX_DIGITS {
   260	            let v = s.read_u64();
   261	            if !is_8digits(v) {
   262	                break;
   263	            }
   264	            d.digits[d.num_digits..].write_u64(v - 0x3030_3030_3030_3030);
   265	            d.num_digits += 8;
   266	            s = &s[8..];
   267	        }
   268	        s = s.parse_digits(|digit| d.try_add_digit(digit));
   269	        fractional_count = first.len() - s.len();
   270	    }
   271	
   272	    let significant_count = d.num_digits;
   273	    if d.num_digits != 0 {
   274	        // Ignore the trailing zeros if there are any
   275	        let mut n_trailing_zeros = 0;
   276	        for &c in start[..(start.len() - s.len())].iter().rev() {
   277	            if c == b'0' {
   278	                n_trailing_zeros += 1;
   279	            } else if c != b'.' {
   280	                break;
   281	            }
   282	        }
   283	        d.num_digits -= n_trailing_zeros;
   284	        if d.num_digits > DecimalSeq::MAX_DIGITS {
   285	            d.truncated = true;
   286	            d.num_digits = DecimalSeq::MAX_DIGITS;
   287	        }
   288	    }
   289	
   290	    let mut explicit = 0;
   291	    if let Some((&ch, s_next)) = s.split_first() {
   292	        if ch == b'e' || ch == b'E' {
   293	            s = s_next;
   294	            explicit = parse_scientific(&mut s).unwrap_or(0);
   295	        }
   296	    }
   297	    d.decimal_point = final_decimal_point(significant_count, fractional_count, explicit);
   298	
   299	    for i in d.num_digits..DecimalSeq::MAX_DIGITS_WITHOUT_OVERFLOW {
   300	        d.digits[i] = 0;
   301	    }
   302	
   303	    d
   304	}

COMMAND: nl -ba crate/dec2flt/decimal_seq.rs | sed -n '269,373p'
   269	pub(super) fn final_decimal_point(
   270	    significant_count: usize,
   271	    fractional_count: usize,
   272	    explicit: i64,
   273	) -> i32 {
   274	    // This is the repaired upstream body, not an extraction replacement.
   275	    // Source-valid byte slices bound both counts by isize::MAX on this target;
   276	    // their i64 difference is therefore in range. Retain saturating_add and
   277	    // clamp as source operations, including the zero-count early return.
   278	    if significant_count == 0 {
   279	        return 0;
   280	    }
   281	    let base = significant_count as i64 - fractional_count as i64;
   282	    base.saturating_add(explicit)
   283	        .clamp(-(DecimalSeq::DECIMAL_POINT_RANGE as i64), DecimalSeq::DECIMAL_POINT_RANGE as i64)
   284	        as i32
   285	}
   286	
   287	/// Parse a big integer representation of the float as a decimal.
   288	pub fn parse_decimal_seq(mut s: &[u8]) -> DecimalSeq {
   289	    let mut d = DecimalSeq::default();
   290	    let start = s;
   291	    let mut fractional_count = 0;
   292	
   293	    // Aeneas rejects the literal-pattern `while let`; this loop performs the
   294	    // same nonempty check, byte comparison, and one-byte consumption in the
   295	    // same order, with identical slice bounds.
   296	    while !s.is_empty() && s[0] == b'0' {
   297	        s = &s[1..];
   298	    }
   299	
   300	    s = parse_digits_into_seq(s, &mut d);
   301	
   302	    if !s.is_empty() && s[0] == b'.' {
   303	        s = &s[1..];
   304	        let first = s;
   305	        // Skip leading zeros.
   306	        if d.num_digits == 0 {
   307	            // As above, this is the source leading-zero loop written in the
   308	            // indexed form accepted by Aeneas.
   309	            while !s.is_empty() && s[0] == b'0' {
   310	                s = &s[1..];
   311	            }
   312	        }
   313	        while s.len() >= 8 && d.num_digits + 8 < DecimalSeq::MAX_DIGITS {
   314	            let v = s.read_u64();
   315	            if !is_8digits(v) {
   316	                break;
   317	            }
   318	            d.digits[d.num_digits..].write_u64(v - 0x3030_3030_3030_3030);
   319	            d.num_digits += 8;
   320	            s = &s[8..];
   321	        }
   322	        s = parse_digits_into_seq(s, &mut d);
   323	        // `first` precedes zero skipping and both digit scans. This difference
   324	        // includes every fractional digit, just as in repaired upstream.
   325	        fractional_count = first.len() - s.len();
   326	    }
   327	
   328	    // Save the source's logical count before trimming and MAX_DIGITS capping;
   329	    // the stored digit prefix must not replace this count in point arithmetic.
   330	    let significant_count = d.num_digits;
   331	    if d.num_digits != 0 {
   332	        // Ignore the trailing zeros if there are any
   333	        let consumed_len = start.len() - s.len();
   334	        // Walking an index downward visits exactly the same bytes as
   335	        // `.iter().rev()` and stops on the same first nonzero nondot byte.  It
   336	        // also avoids the missing extracted `Iterator::rev` library field.
   337	        let n_trailing_zeros = count_trailing_zeros(start, consumed_len);
   338	        d.num_digits -= n_trailing_zeros;
   339	        if d.num_digits > DecimalSeq::MAX_DIGITS {
   340	            d.truncated = true;
   341	            d.num_digits = DecimalSeq::MAX_DIGITS;
   342	        }
   343	    }
   344	
   345	    // Indexed tests preserve `split_first`'s nonempty guard and byte order but
   346	    // avoid the loop-context joins Aeneas creates for nested slice patterns.
   347	    let mut explicit = 0;
   348	    if !s.is_empty() {
   349	        let ch = s[0];
   350	        if ch == b'e' || ch == b'E' {
   351	            // Aeneas cannot join this branch when the enclosing `s` is
   352	            // rebased and mutably borrowed. A fresh slice local translates.
   353	            // The source never reads `s` after this call: all consumed-prefix,
   354	            // significant and fractional counts are already saved. Passing
   355	            // the identical suffix to the unchanged shared parser gives the
   356	            // same sign, digit consumption, bounded accumulation, checked
   357	            // operations and failures; only its unobserved suffix mutation
   358	            // targets a different local. Keep the call even for zero digits,
   359	            // and keep None-to-zero on missing/malformed exponent digits.
   360	            // This argument needs no numeric-validity or correctness premise;
   361	            // parse_number still observes the shared parser's returned suffix.
   362	            let mut exponent_suffix = &s[1..];
   363	            explicit = parse_scientific(&mut exponent_suffix).unwrap_or(0);
   364	        }
   365	    }
   366	    d.decimal_point = final_decimal_point(significant_count, fractional_count, explicit);
   367	
   368	    for i in d.num_digits..DecimalSeq::MAX_DIGITS_WITHOUT_OVERFLOW {
   369	        d.digits[i] = 0;
   370	    }
   371	
   372	    d
   373	}

COMMAND: sed -n '1664,1770p' generated.lean

/-- [dec2flt_model::num::imp::dec2flt::decimal_seq::final_decimal_point]:
    Source: 'num/imp/../../dec2flt/decimal_seq.rs', lines 269:0-285:1 -/
def num.imp.dec2flt.decimal_seq.final_decimal_point
  (significant_count : Std.Usize) (fractional_count : Std.Usize)
  (explicit : Std.I64) :
  Result Std.I32
  := do
  if significant_count = 0#usize
  then ok 0#i32
  else
    let i ← lift (UScalar.hcast .I64 significant_count)
    let i1 ← lift (UScalar.hcast .I64 fractional_count)
    let base ← i - i1
    let i2 ← lift (core.num.I64.saturating_add base explicit)
    let i3 ←
      lift (IScalar.cast .I64
        num.imp.dec2flt.decimal_seq.DecimalSeq.DECIMAL_POINT_RANGE)
    let i4 ← -. i3
    let i5 ←
      lift (IScalar.cast .I64
        num.imp.dec2flt.decimal_seq.DecimalSeq.DECIMAL_POINT_RANGE)
    let i6 ← core.cmp.impls.OrdI64.clamp i2 i4 i5
    ok (IScalar.cast .I32 i6)

/-- [dec2flt_model::num::imp::dec2flt::parse::parse_scientific]: loop body 0:
    Source: 'num/imp/../../dec2flt/parse.rs', lines 145:8-151:9 -/
@[rust_loop_body]
def num.imp.dec2flt.parse.parse_scientific_loop.body
  (s : Slice Std.U8) (exponent : Std.I64) (count : Std.Usize) :
  Result (ControlFlow (Std.I64 × Std.Usize) (Std.I64 × Std.Usize))
  := do
  let i := Slice.len s
  if count < i
  then
    let i1 ← Slice.index_usize s count
    let i2 ← lift (core.num.U8.wrapping_sub i1 48#u8)
    if i2 < 10#u8
    then
      let digit ← lift (core.num.U8.wrapping_sub i1 48#u8)
      let i3 ← 1#i64 <<< 59#i32
      let exponent1 ←
        if exponent < i3
        then
          do
          let i4 ← 10#i64 * exponent
          let i5 ← lift (UScalar.hcast .I64 digit)
          i4 + i5
        else ok exponent
      let count1 ← count + 1#usize
      ok (cont (exponent1, count1))
    else ok (done (exponent, count))
  else ok (done (exponent, count))

/-- [dec2flt_model::num::imp::dec2flt::parse::parse_scientific]: loop 0:
    Source: 'num/imp/../../dec2flt/parse.rs', lines 145:8-151:9 -/
@[rust_loop]
def num.imp.dec2flt.parse.parse_scientific_loop
  (exponent : Std.I64) (s : Slice Std.U8) (count : Std.Usize) :
  Result (Std.I64 × Std.Usize)
  := do
  loop
    (fun (exponent1, count1) =>
      num.imp.dec2flt.parse.parse_scientific_loop.body s exponent1 count1)
    (exponent, count)

/-- [dec2flt_model::num::imp::dec2flt::parse::parse_scientific]:
    Source: 'num/imp/../../dec2flt/parse.rs', lines 121:0-158:1 -/
def num.imp.dec2flt.parse.parse_scientific
  (s_ref : Slice Std.U8) : Result ((Option Std.I64) × (Slice Std.U8)) := do
  let o ← core.slice.Slice.split_first s_ref
  let (negative, s) ←
    match o with
    | none => ok (false, s_ref)
    | some p =>
      do
      let (c, s_next) := p
      let s1 ←
        if c = 45#u8
        then ok s_next
        else if c = 43#u8
             then ok s_next
             else ok s_ref
      ok (c = 45#u8, s1)
  let b ← core.slice.Slice.is_empty s
  if b
  then ok (none, s)
  else
    let i ← Slice.index_usize s 0#usize
    let b1 ← core.num.U8.is_ascii_digit i
    if b1
    then
      let (exponent, count) ←
        num.imp.dec2flt.parse.parse_scientific_loop 0#i64 s 0#usize
      let s_ref1 ←
        core.slice.index.Slice.index
          (core.slice.index.SliceIndexRangeFromUsizeSlice Std.U8) s
          { start := count }
      if negative
      then let i1 ← -. exponent
           ok (some i1, s_ref1)
      else ok (some exponent, s_ref1)
    else ok (none, s)

/-- [dec2flt_model::num::imp::dec2flt::decimal_seq::parse_decimal_seq]: loop body 0:
    Source: 'num/imp/../../dec2flt/decimal_seq.rs', lines 296:4-298:5
    Visibility: public -/

COMMAND: sed -n '3633,3649p' generated.lean

/-- [dec2flt_model::num::imp::dec2flt::biased_fp_to_float]:
    Source: 'num/imp/../../dec2flt/mod.rs', lines 282:0-286:1 -/
def num.imp.dec2flt.biased_fp_to_float
  {F : Type} {Clause0_Clause0_Int : Type} (traitsFloatExtInst :
  num.imp.traits.FloatExt F Clause0_Clause0_Int)
  (x : num.imp.dec2flt.common.BiasedFp) :
  Result F
  := do
  let i ← lift (IScalar.hcast .U64 x.p_biased)
  let i1 ← traitsFloatExtInst.FloatInst.SIG_BITS
  let i2 ← i <<< i1
  let word ← lift (x.m ||| i2)
  traitsFloatExtInst.from_u64_bits word

/-- [dec2flt_model::num::imp::dec2flt::Dec2FltAssemblyTrace]
    Source: 'num/imp/../../dec2flt/mod.rs', lines 329:0-352:1

COMMAND: sed -n '202,209p' upstream/dec2flt/mod.rs
/// Converts a `BiasedFp` to the closest machine float type.
fn biased_fp_to_float<F: FloatExt>(x: BiasedFp) -> F {
    let mut word = x.m;
    word |= (x.p_biased as u64) << F::SIG_BITS;
    F::from_u64_bits(word)
}

/// Converts a decimal string into a floating point number.

The explicit source accumulator tests its OLD value against T=2^59,
updates at most to E=10*T-1<I64::MAX, consumes all subsequent digits even
after updates stop, then returns the first nondigit suffix and applies sign.
This is not a clamp to T, not the old 65536 fold and not the stored point.
For source-valid length L<=2^63-1, saved n and f are each <=L; both I64
casts and their difference are exact. Point finalization absorbs I64
saturation in the final [-2047,2047] clip. n=0 returns point zero only after
the earlier shared exponent call. Normal None is defaulted to zero; fail
or divergence propagate and are not defaulted. Exact mathematical exponent,
full significand, complete grammar and rounding remain independent definitions.
