Source context

Program Rust

body

This Rust is the input prepared for Aeneas. Modeling choices explains the adaptations from the production source.

287     // Aeneas rejects the literal-pattern `while let`; this loop performs the288     // same nonempty check, byte comparison, and one-byte consumption in the289     // same order, with identical slice bounds.290     while !s.is_empty() && s[0] == b'0' {291         s = &s[1..];292     }293 294     s = parse_digits_into_seq(s, &mut d);295 

Aeneas declaration

The Lean below was mechanically extracted by Aeneas from Rust.

@[rust_loop_body]
def num.imp.dec2flt.decimal_seq.parse_decimal_seq_loop0.body
  (s : Slice Std.U8) : Result (ControlFlow (Slice Std.U8) (Slice Std.U8)) := do
  let b ← core.slice.Slice.is_empty s
  if b
  then ok (done s)
  else
    let i ← Slice.index_usize s 0#usize
    if i = 48#u8
    then
      let s1 ←
        core.slice.index.Slice.index
          (core.slice.index.SliceIndexRangeFromUsizeSlice Std.U8) s
          { start := 1#usize }
      ok (cont s1)
    else ok (done s)
Other extracted objects at this span

num.imp.dec2flt.decimal_seq.parse_decimal_seq_loop0

Source details
Declarationnum.imp.dec2flt.decimal_seq.parse_decimal_seq_loop0.body
Filenum/imp/../../dec2flt/decimal_seq.rs
Lines290:4–292:5
Program versionOriginal program