P529_T1_Loop1Execution

Lean checked

Statement

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

Lemma · Constructed loop-one return with fixed endpoints

Let d_0 have count at most 768, decimal retained cells, positive head, and retained length equal to its count. Suppose -324\le p_0\le0, e_0\ge0, and
X/2^{e_0}=V(d_0)+\eta_0,\quad Y/2^{e_0}=V(d_0)+u_0,\quad 0\le\eta_0<u_0,\quad d_0.\mathit{truncated}\iff\eta_0>0.
The actual specialized loop-one call with infinity sentinel (0,2047) and no early result returns normally to (d_1,e_1,\mathsf{none}). There is a natural numerical bound witness b\le21 with e_0-60b\le e_1\le e_0. The output has point zero, nonzero count at most 768, decimal retained cells, head in [5,9] and exact retained length. It has ordered errors
X/2^{e_1}=V(d_1)+\eta_1,\quad Y/2^{e_1}=V(d_1)+u_1,\quad 0\le\eta_1<u_1,\quad d_1.\mathit{truncated}\iff\eta_1>0.
The witness b is not asserted to be an execution count. This generic contract makes no claim that Y/2^{e_1}\le1.

Lean statement

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

import Tablet.P529_T1_LeftLoopStep
import Tablet.P857_T1_LeftLoopBudgetTransition
import Tablet.ResultLoopPartial
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model

-- [TABLET NODE: P529_T1_Loop1Execution]
theorem P529_T1_Loop1Execution (X Y : Real)
    (d0 : num.imp.dec2flt.decimal_seq.DecimalSeq) (exp0 : Std.I32)
    (hpointLo : -324 <= d0.decimal_point.val)
    (hpointHi : d0.decimal_point.val <= 0)
    (hexpLo : 0 <= exp0.val)
    (hinput : d0.num_digits.val <= 768 /\
      (forall b, b ∈ d0.digits.val.take d0.num_digits.val -> b.val < 10) /\
      (exists h tail,
        (d0.digits.val.take d0.num_digits.val).map (fun b => b.val) = h :: tail /\
        1 <= h /\ h < 10 /\ (h :: tail).length = d0.num_digits.val)) :
    let V := fun a : num.imp.dec2flt.decimal_seq.DecimalSeq =>
      ((((a.digits.val.take a.num_digits.val).map (fun b => b.val)).foldl
        (fun n z => 10 * n + z) 0 : Nat) : Real) *
        (10 : Real) ^ (a.decimal_point.val - (a.num_digits.val : Int))
    (exists eta0 u0 : Real,
      X / (2 : Real) ^ exp0.val = V d0 + eta0 /\
      Y / (2 : Real) ^ exp0.val = V d0 + u0 /\
      0 <= eta0 /\ eta0 < u0 /\ (d0.truncated = true <-> 0 < eta0)) ->
    exists (d1 : num.imp.dec2flt.decimal_seq.DecimalSeq) (exp1 : Std.I32) (bound : Nat),
      num.imp.dec2flt.slow.parse_long_mantissa_loop1
        F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
        { m := 0#u64, p_biased := 2047#i32 }
        d0.num_digits d0.decimal_point d0.truncated d0.digits exp0 none =
          ok (d1.num_digits, d1.decimal_point, d1.truncated, d1.digits, exp1, none) /\
      bound <= 21 /\ exp0.val - (60 : Int) * bound <= exp1.val /\
      exp1.val <= exp0.val /\ d1.decimal_point.val = 0 /\
      d1.num_digits.val ≠ 0 /\ 5 <= d1.digits.val[0].val /\ d1.digits.val[0].val < 10 /\
      d1.num_digits.val <= 768 /\
      (forall b, b ∈ d1.digits.val.take d1.num_digits.val -> b.val < 10) /\
      (exists h tail,
        (d1.digits.val.take d1.num_digits.val).map (fun b => b.val) = h :: tail /\
        5 <= h /\ h < 10 /\ (h :: tail).length = d1.num_digits.val) /\
      (exists eta1 u1 : Real,
        X / (2 : Real) ^ exp1.val = V d1 + eta1 /\
        Y / (2 : Real) ^ exp1.val = V d1 + u1 /\
        0 <= eta1 /\ eta1 < u1 /\ (d1.truncated = true <-> 0 < eta1)) := 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 actual loop definition in num imp dec2flt slow parse long mantissa. Track a proof-local natural counter j, initially zero, incremented on each actual continuation. At record a, point p, exponent e and head z, maintain None, the input decimal shape, -324\le p\le0, e_0-60j\le e\le e_0, and the two stated endpoints at exponent e with ordered errors and sticky. Maintain also the simultaneous budgets
\begin{array}{ll} p\le-19&18j-p\le324,\\ -18\le p\le-2&j\le17,\\ p=-1,\ z<7&j\le18,\\ p=-1,\ z\ge7&j\le19,\\ p=0,\ z\le2&j\le19,\\ p=0,\ 3\le z<5&j\le20,\\ p=0,\ z\ge5&j\le21 . \end{array} \tag{1}
Initially the point bound proves the first budget and all others follow from j=0. The hypotheses give every other invariant. The regimes in (1) exhaust all states. In the first regime 18j\le324+p\le305, hence j\le16; the others explicitly imply j\le21. Thus e\ge e_0-60j\ge-1260.
Apply LeftLoopStep to the current endpoints X/2^e,Y/2^e. Its done alternative yields point zero, head at least five, and the unchanged normal done state. Its continuation constructs the actual body, shift and checked subtraction, with e'=e-k, k\le60. Consequently e_0-60(j+1)\le e'\le e_0. The point and decimal shape invariants persist by that principal. Its endpoint equations become the required equations at e' by 2^k(X/2^e)=X/2^{e-k} and the same power law for Y. The exact None result persists and its point bound excludes the infinity arm.
Apply LeftLoopBudgetTransition to the current counter, points, heads, point bounds, seven budgets, and the step principal's correlated transition clauses, omitting its unneeded shift selection equality. It gives all seven successor budgets at j+1 and the seven-way current source-regime disjunction. Retain this disjunction for the rank argument below and reconstruct the successor invariant with the local shape and endpoint facts.
For termination use the natural rank
R(p,z)= \begin{cases} 4(-p),&p<0,\ z\ge7,\\ 4(-p)+1,&p<0,\ z<7,\\ 2,&p=0,\ z\le2,\\ 1,&p=0,\ 3\le z<5,\\ 0,&p=0,\ z\ge5 . \end{cases}
Large-negative points grow by at least 18, strictly reducing the rank even if the last flag increases. Points -18 through -2 reach -1 or zero, whose rank is at most five, below the old rank at least eight. A point-minus-one stall changes rank five to four; a move to zero has rank at most two, below either four or five. At point zero the two progress clauses reduce rank two to at most one, or one to zero. Thus every normal continuation has smaller rank. Well-founded induction on this rank, rewriting the loop by its defining done/continuation equation, constructs a normal final result. The preservation rule ResultLoopPartial gives the maintained invariant on that result; the rank argument proves existence, not merely a conditional postcondition.
A done result has point zero and head at least five, so its last budget gives j\le21. Choose b=j in the existential conclusion. This proves the numerical bound without adding an execution-count assertion. The terminal invariant gives the exact loop equation, e_1\le e_0, nonempty exact-length decimal shape, head below ten, and both fixed endpoint and sticky equations. No terminal-trim hypothesis on d_0 and no enclosing-success hypothesis is needed.

Lean proof


  exact (set_option maxHeartbeats 1600000 in by
    classical
    dsimp only
    intro hend0
    rcases hend0 with ⟨eta0, u0, hX0, hY0, heta0, hlt0, hsticky0⟩
    rcases hinput with ⟨hcap0, hdigit0, hshape0⟩
    rcases hshape0 with ⟨h0, tail0, hmap0, hhead0, hheadHi0, hlen0⟩
    let V := fun a : num.imp.dec2flt.decimal_seq.DecimalSeq =>
      ((((a.digits.val.take a.num_digits.val).map (fun b => b.val)).foldl
        (fun n z => 10 * n + z) 0 : Nat) : Real) *
        (10 : Real) ^ (a.decimal_point.val - (a.num_digits.val : Int))
    let recOf := fun (s : Std.Usize × Std.I32 × Bool ×
        Array Std.U8 768#usize × Std.I32 ×
        Option num.imp.dec2flt.common.BiasedFp) =>
      ({ num_digits := s.1, decimal_point := s.2.1,
         truncated := s.2.2.1, digits := s.2.2.2.1 } :
        num.imp.dec2flt.decimal_seq.DecimalSeq)
    let headOf := fun (s : Std.Usize × Std.I32 × Bool ×
        Array Std.U8 768#usize × Std.I32 ×
        Option num.imp.dec2flt.common.BiasedFp) =>
      ((((recOf s).digits.val.take (recOf s).num_digits.val).map
        (fun b => b.val)).headD 0)
    let rank : Int → Int → Nat := fun p z =>
      if p < 0 then 4 * (-p).toNat + (if z < 7 then 1 else 0)
      else if p = 0 then if z <= 2 then 2 else if z < 5 then 1 else 0
      else 100000
    let measure := fun s => rank (recOf s).decimal_point.val (headOf s)
    let Inv := fun (s : Std.Usize × Std.I32 × Bool ×
        Array Std.U8 768#usize × Std.I32 ×
        Option num.imp.dec2flt.common.BiasedFp) =>
      ∃ j : Nat,
        s.2.2.2.2.2 = none ∧
        -324 ≤ (recOf s).decimal_point.val ∧
        (recOf s).decimal_point.val ≤ 0 ∧
        exp0.val - 60 * (j : Int) ≤ s.2.2.2.2.1.val ∧
        s.2.2.2.2.1.val ≤ exp0.val ∧
        (recOf s).num_digits.val ≤ 768 ∧
        (∀ b, b ∈ (recOf s).digits.val.take (recOf s).num_digits.val -> b.val < 10) ∧
        (∃ h tail,
          ((recOf s).digits.val.take (recOf s).num_digits.val).map
            (fun b => b.val) = h :: tail ∧ 1 ≤ h ∧ h < 10 ∧
          (h :: tail).length = (recOf s).num_digits.val) ∧
        (∃ eta u : Real,
          X / (2 : Real) ^ s.2.2.2.2.1.val = V (recOf s) + eta ∧
          Y / (2 : Real) ^ s.2.2.2.2.1.val = V (recOf s) + u ∧
          0 ≤ eta ∧ eta < u ∧
          ((recOf s).truncated = true ↔ 0 < eta)) ∧
        ((recOf s).decimal_point.val ≤ -19 -> 18 * (j : Int) -
            (recOf s).decimal_point.val ≤ 324) ∧
        (-18 ≤ (recOf s).decimal_point.val ->
            (recOf s).decimal_point.val ≤ -2 -> j ≤ 17) ∧
        ((recOf s).decimal_point.val = -1 -> headOf s < 7 -> j ≤ 18) ∧
        ((recOf s).decimal_point.val = -1 -> 7 ≤ headOf s -> j ≤ 19) ∧
        ((recOf s).decimal_point.val = 0 -> headOf s ≤ 2 -> j ≤ 19) ∧
        ((recOf s).decimal_point.val = 0 -> 3 ≤ headOf s ->
            headOf s < 5 -> j ≤ 20) ∧
        ((recOf s).decimal_point.val = 0 -> 5 ≤ headOf s -> j ≤ 21)
    let Post := fun s => Inv s ∧ (recOf s).decimal_point.val = 0 ∧
      5 ≤ headOf s
    let s0 := (d0.num_digits, d0.decimal_point, d0.truncated,
      d0.digits, exp0, (none : Option num.imp.dec2flt.common.BiasedFp))
    have hstart : Inv s0 := by
      simp only [Inv, recOf, headOf, s0]
      refine ⟨0, by trivial, hpointLo, hpointHi, ?_, le_rfl, hcap0,
        hdigit0, ⟨h0, tail0, hmap0, hhead0, hheadHi0, hlen0⟩,
        ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩
      · omega
      · exact ⟨eta0, u0, hX0, hY0, heta0, hlt0, hsticky0⟩
      all_goals simp [hmap0] <;> intros <;> omega
    have hloop : Aeneas.Std.WP.spec
        (num.imp.dec2flt.slow.parse_long_mantissa_loop1
          F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
          { m := 0#u64, p_biased := 2047#i32 }
          d0.num_digits d0.decimal_point d0.truncated d0.digits exp0 none) Post := by
      unfold num.imp.dec2flt.slow.parse_long_mantissa_loop1
      apply Aeneas.Std.loop.spec_decr_nat measure Inv Post
        (fun s => num.imp.dec2flt.slow.parse_long_mantissa_loop1.body
          F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
          { m := 0#u64, p_biased := 2047#i32 }
          s.1 s.2.1 s.2.2.1 s.2.2.2.1 s.2.2.2.2.1 s.2.2.2.2.2) s0
      · intro s hs
        rcases s with ⟨i, p, b, a, e, res⟩
        dsimp only [Inv, recOf, headOf] at hs
        rcases hs with ⟨j, hnone, hpLo, hpHi, heLo, heHi, hcap,
          hdigit, hshape, hend, hb1, hb2, hb3, hb4, hb5, hb6, hb7⟩
        let d : num.imp.dec2flt.decimal_seq.DecimalSeq :=
          { num_digits := i, decimal_point := p, truncated := b, digits := a }
        rcases hshape with ⟨z, zs, hzmap, hzlo, hzhi, hzlen⟩
        have hnumPos : 0 < i.val := by
          have hpos : 0 < (z :: zs).length := by simp
          rw [← hzlen]
          exact hpos
        have htakeBound : i.val ≤ a.val.length := by
          have haLen : a.val.length = 768 := by simpa using a.property
          have hi : i.val ≤ 768 := by exact_mod_cast hcap
          rw [haLen]
          exact hi
        have hhead :
            (((d.digits.val.take d.num_digits.val).map (fun q => q.val)).headD 0) = z := by
          dsimp [d]
          rw [hzmap]
          rfl
        have hzHead :
            (List.map (fun q : Std.U8 => q.val) (a.val.take i.val)).headD 0 = z := by
          simpa [d] using hhead
        have hzHead' :
            (List.take i.val (List.map (fun q : Std.U8 => q.val) a.val)).headD 0 = z := by
          simpa [List.map_take] using hzHead
        have hstateHead : headOf (i, p, b, a, e, none) = z := by
          dsimp [headOf, recOf]
          rw [hzmap]
          rfl
        have hheadVal : a.val[0].val = z := by
          have hread : (a.val[0]?).map (fun q => q.val) = some z := by
            have hmap := congrArg (fun l : List Nat => l[0]?) hzmap
            simp only [List.getElem?_cons_zero, List.getElem?_map] at hmap
            rw [List.getElem?_take_of_lt hnumPos] at hmap
            exact hmap
          have hidx : 0 < a.val.length := by
            exact lt_of_lt_of_le (by omega : 0 < i.val) htakeBound
          have := hread
          rw [List.getElem?_eq_getElem hidx, Option.map_some] at this
          exact Option.some.inj this
        have hjBound : j ≤ 21 := by
          by_cases hp : p.val ≤ -19
          · have := hb1 hp
            omega
          · by_cases hp18 : -18 ≤ p.val
            · by_cases hpneg : p.val ≤ -2
              · exact le_trans (hb2 hp18 hpneg) (by omega)
              · by_cases hpm : p.val = -1
                · by_cases hz : z < 7
                  · exact le_trans (hb3 hpm (by rw [hzHead]; exact hz)) (by omega)
                  · have h := hb4 hpm (by rw [hzHead]; omega)
                    omega
                · have hp0 : p.val = 0 := by omega
                  by_cases hz2 : z ≤ 2
                  · exact le_trans (hb5 hp0 (by rw [hzHead]; exact hz2)) (by omega)
                  · by_cases hz5 : 5 ≤ z
                    · exact le_trans (hb7 hp0 (by rw [hzHead]; exact hz5)) (by omega)
                    · have hlt5 : z < 5 := by omega
                      have hz3 : 3 ≤ z := by omega
                      have h := hb6 hp0 (by rw [hzHead]; exact hz3)
                        (by rw [hzHead]; exact hlt5)
                      omega
            · omega
        have hexpMin : -1260 ≤ e.val := by
          have hbound : (j : Int) ≤ 21 := by exact_mod_cast hjBound
          omega
        have hdinput : d.num_digits.val ≤ 768 /\
            (forall q, q ∈ d.digits.val.take d.num_digits.val -> q.val < 10) /\
            (exists h tail,
              (d.digits.val.take d.num_digits.val).map (fun q => q.val) = h :: tail /\
              1 ≤ h /\ h < 10 /\ (h :: tail).length = d.num_digits.val) := by
          exact ⟨hcap, hdigit, ⟨z, zs, hzmap, hzlo, hzhi, hzlen⟩⟩
        have hprincipal := P529_T1_LeftLoopStep
          (X / (2 : Real) ^ e.val) (Y / (2 : Real) ^ e.val) d e
          hpLo hpHi hexpMin hdinput hend
        cases hres : res with
        | none =>
          rcases hprincipal with hdone | hcont
          · rcases hdone with ⟨hbodyEq, hp0, hz5⟩
            have hbodyEq' :
                num.imp.dec2flt.slow.parse_long_mantissa_loop1.body
                  F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
                  { m := 0#u64, p_biased := 2047#i32 } i p b a e none =
                ok (done (i, p, b, a, e, none)) := by
              simpa [d] using hbodyEq
            have hz : 5 ≤ z := by
              rw [hheadVal] at hz5
              exact hz5
            have hInvSame : Inv (i, p, b, a, e, none) := by
              dsimp only [Inv, recOf, headOf]
              exact ⟨j, rfl, hpLo, hpHi, heLo, heHi, hcap, hdigit,
                ⟨z, zs, hzmap, hzlo, hzhi, hzlen⟩, hend,
                hb1, hb2, hb3, hb4, hb5, hb6, hb7⟩
            have hbodySpec :
                num.imp.dec2flt.slow.parse_long_mantissa_loop1.body
                  F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
                  { m := 0#u64, p_biased := 2047#i32 } i p b a e none
                  ⦃r => match r with
                    | done y => Post y
                    | cont x' => Inv x' ∧ measure x' < measure (i, p, b, a, e, none)⦄ := by
              rw [hbodyEq']
              simp only [WP.spec_ok]
              refine ⟨hInvSame, hp0, ?_⟩
              change 5 ≤ headOf (i, p, b, a, e, none)
              rw [hstateHead]
              exact hz
            convert hbodySpec using 1
            funext r
            cases r <;> rfl
          · rcases hcont with ⟨d', shift, growth, e', z, z', zs, zs', hbodyEq,
            hleft, hgrowth, hshift, hgrowthBound, heq, hpEq, hshape, hshape',
            hzlo, hzhi, hz'lo, hz'hi, hsel, hlarge, hsmall, hminus, hminusLarge,
            hzero, hpLo', hpHi', hcap', hdigit', hlen', hlast', hend'⟩
            have hbodyEq' :
                num.imp.dec2flt.slow.parse_long_mantissa_loop1.body
                  F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
                  { m := 0#u64, p_biased := 2047#i32 } i p b a e none =
                ok (cont (d'.num_digits, d'.decimal_point, d'.truncated,
                  d'.digits, e', none)) := by
              simpa [d] using hbodyEq
            have hbodySpec :
                num.imp.dec2flt.slow.parse_long_mantissa_loop1.body
                  F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
                  { m := 0#u64, p_biased := 2047#i32 } i p b a e none
                  ⦃r => match r with
                    | done y => Post y
                    | cont x' => Inv x' ∧ measure x' < measure (i, p, b, a, e, none)⦄ := by
              rcases hend' with ⟨eta', u', hXscaled, hYscaled, heta', hlt', hsticky'⟩
              have hscale (Q : Real) : Q / (2 : Real) ^ e'.val =
                  (2 : Real) ^ shift.val * (Q / (2 : Real) ^ e.val) := by
                rw [heq, zpow_sub₀ (by norm_num : (2 : Real) ≠ 0)]
                rw [div_div_eq_mul_div]
                simp only [div_eq_mul_inv]
                ac_rfl
              have hXnew : X / (2 : Real) ^ e'.val = V d' + eta' := by
                rw [hscale]
                exact hXscaled
              have hYnew : Y / (2 : Real) ^ e'.val = V d' + u' := by
                rw [hscale]
                exact hYscaled
              have hhead' :
                  (List.take d'.num_digits.val
                    (List.map (fun q : Std.U8 => q.val) d'.digits.val)).headD 0 = z' := by
                simpa [List.map_take] using congrArg
                  (fun l : List Nat => l.headD 0) hshape'
              have hheadState' : headOf
                  (d'.num_digits, d'.decimal_point, d'.truncated, d'.digits, e', none) = z' := by
                dsimp [headOf, recOf]
                rw [hshape']
                rfl
              have hstateHead' : headOf
                  (d'.num_digits, d'.decimal_point, d'.truncated, d'.digits, e', none) = z' :=
                hheadState'
              have hstateHeadCurrent : headOf (i, p, b, a, e, none) = z := by
                dsimp [headOf, recOf]
                rw [hshape]
                rfl
              have hzHeadCurrent :
                  (List.map (fun q : Std.U8 => q.val) (a.val.take i.val)).headD 0 = z := by
                rw [hshape]
                rfl
              obtain ⟨hsource, hbudgets'⟩ :=
                P857_T1_LeftLoopBudgetTransition j p.val d'.decimal_point.val z z'
                  hpLo hpHi hb1 hb2
                  (by simpa only [hzHeadCurrent] using hb3)
                  (by simpa only [hzHeadCurrent] using hb4)
                  (by simpa only [hzHeadCurrent] using hb5)
                  (by simpa only [hzHeadCurrent] using hb6)
                  (by simpa only [hzHeadCurrent] using hb7)
                  hlarge hsmall hminus hminusLarge
                  (fun hp => ⟨(hzero hp).1, (hzero hp).2.2⟩)
              have hInv' : Inv (d'.num_digits, d'.decimal_point,
                  d'.truncated, d'.digits, e', none) := by
                dsimp only [Inv, recOf]
                rcases hbudgets' with ⟨hb1', hb2', hb3', hb4', hb5', hb6', hb7'⟩
                refine ⟨j + 1, rfl, hpLo', hpHi', ?_, ?_, hcap', hdigit',
                  ⟨z', zs', hshape', hz'lo, hz'hi, hlen'⟩,
                  ⟨eta', u', ?_, ?_, heta', hlt', hsticky'⟩,
                  (by simpa [hhead'] using hb1'),
                  (by simpa [hhead'] using hb2'),
                  (by simpa [hstateHead'] using hb3'),
                  (by simpa [hstateHead'] using hb4'),
                  (by simpa [hstateHead'] using hb5'),
                  (by simpa [hstateHead'] using hb6'),
                  (by simpa [hstateHead'] using hb7')⟩
                · rw [heq]
                  have hk : (shift.val : Int) ≤ 60 := by exact_mod_cast hshift
                  omega
                · rw [heq]
                  have hk : 0 ≤ (shift.val : Int) := by omega
                  omega
                · simpa [V] using hXnew
                · simpa [V] using hYnew
              have hrank' :
                  measure (d'.num_digits, d'.decimal_point,
                    d'.truncated, d'.digits, e', none) < measure (i, p, b, a, e, none) := by
                change rank d'.decimal_point.val (headOf
                    (d'.num_digits, d'.decimal_point, d'.truncated, d'.digits, e', none)) <
                  rank p.val (headOf (i, p, b, a, e, none))
                rw [hstateHead', hstateHeadCurrent]
                have hrankNum : rank d'.decimal_point.val z' < rank p.val z := by
                  rcases hsource with hL | hM | hML | hMH | hZL | hZM | hZH
                  · rcases hL with ⟨hpL, hj⟩
                    rcases hlarge hpL with h18 | h19
                    · have hq : d'.decimal_point.val = p.val + 18 := h18
                      have hpneg : p.val < 0 := by omega
                      have hqneg : d'.decimal_point.val < 0 := by omega
                      have hpconv : ((-p.val).toNat : Int) = -p.val :=
                        Int.toNat_of_nonneg (by omega)
                      have hqconv : ((-d'.decimal_point.val).toNat : Int) =
                          -d'.decimal_point.val := Int.toNat_of_nonneg (by omega)
                      have hInt : 4 * (-d'.decimal_point.val) +
                            (if z' < 7 then 1 else 0) <
                          4 * (-p.val) + (if z < 7 then 1 else 0) := by omega
                      have hNat : 4 * (-d'.decimal_point.val).toNat +
                            (if z' < 7 then 1 else 0) <
                          4 * (-p.val).toNat + (if z < 7 then 1 else 0) := by
                        have hIntNat : (4 : Int) * ((-d'.decimal_point.val).toNat : Int) +
                              (if z' < 7 then 1 else 0) <
                            4 * ((-p.val).toNat : Int) + (if z < 7 then 1 else 0) := by
                          rw [hqconv, hpconv]
                          exact hInt
                        exact_mod_cast hIntNat
                      simpa [rank, hpneg, hqneg] using hNat
                    · have hq : d'.decimal_point.val = p.val + 19 := h19
                      have hpneg : p.val < 0 := by omega
                      by_cases hqzero : d'.decimal_point.val = 0
                      · have hpEq : p.val = -19 := by omega
                        have hpneg : p.val < 0 := by omega
                        have hpconv : ((-p.val).toNat : Int) = -p.val :=
                          Int.toNat_of_nonneg (by omega)
                        have hpNat : 19 ≤ (-p.val).toNat := by
                          have hi : (19 : Int) ≤ -p.val := by omega
                          have hi' : (19 : Int) ≤ ((-p.val).toNat : Int) := by
                            rw [hpconv]
                            exact hi
                          exact_mod_cast hi'
                        rw [hqzero]
                        simp [rank, hpneg]
                        have hzphase : (if z' ≤ 2 then 2 else if z' < 5 then 1 else 0) ≤ 2 := by
                          split_ifs <;> omega
                        omega
                      · have hqneg : d'.decimal_point.val < 0 := by omega
                        have hpconv : ((-p.val).toNat : Int) = -p.val :=
                          Int.toNat_of_nonneg (by omega)
                        have hqconv : ((-d'.decimal_point.val).toNat : Int) =
                            -d'.decimal_point.val := Int.toNat_of_nonneg (by omega)
                        have hInt : 4 * (-d'.decimal_point.val) +
                              (if z' < 7 then 1 else 0) <
                            4 * (-p.val) + (if z < 7 then 1 else 0) := by omega
                        have hNat : 4 * (-d'.decimal_point.val).toNat +
                              (if z' < 7 then 1 else 0) <
                            4 * (-p.val).toNat + (if z < 7 then 1 else 0) := by
                          have hIntNat : (4 : Int) * ((-d'.decimal_point.val).toNat : Int) +
                                (if z' < 7 then 1 else 0) <
                              4 * ((-p.val).toNat : Int) + (if z < 7 then 1 else 0) := by
                            rw [hqconv, hpconv]
                            exact hInt
                          exact_mod_cast hIntNat
                        simpa [rank, hpneg, hqneg] using hNat
                  · rcases hM with ⟨hpLoM, hpHiM, hj⟩
                    have hnext := hsmall hpLoM (show p.val < 0 by omega)
                    rcases hnext with hq | hq
                    · have hpneg : p.val < 0 := by omega
                      have hqneg : d'.decimal_point.val < 0 := by omega
                      have hpconv : ((-p.val).toNat : Int) = -p.val :=
                        Int.toNat_of_nonneg (by omega)
                      have hqconv : ((-d'.decimal_point.val).toNat : Int) =
                          -d'.decimal_point.val := Int.toNat_of_nonneg (by omega)
                      have hInt : 4 * (-d'.decimal_point.val) +
                            (if z' < 7 then 1 else 0) <
                          4 * (-p.val) + (if z < 7 then 1 else 0) := by omega
                      have hNat : 4 * (-d'.decimal_point.val).toNat +
                            (if z' < 7 then 1 else 0) <
                          4 * (-p.val).toNat + (if z < 7 then 1 else 0) := by
                        have hIntNat : (4 : Int) * ((-d'.decimal_point.val).toNat : Int) +
                              (if z' < 7 then 1 else 0) <
                            4 * ((-p.val).toNat : Int) + (if z < 7 then 1 else 0) := by
                          rw [hqconv, hpconv]
                          exact hInt
                        exact_mod_cast hIntNat
                      simpa [rank, hpneg, hqneg] using hNat
                    · have hpneg : p.val < 0 := by omega
                      have hqzero : d'.decimal_point.val = 0 := hq
                      have hpconv : ((-p.val).toNat : Int) = -p.val :=
                        Int.toNat_of_nonneg (by omega)
                      have hpNat : 2 ≤ (-p.val).toNat := by
                        have hi : (2 : Int) ≤ -p.val := by omega
                        have hi' : (2 : Int) ≤ ((-p.val).toNat : Int) := by
                          rw [hpconv]
                          exact hi
                        exact_mod_cast hi'
                      have hphase : (if z' ≤ 2 then 2 else if z' < 5 then 1 else 0) <
                          4 * (-p.val).toNat + (if z < 7 then 1 else 0) := by
                        have hzphase : (if z' ≤ 2 then 2 else if z' < 5 then 1 else 0) ≤ 2 := by
                          split_ifs <;> omega
                        omega
                      simpa [rank, hpneg, hqzero] using hphase
                  · rcases hML with ⟨hminusP, hzlt, hj⟩
                    have hpneg : p.val < 0 := by omega
                    have hpLower : -18 ≤ p.val := by rw [hminusP]; omega
                    have hnext := hsmall hpLower (by rw [hminusP]; omega)
                    rcases hnext with hq | hq
                    · have hqneg : d'.decimal_point.val < 0 := by omega
                      have hpconv : ((-p.val).toNat : Int) = -p.val :=
                        Int.toNat_of_nonneg (by omega)
                      have hqconv : ((-d'.decimal_point.val).toNat : Int) =
                          -d'.decimal_point.val := Int.toNat_of_nonneg (by omega)
                      have hflag : ¬ z' < 7 := by
                        intro hsmallHead
                        have hznext := hminus hminusP hq
                        omega
                      have hInt : 4 * (-d'.decimal_point.val) +
                            (if z' < 7 then 1 else 0) <
                          4 * (-p.val) + (if z < 7 then 1 else 0) := by omega
                      have hNat : 4 * (-d'.decimal_point.val).toNat +
                            (if z' < 7 then 1 else 0) <
                          4 * (-p.val).toNat + (if z < 7 then 1 else 0) := by
                        have hIntNat : (4 : Int) * ((-d'.decimal_point.val).toNat : Int) +
                              (if z' < 7 then 1 else 0) <
                            4 * ((-p.val).toNat : Int) + (if z < 7 then 1 else 0) := by
                          rw [hqconv, hpconv]
                          exact hInt
                        exact_mod_cast hIntNat
                      simpa [rank, hpneg, hqneg] using hNat
                    · have hqzero : d'.decimal_point.val = 0 := hq
                      have hpconv : ((-p.val).toNat : Int) = -p.val :=
                        Int.toNat_of_nonneg (by omega)
                      have hpNat : 1 ≤ (-p.val).toNat := by
                        have hi : (1 : Int) ≤ -p.val := by omega
                        have hi' : (1 : Int) ≤ ((-p.val).toNat : Int) := by
                          rw [hpconv]
                          exact hi
                        exact_mod_cast hi'
                      have hphase : (if z' ≤ 2 then 2 else if z' < 5 then 1 else 0) <
                          4 * (-p.val).toNat + (if z < 7 then 1 else 0) := by
                        have hzphase : (if z' ≤ 2 then 2 else if z' < 5 then 1 else 0) ≤ 2 := by
                          split_ifs <;> omega
                        omega
                      simpa [rank, hpneg, hqzero] using hphase
                  · rcases hMH with ⟨hminusP, hz7, hj⟩
                    have hnext := hminusLarge hminusP hz7
                    rcases hnext with ⟨hq, hznext⟩
                    have hpneg : p.val < 0 := by omega
                    have hpconv : ((-p.val).toNat : Int) = -p.val :=
                      Int.toNat_of_nonneg (by omega)
                    have hInt : 0 < 4 * (-p.val) := by omega
                    have hNat : 0 < 4 * (-p.val).toNat := by
                      have hIntNat : (4 : Int) * ((-p.val).toNat : Int) > 0 := by
                        rw [hpconv]
                        exact hInt
                      exact_mod_cast hIntNat
                    have hqzero : d'.decimal_point.val = 0 := hq
                    have hpNat : 1 ≤ (-p.val).toNat := by
                      have hi : (1 : Int) ≤ -p.val := by omega
                      have hi' : (1 : Int) ≤ ((-p.val).toNat : Int) := by
                        rw [hpconv]
                        exact hi
                      exact_mod_cast hi'
                    have hphase : (if z' ≤ 2 then 2 else if z' < 5 then 1 else 0) <
                        4 * (-p.val).toNat + (if z < 7 then 1 else 0) := by
                      have hzphase : (if z' ≤ 2 then 2 else if z' < 5 then 1 else 0) ≤ 2 := by
                        split_ifs <;> omega
                      omega
                    simpa [rank, hpneg, hqzero] using hphase
                  · rcases hZL with ⟨hp0, hz2, hj⟩
                    have hnext := hzero hp0
                    rcases hnext with ⟨_, _, hq, hsmallHead, hlargeHead⟩
                    have hznext := hsmallHead hz2
                    have hzgt2 : 2 < z' := by omega
                    have hphase : (if z' ≤ 2 then 2 else if z' < 5 then 1 else 0) < 2 := by
                      by_cases hz5 : z' < 5
                      · simp [not_le_of_gt hzgt2, hz5]
                      · simp [not_le_of_gt hzgt2, hz5]
                    have hpnonneg : ¬ p.val < 0 := by omega
                    have hqnonneg : ¬ d'.decimal_point.val < 0 := by omega
                    rw [hp0, hq]
                    simpa [rank, hz2] using hphase
                  · rcases hZM with ⟨hp0, hz3, hzlt5, hj⟩
                    have hnext := hzero hp0
                    rcases hnext with ⟨_, _, hq, hsmallHead, hlargeHead⟩
                    have hznext := hlargeHead hz3
                    have hzgt2 : 2 < z' := by omega
                    have hphase : (if z' ≤ 2 then 2 else if z' < 5 then 1 else 0) < 1 := by
                      simp [not_le_of_gt hzgt2, show ¬ z' < 5 by omega]
                    have hpnonneg : ¬ p.val < 0 := by omega
                    have hqnonneg : ¬ d'.decimal_point.val < 0 := by omega
                    rw [hp0, hq]
                    simpa [rank, show ¬ z ≤ 2 by omega, show z < 5 by omega] using hphase
                  · rcases hZH with ⟨hp0, hz5, hj⟩
                    have hnext := hzero hp0
                    omega
                exact hrankNum
              rw [hbodyEq']
              simp only [WP.spec_ok]
              exact ⟨hInv', hrank'⟩
            convert hbodySpec using 1
            funext r
            cases r <;> rfl
        | some r => simp [hres] at hnone
      · exact hstart
    obtain ⟨out, hout, hpost⟩ := Aeneas.Std.WP.spec_imp_exists hloop
    rcases out with ⟨i, p, b, a, e, res⟩
    dsimp only [Post, Inv, recOf, headOf] at hpost
    rcases hpost with ⟨⟨j, hnone, hpLo, hpHi, heLo, heHi, hcap,
      hdigit, hshape, hend, hb1, hb2, hb3, hb4, hb5, hb6, hb7⟩,
      hpzero, hz5⟩
    rcases hshape with ⟨z, zs, hzmap, hzlo, hzhi, hzlen⟩
    have hhead :
        (List.map (fun q : Std.U8 => q.val) (a.val.take i.val)).headD 0 = z := by
      rw [hzmap]
      rfl
    have hz5' : 5 ≤ z := by rw [hhead] at hz5; exact hz5
    let d1 : num.imp.dec2flt.decimal_seq.DecimalSeq :=
      { num_digits := i, decimal_point := p, truncated := b, digits := a }
    have hloopEq :
        num.imp.dec2flt.slow.parse_long_mantissa_loop1
          F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
          { m := 0#u64, p_biased := 2047#i32 }
          d0.num_digits d0.decimal_point d0.truncated d0.digits exp0 none =
        ok (d1.num_digits, d1.decimal_point, d1.truncated, d1.digits, e, none) := by
      simpa [d1, hnone] using hout
    have hnumPos : 0 < i.val := by
      have hpos : 0 < (z :: zs).length := by simp
      rw [← hzlen]
      exact hpos
    have htakeBound : i.val ≤ a.val.length := by
      have haLen : a.val.length = 768 := by simpa using a.property
      have hi : i.val ≤ 768 := by exact_mod_cast hcap
      rw [haLen]
      exact hi
    have hread : (a.val[0]?).map (fun q => q.val) = some z := by
      have hmap := congrArg (fun l : List Nat => l[0]?) hzmap
      simp only [List.getElem?_cons_zero, List.getElem?_map] at hmap
      rw [List.getElem?_take_of_lt hnumPos] at hmap
      exact hmap
    have hheadVal : a.val[0].val = z := by
      have hidx : 0 < a.val.length := by omega
      have := hread
      rw [List.getElem?_eq_getElem hidx, Option.map_some] at this
      exact Option.some.inj this
    have hnumNe : i.val ≠ 0 := by omega
    have hbound : j ≤ 21 := by
      have := hb7 hpzero hz5
      omega
    rcases hend with ⟨eta1, u1, hX1, hY1, heta1, hlt1, hsticky1⟩
    refine ⟨d1, e, j, hloopEq, hbound, ?_, heHi, hpzero, hnumNe,
      ?_, ?_, hcap, hdigit, ?_, ?_⟩
    · have hji : (j : Int) ≤ 21 := by exact_mod_cast hbound
      omega
    · rw [hheadVal]
      exact hz5'
    · rw [hheadVal]
      exact hzhi
    · exact ⟨z, zs, hzmap, hz5', hzhi, hzlen⟩
    · exact ⟨eta1, u1, hX1, hY1, heta1, hlt1, hsticky1⟩)

end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.P529_T1_LeftLoopStep
import Tablet.P857_T1_LeftLoopBudgetTransition
import Tablet.ResultLoopPartial
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model

-- [TABLET NODE: P529_T1_Loop1Execution]
theorem P529_T1_Loop1Execution (X Y : Real)
    (d0 : num.imp.dec2flt.decimal_seq.DecimalSeq) (exp0 : Std.I32)
    (hpointLo : -324 <= d0.decimal_point.val)
    (hpointHi : d0.decimal_point.val <= 0)
    (hexpLo : 0 <= exp0.val)
    (hinput : d0.num_digits.val <= 768 /\
      (forall b, b ∈ d0.digits.val.take d0.num_digits.val -> b.val < 10) /\
      (exists h tail,
        (d0.digits.val.take d0.num_digits.val).map (fun b => b.val) = h :: tail /\
        1 <= h /\ h < 10 /\ (h :: tail).length = d0.num_digits.val)) :
    let V := fun a : num.imp.dec2flt.decimal_seq.DecimalSeq =>
      ((((a.digits.val.take a.num_digits.val).map (fun b => b.val)).foldl
        (fun n z => 10 * n + z) 0 : Nat) : Real) *
        (10 : Real) ^ (a.decimal_point.val - (a.num_digits.val : Int))
    (exists eta0 u0 : Real,
      X / (2 : Real) ^ exp0.val = V d0 + eta0 /\
      Y / (2 : Real) ^ exp0.val = V d0 + u0 /\
      0 <= eta0 /\ eta0 < u0 /\ (d0.truncated = true <-> 0 < eta0)) ->
    exists (d1 : num.imp.dec2flt.decimal_seq.DecimalSeq) (exp1 : Std.I32) (bound : Nat),
      num.imp.dec2flt.slow.parse_long_mantissa_loop1
        F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
        { m := 0#u64, p_biased := 2047#i32 }
        d0.num_digits d0.decimal_point d0.truncated d0.digits exp0 none =
          ok (d1.num_digits, d1.decimal_point, d1.truncated, d1.digits, exp1, none) /\
      bound <= 21 /\ exp0.val - (60 : Int) * bound <= exp1.val /\
      exp1.val <= exp0.val /\ d1.decimal_point.val = 0 /\
      d1.num_digits.val ≠ 0 /\ 5 <= d1.digits.val[0].val /\ d1.digits.val[0].val < 10 /\
      d1.num_digits.val <= 768 /\
      (forall b, b ∈ d1.digits.val.take d1.num_digits.val -> b.val < 10) /\
      (exists h tail,
        (d1.digits.val.take d1.num_digits.val).map (fun b => b.val) = h :: tail /\
        5 <= h /\ h < 10 /\ (h :: tail).length = d1.num_digits.val) /\
      (exists eta1 u1 : Real,
        X / (2 : Real) ^ exp1.val = V d1 + eta1 /\
        Y / (2 : Real) ^ exp1.val = V d1 + u1 /\
        0 <= eta1 /\ eta1 < u1 /\ (d1.truncated = true <-> 0 < eta1)) := by
-- BODY
  exact (set_option maxHeartbeats 1600000 in by
    classical
    dsimp only
    intro hend0
    rcases hend0 with ⟨eta0, u0, hX0, hY0, heta0, hlt0, hsticky0⟩
    rcases hinput with ⟨hcap0, hdigit0, hshape0⟩
    rcases hshape0 with ⟨h0, tail0, hmap0, hhead0, hheadHi0, hlen0⟩
    let V := fun a : num.imp.dec2flt.decimal_seq.DecimalSeq =>
      ((((a.digits.val.take a.num_digits.val).map (fun b => b.val)).foldl
        (fun n z => 10 * n + z) 0 : Nat) : Real) *
        (10 : Real) ^ (a.decimal_point.val - (a.num_digits.val : Int))
    let recOf := fun (s : Std.Usize × Std.I32 × Bool ×
        Array Std.U8 768#usize × Std.I32 ×
        Option num.imp.dec2flt.common.BiasedFp) =>
      ({ num_digits := s.1, decimal_point := s.2.1,
         truncated := s.2.2.1, digits := s.2.2.2.1 } :
        num.imp.dec2flt.decimal_seq.DecimalSeq)
    let headOf := fun (s : Std.Usize × Std.I32 × Bool ×
        Array Std.U8 768#usize × Std.I32 ×
        Option num.imp.dec2flt.common.BiasedFp) =>
      ((((recOf s).digits.val.take (recOf s).num_digits.val).map
        (fun b => b.val)).headD 0)
    let rank : Int → Int → Nat := fun p z =>
      if p < 0 then 4 * (-p).toNat + (if z < 7 then 1 else 0)
      else if p = 0 then if z <= 2 then 2 else if z < 5 then 1 else 0
      else 100000
    let measure := fun s => rank (recOf s).decimal_point.val (headOf s)
    let Inv := fun (s : Std.Usize × Std.I32 × Bool ×
        Array Std.U8 768#usize × Std.I32 ×
        Option num.imp.dec2flt.common.BiasedFp) =>
      ∃ j : Nat,
        s.2.2.2.2.2 = none ∧
        -324 ≤ (recOf s).decimal_point.val ∧
        (recOf s).decimal_point.val ≤ 0 ∧
        exp0.val - 60 * (j : Int) ≤ s.2.2.2.2.1.val ∧
        s.2.2.2.2.1.val ≤ exp0.val ∧
        (recOf s).num_digits.val ≤ 768 ∧
        (∀ b, b ∈ (recOf s).digits.val.take (recOf s).num_digits.val -> b.val < 10) ∧
        (∃ h tail,
          ((recOf s).digits.val.take (recOf s).num_digits.val).map
            (fun b => b.val) = h :: tail ∧ 1 ≤ h ∧ h < 10 ∧
          (h :: tail).length = (recOf s).num_digits.val) ∧
        (∃ eta u : Real,
          X / (2 : Real) ^ s.2.2.2.2.1.val = V (recOf s) + eta ∧
          Y / (2 : Real) ^ s.2.2.2.2.1.val = V (recOf s) + u ∧
          0 ≤ eta ∧ eta < u ∧
          ((recOf s).truncated = true ↔ 0 < eta)) ∧
        ((recOf s).decimal_point.val ≤ -19 -> 18 * (j : Int) -
            (recOf s).decimal_point.val ≤ 324) ∧
        (-18 ≤ (recOf s).decimal_point.val ->
            (recOf s).decimal_point.val ≤ -2 -> j ≤ 17) ∧
        ((recOf s).decimal_point.val = -1 -> headOf s < 7 -> j ≤ 18) ∧
        ((recOf s).decimal_point.val = -1 -> 7 ≤ headOf s -> j ≤ 19) ∧
        ((recOf s).decimal_point.val = 0 -> headOf s ≤ 2 -> j ≤ 19) ∧
        ((recOf s).decimal_point.val = 0 -> 3 ≤ headOf s ->
            headOf s < 5 -> j ≤ 20) ∧
        ((recOf s).decimal_point.val = 0 -> 5 ≤ headOf s -> j ≤ 21)
    let Post := fun s => Inv s ∧ (recOf s).decimal_point.val = 0 ∧
      5 ≤ headOf s
    let s0 := (d0.num_digits, d0.decimal_point, d0.truncated,
      d0.digits, exp0, (none : Option num.imp.dec2flt.common.BiasedFp))
    have hstart : Inv s0 := by
      simp only [Inv, recOf, headOf, s0]
      refine ⟨0, by trivial, hpointLo, hpointHi, ?_, le_rfl, hcap0,
        hdigit0, ⟨h0, tail0, hmap0, hhead0, hheadHi0, hlen0⟩,
        ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩
      · omega
      · exact ⟨eta0, u0, hX0, hY0, heta0, hlt0, hsticky0⟩
      all_goals simp [hmap0] <;> intros <;> omega
    have hloop : Aeneas.Std.WP.spec
        (num.imp.dec2flt.slow.parse_long_mantissa_loop1
          F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
          { m := 0#u64, p_biased := 2047#i32 }
          d0.num_digits d0.decimal_point d0.truncated d0.digits exp0 none) Post := by
      unfold num.imp.dec2flt.slow.parse_long_mantissa_loop1
      apply Aeneas.Std.loop.spec_decr_nat measure Inv Post
        (fun s => num.imp.dec2flt.slow.parse_long_mantissa_loop1.body
          F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
          { m := 0#u64, p_biased := 2047#i32 }
          s.1 s.2.1 s.2.2.1 s.2.2.2.1 s.2.2.2.2.1 s.2.2.2.2.2) s0
      · intro s hs
        rcases s with ⟨i, p, b, a, e, res⟩
        dsimp only [Inv, recOf, headOf] at hs
        rcases hs with ⟨j, hnone, hpLo, hpHi, heLo, heHi, hcap,
          hdigit, hshape, hend, hb1, hb2, hb3, hb4, hb5, hb6, hb7⟩
        let d : num.imp.dec2flt.decimal_seq.DecimalSeq :=
          { num_digits := i, decimal_point := p, truncated := b, digits := a }
        rcases hshape with ⟨z, zs, hzmap, hzlo, hzhi, hzlen⟩
        have hnumPos : 0 < i.val := by
          have hpos : 0 < (z :: zs).length := by simp
          rw [← hzlen]
          exact hpos
        have htakeBound : i.val ≤ a.val.length := by
          have haLen : a.val.length = 768 := by simpa using a.property
          have hi : i.val ≤ 768 := by exact_mod_cast hcap
          rw [haLen]
          exact hi
        have hhead :
            (((d.digits.val.take d.num_digits.val).map (fun q => q.val)).headD 0) = z := by
          dsimp [d]
          rw [hzmap]
          rfl
        have hzHead :
            (List.map (fun q : Std.U8 => q.val) (a.val.take i.val)).headD 0 = z := by
          simpa [d] using hhead
        have hzHead' :
            (List.take i.val (List.map (fun q : Std.U8 => q.val) a.val)).headD 0 = z := by
          simpa [List.map_take] using hzHead
        have hstateHead : headOf (i, p, b, a, e, none) = z := by
          dsimp [headOf, recOf]
          rw [hzmap]
          rfl
        have hheadVal : a.val[0].val = z := by
          have hread : (a.val[0]?).map (fun q => q.val) = some z := by
            have hmap := congrArg (fun l : List Nat => l[0]?) hzmap
            simp only [List.getElem?_cons_zero, List.getElem?_map] at hmap
            rw [List.getElem?_take_of_lt hnumPos] at hmap
            exact hmap
          have hidx : 0 < a.val.length := by
            exact lt_of_lt_of_le (by omega : 0 < i.val) htakeBound
          have := hread
          rw [List.getElem?_eq_getElem hidx, Option.map_some] at this
          exact Option.some.inj this
        have hjBound : j ≤ 21 := by
          by_cases hp : p.val ≤ -19
          · have := hb1 hp
            omega
          · by_cases hp18 : -18 ≤ p.val
            · by_cases hpneg : p.val ≤ -2
              · exact le_trans (hb2 hp18 hpneg) (by omega)
              · by_cases hpm : p.val = -1
                · by_cases hz : z < 7
                  · exact le_trans (hb3 hpm (by rw [hzHead]; exact hz)) (by omega)
                  · have h := hb4 hpm (by rw [hzHead]; omega)
                    omega
                · have hp0 : p.val = 0 := by omega
                  by_cases hz2 : z ≤ 2
                  · exact le_trans (hb5 hp0 (by rw [hzHead]; exact hz2)) (by omega)
                  · by_cases hz5 : 5 ≤ z
                    · exact le_trans (hb7 hp0 (by rw [hzHead]; exact hz5)) (by omega)
                    · have hlt5 : z < 5 := by omega
                      have hz3 : 3 ≤ z := by omega
                      have h := hb6 hp0 (by rw [hzHead]; exact hz3)
                        (by rw [hzHead]; exact hlt5)
                      omega
            · omega
        have hexpMin : -1260 ≤ e.val := by
          have hbound : (j : Int) ≤ 21 := by exact_mod_cast hjBound
          omega
        have hdinput : d.num_digits.val ≤ 768 /\
            (forall q, q ∈ d.digits.val.take d.num_digits.val -> q.val < 10) /\
            (exists h tail,
              (d.digits.val.take d.num_digits.val).map (fun q => q.val) = h :: tail /\
              1 ≤ h /\ h < 10 /\ (h :: tail).length = d.num_digits.val) := by
          exact ⟨hcap, hdigit, ⟨z, zs, hzmap, hzlo, hzhi, hzlen⟩⟩
        have hprincipal := P529_T1_LeftLoopStep
          (X / (2 : Real) ^ e.val) (Y / (2 : Real) ^ e.val) d e
          hpLo hpHi hexpMin hdinput hend
        cases hres : res with
        | none =>
          rcases hprincipal with hdone | hcont
          · rcases hdone with ⟨hbodyEq, hp0, hz5⟩
            have hbodyEq' :
                num.imp.dec2flt.slow.parse_long_mantissa_loop1.body
                  F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
                  { m := 0#u64, p_biased := 2047#i32 } i p b a e none =
                ok (done (i, p, b, a, e, none)) := by
              simpa [d] using hbodyEq
            have hz : 5 ≤ z := by
              rw [hheadVal] at hz5
              exact hz5
            have hInvSame : Inv (i, p, b, a, e, none) := by
              dsimp only [Inv, recOf, headOf]
              exact ⟨j, rfl, hpLo, hpHi, heLo, heHi, hcap, hdigit,
                ⟨z, zs, hzmap, hzlo, hzhi, hzlen⟩, hend,
                hb1, hb2, hb3, hb4, hb5, hb6, hb7⟩
            have hbodySpec :
                num.imp.dec2flt.slow.parse_long_mantissa_loop1.body
                  F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
                  { m := 0#u64, p_biased := 2047#i32 } i p b a e none
                  ⦃r => match r with
                    | done y => Post y
                    | cont x' => Inv x' ∧ measure x' < measure (i, p, b, a, e, none)⦄ := by
              rw [hbodyEq']
              simp only [WP.spec_ok]
              refine ⟨hInvSame, hp0, ?_⟩
              change 5 ≤ headOf (i, p, b, a, e, none)
              rw [hstateHead]
              exact hz
            convert hbodySpec using 1
            funext r
            cases r <;> rfl
          · rcases hcont with ⟨d', shift, growth, e', z, z', zs, zs', hbodyEq,
            hleft, hgrowth, hshift, hgrowthBound, heq, hpEq, hshape, hshape',
            hzlo, hzhi, hz'lo, hz'hi, hsel, hlarge, hsmall, hminus, hminusLarge,
            hzero, hpLo', hpHi', hcap', hdigit', hlen', hlast', hend'⟩
            have hbodyEq' :
                num.imp.dec2flt.slow.parse_long_mantissa_loop1.body
                  F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
                  { m := 0#u64, p_biased := 2047#i32 } i p b a e none =
                ok (cont (d'.num_digits, d'.decimal_point, d'.truncated,
                  d'.digits, e', none)) := by
              simpa [d] using hbodyEq
            have hbodySpec :
                num.imp.dec2flt.slow.parse_long_mantissa_loop1.body
                  F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
                  { m := 0#u64, p_biased := 2047#i32 } i p b a e none
                  ⦃r => match r with
                    | done y => Post y
                    | cont x' => Inv x' ∧ measure x' < measure (i, p, b, a, e, none)⦄ := by
              rcases hend' with ⟨eta', u', hXscaled, hYscaled, heta', hlt', hsticky'⟩
              have hscale (Q : Real) : Q / (2 : Real) ^ e'.val =
                  (2 : Real) ^ shift.val * (Q / (2 : Real) ^ e.val) := by
                rw [heq, zpow_sub₀ (by norm_num : (2 : Real) ≠ 0)]
                rw [div_div_eq_mul_div]
                simp only [div_eq_mul_inv]
                ac_rfl
              have hXnew : X / (2 : Real) ^ e'.val = V d' + eta' := by
                rw [hscale]
                exact hXscaled
              have hYnew : Y / (2 : Real) ^ e'.val = V d' + u' := by
                rw [hscale]
                exact hYscaled
              have hhead' :
                  (List.take d'.num_digits.val
                    (List.map (fun q : Std.U8 => q.val) d'.digits.val)).headD 0 = z' := by
                simpa [List.map_take] using congrArg
                  (fun l : List Nat => l.headD 0) hshape'
              have hheadState' : headOf
                  (d'.num_digits, d'.decimal_point, d'.truncated, d'.digits, e', none) = z' := by
                dsimp [headOf, recOf]
                rw [hshape']
                rfl
              have hstateHead' : headOf
                  (d'.num_digits, d'.decimal_point, d'.truncated, d'.digits, e', none) = z' :=
                hheadState'
              have hstateHeadCurrent : headOf (i, p, b, a, e, none) = z := by
                dsimp [headOf, recOf]
                rw [hshape]
                rfl
              have hzHeadCurrent :
                  (List.map (fun q : Std.U8 => q.val) (a.val.take i.val)).headD 0 = z := by
                rw [hshape]
                rfl
              obtain ⟨hsource, hbudgets'⟩ :=
                P857_T1_LeftLoopBudgetTransition j p.val d'.decimal_point.val z z'
                  hpLo hpHi hb1 hb2
                  (by simpa only [hzHeadCurrent] using hb3)
                  (by simpa only [hzHeadCurrent] using hb4)
                  (by simpa only [hzHeadCurrent] using hb5)
                  (by simpa only [hzHeadCurrent] using hb6)
                  (by simpa only [hzHeadCurrent] using hb7)
                  hlarge hsmall hminus hminusLarge
                  (fun hp => ⟨(hzero hp).1, (hzero hp).2.2⟩)
              have hInv' : Inv (d'.num_digits, d'.decimal_point,
                  d'.truncated, d'.digits, e', none) := by
                dsimp only [Inv, recOf]
                rcases hbudgets' with ⟨hb1', hb2', hb3', hb4', hb5', hb6', hb7'⟩
                refine ⟨j + 1, rfl, hpLo', hpHi', ?_, ?_, hcap', hdigit',
                  ⟨z', zs', hshape', hz'lo, hz'hi, hlen'⟩,
                  ⟨eta', u', ?_, ?_, heta', hlt', hsticky'⟩,
                  (by simpa [hhead'] using hb1'),
                  (by simpa [hhead'] using hb2'),
                  (by simpa [hstateHead'] using hb3'),
                  (by simpa [hstateHead'] using hb4'),
                  (by simpa [hstateHead'] using hb5'),
                  (by simpa [hstateHead'] using hb6'),
                  (by simpa [hstateHead'] using hb7')⟩
                · rw [heq]
                  have hk : (shift.val : Int) ≤ 60 := by exact_mod_cast hshift
                  omega
                · rw [heq]
                  have hk : 0 ≤ (shift.val : Int) := by omega
                  omega
                · simpa [V] using hXnew
                · simpa [V] using hYnew
              have hrank' :
                  measure (d'.num_digits, d'.decimal_point,
                    d'.truncated, d'.digits, e', none) < measure (i, p, b, a, e, none) := by
                change rank d'.decimal_point.val (headOf
                    (d'.num_digits, d'.decimal_point, d'.truncated, d'.digits, e', none)) <
                  rank p.val (headOf (i, p, b, a, e, none))
                rw [hstateHead', hstateHeadCurrent]
                have hrankNum : rank d'.decimal_point.val z' < rank p.val z := by
                  rcases hsource with hL | hM | hML | hMH | hZL | hZM | hZH
                  · rcases hL with ⟨hpL, hj⟩
                    rcases hlarge hpL with h18 | h19
                    · have hq : d'.decimal_point.val = p.val + 18 := h18
                      have hpneg : p.val < 0 := by omega
                      have hqneg : d'.decimal_point.val < 0 := by omega
                      have hpconv : ((-p.val).toNat : Int) = -p.val :=
                        Int.toNat_of_nonneg (by omega)
                      have hqconv : ((-d'.decimal_point.val).toNat : Int) =
                          -d'.decimal_point.val := Int.toNat_of_nonneg (by omega)
                      have hInt : 4 * (-d'.decimal_point.val) +
                            (if z' < 7 then 1 else 0) <
                          4 * (-p.val) + (if z < 7 then 1 else 0) := by omega
                      have hNat : 4 * (-d'.decimal_point.val).toNat +
                            (if z' < 7 then 1 else 0) <
                          4 * (-p.val).toNat + (if z < 7 then 1 else 0) := by
                        have hIntNat : (4 : Int) * ((-d'.decimal_point.val).toNat : Int) +
                              (if z' < 7 then 1 else 0) <
                            4 * ((-p.val).toNat : Int) + (if z < 7 then 1 else 0) := by
                          rw [hqconv, hpconv]
                          exact hInt
                        exact_mod_cast hIntNat
                      simpa [rank, hpneg, hqneg] using hNat
                    · have hq : d'.decimal_point.val = p.val + 19 := h19
                      have hpneg : p.val < 0 := by omega
                      by_cases hqzero : d'.decimal_point.val = 0
                      · have hpEq : p.val = -19 := by omega
                        have hpneg : p.val < 0 := by omega
                        have hpconv : ((-p.val).toNat : Int) = -p.val :=
                          Int.toNat_of_nonneg (by omega)
                        have hpNat : 19 ≤ (-p.val).toNat := by
                          have hi : (19 : Int) ≤ -p.val := by omega
                          have hi' : (19 : Int) ≤ ((-p.val).toNat : Int) := by
                            rw [hpconv]
                            exact hi
                          exact_mod_cast hi'
                        rw [hqzero]
                        simp [rank, hpneg]
                        have hzphase : (if z' ≤ 2 then 2 else if z' < 5 then 1 else 0) ≤ 2 := by
                          split_ifs <;> omega
                        omega
                      · have hqneg : d'.decimal_point.val < 0 := by omega
                        have hpconv : ((-p.val).toNat : Int) = -p.val :=
                          Int.toNat_of_nonneg (by omega)
                        have hqconv : ((-d'.decimal_point.val).toNat : Int) =
                            -d'.decimal_point.val := Int.toNat_of_nonneg (by omega)
                        have hInt : 4 * (-d'.decimal_point.val) +
                              (if z' < 7 then 1 else 0) <
                            4 * (-p.val) + (if z < 7 then 1 else 0) := by omega
                        have hNat : 4 * (-d'.decimal_point.val).toNat +
                              (if z' < 7 then 1 else 0) <
                            4 * (-p.val).toNat + (if z < 7 then 1 else 0) := by
                          have hIntNat : (4 : Int) * ((-d'.decimal_point.val).toNat : Int) +
                                (if z' < 7 then 1 else 0) <
                              4 * ((-p.val).toNat : Int) + (if z < 7 then 1 else 0) := by
                            rw [hqconv, hpconv]
                            exact hInt
                          exact_mod_cast hIntNat
                        simpa [rank, hpneg, hqneg] using hNat
                  · rcases hM with ⟨hpLoM, hpHiM, hj⟩
                    have hnext := hsmall hpLoM (show p.val < 0 by omega)
                    rcases hnext with hq | hq
                    · have hpneg : p.val < 0 := by omega
                      have hqneg : d'.decimal_point.val < 0 := by omega
                      have hpconv : ((-p.val).toNat : Int) = -p.val :=
                        Int.toNat_of_nonneg (by omega)
                      have hqconv : ((-d'.decimal_point.val).toNat : Int) =
                          -d'.decimal_point.val := Int.toNat_of_nonneg (by omega)
                      have hInt : 4 * (-d'.decimal_point.val) +
                            (if z' < 7 then 1 else 0) <
                          4 * (-p.val) + (if z < 7 then 1 else 0) := by omega
                      have hNat : 4 * (-d'.decimal_point.val).toNat +
                            (if z' < 7 then 1 else 0) <
                          4 * (-p.val).toNat + (if z < 7 then 1 else 0) := by
                        have hIntNat : (4 : Int) * ((-d'.decimal_point.val).toNat : Int) +
                              (if z' < 7 then 1 else 0) <
                            4 * ((-p.val).toNat : Int) + (if z < 7 then 1 else 0) := by
                          rw [hqconv, hpconv]
                          exact hInt
                        exact_mod_cast hIntNat
                      simpa [rank, hpneg, hqneg] using hNat
                    · have hpneg : p.val < 0 := by omega
                      have hqzero : d'.decimal_point.val = 0 := hq
                      have hpconv : ((-p.val).toNat : Int) = -p.val :=
                        Int.toNat_of_nonneg (by omega)
                      have hpNat : 2 ≤ (-p.val).toNat := by
                        have hi : (2 : Int) ≤ -p.val := by omega
                        have hi' : (2 : Int) ≤ ((-p.val).toNat : Int) := by
                          rw [hpconv]
                          exact hi
                        exact_mod_cast hi'
                      have hphase : (if z' ≤ 2 then 2 else if z' < 5 then 1 else 0) <
                          4 * (-p.val).toNat + (if z < 7 then 1 else 0) := by
                        have hzphase : (if z' ≤ 2 then 2 else if z' < 5 then 1 else 0) ≤ 2 := by
                          split_ifs <;> omega
                        omega
                      simpa [rank, hpneg, hqzero] using hphase
                  · rcases hML with ⟨hminusP, hzlt, hj⟩
                    have hpneg : p.val < 0 := by omega
                    have hpLower : -18 ≤ p.val := by rw [hminusP]; omega
                    have hnext := hsmall hpLower (by rw [hminusP]; omega)
                    rcases hnext with hq | hq
                    · have hqneg : d'.decimal_point.val < 0 := by omega
                      have hpconv : ((-p.val).toNat : Int) = -p.val :=
                        Int.toNat_of_nonneg (by omega)
                      have hqconv : ((-d'.decimal_point.val).toNat : Int) =
                          -d'.decimal_point.val := Int.toNat_of_nonneg (by omega)
                      have hflag : ¬ z' < 7 := by
                        intro hsmallHead
                        have hznext := hminus hminusP hq
                        omega
                      have hInt : 4 * (-d'.decimal_point.val) +
                            (if z' < 7 then 1 else 0) <
                          4 * (-p.val) + (if z < 7 then 1 else 0) := by omega
                      have hNat : 4 * (-d'.decimal_point.val).toNat +
                            (if z' < 7 then 1 else 0) <
                          4 * (-p.val).toNat + (if z < 7 then 1 else 0) := by
                        have hIntNat : (4 : Int) * ((-d'.decimal_point.val).toNat : Int) +
                              (if z' < 7 then 1 else 0) <
                            4 * ((-p.val).toNat : Int) + (if z < 7 then 1 else 0) := by
                          rw [hqconv, hpconv]
                          exact hInt
                        exact_mod_cast hIntNat
                      simpa [rank, hpneg, hqneg] using hNat
                    · have hqzero : d'.decimal_point.val = 0 := hq
                      have hpconv : ((-p.val).toNat : Int) = -p.val :=
                        Int.toNat_of_nonneg (by omega)
                      have hpNat : 1 ≤ (-p.val).toNat := by
                        have hi : (1 : Int) ≤ -p.val := by omega
                        have hi' : (1 : Int) ≤ ((-p.val).toNat : Int) := by
                          rw [hpconv]
                          exact hi
                        exact_mod_cast hi'
                      have hphase : (if z' ≤ 2 then 2 else if z' < 5 then 1 else 0) <
                          4 * (-p.val).toNat + (if z < 7 then 1 else 0) := by
                        have hzphase : (if z' ≤ 2 then 2 else if z' < 5 then 1 else 0) ≤ 2 := by
                          split_ifs <;> omega
                        omega
                      simpa [rank, hpneg, hqzero] using hphase
                  · rcases hMH with ⟨hminusP, hz7, hj⟩
                    have hnext := hminusLarge hminusP hz7
                    rcases hnext with ⟨hq, hznext⟩
                    have hpneg : p.val < 0 := by omega
                    have hpconv : ((-p.val).toNat : Int) = -p.val :=
                      Int.toNat_of_nonneg (by omega)
                    have hInt : 0 < 4 * (-p.val) := by omega
                    have hNat : 0 < 4 * (-p.val).toNat := by
                      have hIntNat : (4 : Int) * ((-p.val).toNat : Int) > 0 := by
                        rw [hpconv]
                        exact hInt
                      exact_mod_cast hIntNat
                    have hqzero : d'.decimal_point.val = 0 := hq
                    have hpNat : 1 ≤ (-p.val).toNat := by
                      have hi : (1 : Int) ≤ -p.val := by omega
                      have hi' : (1 : Int) ≤ ((-p.val).toNat : Int) := by
                        rw [hpconv]
                        exact hi
                      exact_mod_cast hi'
                    have hphase : (if z' ≤ 2 then 2 else if z' < 5 then 1 else 0) <
                        4 * (-p.val).toNat + (if z < 7 then 1 else 0) := by
                      have hzphase : (if z' ≤ 2 then 2 else if z' < 5 then 1 else 0) ≤ 2 := by
                        split_ifs <;> omega
                      omega
                    simpa [rank, hpneg, hqzero] using hphase
                  · rcases hZL with ⟨hp0, hz2, hj⟩
                    have hnext := hzero hp0
                    rcases hnext with ⟨_, _, hq, hsmallHead, hlargeHead⟩
                    have hznext := hsmallHead hz2
                    have hzgt2 : 2 < z' := by omega
                    have hphase : (if z' ≤ 2 then 2 else if z' < 5 then 1 else 0) < 2 := by
                      by_cases hz5 : z' < 5
                      · simp [not_le_of_gt hzgt2, hz5]
                      · simp [not_le_of_gt hzgt2, hz5]
                    have hpnonneg : ¬ p.val < 0 := by omega
                    have hqnonneg : ¬ d'.decimal_point.val < 0 := by omega
                    rw [hp0, hq]
                    simpa [rank, hz2] using hphase
                  · rcases hZM with ⟨hp0, hz3, hzlt5, hj⟩
                    have hnext := hzero hp0
                    rcases hnext with ⟨_, _, hq, hsmallHead, hlargeHead⟩
                    have hznext := hlargeHead hz3
                    have hzgt2 : 2 < z' := by omega
                    have hphase : (if z' ≤ 2 then 2 else if z' < 5 then 1 else 0) < 1 := by
                      simp [not_le_of_gt hzgt2, show ¬ z' < 5 by omega]
                    have hpnonneg : ¬ p.val < 0 := by omega
                    have hqnonneg : ¬ d'.decimal_point.val < 0 := by omega
                    rw [hp0, hq]
                    simpa [rank, show ¬ z ≤ 2 by omega, show z < 5 by omega] using hphase
                  · rcases hZH with ⟨hp0, hz5, hj⟩
                    have hnext := hzero hp0
                    omega
                exact hrankNum
              rw [hbodyEq']
              simp only [WP.spec_ok]
              exact ⟨hInv', hrank'⟩
            convert hbodySpec using 1
            funext r
            cases r <;> rfl
        | some r => simp [hres] at hnone
      · exact hstart
    obtain ⟨out, hout, hpost⟩ := Aeneas.Std.WP.spec_imp_exists hloop
    rcases out with ⟨i, p, b, a, e, res⟩
    dsimp only [Post, Inv, recOf, headOf] at hpost
    rcases hpost with ⟨⟨j, hnone, hpLo, hpHi, heLo, heHi, hcap,
      hdigit, hshape, hend, hb1, hb2, hb3, hb4, hb5, hb6, hb7⟩,
      hpzero, hz5⟩
    rcases hshape with ⟨z, zs, hzmap, hzlo, hzhi, hzlen⟩
    have hhead :
        (List.map (fun q : Std.U8 => q.val) (a.val.take i.val)).headD 0 = z := by
      rw [hzmap]
      rfl
    have hz5' : 5 ≤ z := by rw [hhead] at hz5; exact hz5
    let d1 : num.imp.dec2flt.decimal_seq.DecimalSeq :=
      { num_digits := i, decimal_point := p, truncated := b, digits := a }
    have hloopEq :
        num.imp.dec2flt.slow.parse_long_mantissa_loop1
          F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
          { m := 0#u64, p_biased := 2047#i32 }
          d0.num_digits d0.decimal_point d0.truncated d0.digits exp0 none =
        ok (d1.num_digits, d1.decimal_point, d1.truncated, d1.digits, e, none) := by
      simpa [d1, hnone] using hout
    have hnumPos : 0 < i.val := by
      have hpos : 0 < (z :: zs).length := by simp
      rw [← hzlen]
      exact hpos
    have htakeBound : i.val ≤ a.val.length := by
      have haLen : a.val.length = 768 := by simpa using a.property
      have hi : i.val ≤ 768 := by exact_mod_cast hcap
      rw [haLen]
      exact hi
    have hread : (a.val[0]?).map (fun q => q.val) = some z := by
      have hmap := congrArg (fun l : List Nat => l[0]?) hzmap
      simp only [List.getElem?_cons_zero, List.getElem?_map] at hmap
      rw [List.getElem?_take_of_lt hnumPos] at hmap
      exact hmap
    have hheadVal : a.val[0].val = z := by
      have hidx : 0 < a.val.length := by omega
      have := hread
      rw [List.getElem?_eq_getElem hidx, Option.map_some] at this
      exact Option.some.inj this
    have hnumNe : i.val ≠ 0 := by omega
    have hbound : j ≤ 21 := by
      have := hb7 hpzero hz5
      omega
    rcases hend with ⟨eta1, u1, hX1, hY1, heta1, hlt1, hsticky1⟩
    refine ⟨d1, e, j, hloopEq, hbound, ?_, heHi, hpzero, hnumNe,
      ?_, ?_, hcap, hdigit, ?_, ?_⟩
    · have hji : (j : Int) ≤ 21 := by exact_mod_cast hbound
      omega
    · rw [hheadVal]
      exact hz5'
    · rw [hheadVal]
      exact hzhi
    · exact ⟨z, zs, hzmap, hz5', hzhi, hzlen⟩
    · exact ⟨eta1, u1, hX1, hY1, heta1, hlt1, hsticky1⟩)

end dec2flt_model

Proof structure

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

Explore this dependency tree

Inspect related source (152)
More program dependencies (110)
Standard-library dependencies (39)

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
All 129 entries
Technical checking records
Local closure summary
{
  "node": "P529_T1_Loop1Execution",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "14537751f72bb2ea8b2186e45f7f8dad24298211aacc30e2fb927dcb659258d5",
  "active_statement_hash": "2fa22a8a2edb996638922dde2898fc86eeb76bebe81321c0220997ec1b857f00",
  "kernel_axioms": [
    "Classical.choice",
    "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-198",
  "boundary_theorems": {},
  "strict_theorem_deps": {
    "P529_T1_LeftLoopStep": "24fd9fefa4fce9ac",
    "P857_T1_LeftLoopBudgetTransition": "9f695f89ae209a63"
  },
  "strict_definition_deps": {
    "F64": "ec4e25fbaf4e11d4",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64": "94095c9bf79da164",
    "num_imp_dec2flt_common_BiasedFp": "c43614ff2149ecf2",
    "num_imp_dec2flt_decimal_seq_DecimalSeq": "b0286c42454b158d",
    "num_imp_dec2flt_decimal_seq_DecimalSeq_left_shift": "fd298e37d5ae4f86",
    "num_imp_dec2flt_decimal_seq_number_of_digits_decimal_left_shift": "b3efbd0e6b3fe061",
    "num_imp_dec2flt_slow_parse_long_mantissa": "62216a51d634059e",
    "num_imp_dec2flt_slow_parse_long_mantissa_closure_Insts_CoreOpsFunctionFnTupleUsizeUsize_call": "7df8a2c8e3717790"
  }
}
Prose assessment
{
  "label": "Recorded Sound: VerifierPass",
  "assessment_status": "VerifierPass",
  "fingerprint_relation": "differs from current fingerprint",
  "assessment_fingerprint": "sound-v2:357a6d8d7218a86894f8517b06ff630fd6b356882d0012f71d458d544b0f006f",
  "current_fingerprint": "sound-v2:d2b1ee4bec0ecde7f170486c7c01b7738bb0eadf62630d93503e3d00e97e715a",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "sound_status": "Pass",
  "substantiveness_status": "Pass"
}