Statement
This explanation was written alongside the formalization to describe the statement and its reasoning.
Lemma · Slow normalization loop one with fixed endpoints
Lean statement
Trellis authored these statements and proofs. Lean checks the formal proofs; the assumptions used by each proof are listed below.
import Tablet.DecimalSeqLeftShiftCanonical
import Tablet.DecimalLeftShiftLoop1Execution
import Tablet.ParserSlowLoop0
import Tablet.P804_T1_LeftLoopStep
import Tablet.SlowShiftSelectorCertificate
import Tablet.num_imp_dec2flt_slow_parse_long_mantissa
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: ParserSlowLoop1]
theorem ParserSlowLoop1 :
forall (A B : Real) (d0 : num.imp.dec2flt.decimal_seq.DecimalSeq)
(exp0 : Std.I32),
-324 <= d0.decimal_point.val -> d0.decimal_point.val <= 0 ->
0 <= exp0.val ->
let digits0 :=
(d0.digits.val.take d0.num_digits.val).map (fun z => z.val)
let integer0 : Nat := digits0.foldl (fun n digit => 10 * n + digit) 0
let value0 : Real := integer0 * (10 : Real) ^
(d0.decimal_point.val - (d0.num_digits.val : Int))
d0.num_digits.val <= 768 /\
(forall z, z ∈ d0.digits.val.take d0.num_digits.val -> z.val < 10) /\
(exists z zs, digits0 = z :: zs /\ 1 <= z /\ z < 10 /\
digits0.length = d0.num_digits.val) /\
(exists eta0 u0 : Real,
A / (2 : Real) ^ exp0.val = value0 + eta0 /\
B / (2 : Real) ^ exp0.val = value0 + u0 /\
0 <= eta0 /\ eta0 < u0 /\
(d0.truncated = true <-> 0 < eta0)) ->
exists (d1 : num.imp.dec2flt.decimal_seq.DecimalSeq)
(exp1 : Std.I32) (steps : 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) /\
steps <= 21 /\ 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 /\
let digits1 :=
(d1.digits.val.take d1.num_digits.val).map (fun z => z.val)
let integer1 : Nat := digits1.foldl (fun n digit => 10 * n + digit) 0
let value1 : Real := integer1 * (10 : Real) ^
(d1.decimal_point.val - (d1.num_digits.val : Int))
d1.num_digits.val <= 768 /\
(forall z, z ∈ d1.digits.val.take d1.num_digits.val -> z.val < 10) /\
(exists z zs, digits1 = z :: zs /\ 5 <= z /\ z < 10 /\
digits1.length = d1.num_digits.val) /\
exists eta1 u1 : Real,
A / (2 : Real) ^ exp1.val = value1 + eta1 /\
B / (2 : Real) ^ exp1.val = value1 + 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.
Earlier prose review
An earlier review questioned the prose argument. Lean subsequently checked the formal proof. Review of the statement’s intended meaning is a separate judgment.
Proof
Lean proof
dsimp only
intro A B d0 exp0 hpLower hpUpper he0Lower hcanonical
classical
let State := Std.Usize × Std.I32 × Bool × Array Std.U8 768#usize ×
Std.I32 × Option num.imp.dec2flt.common.BiasedFp
let recordOf : State -> num.imp.dec2flt.decimal_seq.DecimalSeq := fun x =>
{ num_digits := x.1, decimal_point := x.2.1, truncated := x.2.2.1,
digits := x.2.2.2.1 }
let exponentOf : State -> Std.I32 := fun x => x.2.2.2.2.1
let resultOf : State -> Option num.imp.dec2flt.common.BiasedFp := fun x =>
x.2.2.2.2.2
let Digits := fun q : num.imp.dec2flt.decimal_seq.DecimalSeq =>
(q.digits.val.take q.num_digits.val).map (fun z => z.val)
let Value := fun q : num.imp.dec2flt.decimal_seq.DecimalSeq =>
((Digits q).foldl (fun n digit => 10 * n + digit) 0 : Nat) *
(10 : Real) ^ (q.decimal_point.val - (q.num_digits.val : Int))
let Shape := fun q : num.imp.dec2flt.decimal_seq.DecimalSeq =>
q.num_digits.val <= 768 /\
(forall z, z ∈ q.digits.val.take q.num_digits.val -> z.val < 10) /\
(exists z zs, Digits q = z :: zs /\ 1 <= z /\ z < 10 /\
(Digits q).length = q.num_digits.val)
let Endpoints := fun (q : num.imp.dec2flt.decimal_seq.DecimalSeq)
(e : Std.I32) =>
exists eta u : Real,
A / (2 : Real) ^ e.val = Value q + eta /\
B / (2 : Real) ^ e.val = Value q + u /\
0 <= eta /\ eta < u /\
(q.truncated = true <-> 0 < eta)
let Lead := fun q : num.imp.dec2flt.decimal_seq.DecimalSeq =>
q.digits.val[0].val
let Budget := fun (q : num.imp.dec2flt.decimal_seq.DecimalSeq) (s : Nat) =>
(q.decimal_point.val <= -19 ->
(18 : Int) * s - q.decimal_point.val <= 324) /\
(-18 <= q.decimal_point.val -> q.decimal_point.val <= -2 -> s <= 17) /\
(q.decimal_point.val = -1 -> Lead q < 7 -> s <= 18) /\
(q.decimal_point.val = -1 -> 7 <= Lead q -> s <= 19) /\
(q.decimal_point.val = 0 -> Lead q <= 2 -> s <= 19) /\
(q.decimal_point.val = 0 -> 3 <= Lead q -> Lead q < 5 -> s <= 20) /\
(q.decimal_point.val = 0 -> 5 <= Lead q -> s <= 21)
let Inv := fun x : State =>
resultOf x = none /\
-324 <= (recordOf x).decimal_point.val /\
(recordOf x).decimal_point.val <= 0 /\
exists s : Nat,
exp0.val - (60 : Int) * s <= (exponentOf x).val /\
(exponentOf x).val <= exp0.val /\
Budget (recordOf x) s /\
Shape (recordOf x) /\ Endpoints (recordOf x) (exponentOf x)
let Post := fun x : State => Inv x /\
(recordOf x).decimal_point.val = 0 /\ 5 <= Lead (recordOf x)
let Measure := fun x : State =>
if (recordOf x).decimal_point.val < 0 then
4 * (- (recordOf x).decimal_point.val).toNat +
(if 7 <= Lead (recordOf x) then 0 else 1)
else if (recordOf x).decimal_point.val = 0 then
if 5 <= Lead (recordOf x) then 0
else if Lead (recordOf x) <= 2 then 2 else 1
else 0
let Body := fun x : State =>
num.imp.dec2flt.slow.parse_long_mantissa_loop1.body
F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
{ m := 0#u64, p_biased := 2047#i32 }
x.1 x.2.1 x.2.2.1 x.2.2.2.1 x.2.2.2.2.1 x.2.2.2.2.2
have head_eq (q : num.imp.dec2flt.decimal_seq.DecimalSeq)
(z : Nat) (zs : List Nat)
(hshape : Digits q = z :: zs)
(hlen : (Digits q).length = q.num_digits.val) : Lead q = z := by
simp only [Digits] at hshape hlen
have hnumPos : 0 < q.num_digits.val := by
rw [← hlen, hshape]
simp
have hindexBound : (0 : Nat) < q.digits.val.length := by
rw [q.digits.property]
norm_num
have hget : q.digits.val[0]? = some q.digits.val[0] :=
getElem?_eq_some_iff.mpr ⟨hindexBound, rfl⟩
have hh := congrArg List.head? hshape
rw [List.head?_eq_getElem?] at hh
have ht : (q.digits.val.take q.num_digits.val)[0]? =
some q.digits.val[0] := by
rw [List.getElem?_take, if_pos hnumPos]
exact hget
simp only [List.getElem?_map, ht] at hh
simpa [Lead] using Option.some.inj hh
have hinitShape : Shape d0 := by
exact ⟨hcanonical.1, hcanonical.2.1, hcanonical.2.2.1⟩
have hinitEndpoints : Endpoints d0 exp0 := by
simpa [Endpoints, Value, Digits] using hcanonical.2.2.2
have hinitBudget : Budget d0 0 := by
simp only [Budget]
constructor
· intro _
omega
constructor
· omega
constructor
· omega
constructor
· omega
constructor
· omega
constructor <;> omega
have hinit : Inv
(d0.num_digits, d0.decimal_point, d0.truncated, d0.digits,
exp0, none) := by
simp only [Inv, recordOf, exponentOf, resultOf]
exact ⟨by simp, hpLower, hpUpper, 0, by norm_num, by omega,
hinitBudget, hinitShape, hinitEndpoints⟩
have hspec :
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 Body
(d0.num_digits, d0.decimal_point, d0.truncated, d0.digits, exp0, none)
· intro x hx
rcases x with ⟨i, p, t, a, e, lr⟩
simp only [Inv, recordOf, exponentOf, resultOf] at hx
rcases hx with ⟨hlr, hpLo, hpHi, s, heLo, heHi, hbudget,
hshape, hend⟩
simp only [Budget] at hbudget
simp only [Shape, Digits] at hshape
simp only [Endpoints, Value, Digits] at hend
simp only [Body, Prod.fst, Prod.snd]
rw [hlr]
rcases hshape.2.2 with ⟨z0, zs0, hzshape, hzLo, hzHi, hzlen⟩
have hlead : Lead
{ num_digits := i, decimal_point := p, truncated := t, digits := a } =
z0 := head_eq _ z0 zs0 hzshape hzlen
have hs21 : s <= 21 := by
by_cases hp19 : p.val <= -19
· have hb := hbudget.1 hp19
omega
· by_cases hp2 : p.val <= -2
· exact (hbudget.2.1 (by omega) hp2).trans (by omega)
· by_cases hm1 : p.val = -1
· by_cases hz7 : Lead
{ num_digits := i, decimal_point := p,
truncated := t, digits := a } < 7
· exact (hbudget.2.2.1 hm1 hz7).trans (by omega)
· exact (hbudget.2.2.2.1 hm1 (by omega)).trans (by omega)
· have hp0 : p.val = 0 := by omega
by_cases hz2 : Lead
{ num_digits := i, decimal_point := p,
truncated := t, digits := a } <= 2
· exact (hbudget.2.2.2.2.1 hp0 hz2).trans (by omega)
· by_cases hz5 : Lead
{ num_digits := i, decimal_point := p,
truncated := t, digits := a } < 5
· exact (hbudget.2.2.2.2.2.1 hp0 (by omega) hz5).trans
(by omega)
· exact (hbudget.2.2.2.2.2.2 hp0 (by omega)).trans
(by omega)
have heStepLo : -1260 <= e.val := by
have he0 : 0 <= exp0.val := he0Lower
nlinarith
have hstep := P804_T1_LeftLoopStep
(A / (2 : Real) ^ e.val) (B / (2 : Real) ^ e.val)
{ num_digits := i, decimal_point := p, truncated := t, digits := a }
e hpLo hpHi heStepLo hshape hend
rcases hstep with hdone | hcont
· rcases hdone with ⟨hbody, hp0, hfive⟩
rw [hbody]
simp only [WP.spec_ok]
simp only [Post, Inv, recordOf, exponentOf, resultOf, Lead]
exact ⟨⟨by simp, hpLo, hpHi, s, heLo, heHi, hbudget,
⟨hshape.1, hshape.2.1, z0, zs0, hzshape, hzLo, hzHi, hzlen⟩,
hend⟩, hp0, hfive⟩
· rcases hcont with ⟨d', shift, growth, e', z, z', zs, zs',
hbody, hleft, hgrowth, hk, he', hzshapeIn, hzshapeOut,
hzInLo, hzInHi, hzOutLo, hzOutHi, hlarge, hsmall, hstall,
hrecover, hzeroInput, hzeroProgress, hshapeEnd⟩
change (p.val <= -19 ->
d'.decimal_point.val = p.val + 18 \/
d'.decimal_point.val = p.val + 19) at hlarge
change (-18 <= p.val -> p.val < 0 ->
d'.decimal_point.val = -1 \/ d'.decimal_point.val = 0) at hsmall
change (p.val = -1 -> d'.decimal_point.val = -1 -> 7 <= z') at hstall
change (p.val = -1 -> 7 <= z ->
d'.decimal_point.val = 0 /\ 5 <= z') at hrecover
change (p.val = 0 -> z < 5) at hzeroInput
change (p.val = 0 -> d'.decimal_point.val = 0 /\
(z <= 2 -> 3 <= z') /\ (3 <= z -> 5 <= z')) at hzeroProgress
rcases hshapeEnd with ⟨hcap', hdigit', hlen', hend'⟩
have hleadIn : Lead
{ num_digits := i, decimal_point := p, truncated := t, digits := a } =
z := head_eq _ z zs hzshapeIn (by simpa [Digits] using hzlen)
have hleadOut : Lead d' = z' :=
head_eq d' z' zs' hzshapeOut hlen'
have hshape' : Shape d' := by
exact ⟨hcap', hdigit', z', zs', hzshapeOut, hzOutLo, hzOutHi, hlen'⟩
have hs20 : s <= 20 := by
by_cases hp19 : p.val <= -19
· have hb := hbudget.1 hp19
omega
· by_cases hp2 : p.val <= -2
· exact (hbudget.2.1 (by omega) hp2).trans (by omega)
· by_cases hm1 : p.val = -1
· by_cases hz7 : Lead
{ num_digits := i, decimal_point := p,
truncated := t, digits := a } < 7
· exact (hbudget.2.2.1 hm1 hz7).trans (by omega)
· exact (hbudget.2.2.2.1 hm1 (by omega)).trans (by omega)
· have hp0 : p.val = 0 := by omega
have hz5 : z < 5 := hzeroInput hp0
by_cases hz2 : Lead
{ num_digits := i, decimal_point := p,
truncated := t, digits := a } <= 2
· exact (hbudget.2.2.2.2.1 hp0 hz2).trans (by omega)
· exact (hbudget.2.2.2.2.2.1 hp0 (by omega)
(by rw [hleadIn]; exact hz5)).trans (by omega)
have hp'Lo : -324 <= d'.decimal_point.val := by
by_cases hp19 : p.val <= -19
· rcases hlarge hp19 with h | h <;> omega
· by_cases hpneg : p.val < 0
· rcases hsmall (by omega) hpneg with h | h <;> omega
· have hz := hzeroProgress (by omega)
omega
have hp'Hi : d'.decimal_point.val <= 0 := by
by_cases hp19 : p.val <= -19
· rcases hlarge hp19 with h | h <;> omega
· by_cases hpneg : p.val < 0
· rcases hsmall (by omega) hpneg with h | h <;> omega
· have hz := hzeroProgress (by omega)
omega
have heNextLo : exp0.val - (60 : Int) * (s + 1) <= e'.val := by
rw [he']
norm_num only [Nat.cast_add, Nat.cast_one]
nlinarith
have heNextHi : e'.val <= exp0.val := by
rw [he']
have hknonneg : (0 : Int) <= shift.val := by omega
omega
have hscaleA :
(2 : Real) ^ shift.val * (A / (2 : Real) ^ e.val) =
A / (2 : Real) ^ e'.val := by
rw [he', zpow_sub₀ (by norm_num : (2 : Real) ≠ 0)]
norm_num only [zpow_natCast]
field_simp
have hscaleB :
(2 : Real) ^ shift.val * (B / (2 : Real) ^ e.val) =
B / (2 : Real) ^ e'.val := by
rw [he', zpow_sub₀ (by norm_num : (2 : Real) ≠ 0)]
norm_num only [zpow_natCast]
field_simp
have hendNext : Endpoints d' e' := by
rcases hend' with ⟨eta, u, hA, hB, heta, hetau, hsticky⟩
refine ⟨eta, u, ?_, ?_, heta, hetau, hsticky⟩
· rw [← hscaleA]
exact hA
· rw [← hscaleB]
exact hB
have hbudgetNext : Budget d' (s + 1) := by
simp only [Budget]
constructor
· intro hp'19
have hp19 : p.val <= -19 := by
by_contra h
by_cases hpneg : p.val < 0
· rcases hsmall (by omega) hpneg with h | h <;> omega
· have hz := hzeroProgress (by omega)
omega
have hb := hbudget.1 hp19
rcases hlarge hp19 with h | h <;> omega
constructor
· intro hp'18 hp'2
by_cases hp19 : p.val <= -19
· have hb := hbudget.1 hp19
rcases hlarge hp19 with h | h <;> omega
· by_cases hp2 : p.val <= -2
· have hb := hbudget.2.1 (by omega) hp2
rcases hsmall (by omega) (by omega) with h | h <;> omega
· by_cases hm1 : p.val = -1
· rcases hsmall (by omega) (by omega) with h | h <;> omega
· have hz := hzeroProgress (by omega)
omega
constructor
· intro hp'm1 hz'7
by_cases hp19 : p.val <= -19
· have hb := hbudget.1 hp19
rcases hlarge hp19 with h | h <;> omega
· by_cases hp2 : p.val <= -2
· have hb := hbudget.2.1 (by omega) hp2
omega
· by_cases hm1 : p.val = -1
· by_cases hz7 : Lead
{ num_digits := i, decimal_point := p,
truncated := t, digits := a } < 7
· have hb := hbudget.2.2.1 hm1 hz7
have hs := hstall hm1 hp'm1
rw [hleadOut] at hz'7
omega
· have hr := hrecover hm1 (by omega)
omega
· have hz := hzeroProgress (by omega)
omega
constructor
· intro hp'm1 hz'7
by_cases hp19 : p.val <= -19
· have hb := hbudget.1 hp19
rcases hlarge hp19 with h | h <;> omega
· by_cases hp2 : p.val <= -2
· have hb := hbudget.2.1 (by omega) hp2
omega
· by_cases hm1 : p.val = -1
· by_cases hz7 : Lead
{ num_digits := i, decimal_point := p,
truncated := t, digits := a } < 7
· have hb := hbudget.2.2.1 hm1 hz7
omega
· have hr := hrecover hm1 (by omega)
omega
· have hz := hzeroProgress (by omega)
omega
constructor
· intro hp'0 hz'2
by_cases hp19 : p.val <= -19
· have hb := hbudget.1 hp19
rcases hlarge hp19 with h | h <;> omega
· by_cases hp2 : p.val <= -2
· have hb := hbudget.2.1 (by omega) hp2
omega
· by_cases hm1 : p.val = -1
· by_cases hz7 : Lead
{ num_digits := i, decimal_point := p,
truncated := t, digits := a } < 7
· have hb := hbudget.2.2.1 hm1 hz7
omega
· have hr := hrecover hm1 (by omega)
rw [hleadOut] at hz'2
omega
· have hz := hzeroProgress (by omega)
rw [hleadOut] at hz'2
by_cases hz2 : z <= 2
· have := hz.2.1 hz2
omega
· have := hz.2.2 (by omega)
omega
constructor
· intro hp'0 hz'3 hz'5
by_cases hp19 : p.val <= -19
· have hb := hbudget.1 hp19
rcases hlarge hp19 with h | h <;> omega
· by_cases hp2 : p.val <= -2
· have hb := hbudget.2.1 (by omega) hp2
omega
· by_cases hm1 : p.val = -1
· by_cases hz7 : Lead
{ num_digits := i, decimal_point := p,
truncated := t, digits := a } < 7
· have hb := hbudget.2.2.1 hm1 hz7
omega
· have hr := hrecover hm1 (by omega)
rw [hleadOut] at hz'5
omega
· have hz := hzeroProgress (by omega)
rw [hleadOut] at hz'3 hz'5
by_cases hz2 : z <= 2
· have hb := hbudget.2.2.2.2.1 (by omega)
(by omega)
omega
· have := hz.2.2 (by omega)
omega
· intro hp'0 hz'5
omega
rw [hbody]
simp only [WP.spec_ok]
constructor
· simp only [Inv, recordOf, exponentOf, resultOf]
exact ⟨by simp, hp'Lo, hp'Hi, s + 1, heNextLo, heNextHi,
hbudgetNext, hshape', hendNext⟩
· simp only [Measure, recordOf]
have hd'eta :
({ num_digits := d'.num_digits,
decimal_point := d'.decimal_point,
truncated := d'.truncated,
digits := d'.digits } :
num.imp.dec2flt.decimal_seq.DecimalSeq) = d' := by
cases d'
rfl
have hleadOutEta : Lead
{ num_digits := d'.num_digits,
decimal_point := d'.decimal_point,
truncated := d'.truncated,
digits := d'.digits } = z' := by
rw [hd'eta]
exact hleadOut
rw [hleadIn, hleadOutEta]
by_cases hp19 : p.val <= -19
· rcases hlarge hp19 with h | h
· have hpneg : p.val < 0 := by omega
rw [h]
by_cases hp'neg : p.val + 18 < 0
· simp only [hpneg, hp'neg, if_true]
have hpNat : ((-p.val).toNat : Int) = -p.val :=
Int.toNat_of_nonneg (by omega)
have hp'Nat : ((-(p.val + 18)).toNat : Int) =
-(p.val + 18) := Int.toNat_of_nonneg (by omega)
split <;> split <;> omega
· have hp'0 : p.val + 18 = 0 := by omega
simp only [hpneg, hp'neg, hp'0, if_true, if_false]
have hpNat : ((-p.val).toNat : Int) = -p.val :=
Int.toNat_of_nonneg (by omega)
split <;> split <;> omega
· have hpneg : p.val < 0 := by omega
rw [h]
by_cases hp'neg : p.val + 19 < 0
· simp only [hpneg, hp'neg, if_true]
have hpNat : ((-p.val).toNat : Int) = -p.val :=
Int.toNat_of_nonneg (by omega)
have hp'Nat : ((-(p.val + 19)).toNat : Int) =
-(p.val + 19) := Int.toNat_of_nonneg (by omega)
split <;> split <;> omega
· have hp'0 : p.val + 19 = 0 := by omega
simp only [hpneg, hp'neg, hp'0, if_true, if_false]
have hpNat : ((-p.val).toNat : Int) = -p.val :=
Int.toNat_of_nonneg (by omega)
by_cases hz'5 : 5 <= z'
· simp only [hz'5, if_true]
norm_num at ⊢
omega
· have hz'5' : ¬ 5 <= z' := hz'5
simp only [hz'5', if_false]
by_cases hz'2 : z' <= 2
· simp only [hz'2, if_true]
norm_num at ⊢
omega
· simp only [hz'2, if_false]
norm_num at ⊢
omega
· by_cases hp2 : p.val <= -2
· rcases hsmall (by omega) (by omega) with h | h
· have hpneg : p.val < 0 := by omega
rw [h]
simp only [hpneg, if_true]
have hpNat : ((-p.val).toNat : Int) = -p.val :=
Int.toNat_of_nonneg (by omega)
split <;> split <;> omega
· have hpneg : p.val < 0 := by omega
rw [h]
simp only [hpneg, if_true, if_false]
have hpNat : ((-p.val).toNat : Int) = -p.val :=
Int.toNat_of_nonneg (by omega)
by_cases hz'5 : 5 <= z'
· simp only [hz'5, if_true]
norm_num at ⊢
omega
· have hz'5' : ¬ 5 <= z' := hz'5
simp only [hz'5', if_false]
by_cases hz'2 : z' <= 2
· simp only [hz'2, if_true]
norm_num at ⊢
omega
· simp only [hz'2, if_false]
norm_num at ⊢
omega
· by_cases hm1 : p.val = -1
· by_cases hp'm1 : d'.decimal_point.val = -1
· have hs := hstall hm1 hp'm1
have hnold : ¬ 7 <= z := by
intro hz7
have hr := hrecover hm1 hz7
omega
have hpNat : (-p.val).toNat = 1 := by omega
simp [hm1, hp'm1, hpNat, hnold, hs]
· have hp'0 : d'.decimal_point.val = 0 := by
rcases hsmall (by omega) (by omega) with h | h <;> omega
have hpNat : (-p.val).toNat = 1 := by omega
simp only [hm1, hp'0, hpNat, if_true, if_false]
by_cases hz'5 : 5 <= z'
· simp only [hz'5, if_true]
norm_num at ⊢
· simp only [hz'5, if_false]
by_cases hz'2 : z' <= 2
· simp only [hz'2, if_true]
norm_num at ⊢
by_cases hz7 : 7 <= z <;> simp [hz7]
· simp only [hz'2, if_false]
norm_num at ⊢
by_cases hz7 : 7 <= z <;> simp [hz7]
· have hp0 : p.val = 0 := by omega
have hz0 := hzeroProgress hp0
have hz5 := hzeroInput hp0
rw [hz0.1]
simp only [hp0, if_true, if_false]
by_cases hz2 : z <= 2
· have hz'3 := hz0.2.1 hz2
have hz5' : ¬ 5 <= z := by omega
simp only [hz5', hz2, if_false, if_true]
by_cases hz'5 : 5 <= z'
· simp only [hz'5, if_true]
norm_num
· have hz'2 : ¬ z' <= 2 := by omega
simp only [hz'5, hz'2, if_false]
norm_num
· have hz'5 := hz0.2.2 (by omega)
have hz5' : ¬ 5 <= z := by omega
simp only [hz5', hz2, hz'5, if_false, if_true]
norm_num
· exact hinit
obtain ⟨out, hcall, hout⟩ := Aeneas.Std.WP.spec_imp_exists hspec
rcases out with ⟨i1, p1, t1, a1, e1, lr1⟩
simp only [Post, Inv, recordOf, exponentOf, resultOf] at hout
rcases hout with
⟨⟨hlr1, hp1Lo, hp1Hi, steps, he1Lo, he1Hi, hbudget1,
hshape1, hend1⟩, hp1, hlead1⟩
have hsteps : steps <= 21 := by
exact hbudget1.2.2.2.2.2.2 hp1 hlead1
let d1 : num.imp.dec2flt.decimal_seq.DecimalSeq :=
{ num_digits := i1, decimal_point := p1, truncated := t1, digits := a1 }
rcases hshape1.2.2 with ⟨z1, zs1, hzshape1, hz1Lo, hz1Hi, hzlen1⟩
have hleadEq1 : Lead d1 = z1 := head_eq d1 z1 zs1
(by simpa [Digits, d1] using hzshape1) (by simpa [Digits, d1] using hzlen1)
have hz1Five : 5 <= z1 := by
rw [← hleadEq1]
simpa [Lead, d1] using hlead1
refine ⟨d1, e1, steps, ?_, hsteps, he1Hi, hp1, ?_, ?_, ?_, ?_⟩
· simpa [d1, hlr1] using hcall
· have : 0 < z1 := by omega
have hlenPos : 0 < (Digits d1).length := by rw [hzshape1]; simp
have hcountPos : 0 < d1.num_digits.val := by rw [← hzlen1]; exact hlenPos
simpa [d1, bne_iff_ne] using hcountPos.ne'
· simpa [Lead, d1] using hlead1
· have hz : Lead d1 < 10 := by rw [hleadEq1]; exact hz1Hi
simpa [Lead] using hz
· dsimp only
refine ⟨?_, ?_, ?_, ?_⟩
· simpa [d1] using hshape1.1
· simpa [d1] using hshape1.2.1
· refine ⟨z1, zs1, ?_, hz1Five, hz1Hi, ?_⟩
· simpa [Digits, d1] using hzshape1
· simpa [Digits, d1] using hzlen1
· simpa [Endpoints, Value, Digits, d1] using hend1
end dec2flt_model
Download Lean source · Download TeX source
Complete Lean module
import Tablet.DecimalSeqLeftShiftCanonical
import Tablet.DecimalLeftShiftLoop1Execution
import Tablet.ParserSlowLoop0
import Tablet.P804_T1_LeftLoopStep
import Tablet.SlowShiftSelectorCertificate
import Tablet.num_imp_dec2flt_slow_parse_long_mantissa
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: ParserSlowLoop1]
theorem ParserSlowLoop1 :
forall (A B : Real) (d0 : num.imp.dec2flt.decimal_seq.DecimalSeq)
(exp0 : Std.I32),
-324 <= d0.decimal_point.val -> d0.decimal_point.val <= 0 ->
0 <= exp0.val ->
let digits0 :=
(d0.digits.val.take d0.num_digits.val).map (fun z => z.val)
let integer0 : Nat := digits0.foldl (fun n digit => 10 * n + digit) 0
let value0 : Real := integer0 * (10 : Real) ^
(d0.decimal_point.val - (d0.num_digits.val : Int))
d0.num_digits.val <= 768 /\
(forall z, z ∈ d0.digits.val.take d0.num_digits.val -> z.val < 10) /\
(exists z zs, digits0 = z :: zs /\ 1 <= z /\ z < 10 /\
digits0.length = d0.num_digits.val) /\
(exists eta0 u0 : Real,
A / (2 : Real) ^ exp0.val = value0 + eta0 /\
B / (2 : Real) ^ exp0.val = value0 + u0 /\
0 <= eta0 /\ eta0 < u0 /\
(d0.truncated = true <-> 0 < eta0)) ->
exists (d1 : num.imp.dec2flt.decimal_seq.DecimalSeq)
(exp1 : Std.I32) (steps : 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) /\
steps <= 21 /\ 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 /\
let digits1 :=
(d1.digits.val.take d1.num_digits.val).map (fun z => z.val)
let integer1 : Nat := digits1.foldl (fun n digit => 10 * n + digit) 0
let value1 : Real := integer1 * (10 : Real) ^
(d1.decimal_point.val - (d1.num_digits.val : Int))
d1.num_digits.val <= 768 /\
(forall z, z ∈ d1.digits.val.take d1.num_digits.val -> z.val < 10) /\
(exists z zs, digits1 = z :: zs /\ 5 <= z /\ z < 10 /\
digits1.length = d1.num_digits.val) /\
exists eta1 u1 : Real,
A / (2 : Real) ^ exp1.val = value1 + eta1 /\
B / (2 : Real) ^ exp1.val = value1 + u1 /\
0 <= eta1 /\ eta1 < u1 /\
(d1.truncated = true <-> 0 < eta1) := by
-- BODY
dsimp only
intro A B d0 exp0 hpLower hpUpper he0Lower hcanonical
classical
let State := Std.Usize × Std.I32 × Bool × Array Std.U8 768#usize ×
Std.I32 × Option num.imp.dec2flt.common.BiasedFp
let recordOf : State -> num.imp.dec2flt.decimal_seq.DecimalSeq := fun x =>
{ num_digits := x.1, decimal_point := x.2.1, truncated := x.2.2.1,
digits := x.2.2.2.1 }
let exponentOf : State -> Std.I32 := fun x => x.2.2.2.2.1
let resultOf : State -> Option num.imp.dec2flt.common.BiasedFp := fun x =>
x.2.2.2.2.2
let Digits := fun q : num.imp.dec2flt.decimal_seq.DecimalSeq =>
(q.digits.val.take q.num_digits.val).map (fun z => z.val)
let Value := fun q : num.imp.dec2flt.decimal_seq.DecimalSeq =>
((Digits q).foldl (fun n digit => 10 * n + digit) 0 : Nat) *
(10 : Real) ^ (q.decimal_point.val - (q.num_digits.val : Int))
let Shape := fun q : num.imp.dec2flt.decimal_seq.DecimalSeq =>
q.num_digits.val <= 768 /\
(forall z, z ∈ q.digits.val.take q.num_digits.val -> z.val < 10) /\
(exists z zs, Digits q = z :: zs /\ 1 <= z /\ z < 10 /\
(Digits q).length = q.num_digits.val)
let Endpoints := fun (q : num.imp.dec2flt.decimal_seq.DecimalSeq)
(e : Std.I32) =>
exists eta u : Real,
A / (2 : Real) ^ e.val = Value q + eta /\
B / (2 : Real) ^ e.val = Value q + u /\
0 <= eta /\ eta < u /\
(q.truncated = true <-> 0 < eta)
let Lead := fun q : num.imp.dec2flt.decimal_seq.DecimalSeq =>
q.digits.val[0].val
let Budget := fun (q : num.imp.dec2flt.decimal_seq.DecimalSeq) (s : Nat) =>
(q.decimal_point.val <= -19 ->
(18 : Int) * s - q.decimal_point.val <= 324) /\
(-18 <= q.decimal_point.val -> q.decimal_point.val <= -2 -> s <= 17) /\
(q.decimal_point.val = -1 -> Lead q < 7 -> s <= 18) /\
(q.decimal_point.val = -1 -> 7 <= Lead q -> s <= 19) /\
(q.decimal_point.val = 0 -> Lead q <= 2 -> s <= 19) /\
(q.decimal_point.val = 0 -> 3 <= Lead q -> Lead q < 5 -> s <= 20) /\
(q.decimal_point.val = 0 -> 5 <= Lead q -> s <= 21)
let Inv := fun x : State =>
resultOf x = none /\
-324 <= (recordOf x).decimal_point.val /\
(recordOf x).decimal_point.val <= 0 /\
exists s : Nat,
exp0.val - (60 : Int) * s <= (exponentOf x).val /\
(exponentOf x).val <= exp0.val /\
Budget (recordOf x) s /\
Shape (recordOf x) /\ Endpoints (recordOf x) (exponentOf x)
let Post := fun x : State => Inv x /\
(recordOf x).decimal_point.val = 0 /\ 5 <= Lead (recordOf x)
let Measure := fun x : State =>
if (recordOf x).decimal_point.val < 0 then
4 * (- (recordOf x).decimal_point.val).toNat +
(if 7 <= Lead (recordOf x) then 0 else 1)
else if (recordOf x).decimal_point.val = 0 then
if 5 <= Lead (recordOf x) then 0
else if Lead (recordOf x) <= 2 then 2 else 1
else 0
let Body := fun x : State =>
num.imp.dec2flt.slow.parse_long_mantissa_loop1.body
F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
{ m := 0#u64, p_biased := 2047#i32 }
x.1 x.2.1 x.2.2.1 x.2.2.2.1 x.2.2.2.2.1 x.2.2.2.2.2
have head_eq (q : num.imp.dec2flt.decimal_seq.DecimalSeq)
(z : Nat) (zs : List Nat)
(hshape : Digits q = z :: zs)
(hlen : (Digits q).length = q.num_digits.val) : Lead q = z := by
simp only [Digits] at hshape hlen
have hnumPos : 0 < q.num_digits.val := by
rw [← hlen, hshape]
simp
have hindexBound : (0 : Nat) < q.digits.val.length := by
rw [q.digits.property]
norm_num
have hget : q.digits.val[0]? = some q.digits.val[0] :=
getElem?_eq_some_iff.mpr ⟨hindexBound, rfl⟩
have hh := congrArg List.head? hshape
rw [List.head?_eq_getElem?] at hh
have ht : (q.digits.val.take q.num_digits.val)[0]? =
some q.digits.val[0] := by
rw [List.getElem?_take, if_pos hnumPos]
exact hget
simp only [List.getElem?_map, ht] at hh
simpa [Lead] using Option.some.inj hh
have hinitShape : Shape d0 := by
exact ⟨hcanonical.1, hcanonical.2.1, hcanonical.2.2.1⟩
have hinitEndpoints : Endpoints d0 exp0 := by
simpa [Endpoints, Value, Digits] using hcanonical.2.2.2
have hinitBudget : Budget d0 0 := by
simp only [Budget]
constructor
· intro _
omega
constructor
· omega
constructor
· omega
constructor
· omega
constructor
· omega
constructor <;> omega
have hinit : Inv
(d0.num_digits, d0.decimal_point, d0.truncated, d0.digits,
exp0, none) := by
simp only [Inv, recordOf, exponentOf, resultOf]
exact ⟨by simp, hpLower, hpUpper, 0, by norm_num, by omega,
hinitBudget, hinitShape, hinitEndpoints⟩
have hspec :
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 Body
(d0.num_digits, d0.decimal_point, d0.truncated, d0.digits, exp0, none)
· intro x hx
rcases x with ⟨i, p, t, a, e, lr⟩
simp only [Inv, recordOf, exponentOf, resultOf] at hx
rcases hx with ⟨hlr, hpLo, hpHi, s, heLo, heHi, hbudget,
hshape, hend⟩
simp only [Budget] at hbudget
simp only [Shape, Digits] at hshape
simp only [Endpoints, Value, Digits] at hend
simp only [Body, Prod.fst, Prod.snd]
rw [hlr]
rcases hshape.2.2 with ⟨z0, zs0, hzshape, hzLo, hzHi, hzlen⟩
have hlead : Lead
{ num_digits := i, decimal_point := p, truncated := t, digits := a } =
z0 := head_eq _ z0 zs0 hzshape hzlen
have hs21 : s <= 21 := by
by_cases hp19 : p.val <= -19
· have hb := hbudget.1 hp19
omega
· by_cases hp2 : p.val <= -2
· exact (hbudget.2.1 (by omega) hp2).trans (by omega)
· by_cases hm1 : p.val = -1
· by_cases hz7 : Lead
{ num_digits := i, decimal_point := p,
truncated := t, digits := a } < 7
· exact (hbudget.2.2.1 hm1 hz7).trans (by omega)
· exact (hbudget.2.2.2.1 hm1 (by omega)).trans (by omega)
· have hp0 : p.val = 0 := by omega
by_cases hz2 : Lead
{ num_digits := i, decimal_point := p,
truncated := t, digits := a } <= 2
· exact (hbudget.2.2.2.2.1 hp0 hz2).trans (by omega)
· by_cases hz5 : Lead
{ num_digits := i, decimal_point := p,
truncated := t, digits := a } < 5
· exact (hbudget.2.2.2.2.2.1 hp0 (by omega) hz5).trans
(by omega)
· exact (hbudget.2.2.2.2.2.2 hp0 (by omega)).trans
(by omega)
have heStepLo : -1260 <= e.val := by
have he0 : 0 <= exp0.val := he0Lower
nlinarith
have hstep := P804_T1_LeftLoopStep
(A / (2 : Real) ^ e.val) (B / (2 : Real) ^ e.val)
{ num_digits := i, decimal_point := p, truncated := t, digits := a }
e hpLo hpHi heStepLo hshape hend
rcases hstep with hdone | hcont
· rcases hdone with ⟨hbody, hp0, hfive⟩
rw [hbody]
simp only [WP.spec_ok]
simp only [Post, Inv, recordOf, exponentOf, resultOf, Lead]
exact ⟨⟨by simp, hpLo, hpHi, s, heLo, heHi, hbudget,
⟨hshape.1, hshape.2.1, z0, zs0, hzshape, hzLo, hzHi, hzlen⟩,
hend⟩, hp0, hfive⟩
· rcases hcont with ⟨d', shift, growth, e', z, z', zs, zs',
hbody, hleft, hgrowth, hk, he', hzshapeIn, hzshapeOut,
hzInLo, hzInHi, hzOutLo, hzOutHi, hlarge, hsmall, hstall,
hrecover, hzeroInput, hzeroProgress, hshapeEnd⟩
change (p.val <= -19 ->
d'.decimal_point.val = p.val + 18 \/
d'.decimal_point.val = p.val + 19) at hlarge
change (-18 <= p.val -> p.val < 0 ->
d'.decimal_point.val = -1 \/ d'.decimal_point.val = 0) at hsmall
change (p.val = -1 -> d'.decimal_point.val = -1 -> 7 <= z') at hstall
change (p.val = -1 -> 7 <= z ->
d'.decimal_point.val = 0 /\ 5 <= z') at hrecover
change (p.val = 0 -> z < 5) at hzeroInput
change (p.val = 0 -> d'.decimal_point.val = 0 /\
(z <= 2 -> 3 <= z') /\ (3 <= z -> 5 <= z')) at hzeroProgress
rcases hshapeEnd with ⟨hcap', hdigit', hlen', hend'⟩
have hleadIn : Lead
{ num_digits := i, decimal_point := p, truncated := t, digits := a } =
z := head_eq _ z zs hzshapeIn (by simpa [Digits] using hzlen)
have hleadOut : Lead d' = z' :=
head_eq d' z' zs' hzshapeOut hlen'
have hshape' : Shape d' := by
exact ⟨hcap', hdigit', z', zs', hzshapeOut, hzOutLo, hzOutHi, hlen'⟩
have hs20 : s <= 20 := by
by_cases hp19 : p.val <= -19
· have hb := hbudget.1 hp19
omega
· by_cases hp2 : p.val <= -2
· exact (hbudget.2.1 (by omega) hp2).trans (by omega)
· by_cases hm1 : p.val = -1
· by_cases hz7 : Lead
{ num_digits := i, decimal_point := p,
truncated := t, digits := a } < 7
· exact (hbudget.2.2.1 hm1 hz7).trans (by omega)
· exact (hbudget.2.2.2.1 hm1 (by omega)).trans (by omega)
· have hp0 : p.val = 0 := by omega
have hz5 : z < 5 := hzeroInput hp0
by_cases hz2 : Lead
{ num_digits := i, decimal_point := p,
truncated := t, digits := a } <= 2
· exact (hbudget.2.2.2.2.1 hp0 hz2).trans (by omega)
· exact (hbudget.2.2.2.2.2.1 hp0 (by omega)
(by rw [hleadIn]; exact hz5)).trans (by omega)
have hp'Lo : -324 <= d'.decimal_point.val := by
by_cases hp19 : p.val <= -19
· rcases hlarge hp19 with h | h <;> omega
· by_cases hpneg : p.val < 0
· rcases hsmall (by omega) hpneg with h | h <;> omega
· have hz := hzeroProgress (by omega)
omega
have hp'Hi : d'.decimal_point.val <= 0 := by
by_cases hp19 : p.val <= -19
· rcases hlarge hp19 with h | h <;> omega
· by_cases hpneg : p.val < 0
· rcases hsmall (by omega) hpneg with h | h <;> omega
· have hz := hzeroProgress (by omega)
omega
have heNextLo : exp0.val - (60 : Int) * (s + 1) <= e'.val := by
rw [he']
norm_num only [Nat.cast_add, Nat.cast_one]
nlinarith
have heNextHi : e'.val <= exp0.val := by
rw [he']
have hknonneg : (0 : Int) <= shift.val := by omega
omega
have hscaleA :
(2 : Real) ^ shift.val * (A / (2 : Real) ^ e.val) =
A / (2 : Real) ^ e'.val := by
rw [he', zpow_sub₀ (by norm_num : (2 : Real) ≠ 0)]
norm_num only [zpow_natCast]
field_simp
have hscaleB :
(2 : Real) ^ shift.val * (B / (2 : Real) ^ e.val) =
B / (2 : Real) ^ e'.val := by
rw [he', zpow_sub₀ (by norm_num : (2 : Real) ≠ 0)]
norm_num only [zpow_natCast]
field_simp
have hendNext : Endpoints d' e' := by
rcases hend' with ⟨eta, u, hA, hB, heta, hetau, hsticky⟩
refine ⟨eta, u, ?_, ?_, heta, hetau, hsticky⟩
· rw [← hscaleA]
exact hA
· rw [← hscaleB]
exact hB
have hbudgetNext : Budget d' (s + 1) := by
simp only [Budget]
constructor
· intro hp'19
have hp19 : p.val <= -19 := by
by_contra h
by_cases hpneg : p.val < 0
· rcases hsmall (by omega) hpneg with h | h <;> omega
· have hz := hzeroProgress (by omega)
omega
have hb := hbudget.1 hp19
rcases hlarge hp19 with h | h <;> omega
constructor
· intro hp'18 hp'2
by_cases hp19 : p.val <= -19
· have hb := hbudget.1 hp19
rcases hlarge hp19 with h | h <;> omega
· by_cases hp2 : p.val <= -2
· have hb := hbudget.2.1 (by omega) hp2
rcases hsmall (by omega) (by omega) with h | h <;> omega
· by_cases hm1 : p.val = -1
· rcases hsmall (by omega) (by omega) with h | h <;> omega
· have hz := hzeroProgress (by omega)
omega
constructor
· intro hp'm1 hz'7
by_cases hp19 : p.val <= -19
· have hb := hbudget.1 hp19
rcases hlarge hp19 with h | h <;> omega
· by_cases hp2 : p.val <= -2
· have hb := hbudget.2.1 (by omega) hp2
omega
· by_cases hm1 : p.val = -1
· by_cases hz7 : Lead
{ num_digits := i, decimal_point := p,
truncated := t, digits := a } < 7
· have hb := hbudget.2.2.1 hm1 hz7
have hs := hstall hm1 hp'm1
rw [hleadOut] at hz'7
omega
· have hr := hrecover hm1 (by omega)
omega
· have hz := hzeroProgress (by omega)
omega
constructor
· intro hp'm1 hz'7
by_cases hp19 : p.val <= -19
· have hb := hbudget.1 hp19
rcases hlarge hp19 with h | h <;> omega
· by_cases hp2 : p.val <= -2
· have hb := hbudget.2.1 (by omega) hp2
omega
· by_cases hm1 : p.val = -1
· by_cases hz7 : Lead
{ num_digits := i, decimal_point := p,
truncated := t, digits := a } < 7
· have hb := hbudget.2.2.1 hm1 hz7
omega
· have hr := hrecover hm1 (by omega)
omega
· have hz := hzeroProgress (by omega)
omega
constructor
· intro hp'0 hz'2
by_cases hp19 : p.val <= -19
· have hb := hbudget.1 hp19
rcases hlarge hp19 with h | h <;> omega
· by_cases hp2 : p.val <= -2
· have hb := hbudget.2.1 (by omega) hp2
omega
· by_cases hm1 : p.val = -1
· by_cases hz7 : Lead
{ num_digits := i, decimal_point := p,
truncated := t, digits := a } < 7
· have hb := hbudget.2.2.1 hm1 hz7
omega
· have hr := hrecover hm1 (by omega)
rw [hleadOut] at hz'2
omega
· have hz := hzeroProgress (by omega)
rw [hleadOut] at hz'2
by_cases hz2 : z <= 2
· have := hz.2.1 hz2
omega
· have := hz.2.2 (by omega)
omega
constructor
· intro hp'0 hz'3 hz'5
by_cases hp19 : p.val <= -19
· have hb := hbudget.1 hp19
rcases hlarge hp19 with h | h <;> omega
· by_cases hp2 : p.val <= -2
· have hb := hbudget.2.1 (by omega) hp2
omega
· by_cases hm1 : p.val = -1
· by_cases hz7 : Lead
{ num_digits := i, decimal_point := p,
truncated := t, digits := a } < 7
· have hb := hbudget.2.2.1 hm1 hz7
omega
· have hr := hrecover hm1 (by omega)
rw [hleadOut] at hz'5
omega
· have hz := hzeroProgress (by omega)
rw [hleadOut] at hz'3 hz'5
by_cases hz2 : z <= 2
· have hb := hbudget.2.2.2.2.1 (by omega)
(by omega)
omega
· have := hz.2.2 (by omega)
omega
· intro hp'0 hz'5
omega
rw [hbody]
simp only [WP.spec_ok]
constructor
· simp only [Inv, recordOf, exponentOf, resultOf]
exact ⟨by simp, hp'Lo, hp'Hi, s + 1, heNextLo, heNextHi,
hbudgetNext, hshape', hendNext⟩
· simp only [Measure, recordOf]
have hd'eta :
({ num_digits := d'.num_digits,
decimal_point := d'.decimal_point,
truncated := d'.truncated,
digits := d'.digits } :
num.imp.dec2flt.decimal_seq.DecimalSeq) = d' := by
cases d'
rfl
have hleadOutEta : Lead
{ num_digits := d'.num_digits,
decimal_point := d'.decimal_point,
truncated := d'.truncated,
digits := d'.digits } = z' := by
rw [hd'eta]
exact hleadOut
rw [hleadIn, hleadOutEta]
by_cases hp19 : p.val <= -19
· rcases hlarge hp19 with h | h
· have hpneg : p.val < 0 := by omega
rw [h]
by_cases hp'neg : p.val + 18 < 0
· simp only [hpneg, hp'neg, if_true]
have hpNat : ((-p.val).toNat : Int) = -p.val :=
Int.toNat_of_nonneg (by omega)
have hp'Nat : ((-(p.val + 18)).toNat : Int) =
-(p.val + 18) := Int.toNat_of_nonneg (by omega)
split <;> split <;> omega
· have hp'0 : p.val + 18 = 0 := by omega
simp only [hpneg, hp'neg, hp'0, if_true, if_false]
have hpNat : ((-p.val).toNat : Int) = -p.val :=
Int.toNat_of_nonneg (by omega)
split <;> split <;> omega
· have hpneg : p.val < 0 := by omega
rw [h]
by_cases hp'neg : p.val + 19 < 0
· simp only [hpneg, hp'neg, if_true]
have hpNat : ((-p.val).toNat : Int) = -p.val :=
Int.toNat_of_nonneg (by omega)
have hp'Nat : ((-(p.val + 19)).toNat : Int) =
-(p.val + 19) := Int.toNat_of_nonneg (by omega)
split <;> split <;> omega
· have hp'0 : p.val + 19 = 0 := by omega
simp only [hpneg, hp'neg, hp'0, if_true, if_false]
have hpNat : ((-p.val).toNat : Int) = -p.val :=
Int.toNat_of_nonneg (by omega)
by_cases hz'5 : 5 <= z'
· simp only [hz'5, if_true]
norm_num at ⊢
omega
· have hz'5' : ¬ 5 <= z' := hz'5
simp only [hz'5', if_false]
by_cases hz'2 : z' <= 2
· simp only [hz'2, if_true]
norm_num at ⊢
omega
· simp only [hz'2, if_false]
norm_num at ⊢
omega
· by_cases hp2 : p.val <= -2
· rcases hsmall (by omega) (by omega) with h | h
· have hpneg : p.val < 0 := by omega
rw [h]
simp only [hpneg, if_true]
have hpNat : ((-p.val).toNat : Int) = -p.val :=
Int.toNat_of_nonneg (by omega)
split <;> split <;> omega
· have hpneg : p.val < 0 := by omega
rw [h]
simp only [hpneg, if_true, if_false]
have hpNat : ((-p.val).toNat : Int) = -p.val :=
Int.toNat_of_nonneg (by omega)
by_cases hz'5 : 5 <= z'
· simp only [hz'5, if_true]
norm_num at ⊢
omega
· have hz'5' : ¬ 5 <= z' := hz'5
simp only [hz'5', if_false]
by_cases hz'2 : z' <= 2
· simp only [hz'2, if_true]
norm_num at ⊢
omega
· simp only [hz'2, if_false]
norm_num at ⊢
omega
· by_cases hm1 : p.val = -1
· by_cases hp'm1 : d'.decimal_point.val = -1
· have hs := hstall hm1 hp'm1
have hnold : ¬ 7 <= z := by
intro hz7
have hr := hrecover hm1 hz7
omega
have hpNat : (-p.val).toNat = 1 := by omega
simp [hm1, hp'm1, hpNat, hnold, hs]
· have hp'0 : d'.decimal_point.val = 0 := by
rcases hsmall (by omega) (by omega) with h | h <;> omega
have hpNat : (-p.val).toNat = 1 := by omega
simp only [hm1, hp'0, hpNat, if_true, if_false]
by_cases hz'5 : 5 <= z'
· simp only [hz'5, if_true]
norm_num at ⊢
· simp only [hz'5, if_false]
by_cases hz'2 : z' <= 2
· simp only [hz'2, if_true]
norm_num at ⊢
by_cases hz7 : 7 <= z <;> simp [hz7]
· simp only [hz'2, if_false]
norm_num at ⊢
by_cases hz7 : 7 <= z <;> simp [hz7]
· have hp0 : p.val = 0 := by omega
have hz0 := hzeroProgress hp0
have hz5 := hzeroInput hp0
rw [hz0.1]
simp only [hp0, if_true, if_false]
by_cases hz2 : z <= 2
· have hz'3 := hz0.2.1 hz2
have hz5' : ¬ 5 <= z := by omega
simp only [hz5', hz2, if_false, if_true]
by_cases hz'5 : 5 <= z'
· simp only [hz'5, if_true]
norm_num
· have hz'2 : ¬ z' <= 2 := by omega
simp only [hz'5, hz'2, if_false]
norm_num
· have hz'5 := hz0.2.2 (by omega)
have hz5' : ¬ 5 <= z := by omega
simp only [hz5', hz2, hz'5, if_false, if_true]
norm_num
· exact hinit
obtain ⟨out, hcall, hout⟩ := Aeneas.Std.WP.spec_imp_exists hspec
rcases out with ⟨i1, p1, t1, a1, e1, lr1⟩
simp only [Post, Inv, recordOf, exponentOf, resultOf] at hout
rcases hout with
⟨⟨hlr1, hp1Lo, hp1Hi, steps, he1Lo, he1Hi, hbudget1,
hshape1, hend1⟩, hp1, hlead1⟩
have hsteps : steps <= 21 := by
exact hbudget1.2.2.2.2.2.2 hp1 hlead1
let d1 : num.imp.dec2flt.decimal_seq.DecimalSeq :=
{ num_digits := i1, decimal_point := p1, truncated := t1, digits := a1 }
rcases hshape1.2.2 with ⟨z1, zs1, hzshape1, hz1Lo, hz1Hi, hzlen1⟩
have hleadEq1 : Lead d1 = z1 := head_eq d1 z1 zs1
(by simpa [Digits, d1] using hzshape1) (by simpa [Digits, d1] using hzlen1)
have hz1Five : 5 <= z1 := by
rw [← hleadEq1]
simpa [Lead, d1] using hlead1
refine ⟨d1, e1, steps, ?_, hsteps, he1Hi, hp1, ?_, ?_, ?_, ?_⟩
· simpa [d1, hlr1] using hcall
· have : 0 < z1 := by omega
have hlenPos : 0 < (Digits d1).length := by rw [hzshape1]; simp
have hcountPos : 0 < d1.num_digits.val := by rw [← hzlen1]; exact hlenPos
simpa [d1, bne_iff_ne] using hcountPos.ne'
· simpa [Lead, d1] using hlead1
· have hz : Lead d1 < 10 := by rw [hleadEq1]; exact hz1Hi
simpa [Lead] using hz
· dsimp only
refine ⟨?_, ?_, ?_, ?_⟩
· simpa [d1] using hshape1.1
· simpa [d1] using hshape1.2.1
· refine ⟨z1, zs1, ?_, hz1Five, hz1Hi, ?_⟩
· simpa [Digits, d1] using hzshape1
· simpa [Digits, d1] using hzlen1
· simpa [Endpoints, Value, Digits, d1] using hend1
end dec2flt_model
Proof structure
Follow the declared dependencies to read the supporting statements and proofs.
Uses
Inspect related source (201)
- parse_long_mantissa · dec2flt/slow.rs:27 Program Rust
- parse_long_mantissa_loop0 · dec2flt/slow.rs:51 Program Rust
- body · dec2flt/slow.rs:51 Program Rust
More program dependencies (159)
- parse_long_mantissa_loop1 · dec2flt/slow.rs:69 Program Rust
- body · dec2flt/slow.rs:69 Program Rust
- parse_long_mantissa_loop2 · dec2flt/slow.rs:94 Program Rust
- body · dec2flt/slow.rs:94 Program Rust
- BiasedFp · dec2flt/common.rs:52 Program Rust
- zero_pow2 · dec2flt/common.rs:62 Program Rust
- DecimalSeq · dec2flt/decimal_seq.rs:21 Program Rust
- DECIMAL_POINT_RANGE · dec2flt/decimal_seq.rs:67 Program Rust
- left_shift · dec2flt/decimal_seq.rs:129 Program Rust
- left_shift_loop0 · dec2flt/decimal_seq.rs:138 Program Rust
- body · dec2flt/decimal_seq.rs:138 Program Rust
- left_shift_loop1 · dec2flt/decimal_seq.rs:152 Program Rust
- body · dec2flt/decimal_seq.rs:152 Program Rust
- right_shift · dec2flt/decimal_seq.rs:175 Program Rust
- right_shift_loop0 · dec2flt/decimal_seq.rs:180 Program Rust
- body · dec2flt/decimal_seq.rs:180 Program Rust
- right_shift_loop0_loop0 · dec2flt/decimal_seq.rs:190 Program Rust
- body · dec2flt/decimal_seq.rs:190 Program Rust
- right_shift_loop1 · dec2flt/decimal_seq.rs:209 Program Rust
- body · dec2flt/decimal_seq.rs:209 Program Rust
- right_shift_loop2 · dec2flt/decimal_seq.rs:216 Program Rust
- body · dec2flt/decimal_seq.rs:216 Program Rust
- round · dec2flt/decimal_seq.rs:96 Program Rust
- round_loop · dec2flt/decimal_seq.rs:106 Program Rust
- body · dec2flt/decimal_seq.rs:106 Program Rust
- parse_decimal_seq · dec2flt/decimal_seq.rs:283 Program Rust
- parse_decimal_seq_loop0 · dec2flt/decimal_seq.rs:290 Program Rust
- body · dec2flt/decimal_seq.rs:290 Program Rust
- parse_decimal_seq_loop1 · dec2flt/decimal_seq.rs:361 Program Rust
- body · dec2flt/decimal_seq.rs:361 Program Rust
- parse_decimal_seq_loop2 · dec2flt/decimal_seq.rs:303 Program Rust
- body · dec2flt/decimal_seq.rs:303 Program Rust
- parse_decimal_seq_loop3 · dec2flt/decimal_seq.rs:307 Program Rust
- body · dec2flt/decimal_seq.rs:307 Program Rust
- parse_decimal_seq_loop4 · dec2flt/decimal_seq.rs:361 Program Rust
- body · dec2flt/decimal_seq.rs:361 Program Rust
- parse_decimal_seq_loop5 · dec2flt/decimal_seq.rs:307 Program Rust
- body · dec2flt/decimal_seq.rs:307 Program Rust
- parse_decimal_seq_loop6 · dec2flt/decimal_seq.rs:361 Program Rust
- body · dec2flt/decimal_seq.rs:361 Program Rust
- parse_decimal_seq_loop7 · dec2flt/decimal_seq.rs:361 Program Rust
- body · dec2flt/decimal_seq.rs:361 Program Rust
- MAX_SHIFT · dec2flt/slow.rs:28 Program Rust
- NUM_POWERS · dec2flt/slow.rs:29 Program Rust
- POWERS · dec2flt/slow.rs:30 Program Rust
- call · dec2flt/slow.rs:33 Program Rust
- Float · traits.rs:74 Program Rust
- from_u64 · dec2flt/mod.rs:263 Program Rust
- Dec2flt_modelNumImpTraitsFloatU64 · traits.rs:309 Program Rust
- read_u64 · dec2flt/common.rs:18 Program Rust
- write_u64 · dec2flt/common.rs:25 Program Rust
- FloatErrorKind · num/mod.rs:18 Program Rust
- ParseFloatError · num/mod.rs:13 Program Rust
- Dec2FltAssemblyTrace · dec2flt/mod.rs:329 Program Rust
- Dec2FltTrace · dec2flt/mod.rs:295 Program Rust
- Lemire · dec2flt/mod.rs:115 Program Rust
- ByteSlice · dec2flt/common.rs:4 Program Rust
- is_8digits · dec2flt/common.rs:40 Program Rust
- Decimal · dec2flt/decimal.rs:32 Program Rust
- default · dec2flt/decimal_seq.rs:33 Program Rust
- MAX_DIGITS · dec2flt/decimal_seq.rs:63 Program Rust
- MAX_DIGITS_WITHOUT_OVERFLOW · dec2flt/decimal_seq.rs:66 Program Rust
- trim · dec2flt/decimal_seq.rs:82 Program Rust
- trim_loop · dec2flt/decimal_seq.rs:91 Program Rust
- body · dec2flt/decimal_seq.rs:91 Program Rust
- count_trailing_zeros · dec2flt/decimal_seq.rs:235 Program Rust
- count_trailing_zeros_loop · dec2flt/decimal_seq.rs:239 Program Rust
- body · dec2flt/decimal_seq.rs:239 Program Rust
- number_of_digits_decimal_left_shift · dec2flt/decimal_seq.rs:368 Program Rust
- TABLE · dec2flt/decimal_seq.rs:370 Program Rust
- TABLE_POW5 · dec2flt/decimal_seq.rs:379 Program Rust
- number_of_digits_decimal_left_shift_loop · dec2flt/decimal_seq.rs:434 Program Rust
- body · dec2flt/decimal_seq.rs:434 Program Rust
- parse_decimal_exponent · dec2flt/decimal_seq.rs:269 Program Rust
- parse_decimal_exponent_loop · dec2flt/decimal_seq.rs:272 Program Rust
- body · dec2flt/decimal_seq.rs:272 Program Rust
- parse_digits_into_seq · dec2flt/decimal_seq.rs:256 Program Rust
- parse_digits_into_seq_loop · dec2flt/decimal_seq.rs:258 Program Rust
- body · dec2flt/decimal_seq.rs:258 Program Rust
- closure · dec2flt/slow.rs:33 Program Rust
- CastInto · traits.rs:18 Program Rust
- FloatExt · traits.rs:170 Program Rust
- Int · traits.rs:27 Program Rust
- BITS · traits.rs:319 Program Rust
- EXP_MASK · traits.rs:321 Program Rust
- INFINITY · traits.rs:312 Program Rust
- LARGEST_POWER_OF_TEN · traits.rs:327 Program Rust
- MAX_EXPONENT_ROUND_TO_EVEN · traits.rs:325 Program Rust
- MIN_EXPONENT_ROUND_TO_EVEN · traits.rs:324 Program Rust
- NAN · traits.rs:314 Program Rust
- NEG_INFINITY · traits.rs:313 Program Rust
- NEG_NAN · traits.rs:317 Program Rust
- SIG_MASK · traits.rs:322 Program Rust
- SIG_TOTAL_BITS · traits.rs:320 Program Rust
- SMALLEST_POWER_OF_TEN · traits.rs:328 Program Rust
- classify · traits.rs:334 Program Rust
- to_bits · traits.rs:330 Program Rust
- Dec2flt_modelNumImpTraitsInt · traits.rs:51 Program Rust
- try_add_digit · dec2flt/decimal_seq.rs:73 Program Rust
- default · traits.rs:116 Program Rust
- default · traits.rs:104 Program Rust
- default · traits.rs:119 Program Rust
- default · traits.rs:110 Program Rust
- default · traits.rs:113 Program Rust
- default · traits.rs:101 Program Rust
- Dec2flt_modelNumImpTraitsCastIntoI16 · traits.rs:45 Program Rust
- ONE · traits.rs:53 Program Rust
- ZERO · traits.rs:52 Program Rust
- biased_fp_to_float · dec2flt/mod.rs:282 Program Rust
- dec2flt_with_trace · dec2flt/mod.rs:355 Program Rust
- compute_float · dec2flt/lemire.rs:26 Program Rust
- MIN_19DIGIT_INT · dec2flt/parse.rs:8 Program Rust
- adjust_many_digit_count · dec2flt/parse.rs:86 Program Rust
- adjust_many_digit_count_loop · dec2flt/parse.rs:89 Program Rust
- body · dec2flt/parse.rs:89 Program Rust
- parse_many_digits · dec2flt/parse.rs:104 Program Rust
- parse_number · dec2flt/parse.rs:231 Program Rust
- parse_partial_number · dec2flt/parse.rs:161 Program Rust
- parse_scientific · dec2flt/parse.rs:121 Program Rust
- parse_scientific_loop · dec2flt/parse.rs:142 Program Rust
- body · dec2flt/parse.rs:142 Program Rust
- try_parse_19digits · dec2flt/parse.rs:61 Program Rust
- try_parse_19digits_loop · dec2flt/parse.rs:64 Program Rust
- body · dec2flt/parse.rs:64 Program Rust
- try_parse_digits · dec2flt/parse.rs:30 Program Rust
- try_parse_digits_loop0 · dec2flt/parse.rs:33 Program Rust
- body · dec2flt/parse.rs:33 Program Rust
- try_parse_digits_loop1 · dec2flt/parse.rs:50 Program Rust
- body · dec2flt/parse.rs:50 Program Rust
- Dec2flt_modelNumImpDec2fltLemireU64 · dec2flt/mod.rs:217 Program Rust
- Dec2flt_modelNumImpTraitsFloatExtU64 · traits.rs:339 Program Rust
- from_u64_bits · traits.rs:341 Program Rust
- offset_from · dec2flt/common.rs:30 Program Rust
- cast · traits.rs:46 Program Rust
- eq · dec2flt/common.rs:51 Program Rust
- dec2flt · dec2flt/mod.rs:508 Program Rust
- try_fast_path · dec2flt/decimal.rs:59 Program Rust
- compute_product_approx · dec2flt/lemire.rs:134 Program Rust
- power · dec2flt/lemire.rs:121 Program Rust
- parse_8digits · dec2flt/parse.rs:18 Program Rust
- MASK · dec2flt/parse.rs:19 Program Rust
- MUL1 · dec2flt/parse.rs:20 Program Rust
- MUL2 · dec2flt/parse.rs:21 Program Rust
- parse_inf_nan · dec2flt/parse.rs:241 Program Rust
- pfe_empty · dec2flt/mod.rs:270 Program Rust
- pfe_invalid · dec2flt/mod.rs:277 Program Rust
- MAX_EXPONENT_DISGUISED_FAST_PATH · dec2flt/mod.rs:220 Program Rust
- MAX_EXPONENT_FAST_PATH · dec2flt/mod.rs:219 Program Rust
- pow10_fast_path · dec2flt/mod.rs:222 Program Rust
- integer_decode · traits.rs:348 Program Rust
- default · dec2flt/mod.rs:128 Program Rust
- default · dec2flt/mod.rs:121 Program Rust
- can_use_fast_path · dec2flt/decimal.rs:42 Program Rust
- INT_POW10 · dec2flt/decimal.rs:8 Program Rust
- set_precision · dec2flt/fpu.rs:99 Program Rust
- full_multiplication · dec2flt/lemire.rs:126 Program Rust
- LARGEST_POWER_OF_FIVE · dec2flt/table.rs:10 Program Rust
- POWER_OF_FIVE_128 · dec2flt/table.rs:19 Program Rust
- SMALLEST_POWER_OF_FIVE · dec2flt/table.rs:9 Program Rust
Standard-library dependencies (39)
- clone · core/src/clone.rs:698 Rust library
- div · core/src/ops/arith.rs:515 Rust library
- mul · core/src/ops/arith.rs:350 Rust library
- neg · core/src/ops/arith.rs:719 Rust library
- bitand · core/src/ops/bit.rs:178 Rust library
- bitor · core/src/ops/bit.rs:282 Rust library
- shl · core/src/ops/bit.rs:489 Rust library
- shr · core/src/ops/bit.rs:612 Rust library
- EXPONENT_MASK · core/src/num/f64.rs:615 Rust library
- INFINITY · core/src/num/f64.rs:512 Rust library
- MANTISSA_DIGITS · core/src/num/f64.rs:412 Rust library
- MANTISSA_MASK · core/src/num/f64.rs:637 Rust library
- NAN · core/src/num/f64.rs:509 Rust library
- NEG_INFINITY · core/src/num/f64.rs:515 Rust library
- classify · core/src/num/f64.rs:782 Rust library
- from_bits · core/src/num/f64.rs:1269 Rust library
- to_bits · core/src/num/f64.rs:1223 Rust library
- is_ascii_digit · core/src/num/mod.rs:958 Rust library
- from_residual · core/src/option.rs:2793 Rust library
- branch · core/src/option.rs:2779 Rust library
- first · core/src/slice/mod.rs:155 Rust library
- split_first · core/src/slice/mod.rs:198 Rust library
- as_bytes · core/src/str/mod.rs:498 Rust library
- FpCategory · core/src/num/mod.rs:1522 Rust library
- Div · core/src/ops/arith.rs:460 Rust library
- Mul · core/src/ops/arith.rs:322 Rust library
- Neg · core/src/ops/arith.rs:690 Rust library
- BitOr · core/src/ops/bit.rs:254 Rust library
- Shl · core/src/ops/bit.rs:461 Rust library
- Shr · core/src/ops/bit.rs:584 Rust library
- CoreMarkerCopy · core/src/marker.rs:57 Rust library
- CoreOpsArithDivF64F64 · core/src/ops/arith.rs:511 Rust library
- CoreOpsArithMulF64F64 · core/src/ops/arith.rs:344 Rust library
- CoreOpsArithNegF64 · core/src/ops/arith.rs:713 Rust library
- CoreCloneClone · core/src/clone.rs:696 Rust library
- CoreOpsBitBitAndU64U64 · core/src/ops/bit.rs:174 Rust library
- CoreOpsBitBitOrU64U64 · core/src/ops/bit.rs:278 Rust library
- CoreOpsBitShlU32U64 · core/src/ops/bit.rs:483 Rust library
- CoreOpsBitShrU32U64 · core/src/ops/bit.rs:606 Rust library
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
- Classical.choice
- Dec2Flt.configured_x86_64_numBits
- Quot.sound
- propext
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
- Binary64Model
- Binary64ModelDefault
- DecimalDigitLexScale
- DecimalLeftShiftDigitGrowth
- DecimalLeftShiftFirstLoopSemantics
- DecimalLeftShiftLoop1Execution
All 127 entries
- Binary64Model
- Binary64ModelDefault
- DecimalDigitLexScale
- DecimalLeftShiftDigitGrowth
- DecimalLeftShiftFirstLoopSemantics
- DecimalLeftShiftLoop1Execution
- DecimalLeftShiftLoopLex
- DecimalLeftShiftSecondLoopSemantics
- DecimalLeftShiftTableCertificate
- DecimalRightShiftFinalLoopSemantics
- DecimalRightShiftMainLoopSemantics
- DecimalRightShiftPrefixLoopSemantics
- DecimalRightShiftU64DyadicBridge
- DecimalSeqDyadicShiftSemantics
- DecimalSeqLeftShiftCanonical
- DecimalSeqLeftShiftRecordSemantics
- DecimalSeqRightShiftRecordSemantics
- DecimalSeqTrimSemantics
- F64
- F64 Insts CoreCloneClone
- F64 Insts CoreMarkerCopy
- F64 Insts CoreOpsArithDivF64F64
- F64 Insts CoreOpsArithMulF64F64
- F64 Insts CoreOpsArithNegF64
- F64 Insts Dec2flt modelNumImpTraitsFloatU64
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 BITS
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 EXP MASK
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 INFINITY
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 LARGEST POWER OF TEN
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 MAX EXPONENT ROUND TO EVEN
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 MIN EXPONENT ROUND TO EVEN
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 NAN
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 NEG INFINITY
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 NEG NAN
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 SIG MASK
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 SIG TOTAL BITS
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 SMALLEST POWER OF TEN
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 classify
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 to bits
- ModelF64Classify
- ModelF64Clone
- ModelF64Div
- ModelF64ExponentMask
- ModelF64FromBits
- ModelF64FromU64
- ModelF64Infinity
- ModelF64MantissaDigits
- ModelF64MantissaMask
- ModelF64Mul
- ModelF64Nan
- ModelF64Neg
- ModelF64NegInfinity
- ModelF64ToBits
- ModelOptionBranch
- ModelOptionFromResidual
- ModelSliceFirst
- ModelSliceSplitFirst
- ModelStrAsBytes
- ModelU64BitAnd
- ModelU64BitOr
- ModelU64Shl
- ModelU64Shr
- ModelU8IsAsciiDigit
- DecimalLeadingInterval
- LeftLeadingProgress
- LeftLoopStep
- LeftShiftPointGrowth
- PointMinusOneGrowth
- PointZeroGrowth
- SelectedLeftGrowth
- ParserSlowLoop1
- PositiveScaleErrorTransport
- Preamble
- ResultLoopPartial
- SliceU8 Insts Dec2flt modelNumImpDec2fltCommonByteSlice read u64
- SliceU8 Insts Dec2flt modelNumImpDec2fltCommonByteSlice write u64
- SlowShiftSelectorCertificate
- U64 Insts CoreOpsBitBitAndU64U64
- U64 Insts CoreOpsBitBitOrU64U64
- U64 Insts CoreOpsBitShlU32U64
- U64 Insts CoreOpsBitShrU32U64
- U64 Insts Dec2flt modelNumImpTraitsCastIntoI16
- U64 Insts Dec2flt modelNumImpTraitsCastIntoI16 cast
- U64 Insts Dec2flt modelNumImpTraitsInt
- U64 Insts Dec2flt modelNumImpTraitsInt ONE
- U64 Insts Dec2flt modelNumImpTraitsInt ZERO
- core num FpCategory
- core ops arith Div
- core ops arith Mul
- core ops arith Neg
- core ops bit BitOr
- core ops bit Shl
- core ops bit Shr
- num imp dec2flt common BiasedFp
- num imp dec2flt common BiasedFp zero pow2
- num imp dec2flt common is 8digits
- num imp dec2flt decimal seq DecimalSeq
- num imp dec2flt decimal seq DecimalSeq DECIMAL POINT RANGE
- num imp dec2flt decimal seq DecimalSeq Insts CoreDefaultDefault default
- num imp dec2flt decimal seq DecimalSeq MAX DIGITS
- num imp dec2flt decimal seq DecimalSeq MAX DIGITS WITHOUT OVERFLOW
- num imp dec2flt decimal seq DecimalSeq left shift
- num imp dec2flt decimal seq DecimalSeq right shift
- num imp dec2flt decimal seq DecimalSeq round
- num imp dec2flt decimal seq DecimalSeq trim
- num imp dec2flt decimal seq DecimalSeq try add digit
- num imp dec2flt decimal seq count trailing zeros
- num imp dec2flt decimal seq number of digits decimal left shift
- num imp dec2flt decimal seq number of digits decimal left shift TABLE
- num imp dec2flt decimal seq number of digits decimal left shift TABLE POW5
- num imp dec2flt decimal seq parse decimal exponent
- num imp dec2flt decimal seq parse decimal seq
- num imp dec2flt decimal seq parse digits into seq
- num imp dec2flt slow parse long mantissa
- num imp dec2flt slow parse long mantissa MAX SHIFT
- num imp dec2flt slow parse long mantissa NUM POWERS
- num imp dec2flt slow parse long mantissa POWERS
- num imp dec2flt slow parse long mantissa closure
- num imp dec2flt slow parse long mantissa closure Insts CoreOpsFunctionFnTupleUsizeUsize call
- num imp traits CastInto
- num imp traits Float
- num imp traits Float EXP BIAS default
- num imp traits Float EXP BITS default
- num imp traits Float EXP MIN default
- num imp traits Float EXP SAT default
- num imp traits Float SIG BITS default
- num imp traits Int
Technical checking records
Local closure summary
{
"node": "ParserSlowLoop1",
"closure_version": "patch_c_v1",
"active_decl_hash": "a8080fe08b5f915527b0a5b0b628cfa5474819a7e644a88a55cec91a6319b06a",
"active_statement_hash": "61320ccf5d49f11dfb928e21541f4d9b45b8b45e8bf439451533fa3dc85b68aa",
"kernel_axioms": [
"Classical.choice",
"Quot.sound",
"propext"
],
"toolchain_hash": "ce4c4e3d87434b9663f46de25ce34b48a0cf0d392e0a320a0787b4674a2d7b61",
"lean_executable_hash": "3e0d0d3d801675359f2d4cf9815bfdb417b20b92fdd9d48b3b14c95bbae28bbf",
"checker_script_hash": "c8e4a03273e23b9a8f2e141020652a4e0b7b0a8ab0883366ea9d031ca3f37aa1",
"approved_axioms_hash": "ab64d13f256386ee0e494a5abcc6a5db49512cf3d90bbdfcabd6327793a31f95",
"axcheck_status": "Agreed",
"accepted_at_snapshot_id": "worker-result-local-closure-issuance-cycle-192",
"boundary_theorems": {},
"strict_theorem_deps": {
"P804_T1_LeftLoopStep": "9c33b506a357178d"
},
"strict_definition_deps": {
"F64": "ec4e25fbaf4e11d4",
"F64_Insts_Dec2flt_modelNumImpTraitsFloatU64": "94095c9bf79da164",
"num_imp_dec2flt_common_BiasedFp": "63baac539d218a81",
"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": "a3ed147b34a97b11"
}
}Prose assessment
{
"label": "Sound flag superseded by recorded Lean closure",
"assessment_status": "VerifierFail",
"fingerprint_relation": "differs from current fingerprint",
"assessment_fingerprint": "sound-v2:49b651b477a2cce09fcba33e07d0d93c4e5afd6acb95e202f1e523b79c104b87",
"current_fingerprint": "sound-v2:d110e864776ddda0863771eabd5d42e4aaf8642924d1e65ac869fc3336496ebb",
"superseded_for_theorem_closure": true
}Review verdicts
{
"corr_status": "Pass",
"sound_status": "Fail",
"substantiveness_status": "Pass"
}