P364_T1_NumberHelperAdjustCountExact

Lean checked

Statement

This explanation was written alongside the formalization to describe the statement and its reasoning.

Lemma · Exact leading-zero and dot adjustment

Let an Aeneas byte slice s have contents ZT, where every byte of Z is either ASCII zero (48) or a dot (46), and T is empty or starts with a byte different from both. Suppose |s|\leq C=9223372036854775807. For a signed pointer-sized word n, assume 0\leq n\leq |s| and \mathit{isize}_{\min}\leq n-c_0(Z), where c_0(Z) is the number of zero bytes in Z. The extracted operation num imp dec2flt parse adjust many digit count on (s,n) returns normally with integer value n-c_0(Z).

Lean statement

Trellis authored these statements and proofs. Lean checks the formal proofs; the assumptions used by each proof are listed below.

import Tablet.Assumptions
import Tablet.num_imp_dec2flt_parse_adjust_many_digit_count

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: P364_T1_NumberHelperAdjustCountExact]
theorem P364_T1_NumberHelperAdjustCountExact
  (start : Slice Std.U8) (n : Std.Isize)
  (zeroPrefix tail : List Std.U8)
  (hstart : start.val = zeroPrefix ++ tail)
  (hprefix : forall b, List.Mem b zeroPrefix -> b = 48#u8 \/ b = 46#u8)
  (htail : tail = [] \/ exists b rest, tail = b :: rest /\
    b ≠ 48#u8 /\ b ≠ 46#u8)
  (hlen : start.val.length <= 9223372036854775807)
  (hnonneg : 0 <= n.val) (hnle : n.val <= start.val.length)
  (hlower : IScalar.min .Isize <= n.val - (zeroPrefix.count 48#u8 : Int)) :
  exists adjusted,
    num.imp.dec2flt.parse.adjust_many_digit_count start n = ok adjusted /\
    adjusted.val = n.val - (zeroPrefix.count 48#u8 : Int) := by
Proof

Natural-language proof

The status above describes the Lean proof. Its explanatory prose may remain a sketch after that proof closes.

Explanatory prose status

Prose retained as authored. The explanatory prose is preserved as it stood when captured.

Proof

Use the 64-bit target equation of Assumptions. Unfold num imp dec2flt parse adjust many digit count, including its loop body. Write the scanning state as (a,j,f), consisting of the count, unsigned index, and scanning flag. While f is true, maintain a partition Z=PQ, j=|P|, and a=n-c_0(P). Once f is false, maintain instead a=n-c_0(Z). Initially P is empty, j=0, a=n, and f is true.
If Q=bQ', then j<|s| and the indexed byte is exactly b, by the partition and the slice equation. If b=48, the checked byte subtraction 48-1 gives 47, saturating subtraction 48-47 gives 1, and the heterogeneous cast of 1 to isize is exact. The new count is a-1=n-c_0(Pb). Its lower bound follows from c_0(Pb)\leq c_0(Z) and the assumed lower bound for n-c_0(Z). Its upper bound follows from a-1\leq n\leq |s|\leq C. Consequently this checked signed subtraction succeeds. If b=46, the same checked byte subtraction gives 47, but saturating subtraction 46-47 gives 0. Its cast is exact, and the checked subtraction by 0 leaves the count unchanged and within its scalar bounds. These are all possibilities by the prefix hypothesis.
In both cases the checked index increment succeeds, since j+1\leq |Z|\leq |s|\leq C<2^{64}, and the invariant advances from P to Pb. When Q is empty and T is empty, the length guard fails at j=|s| and returns the desired count. When Q is empty and T=bR, the index is in bounds and the indexed byte is neither zero nor dot. The body keeps the count and index and changes the flag to false; the next iteration returns the count. A state with false flag also returns immediately if the length guard fails. Thus every terminal branch returns n-c_0(Z).
Termination is justified by the natural measure 2(|s|-j)+(1\text{ if }f\text{ is true, else }0). An index increment in a scanning state reduces it by 2; switching the flag to false reduces it by 1. No other continuation is possible. The well-founded loop specification therefore gives a normal result with the asserted integer value, including the all-prefix and empty-input cases.

Lean proof


  have hbits := Dec2Flt.P340_T1_selected_target_numBits

  have hloop : num.imp.dec2flt.parse.adjust_many_digit_count_loop
      start n 0#usize true ⦃ adjusted =>
        adjusted.val = n.val - (zeroPrefix.count 48#u8 : Int) ⦄ := by
    unfold num.imp.dec2flt.parse.adjust_many_digit_count_loop
    apply Aeneas.Std.loop.spec_decr_nat
      (fun p : Std.Isize × Std.Usize × Bool =>
        2 * (start.val.length - p.2.1.val) + if p.2.2 then 1 else 0)
      (fun p =>
        (p.2.2 = true /\ exists consumed remaining,
          zeroPrefix = consumed ++ remaining /\
          p.2.1.val = consumed.length /\
          p.1.val = n.val - (consumed.count 48#u8 : Int)) \/
        (p.2.2 = false /\ p.1.val =
          n.val - (zeroPrefix.count 48#u8 : Int)))
      (fun adjusted => adjusted.val =
        n.val - (zeroPrefix.count 48#u8 : Int))
      (fun p => num.imp.dec2flt.parse.adjust_many_digit_count_loop.body
        start p.1 p.2.1 p.2.2)
      (n, 0#usize, true)
    · intro p hp
      rcases p with ⟨count, index, scanning⟩
      rcases hp with hscan | hdone
      · rcases hscan with
          ⟨hscanning, consumed, remaining, hpart, hindex, hcount⟩
        simp only [Prod.fst, Prod.snd] at hscanning hindex hcount ⊢
        cases scanning <;> simp at hscanning
        cases remaining with
        | nil =>
          have hconsumed : consumed = zeroPrefix := by
            simpa using hpart.symm
          subst consumed
          rcases htail with htailnil | ⟨b, rest, htaileq, hb48, hb46⟩
          · subst tail
            have houtside : Not (index.val < start.val.length) := by
              rw [hstart, hindex]
              simp
            simp [num.imp.dec2flt.parse.adjust_many_digit_count_loop.body,
              WP.spec_ok, houtside, hcount]
          · have hinside : index.val < start.val.length := by
              rw [hstart, htaileq, hindex]
              simp
            have hread : Slice.index_usize start index = ok b := by
              simp [Slice.index_usize, hstart, htaileq, hindex]
            simp [num.imp.dec2flt.parse.adjust_many_digit_count_loop.body,
              WP.spec_ok, hinside, hread, hb48, hb46]
            exact hcount
        | cons b rest =>
          have hbmem : List.Mem b zeroPrefix := by
            rw [hpart]
            exact List.mem_append_right _ List.mem_cons_self
          rcases hprefix b hbmem with hbzero | hbpoint
          · subst b
            have hinside : index.val < start.val.length := by
              rw [hstart, hpart, hindex]
              simp
            have hread : Slice.index_usize start index = ok 48#u8 := by
              simp [Slice.index_usize, hstart, hpart, hindex]
            simp [num.imp.dec2flt.parse.adjust_many_digit_count_loop.body,
              WP.spec_ok, hinside, hread]
            rw [show (48#u8 - 1#u8) = ok 47#u8 by rfl]
            change (do
              let digit ← lift (core.num.U8.saturating_sub 48#u8 47#u8)
              let digit' ← lift (UScalar.hcast .Isize digit)
              let count1 ← count - digit'
              let index1 ← index + 1#usize
              ok (cont (count1, index1, true))) ⦃ _ ⦄
            rw [show lift (core.num.U8.saturating_sub 48#u8 47#u8) =
              ok 1#u8 by rfl]
            have hcast1 : UScalar.hcast .Isize 1#u8 = 1#isize := by
              apply IScalar.eq_of_val_eq
              have h := UScalar.hcast_inBounds_spec .Isize (1#u8)
                (by scalar_tac)
              simpa [Aeneas.Std.lift, WP.spec_ok] using h
            change (do
              let digit' ← lift (UScalar.hcast .Isize 1#u8)
              let count1 ← count - digit'
              let index1 ← index + 1#usize
              ok (cont (count1, index1, true))) ⦃ _ ⦄
            rw [hcast1]
            have hremainingCount :
                (zeroPrefix.count 48#u8 : Int) =
                  (consumed.count 48#u8 : Int) + 1 +
                    (rest.count 48#u8 : Int) := by
              rw [hpart, List.count_append]
              simp
              omega
            have hsublo : IScalar.min .Isize <=
                count.val - (1#isize).val := by
              simp [IScalar.min, IScalarTy.numBits,
                hbits] at hlower ⊢
              rw [hremainingCount] at hlower
              rw [hcount]
              omega
            have hsubhi : count.val - (1#isize).val <=
                IScalar.max .Isize := by
              simp [IScalar.max, IScalarTy.numBits,
                hbits]
              rw [hcount]
              have hlen' : (start.val.length : Int) <=
                  9223372036854775807 := by exact_mod_cast hlen
              have hnupper : n.val <= 9223372036854775807 := by
                exact le_trans hnle hlen'
              omega
            obtain ⟨count1, hcount1, hcount1val⟩ :=
              Aeneas.Std.WP.spec_imp_exists
                (IScalar.sub_spec (x := count) (y := 1#isize)
                  (by simpa using hsublo) (by simpa using hsubhi))
            rw [show lift (1#isize) = ok 1#isize by rfl]
            simp only [bind_tc_ok]
            rw [hcount1]
            have hadd : index.val + 1 <= UScalar.max .Usize := by
              have hbits := hbits
              simp [UScalar.max, hbits]
              rw [hstart, hpart] at hlen
              simp only [List.length_append, List.length_cons] at hlen
              omega
            obtain ⟨index1, hindex1, hindex1val⟩ :=
              Aeneas.Std.WP.spec_imp_exists
                (UScalar.add_spec (x := index) (y := 1#usize) hadd)
            rw [hindex1]
            simp [WP.spec_ok]
            constructor
            · refine ⟨consumed ++ [48#u8], ?_, ?_, ?_⟩
              · exact ⟨rest, by simpa [List.append_assoc] using hpart⟩
              · norm_num at hindex1val
                simp [hindex]
                omega
              · norm_num at hcount1val
                simp [hcount]
                omega
            · norm_num at hindex1val
              omega
          · subst b
            have hinside : index.val < start.val.length := by
              rw [hstart, hpart, hindex]
              simp
            have hread : Slice.index_usize start index = ok 46#u8 := by
              simp [Slice.index_usize, hstart, hpart, hindex]
            simp [num.imp.dec2flt.parse.adjust_many_digit_count_loop.body,
              WP.spec_ok, hinside, hread]
            rw [show (48#u8 - 1#u8) = ok 47#u8 by rfl]
            change (do
              let digit ← lift (core.num.U8.saturating_sub 46#u8 47#u8)
              let digit' ← lift (UScalar.hcast .Isize digit)
              let count1 ← count - digit'
              let index1 ← index + 1#usize
              ok (cont (count1, index1, true))) ⦃ _ ⦄
            rw [show lift (core.num.U8.saturating_sub 46#u8 47#u8) =
              ok 0#u8 by rfl]
            have hcast0 : UScalar.hcast .Isize 0#u8 = 0#isize := by
              apply IScalar.eq_of_val_eq
              have h := UScalar.hcast_inBounds_spec .Isize (0#u8)
                (by scalar_tac)
              simpa [Aeneas.Std.lift, WP.spec_ok] using h
            change (do
              let digit' ← lift (UScalar.hcast .Isize 0#u8)
              let count1 ← count - digit'
              let index1 ← index + 1#usize
              ok (cont (count1, index1, true))) ⦃ _ ⦄
            rw [hcast0]
            have hsublo : IScalar.min .Isize <=
                count.val - (0#isize).val := by
              have hc := IScalar.hBounds count
              simp [IScalar.min, IScalarTy.numBits,
                hbits] at hc ⊢
              omega
            have hsubhi : count.val - (0#isize).val <=
                IScalar.max .Isize := by
              have hc := IScalar.hBounds count
              simp [IScalar.max, IScalarTy.numBits,
                hbits] at hc ⊢
              omega
            obtain ⟨count1, hcount1, hcount1val⟩ :=
              Aeneas.Std.WP.spec_imp_exists
                (IScalar.sub_spec (x := count) (y := 0#isize)
                  (by simpa using hsublo) (by simpa using hsubhi))
            rw [show lift (0#isize) = ok 0#isize by rfl]
            simp only [bind_tc_ok]
            rw [hcount1]
            have hadd : index.val + 1 <= UScalar.max .Usize := by
              have hbits := hbits
              simp [UScalar.max, hbits]
              rw [hstart, hpart] at hlen
              simp only [List.length_append, List.length_cons] at hlen
              omega
            obtain ⟨index1, hindex1, hindex1val⟩ :=
              Aeneas.Std.WP.spec_imp_exists
                (UScalar.add_spec (x := index) (y := 1#usize) hadd)
            rw [hindex1]
            simp [WP.spec_ok]
            constructor
            · refine ⟨consumed ++ [46#u8], ?_, ?_, ?_⟩
              · exact ⟨rest, by simpa [List.append_assoc] using hpart⟩
              · norm_num at hindex1val
                simp [hindex]
                omega
              · norm_num at hcount1val
                rw [hcount1val, hcount]
                simp
            · norm_num at hindex1val
              omega
      · rcases hdone with ⟨hscanning, hcount⟩
        simp only [Prod.fst, Prod.snd] at hscanning hcount ⊢
        cases scanning <;> simp at hscanning
        simp [num.imp.dec2flt.parse.adjust_many_digit_count_loop.body,
          WP.spec_ok, hcount]
    · refine Or.inl ⟨rfl, [], zeroPrefix, by simp, by simp, ?_⟩
      simpa using rfl
  obtain ⟨adjusted, hadjusted, hvalue⟩ :=
    Aeneas.Std.WP.spec_imp_exists hloop
  refine ⟨adjusted, ?_, hvalue⟩
  simpa [num.imp.dec2flt.parse.adjust_many_digit_count] using hadjusted

end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.Assumptions
import Tablet.num_imp_dec2flt_parse_adjust_many_digit_count

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: P364_T1_NumberHelperAdjustCountExact]
theorem P364_T1_NumberHelperAdjustCountExact
  (start : Slice Std.U8) (n : Std.Isize)
  (zeroPrefix tail : List Std.U8)
  (hstart : start.val = zeroPrefix ++ tail)
  (hprefix : forall b, List.Mem b zeroPrefix -> b = 48#u8 \/ b = 46#u8)
  (htail : tail = [] \/ exists b rest, tail = b :: rest /\
    b ≠ 48#u8 /\ b ≠ 46#u8)
  (hlen : start.val.length <= 9223372036854775807)
  (hnonneg : 0 <= n.val) (hnle : n.val <= start.val.length)
  (hlower : IScalar.min .Isize <= n.val - (zeroPrefix.count 48#u8 : Int)) :
  exists adjusted,
    num.imp.dec2flt.parse.adjust_many_digit_count start n = ok adjusted /\
    adjusted.val = n.val - (zeroPrefix.count 48#u8 : Int) := by
-- BODY
  have hbits := Dec2Flt.P340_T1_selected_target_numBits

  have hloop : num.imp.dec2flt.parse.adjust_many_digit_count_loop
      start n 0#usize true ⦃ adjusted =>
        adjusted.val = n.val - (zeroPrefix.count 48#u8 : Int) ⦄ := by
    unfold num.imp.dec2flt.parse.adjust_many_digit_count_loop
    apply Aeneas.Std.loop.spec_decr_nat
      (fun p : Std.Isize × Std.Usize × Bool =>
        2 * (start.val.length - p.2.1.val) + if p.2.2 then 1 else 0)
      (fun p =>
        (p.2.2 = true /\ exists consumed remaining,
          zeroPrefix = consumed ++ remaining /\
          p.2.1.val = consumed.length /\
          p.1.val = n.val - (consumed.count 48#u8 : Int)) \/
        (p.2.2 = false /\ p.1.val =
          n.val - (zeroPrefix.count 48#u8 : Int)))
      (fun adjusted => adjusted.val =
        n.val - (zeroPrefix.count 48#u8 : Int))
      (fun p => num.imp.dec2flt.parse.adjust_many_digit_count_loop.body
        start p.1 p.2.1 p.2.2)
      (n, 0#usize, true)
    · intro p hp
      rcases p with ⟨count, index, scanning⟩
      rcases hp with hscan | hdone
      · rcases hscan with
          ⟨hscanning, consumed, remaining, hpart, hindex, hcount⟩
        simp only [Prod.fst, Prod.snd] at hscanning hindex hcount ⊢
        cases scanning <;> simp at hscanning
        cases remaining with
        | nil =>
          have hconsumed : consumed = zeroPrefix := by
            simpa using hpart.symm
          subst consumed
          rcases htail with htailnil | ⟨b, rest, htaileq, hb48, hb46⟩
          · subst tail
            have houtside : Not (index.val < start.val.length) := by
              rw [hstart, hindex]
              simp
            simp [num.imp.dec2flt.parse.adjust_many_digit_count_loop.body,
              WP.spec_ok, houtside, hcount]
          · have hinside : index.val < start.val.length := by
              rw [hstart, htaileq, hindex]
              simp
            have hread : Slice.index_usize start index = ok b := by
              simp [Slice.index_usize, hstart, htaileq, hindex]
            simp [num.imp.dec2flt.parse.adjust_many_digit_count_loop.body,
              WP.spec_ok, hinside, hread, hb48, hb46]
            exact hcount
        | cons b rest =>
          have hbmem : List.Mem b zeroPrefix := by
            rw [hpart]
            exact List.mem_append_right _ List.mem_cons_self
          rcases hprefix b hbmem with hbzero | hbpoint
          · subst b
            have hinside : index.val < start.val.length := by
              rw [hstart, hpart, hindex]
              simp
            have hread : Slice.index_usize start index = ok 48#u8 := by
              simp [Slice.index_usize, hstart, hpart, hindex]
            simp [num.imp.dec2flt.parse.adjust_many_digit_count_loop.body,
              WP.spec_ok, hinside, hread]
            rw [show (48#u8 - 1#u8) = ok 47#u8 by rfl]
            change (do
              let digit ← lift (core.num.U8.saturating_sub 48#u8 47#u8)
              let digit' ← lift (UScalar.hcast .Isize digit)
              let count1 ← count - digit'
              let index1 ← index + 1#usize
              ok (cont (count1, index1, true))) ⦃ _ ⦄
            rw [show lift (core.num.U8.saturating_sub 48#u8 47#u8) =
              ok 1#u8 by rfl]
            have hcast1 : UScalar.hcast .Isize 1#u8 = 1#isize := by
              apply IScalar.eq_of_val_eq
              have h := UScalar.hcast_inBounds_spec .Isize (1#u8)
                (by scalar_tac)
              simpa [Aeneas.Std.lift, WP.spec_ok] using h
            change (do
              let digit' ← lift (UScalar.hcast .Isize 1#u8)
              let count1 ← count - digit'
              let index1 ← index + 1#usize
              ok (cont (count1, index1, true))) ⦃ _ ⦄
            rw [hcast1]
            have hremainingCount :
                (zeroPrefix.count 48#u8 : Int) =
                  (consumed.count 48#u8 : Int) + 1 +
                    (rest.count 48#u8 : Int) := by
              rw [hpart, List.count_append]
              simp
              omega
            have hsublo : IScalar.min .Isize <=
                count.val - (1#isize).val := by
              simp [IScalar.min, IScalarTy.numBits,
                hbits] at hlower ⊢
              rw [hremainingCount] at hlower
              rw [hcount]
              omega
            have hsubhi : count.val - (1#isize).val <=
                IScalar.max .Isize := by
              simp [IScalar.max, IScalarTy.numBits,
                hbits]
              rw [hcount]
              have hlen' : (start.val.length : Int) <=
                  9223372036854775807 := by exact_mod_cast hlen
              have hnupper : n.val <= 9223372036854775807 := by
                exact le_trans hnle hlen'
              omega
            obtain ⟨count1, hcount1, hcount1val⟩ :=
              Aeneas.Std.WP.spec_imp_exists
                (IScalar.sub_spec (x := count) (y := 1#isize)
                  (by simpa using hsublo) (by simpa using hsubhi))
            rw [show lift (1#isize) = ok 1#isize by rfl]
            simp only [bind_tc_ok]
            rw [hcount1]
            have hadd : index.val + 1 <= UScalar.max .Usize := by
              have hbits := hbits
              simp [UScalar.max, hbits]
              rw [hstart, hpart] at hlen
              simp only [List.length_append, List.length_cons] at hlen
              omega
            obtain ⟨index1, hindex1, hindex1val⟩ :=
              Aeneas.Std.WP.spec_imp_exists
                (UScalar.add_spec (x := index) (y := 1#usize) hadd)
            rw [hindex1]
            simp [WP.spec_ok]
            constructor
            · refine ⟨consumed ++ [48#u8], ?_, ?_, ?_⟩
              · exact ⟨rest, by simpa [List.append_assoc] using hpart⟩
              · norm_num at hindex1val
                simp [hindex]
                omega
              · norm_num at hcount1val
                simp [hcount]
                omega
            · norm_num at hindex1val
              omega
          · subst b
            have hinside : index.val < start.val.length := by
              rw [hstart, hpart, hindex]
              simp
            have hread : Slice.index_usize start index = ok 46#u8 := by
              simp [Slice.index_usize, hstart, hpart, hindex]
            simp [num.imp.dec2flt.parse.adjust_many_digit_count_loop.body,
              WP.spec_ok, hinside, hread]
            rw [show (48#u8 - 1#u8) = ok 47#u8 by rfl]
            change (do
              let digit ← lift (core.num.U8.saturating_sub 46#u8 47#u8)
              let digit' ← lift (UScalar.hcast .Isize digit)
              let count1 ← count - digit'
              let index1 ← index + 1#usize
              ok (cont (count1, index1, true))) ⦃ _ ⦄
            rw [show lift (core.num.U8.saturating_sub 46#u8 47#u8) =
              ok 0#u8 by rfl]
            have hcast0 : UScalar.hcast .Isize 0#u8 = 0#isize := by
              apply IScalar.eq_of_val_eq
              have h := UScalar.hcast_inBounds_spec .Isize (0#u8)
                (by scalar_tac)
              simpa [Aeneas.Std.lift, WP.spec_ok] using h
            change (do
              let digit' ← lift (UScalar.hcast .Isize 0#u8)
              let count1 ← count - digit'
              let index1 ← index + 1#usize
              ok (cont (count1, index1, true))) ⦃ _ ⦄
            rw [hcast0]
            have hsublo : IScalar.min .Isize <=
                count.val - (0#isize).val := by
              have hc := IScalar.hBounds count
              simp [IScalar.min, IScalarTy.numBits,
                hbits] at hc ⊢
              omega
            have hsubhi : count.val - (0#isize).val <=
                IScalar.max .Isize := by
              have hc := IScalar.hBounds count
              simp [IScalar.max, IScalarTy.numBits,
                hbits] at hc ⊢
              omega
            obtain ⟨count1, hcount1, hcount1val⟩ :=
              Aeneas.Std.WP.spec_imp_exists
                (IScalar.sub_spec (x := count) (y := 0#isize)
                  (by simpa using hsublo) (by simpa using hsubhi))
            rw [show lift (0#isize) = ok 0#isize by rfl]
            simp only [bind_tc_ok]
            rw [hcount1]
            have hadd : index.val + 1 <= UScalar.max .Usize := by
              have hbits := hbits
              simp [UScalar.max, hbits]
              rw [hstart, hpart] at hlen
              simp only [List.length_append, List.length_cons] at hlen
              omega
            obtain ⟨index1, hindex1, hindex1val⟩ :=
              Aeneas.Std.WP.spec_imp_exists
                (UScalar.add_spec (x := index) (y := 1#usize) hadd)
            rw [hindex1]
            simp [WP.spec_ok]
            constructor
            · refine ⟨consumed ++ [46#u8], ?_, ?_, ?_⟩
              · exact ⟨rest, by simpa [List.append_assoc] using hpart⟩
              · norm_num at hindex1val
                simp [hindex]
                omega
              · norm_num at hcount1val
                rw [hcount1val, hcount]
                simp
            · norm_num at hindex1val
              omega
      · rcases hdone with ⟨hscanning, hcount⟩
        simp only [Prod.fst, Prod.snd] at hscanning hcount ⊢
        cases scanning <;> simp at hscanning
        simp [num.imp.dec2flt.parse.adjust_many_digit_count_loop.body,
          WP.spec_ok, hcount]
    · refine Or.inl ⟨rfl, [], zeroPrefix, by simp, by simp, ?_⟩
      simpa using rfl
  obtain ⟨adjusted, hadjusted, hvalue⟩ :=
    Aeneas.Std.WP.spec_imp_exists hloop
  refine ⟨adjusted, ?_, hvalue⟩
  simpa [num.imp.dec2flt.parse.adjust_many_digit_count] using hadjusted

end dec2flt_model

Proof structure

Follow the declared dependencies to read the supporting statements and proofs.

Explore this dependency tree

Inspect related source (47)
More program dependencies (14)
Standard-library dependencies (30)

Related source and models come from the extraction records and declared dependencies.

Proof assumptions and review

Lean checks the formal proof. Trellis also reviews how the statement corresponds to the intended requirement.

Transitive assumptions

This list combines the assumptions recorded for this declaration and its dependencies. It may include assumptions used by auxiliary declarations in those modules.

Helper theorems included
Technical checking records
Local closure summary
{
  "node": "P364_T1_NumberHelperAdjustCountExact",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "11fee72f03317bfc4b2a0c0cad7bbfbd5b5c7311ec209bfca55fe7b689d01726",
  "active_statement_hash": "0f68aeae4b367d7e3bd7488abb8f78ebdc668e1121dd5606ea9bae15e3b3399c",
  "kernel_axioms": [
    "Classical.choice",
    "Dec2Flt.P340_T1_selected_target_numBits",
    "Quot.sound",
    "propext"
  ],
  "toolchain_hash": "ce4c4e3d87434b9663f46de25ce34b48a0cf0d392e0a320a0787b4674a2d7b61",
  "lean_executable_hash": "3e0d0d3d801675359f2d4cf9815bfdb417b20b92fdd9d48b3b14c95bbae28bbf",
  "checker_script_hash": "c8e4a03273e23b9a8f2e141020652a4e0b7b0a8ab0883366ea9d031ca3f37aa1",
  "approved_axioms_hash": "576e6bf9480cfd32f53c309c7ac8fb115c1ba6e413f299ed5ff9fa7c647e6769",
  "axcheck_status": "Agreed",
  "accepted_at_snapshot_id": "worker-result-local-closure-issuance-cycle-73",
  "boundary_theorems": {},
  "strict_theorem_deps": {
    "num_imp_dec2flt_parse_adjust_many_digit_count": "7a20708611001f01"
  },
  "strict_definition_deps": {
    "num_imp_dec2flt_parse_adjust_many_digit_count": "1bc88a1b016164f3"
  }
}
Prose assessment
{
  "label": "Lean proof closed; predictive prose review no longer required",
  "assessment_status": null,
  "fingerprint_relation": "unknown",
  "assessment_fingerprint": null,
  "current_fingerprint": "sound-v2:1f7cf24528181aae286ee2aa4b9491fa987516ad4957207b6cc1cb7e925e267a",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}