Source context

Program Rust

left_shift_loop1

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

149             n = quotient;150         }151 152         while n > 0 {153             write_index -= 1;154             let quotient = n / 10;155             let remainder = n - (10 * quotient);156             if write_index < Self::MAX_DIGITS {157                 self.digits[write_index] = remainder as u8;158             } else if remainder > 0 {159                 self.truncated = true;160             }161             n = quotient;162         }163 164         self.num_digits += num_new_digits;165 

Aeneas declaration

The Lean below was mechanically extracted by Aeneas from Rust.

@[rust_loop]
def num.imp.dec2flt.decimal_seq.DecimalSeq.left_shift_loop1
  (b : Bool) (a : Array Std.U8 768#usize) (write_index : Std.Usize)
  (n : Std.U64) :
  Result (Bool × (Array Std.U8 768#usize))
  := do
  loop
    (fun (b1, a1, write_index1, n1) =>
      num.imp.dec2flt.decimal_seq.DecimalSeq.left_shift_loop1.body b1 a1
      write_index1 n1)
    (b, a, write_index, n)
Operations used here

body · Program Rust

Other extracted objects at this span

num.imp.dec2flt.decimal_seq.DecimalSeq.left_shift_loop1.body

Source details
Declarationnum.imp.dec2flt.decimal_seq.DecimalSeq.left_shift_loop1
Filenum/imp/../../dec2flt/decimal_seq.rs
Lines152:8–162:9
Program versionOriginal program