Statement
This explanation was written alongside the formalization to describe the statement and its reasoning.
Lemma · Both separations from the original decimal cell
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_ReachableCapacity
import Tablet.P495_T1_SlowLoop0Execution
import Tablet.P529_T1_Loop1Execution
import Tablet.P529_T1_NormalizationBounds
import Tablet.P529_T1_Loop2Execution
import Tablet.P529_T1_FinalShiftCertificate
import Tablet.P856_T1_CoefficientGridAlignment
import Tablet.P472_T1_DecimalValueBounds
import Tablet.P529_T1_LeftHistoryBoundary
import Tablet.P529_T1_RightHistoryBoundary
import Tablet.P529_T1_RightBoundaryTransport
import Tablet.P798_T1_LeftBoundaryTransport
import Tablet.P798_T1_GridAlignment
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: P529_T1_SeparationPackage]
theorem P529_T1_SeparationPackage (X Y : Real)
(d d0 d1 d2 d3 : num.imp.dec2flt.decimal_seq.DecimalSeq)
(exp0 exp1 exps exp2 : Std.I32)
(hpointLo : -324 <= d.decimal_point.val)
(hpointHi : d.decimal_point.val < 310)
(hinput : d.num_digits.val <= 768 /\
(forall b, b ∈ d.digits.val.take d.num_digits.val -> b.val < 10) /\
(exists h tail,
(d.digits.val.take d.num_digits.val).map (fun b => b.val) = h :: tail /\
1 <= h /\ h < 10 /\ (h :: tail).length = d.num_digits.val))
(hloop0 : num.imp.dec2flt.slow.parse_long_mantissa_loop0
F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
{ m := 0#u64, p_biased := 0#i32 }
d.num_digits d.decimal_point d.truncated d.digits 0#i32 none =
ok (d0.num_digits, d0.decimal_point, d0.truncated, d0.digits, exp0, none))
(hloop1 : 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))
(hdecrement : exp1 - 1#i32 = ok exps)
(hloop2 : num.imp.dec2flt.slow.parse_long_mantissa_loop2
F64.Insts.Dec2flt_modelNumImpTraitsFloatU64 d1 exps = ok (d2, exp2))
(hshift : num.imp.dec2flt.decimal_seq.DecimalSeq.left_shift d2 53#usize = ok d3) :
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))
Y = V d + (10 : Real) ^ (d.decimal_point.val - 768) ->
(exists eta : Real, X = V d + eta /\ 0 <= eta /\
eta < (10 : Real) ^ (d.decimal_point.val - 768) /\
(d.truncated = true <-> 0 < eta)) ->
(forall n : Nat,
(n : Real) + 1 / 2 <= V d3 \/
Y / (2 : Real) ^ (exp2.val - 52) <= (n : Real) + 1 / 2) /\
(forall n : Nat,
(2 * n + 1 : Nat) <= V d3 \/
Y / (2 : Real) ^ (exp2.val - 52) <= (2 * n + 1 : Nat)) := 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
Lean proof
intro V hY hX
have h0pkg := P495_T1_SlowLoop0Execution X Y d hpointLo hpointHi hinput hY hX
rcases h0pkg with ⟨d0', e0', steps, h0', hsteps, hstepsLo, hstepsHi,
hXlow, hp0lo, hp0hi, hn0, hd0, hshape0, htrim0, herr0⟩
have h0eq := h0'.symm.trans hloop0
injection h0eq with h0tuple
simp only [Prod.mk.injEq] at h0tuple
rcases h0tuple with ⟨h0num, h0point, h0trunc, h0digits, h0exp, _⟩
have h0record : d0' = d0 := by
cases d0' with
| mk n p t ds =>
cases d0 with
| mk n' p' t' ds' => simp_all
cases h0record
cases h0exp
have h1pkg := P529_T1_Loop1Execution X Y d0 exp0 hp0lo hp0hi hstepsLo
(by exact ⟨hn0, hd0, hshape0⟩) herr0
rcases h1pkg with ⟨d1', e1', bound, h1', hbound, hboundlo, hboundhi,
hp1, hn1, hhead1lo, hhead1hi, hn1cap, hd1, hshape1, herr1⟩
have h1eq := h1'.symm.trans hloop1
injection h1eq with h1tuple
simp only [Prod.mk.injEq] at h1tuple
rcases h1tuple with ⟨h1num, h1point, h1trunc, h1digits, h1exp, _⟩
have h1record : d1' = d1 := by
cases d1' with
| mk n p t ds =>
cases d1 with
| mk n' p' t' ds' => simp_all
cases h1record
cases h1exp
have hnorm := P529_T1_NormalizationBounds X Y d d0 d1 exp0 exp1
hpointLo hpointHi hinput hloop0 hloop1 hY hX
rcases hnorm with ⟨hXlow', hXY, hYbound1, hexp1lo, hexp1hi⟩
have h2pkg := P529_T1_Loop2Execution X Y d1 exp1 hexp1lo hp1
(by exact ⟨hn1cap, hd1, hshape1⟩) herr1
rcases h2pkg with ⟨exps', exp2', d2', shift, hdec', hexpsval,
hexpslo, h2', hexp2val, hshiftval, hshiftle, h2case,
hp2lo, hp2hi, hn2, hd2, hshape2, hnonreset, herr2⟩
have hdeceq := hdec'.symm.trans hdecrement
injection hdeceq with hexps
cases hexps
have h2eq := h2'.symm.trans hloop2
injection h2eq with h2tuple
simp only [Prod.mk.injEq] at h2tuple
rcases h2tuple with ⟨h2record, h2exp⟩
have h2record' : d2' = d2 := by
cases d2' with
| mk n p t ds =>
cases d2 with
| mk n' p' t' ds' => simp_all
cases h2record'
cases h2exp
have hexp2 : exp2.val = max (exp1.val - 1) (-1022) := by
rw [← hexpsval]
exact hexp2val
have hcap0 := P529_T1_ReachableCapacity X Y d d0 d1 exp0 exp1 exp2
hpointLo hpointHi hinput hloop0 hloop1 hexp2 hY hX
have he2lower : exp1.val ≤ exp2.val + 1 := by
rw [hexp2]
omega
have hYle : Y ≤ (2 : Real) ^ exp1.val :=
(div_le_one (by positivity)).mp hYbound1
have hpowmon : (2 : Real) ^ exp1.val ≤ (2 : Real) ^ (exp2.val + 1) :=
zpow_le_zpow_right₀ (by norm_num) he2lower
have hYupper : Y / (2 : Real) ^ (exp2.val + 1) ≤ 1 :=
(div_le_one (by positivity)).2 (le_trans hYle hpowmon)
have h3pkg := P529_T1_FinalShiftCertificate X Y d2 exp2 hp2lo hp2hi
(by exact ⟨hn2, hd2, hshape2⟩) hYupper herr2
rcases h3pkg with ⟨d3', h3', hp3lo, hp3hi, hn3, hd3, hshape3,
htrim3, hXpos3, hXupper3, herr3⟩
have h3eq := h3'.symm.trans hshift
injection h3eq with h3
have h3record : d3' = d3 := by
cases d3' with
| mk n p t ds =>
cases d3 with
| mk n' p' t' ds' => simp_all
cases h3record
have hleftHist := P529_T1_LeftHistoryBoundary X Y d0 d1 exp0 exp1
hp0lo hp0hi hstepsLo ⟨hn0, hd0, hshape0⟩ hloop1 herr0
rcases hleftHist with ⟨hbasecap, hprogress, hleftBoundary⟩
have hrightHist := P529_T1_RightHistoryBoundary X Y d d0 exp0
hpointLo hpointHi hinput hloop0 hY hX
rcases hrightHist with ⟨hrightZero, hrightBoundary⟩
rcases hshape1 with ⟨z1, zs1, hxs1, hz1, hz1lt, hlen1⟩
have hdmap1 : ∀ q, q ∈ (d1.digits.val.take d1.num_digits.val).map
(fun b => b.val) -> q < 10 := by
intro q hq
rcases List.mem_map.mp hq with ⟨b, hb, rfl⟩
exact hd1 b hb
have hvbounds1 := P472_T1_DecimalValueBounds
((d1.digits.val.take d1.num_digits.val).map (fun b => b.val))
z1 zs1 hxs1 (by omega) hdmap1 d1.decimal_point.val
have htake1 : (d1.digits.val.take d1.num_digits.val).map
(fun b => b.val) =
(d1.digits.val.map (fun b => b.val)).take d1.num_digits.val := by
simp
have hv1 : 0 < V d1 := by
have hz1pos : (0 : Real) < z1 := by exact_mod_cast (show 0 < z1 by omega)
have hpow : (0 : Real) < (10 : Real) ^ (d1.decimal_point.val - 1) :=
zpow_pos (by norm_num) _
have hlow : (z1 : Real) * (10 : Real) ^ (d1.decimal_point.val - 1) ≤ V d1 := by
simpa [V, ← htake1, hxs1, hlen1] using hvbounds1.1
exact lt_of_lt_of_le (mul_pos hz1pos hpow) hlow
rcases hshape2 with ⟨z2, zs2, hxs2, hz2, hz2lt, hlen2⟩
have hdmap2 : ∀ q, q ∈ (d2.digits.val.take d2.num_digits.val).map
(fun b => b.val) -> q < 10 := by
intro q hq
rcases List.mem_map.mp hq with ⟨b, hb, rfl⟩
exact hd2 b hb
have hvbounds2 := P472_T1_DecimalValueBounds
((d2.digits.val.take d2.num_digits.val).map (fun b => b.val))
z2 zs2 hxs2 (by omega) hdmap2 d2.decimal_point.val
have htake2 : (d2.digits.val.take d2.num_digits.val).map
(fun b => b.val) =
(d2.digits.val.map (fun b => b.val)).take d2.num_digits.val := by
simp
have hv2 : 0 < V d2 := by
have hz2pos : (0 : Real) < z2 := by exact_mod_cast (show 0 < z2 by omega)
have hpow : (0 : Real) < (10 : Real) ^ (d2.decimal_point.val - 1) :=
zpow_pos (by norm_num) _
have hlow : (z2 : Real) * (10 : Real) ^ (d2.decimal_point.val - 1) ≤ V d2 := by
simpa [V, ← htake2, hxs2, hlen2] using hvbounds2.1
exact lt_of_lt_of_le (mul_pos hz2pos hpow) hlow
have hcapacity0 (R : Int)
(hR : R = exp2.val - 53 ∨ R = exp2.val - 52) :
0 ≤ R - exp0.val + 768 - d0.decimal_point.val := by
have h := hcap0
rcases hR with hR | hR <;> rw [hR] <;> omega
have hcapacity2 (R : Int)
(hR : R = exp2.val - 53 ∨ R = exp2.val - 52) :
0 ≤ R - (exp2.val + 1) + 768 - d2.decimal_point.val := by
rcases hR with hR | hR <;> rw [hR] <;> omega
have hcapacity3 (R : Int)
(hR : R = exp2.val - 53 ∨ R = exp2.val - 52) :
0 ≤ R - (exp2.val - 52) + 768 - d3.decimal_point.val := by
rcases hR with hR | hR <;> rw [hR] <;> omega
have hnoncross (c : Nat) (R : Int)
(hR : R = exp2.val - 53 ∨ R = exp2.val - 52) :
V d3 < (c : Real) * (2 : Real) ^ (R - (exp2.val - 52)) ->
(c : Real) * (2 : Real) ^ R < Y -> False := by
intro hcross3 hcrossY
have hcap2 := hcapacity2 R hR
have hcap3 := hcapacity3 R hR
have halign2 := P856_T1_CoefficientGridAlignment c
(R - (exp2.val + 1)) d2.decimal_point.val (by omega) hcap2
rcases halign2 with ⟨b2, hb2⟩
have halign3 := P856_T1_CoefficientGridAlignment c
(R - (exp2.val - 52)) d3.decimal_point.val (by omega) hcap3
rcases halign3 with ⟨b3, hb3⟩
have hpow53 : (2 : Real) ^ (53 : Nat) *
(2 : Real) ^ (R - (exp2.val + 1)) =
(2 : Real) ^ (R - (exp2.val - 52)) := by
have hnat : (2 : Real) ^ (53 : Nat) = (2 : Real) ^ (53 : Int) := by
norm_num
rw [hnat, ← zpow_add₀ (by norm_num : (2 : Real) ≠ 0)]
congr 1
omega
have hcoefPower : (c : Real) *
(2 : Real) ^ (R - (exp2.val - 52)) =
(2 : Real) ^ (53 : Nat) *
((c : Real) * (2 : Real) ^ (R - (exp2.val + 1))) := by
have hnatpow : (2 : Real) ^ (53 : Nat) =
(2 : Real) ^ (53 : Int) := by norm_num
rw [hnatpow]
rw [show R - (exp2.val - 52) = (53 : Int) +
(R - (exp2.val + 1)) by omega]
rw [zpow_add₀ (by norm_num : (2 : Real) ≠ 0)]
ring
have hshifttransport := P798_T1_LeftBoundaryTransport d2 d3
53#usize b3 (by norm_num) hv2 hd2 hshift hn3
have hcross2 : V d2 < (c : Real) *
(2 : Real) ^ (R - (exp2.val + 1)) := by
by_contra hnot
have hle : (c : Real) * (2 : Real) ^ (R - (exp2.val + 1)) ≤ V d2 :=
le_of_not_gt hnot
have hmul := mul_le_mul_of_nonneg_left hle
(le_of_lt (show (0 : Real) < (2 : Real) ^ (53 : Nat) by positivity))
have htransportIn : (b3 : Real) *
(10 : Real) ^ (d3.decimal_point.val - 768) ≤
(2 : Real) ^ (53 : Nat) * V d2 := by
calc
(b3 : Real) * (10 : Real) ^ (d3.decimal_point.val - 768) =
(c : Real) * (2 : Real) ^ (R - (exp2.val - 52)) := hb3.symm
_ = (2 : Real) ^ (53 : Nat) *
((c : Real) * (2 : Real) ^ (R - (exp2.val + 1))) := by
exact hcoefPower
_ ≤ (2 : Real) ^ (53 : Nat) * V d2 := hmul
have htransportOut := hshifttransport htransportIn
rw [← hb3] at htransportOut
exact (not_lt_of_ge htransportOut) hcross3
have hloop2Exponent : exp2.val + 1 = exp1.val + shift.val := by
rcases h2case with hident | hright
· rcases hident with ⟨hcut, hzero, hd2eq, he2eq⟩
have he2 : exp2.val = exps.val :=
congrArg (fun e : Std.I32 => e.val) he2eq
omega
· rcases hright with ⟨hcut, hpositive, hcall, hexp2reset⟩
omega
have hcross1 : V d1 < (c : Real) *
(2 : Real) ^ (R - exp1.val) := by
by_contra hnot
have hle : (c : Real) * (2 : Real) ^ (R - exp1.val) ≤ V d1 :=
le_of_not_gt hnot
rcases h2case with hident | hright
· rcases hident with ⟨hcut, hzero, hd2eq, he2eq⟩
have he2 : exp2.val = exps.val :=
congrArg (fun e : Std.I32 => e.val) he2eq
have hexp : exp2.val + 1 = exp1.val := by omega
rw [hd2eq] at hcross2
rw [show R - (exp2.val + 1) = R - exp1.val by omega] at hcross2
exact (not_lt_of_ge hle) hcross2
· rcases hright with ⟨hcut, hpositive, hcall, hexp2reset⟩
have hnonreset2 : ¬ (d2.num_digits.val = 0 ∧
d2.decimal_point.val = 0 ∧ d2.truncated = false) := by
intro hreset
have hn2pos : 0 < d2.num_digits.val := by
rw [← hlen2]
simp
omega
have hrighttransport := P529_T1_RightBoundaryTransport
d1 d2 shift (by omega) hd1 hcall hnonreset2 hn2 hv1
have hshiftpowpos : (0 : Real) < (2 : Real) ^ shift.val := by
positivity
have hnatpow : (2 : Real) ^ shift.val =
(2 : Real) ^ (shift.val : Int) := by
norm_num [zpow_natCast]
have hpowRel : (2 : Real) ^ (R - exp1.val) =
(2 : Real) ^ (R - (exp2.val + 1)) * (2 : Real) ^ shift.val := by
rw [show R - exp1.val = (R - (exp2.val + 1)) +
(shift.val : Int) by omega]
rw [zpow_add₀ (by norm_num : (2 : Real) ≠ 0)]
rw [← hnatpow]
have hmulBound : (c : Real) *
(2 : Real) ^ (R - (exp2.val + 1)) * (2 : Real) ^ shift.val ≤ V d1 := by
calc
(c : Real) * (2 : Real) ^ (R - (exp2.val + 1)) *
(2 : Real) ^ shift.val =
(c : Real) * ((2 : Real) ^ (R - (exp2.val + 1)) *
(2 : Real) ^ shift.val) := by ring
_ = (c : Real) * (2 : Real) ^ (R - exp1.val) := by
rw [← hpowRel]
_ ≤ V d1 := hle
have htransportIn : (b2 : Real) *
(10 : Real) ^ (d2.decimal_point.val - 768) ≤
V d1 / (2 : Real) ^ shift.val := by
rw [← hb2]
exact (le_div_iff₀ hshiftpowpos).2 (by simpa [mul_assoc] using hmulBound)
have htransportOut := hrighttransport b2 htransportIn
rw [← hb2] at htransportOut
exact (not_lt_of_ge htransportOut) hcross2
have hleftStep := hleftBoundary c R (hcapacity0 R hR)
have hcross0 := hleftStep.2 hcross1
have hrightStep := hrightBoundary c R (hcapacity0 R hR)
have hcrossd := hrightStep.2 hcross0
have hgrid := P798_T1_GridAlignment d hinput.1
rcases hgrid with ⟨a, ha⟩
have halign0 := P856_T1_CoefficientGridAlignment c R
d.decimal_point.val (by omega) hrightStep.1
rcases halign0 with ⟨b, hb⟩
let q : Real := (10 : Real) ^ (d.decimal_point.val - 768)
have htakeD : (d.digits.val.take d.num_digits.val).map
(fun z => z.val) =
(d.digits.val.map (fun z => z.val)).take d.num_digits.val := by
simp
have hq : 0 < q := by
dsimp [q]
exact zpow_pos (by norm_num) _
have ha' : V d = (a : Real) * q := by
simpa only [V, q, htakeD] using ha
have hb' : (c : Real) * (2 : Real) ^ R = (b : Real) * q := by
simpa [q] using hb
have hcrossd' : (a : Real) * q < (c : Real) * (2 : Real) ^ R := by
rw [← ha']
exact hcrossd
have habreal : (a : Real) * q < (b : Real) * q := by
rw [← hb']
exact hcrossd'
have hab : a < b := by
exact_mod_cast (lt_of_mul_lt_mul_right habreal (le_of_lt hq))
have hbaReal : (b : Real) * q < ((a : Nat) + 1 : Real) * q := by
calc
(b : Real) * q = (c : Real) * (2 : Real) ^ R := hb'.symm
_ < Y := hcrossY
_ = V d + q := by simpa [q] using hY
_ = (a : Real) * q + q := by rw [ha']
_ = ((a : Nat) + 1 : Real) * q := by push_cast; ring
have hba : b < a + 1 := by
exact_mod_cast (lt_of_mul_lt_mul_right hbaReal (le_of_lt hq))
omega
have hpowFactor (r s : Int) :
(2 : Real) ^ r = (2 : Real) ^ (r - s) * (2 : Real) ^ s := by
calc
(2 : Real) ^ r = (2 : Real) ^ ((r - s) + s) := by congr 1 <;> omega
_ = (2 : Real) ^ (r - s) * (2 : Real) ^ s :=
zpow_add₀ (by norm_num : (2 : Real) ≠ 0) _ _
constructor
· intro n
by_contra hbad
push_neg at hbad
rcases hbad with ⟨hleft, hright⟩
let c : Nat := 2 * n + 1
let R : Int := exp2.val - 53
let s : Int := exp2.val - 52
have hboundary : (n : Real) + 1 / 2 = (c : Real) *
(2 : Real) ^ (R - s) := by
have hexp : R - s = -1 := by dsimp [R, s]; omega
rw [hexp]
have hpow : (2 : Real) ^ (-1 : Int) = (1 / 2 : Real) := by norm_num
rw [hpow]
dsimp [c]
push_cast
ring
have hupperMul : ((n : Real) + 1 / 2) * (2 : Real) ^ s < Y :=
(lt_div_iff₀ (zpow_pos (by norm_num) s)).mp hright
have hcrossY : (c : Real) * (2 : Real) ^ R < Y := by
calc
(c : Real) * (2 : Real) ^ R =
((c : Real) * (2 : Real) ^ (R - s)) * (2 : Real) ^ s := by
conv_lhs => rw [hpowFactor R s]
ring
_ = ((n : Real) + 1 / 2) * (2 : Real) ^ s := by rw [← hboundary]
_ < Y := hupperMul
have hR : R = exp2.val - 53 ∨ R = exp2.val - 52 := Or.inl rfl
have hcross3 : V d3 < (c : Real) * (2 : Real) ^ (R - s) := by
rw [← hboundary]
exact hleft
exact hnoncross c R hR hcross3 hcrossY
· intro n
by_contra hbad
push_neg at hbad
rcases hbad with ⟨hleft, hright⟩
let c : Nat := 2 * n + 1
let R : Int := exp2.val - 52
let s : Int := exp2.val - 52
have hboundary : (2 * n + 1 : Nat) = (c : Real) *
(2 : Real) ^ (R - s) := by
have hexp : R - s = 0 := by dsimp [R, s]; omega
rw [hexp]
simp [c]
have hupperMul : ((2 * n + 1 : Nat) : Real) *
(2 : Real) ^ s < Y := (lt_div_iff₀ (zpow_pos (by norm_num) s)).mp hright
have hcrossY : (c : Real) * (2 : Real) ^ R < Y := by
calc
(c : Real) * (2 : Real) ^ R =
((c : Real) * (2 : Real) ^ (R - s)) * (2 : Real) ^ s := by
conv_lhs => rw [hpowFactor R s]
ring
_ = ((2 * n + 1 : Nat) : Real) * (2 : Real) ^ s := by
rw [← hboundary]
_ < Y := hupperMul
have hR : R = exp2.val - 53 ∨ R = exp2.val - 52 := Or.inr rfl
have hcross3 : V d3 < (c : Real) * (2 : Real) ^ (R - s) := by
rw [← hboundary]
exact hleft
exact hnoncross c R hR hcross3 hcrossY
end dec2flt_model
Download Lean source · Download TeX source
Complete Lean module
import Tablet.P529_T1_ReachableCapacity
import Tablet.P495_T1_SlowLoop0Execution
import Tablet.P529_T1_Loop1Execution
import Tablet.P529_T1_NormalizationBounds
import Tablet.P529_T1_Loop2Execution
import Tablet.P529_T1_FinalShiftCertificate
import Tablet.P856_T1_CoefficientGridAlignment
import Tablet.P472_T1_DecimalValueBounds
import Tablet.P529_T1_LeftHistoryBoundary
import Tablet.P529_T1_RightHistoryBoundary
import Tablet.P529_T1_RightBoundaryTransport
import Tablet.P798_T1_LeftBoundaryTransport
import Tablet.P798_T1_GridAlignment
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: P529_T1_SeparationPackage]
theorem P529_T1_SeparationPackage (X Y : Real)
(d d0 d1 d2 d3 : num.imp.dec2flt.decimal_seq.DecimalSeq)
(exp0 exp1 exps exp2 : Std.I32)
(hpointLo : -324 <= d.decimal_point.val)
(hpointHi : d.decimal_point.val < 310)
(hinput : d.num_digits.val <= 768 /\
(forall b, b ∈ d.digits.val.take d.num_digits.val -> b.val < 10) /\
(exists h tail,
(d.digits.val.take d.num_digits.val).map (fun b => b.val) = h :: tail /\
1 <= h /\ h < 10 /\ (h :: tail).length = d.num_digits.val))
(hloop0 : num.imp.dec2flt.slow.parse_long_mantissa_loop0
F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
{ m := 0#u64, p_biased := 0#i32 }
d.num_digits d.decimal_point d.truncated d.digits 0#i32 none =
ok (d0.num_digits, d0.decimal_point, d0.truncated, d0.digits, exp0, none))
(hloop1 : 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))
(hdecrement : exp1 - 1#i32 = ok exps)
(hloop2 : num.imp.dec2flt.slow.parse_long_mantissa_loop2
F64.Insts.Dec2flt_modelNumImpTraitsFloatU64 d1 exps = ok (d2, exp2))
(hshift : num.imp.dec2flt.decimal_seq.DecimalSeq.left_shift d2 53#usize = ok d3) :
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))
Y = V d + (10 : Real) ^ (d.decimal_point.val - 768) ->
(exists eta : Real, X = V d + eta /\ 0 <= eta /\
eta < (10 : Real) ^ (d.decimal_point.val - 768) /\
(d.truncated = true <-> 0 < eta)) ->
(forall n : Nat,
(n : Real) + 1 / 2 <= V d3 \/
Y / (2 : Real) ^ (exp2.val - 52) <= (n : Real) + 1 / 2) /\
(forall n : Nat,
(2 * n + 1 : Nat) <= V d3 \/
Y / (2 : Real) ^ (exp2.val - 52) <= (2 * n + 1 : Nat)) := by
-- BODY
intro V hY hX
have h0pkg := P495_T1_SlowLoop0Execution X Y d hpointLo hpointHi hinput hY hX
rcases h0pkg with ⟨d0', e0', steps, h0', hsteps, hstepsLo, hstepsHi,
hXlow, hp0lo, hp0hi, hn0, hd0, hshape0, htrim0, herr0⟩
have h0eq := h0'.symm.trans hloop0
injection h0eq with h0tuple
simp only [Prod.mk.injEq] at h0tuple
rcases h0tuple with ⟨h0num, h0point, h0trunc, h0digits, h0exp, _⟩
have h0record : d0' = d0 := by
cases d0' with
| mk n p t ds =>
cases d0 with
| mk n' p' t' ds' => simp_all
cases h0record
cases h0exp
have h1pkg := P529_T1_Loop1Execution X Y d0 exp0 hp0lo hp0hi hstepsLo
(by exact ⟨hn0, hd0, hshape0⟩) herr0
rcases h1pkg with ⟨d1', e1', bound, h1', hbound, hboundlo, hboundhi,
hp1, hn1, hhead1lo, hhead1hi, hn1cap, hd1, hshape1, herr1⟩
have h1eq := h1'.symm.trans hloop1
injection h1eq with h1tuple
simp only [Prod.mk.injEq] at h1tuple
rcases h1tuple with ⟨h1num, h1point, h1trunc, h1digits, h1exp, _⟩
have h1record : d1' = d1 := by
cases d1' with
| mk n p t ds =>
cases d1 with
| mk n' p' t' ds' => simp_all
cases h1record
cases h1exp
have hnorm := P529_T1_NormalizationBounds X Y d d0 d1 exp0 exp1
hpointLo hpointHi hinput hloop0 hloop1 hY hX
rcases hnorm with ⟨hXlow', hXY, hYbound1, hexp1lo, hexp1hi⟩
have h2pkg := P529_T1_Loop2Execution X Y d1 exp1 hexp1lo hp1
(by exact ⟨hn1cap, hd1, hshape1⟩) herr1
rcases h2pkg with ⟨exps', exp2', d2', shift, hdec', hexpsval,
hexpslo, h2', hexp2val, hshiftval, hshiftle, h2case,
hp2lo, hp2hi, hn2, hd2, hshape2, hnonreset, herr2⟩
have hdeceq := hdec'.symm.trans hdecrement
injection hdeceq with hexps
cases hexps
have h2eq := h2'.symm.trans hloop2
injection h2eq with h2tuple
simp only [Prod.mk.injEq] at h2tuple
rcases h2tuple with ⟨h2record, h2exp⟩
have h2record' : d2' = d2 := by
cases d2' with
| mk n p t ds =>
cases d2 with
| mk n' p' t' ds' => simp_all
cases h2record'
cases h2exp
have hexp2 : exp2.val = max (exp1.val - 1) (-1022) := by
rw [← hexpsval]
exact hexp2val
have hcap0 := P529_T1_ReachableCapacity X Y d d0 d1 exp0 exp1 exp2
hpointLo hpointHi hinput hloop0 hloop1 hexp2 hY hX
have he2lower : exp1.val ≤ exp2.val + 1 := by
rw [hexp2]
omega
have hYle : Y ≤ (2 : Real) ^ exp1.val :=
(div_le_one (by positivity)).mp hYbound1
have hpowmon : (2 : Real) ^ exp1.val ≤ (2 : Real) ^ (exp2.val + 1) :=
zpow_le_zpow_right₀ (by norm_num) he2lower
have hYupper : Y / (2 : Real) ^ (exp2.val + 1) ≤ 1 :=
(div_le_one (by positivity)).2 (le_trans hYle hpowmon)
have h3pkg := P529_T1_FinalShiftCertificate X Y d2 exp2 hp2lo hp2hi
(by exact ⟨hn2, hd2, hshape2⟩) hYupper herr2
rcases h3pkg with ⟨d3', h3', hp3lo, hp3hi, hn3, hd3, hshape3,
htrim3, hXpos3, hXupper3, herr3⟩
have h3eq := h3'.symm.trans hshift
injection h3eq with h3
have h3record : d3' = d3 := by
cases d3' with
| mk n p t ds =>
cases d3 with
| mk n' p' t' ds' => simp_all
cases h3record
have hleftHist := P529_T1_LeftHistoryBoundary X Y d0 d1 exp0 exp1
hp0lo hp0hi hstepsLo ⟨hn0, hd0, hshape0⟩ hloop1 herr0
rcases hleftHist with ⟨hbasecap, hprogress, hleftBoundary⟩
have hrightHist := P529_T1_RightHistoryBoundary X Y d d0 exp0
hpointLo hpointHi hinput hloop0 hY hX
rcases hrightHist with ⟨hrightZero, hrightBoundary⟩
rcases hshape1 with ⟨z1, zs1, hxs1, hz1, hz1lt, hlen1⟩
have hdmap1 : ∀ q, q ∈ (d1.digits.val.take d1.num_digits.val).map
(fun b => b.val) -> q < 10 := by
intro q hq
rcases List.mem_map.mp hq with ⟨b, hb, rfl⟩
exact hd1 b hb
have hvbounds1 := P472_T1_DecimalValueBounds
((d1.digits.val.take d1.num_digits.val).map (fun b => b.val))
z1 zs1 hxs1 (by omega) hdmap1 d1.decimal_point.val
have htake1 : (d1.digits.val.take d1.num_digits.val).map
(fun b => b.val) =
(d1.digits.val.map (fun b => b.val)).take d1.num_digits.val := by
simp
have hv1 : 0 < V d1 := by
have hz1pos : (0 : Real) < z1 := by exact_mod_cast (show 0 < z1 by omega)
have hpow : (0 : Real) < (10 : Real) ^ (d1.decimal_point.val - 1) :=
zpow_pos (by norm_num) _
have hlow : (z1 : Real) * (10 : Real) ^ (d1.decimal_point.val - 1) ≤ V d1 := by
simpa [V, ← htake1, hxs1, hlen1] using hvbounds1.1
exact lt_of_lt_of_le (mul_pos hz1pos hpow) hlow
rcases hshape2 with ⟨z2, zs2, hxs2, hz2, hz2lt, hlen2⟩
have hdmap2 : ∀ q, q ∈ (d2.digits.val.take d2.num_digits.val).map
(fun b => b.val) -> q < 10 := by
intro q hq
rcases List.mem_map.mp hq with ⟨b, hb, rfl⟩
exact hd2 b hb
have hvbounds2 := P472_T1_DecimalValueBounds
((d2.digits.val.take d2.num_digits.val).map (fun b => b.val))
z2 zs2 hxs2 (by omega) hdmap2 d2.decimal_point.val
have htake2 : (d2.digits.val.take d2.num_digits.val).map
(fun b => b.val) =
(d2.digits.val.map (fun b => b.val)).take d2.num_digits.val := by
simp
have hv2 : 0 < V d2 := by
have hz2pos : (0 : Real) < z2 := by exact_mod_cast (show 0 < z2 by omega)
have hpow : (0 : Real) < (10 : Real) ^ (d2.decimal_point.val - 1) :=
zpow_pos (by norm_num) _
have hlow : (z2 : Real) * (10 : Real) ^ (d2.decimal_point.val - 1) ≤ V d2 := by
simpa [V, ← htake2, hxs2, hlen2] using hvbounds2.1
exact lt_of_lt_of_le (mul_pos hz2pos hpow) hlow
have hcapacity0 (R : Int)
(hR : R = exp2.val - 53 ∨ R = exp2.val - 52) :
0 ≤ R - exp0.val + 768 - d0.decimal_point.val := by
have h := hcap0
rcases hR with hR | hR <;> rw [hR] <;> omega
have hcapacity2 (R : Int)
(hR : R = exp2.val - 53 ∨ R = exp2.val - 52) :
0 ≤ R - (exp2.val + 1) + 768 - d2.decimal_point.val := by
rcases hR with hR | hR <;> rw [hR] <;> omega
have hcapacity3 (R : Int)
(hR : R = exp2.val - 53 ∨ R = exp2.val - 52) :
0 ≤ R - (exp2.val - 52) + 768 - d3.decimal_point.val := by
rcases hR with hR | hR <;> rw [hR] <;> omega
have hnoncross (c : Nat) (R : Int)
(hR : R = exp2.val - 53 ∨ R = exp2.val - 52) :
V d3 < (c : Real) * (2 : Real) ^ (R - (exp2.val - 52)) ->
(c : Real) * (2 : Real) ^ R < Y -> False := by
intro hcross3 hcrossY
have hcap2 := hcapacity2 R hR
have hcap3 := hcapacity3 R hR
have halign2 := P856_T1_CoefficientGridAlignment c
(R - (exp2.val + 1)) d2.decimal_point.val (by omega) hcap2
rcases halign2 with ⟨b2, hb2⟩
have halign3 := P856_T1_CoefficientGridAlignment c
(R - (exp2.val - 52)) d3.decimal_point.val (by omega) hcap3
rcases halign3 with ⟨b3, hb3⟩
have hpow53 : (2 : Real) ^ (53 : Nat) *
(2 : Real) ^ (R - (exp2.val + 1)) =
(2 : Real) ^ (R - (exp2.val - 52)) := by
have hnat : (2 : Real) ^ (53 : Nat) = (2 : Real) ^ (53 : Int) := by
norm_num
rw [hnat, ← zpow_add₀ (by norm_num : (2 : Real) ≠ 0)]
congr 1
omega
have hcoefPower : (c : Real) *
(2 : Real) ^ (R - (exp2.val - 52)) =
(2 : Real) ^ (53 : Nat) *
((c : Real) * (2 : Real) ^ (R - (exp2.val + 1))) := by
have hnatpow : (2 : Real) ^ (53 : Nat) =
(2 : Real) ^ (53 : Int) := by norm_num
rw [hnatpow]
rw [show R - (exp2.val - 52) = (53 : Int) +
(R - (exp2.val + 1)) by omega]
rw [zpow_add₀ (by norm_num : (2 : Real) ≠ 0)]
ring
have hshifttransport := P798_T1_LeftBoundaryTransport d2 d3
53#usize b3 (by norm_num) hv2 hd2 hshift hn3
have hcross2 : V d2 < (c : Real) *
(2 : Real) ^ (R - (exp2.val + 1)) := by
by_contra hnot
have hle : (c : Real) * (2 : Real) ^ (R - (exp2.val + 1)) ≤ V d2 :=
le_of_not_gt hnot
have hmul := mul_le_mul_of_nonneg_left hle
(le_of_lt (show (0 : Real) < (2 : Real) ^ (53 : Nat) by positivity))
have htransportIn : (b3 : Real) *
(10 : Real) ^ (d3.decimal_point.val - 768) ≤
(2 : Real) ^ (53 : Nat) * V d2 := by
calc
(b3 : Real) * (10 : Real) ^ (d3.decimal_point.val - 768) =
(c : Real) * (2 : Real) ^ (R - (exp2.val - 52)) := hb3.symm
_ = (2 : Real) ^ (53 : Nat) *
((c : Real) * (2 : Real) ^ (R - (exp2.val + 1))) := by
exact hcoefPower
_ ≤ (2 : Real) ^ (53 : Nat) * V d2 := hmul
have htransportOut := hshifttransport htransportIn
rw [← hb3] at htransportOut
exact (not_lt_of_ge htransportOut) hcross3
have hloop2Exponent : exp2.val + 1 = exp1.val + shift.val := by
rcases h2case with hident | hright
· rcases hident with ⟨hcut, hzero, hd2eq, he2eq⟩
have he2 : exp2.val = exps.val :=
congrArg (fun e : Std.I32 => e.val) he2eq
omega
· rcases hright with ⟨hcut, hpositive, hcall, hexp2reset⟩
omega
have hcross1 : V d1 < (c : Real) *
(2 : Real) ^ (R - exp1.val) := by
by_contra hnot
have hle : (c : Real) * (2 : Real) ^ (R - exp1.val) ≤ V d1 :=
le_of_not_gt hnot
rcases h2case with hident | hright
· rcases hident with ⟨hcut, hzero, hd2eq, he2eq⟩
have he2 : exp2.val = exps.val :=
congrArg (fun e : Std.I32 => e.val) he2eq
have hexp : exp2.val + 1 = exp1.val := by omega
rw [hd2eq] at hcross2
rw [show R - (exp2.val + 1) = R - exp1.val by omega] at hcross2
exact (not_lt_of_ge hle) hcross2
· rcases hright with ⟨hcut, hpositive, hcall, hexp2reset⟩
have hnonreset2 : ¬ (d2.num_digits.val = 0 ∧
d2.decimal_point.val = 0 ∧ d2.truncated = false) := by
intro hreset
have hn2pos : 0 < d2.num_digits.val := by
rw [← hlen2]
simp
omega
have hrighttransport := P529_T1_RightBoundaryTransport
d1 d2 shift (by omega) hd1 hcall hnonreset2 hn2 hv1
have hshiftpowpos : (0 : Real) < (2 : Real) ^ shift.val := by
positivity
have hnatpow : (2 : Real) ^ shift.val =
(2 : Real) ^ (shift.val : Int) := by
norm_num [zpow_natCast]
have hpowRel : (2 : Real) ^ (R - exp1.val) =
(2 : Real) ^ (R - (exp2.val + 1)) * (2 : Real) ^ shift.val := by
rw [show R - exp1.val = (R - (exp2.val + 1)) +
(shift.val : Int) by omega]
rw [zpow_add₀ (by norm_num : (2 : Real) ≠ 0)]
rw [← hnatpow]
have hmulBound : (c : Real) *
(2 : Real) ^ (R - (exp2.val + 1)) * (2 : Real) ^ shift.val ≤ V d1 := by
calc
(c : Real) * (2 : Real) ^ (R - (exp2.val + 1)) *
(2 : Real) ^ shift.val =
(c : Real) * ((2 : Real) ^ (R - (exp2.val + 1)) *
(2 : Real) ^ shift.val) := by ring
_ = (c : Real) * (2 : Real) ^ (R - exp1.val) := by
rw [← hpowRel]
_ ≤ V d1 := hle
have htransportIn : (b2 : Real) *
(10 : Real) ^ (d2.decimal_point.val - 768) ≤
V d1 / (2 : Real) ^ shift.val := by
rw [← hb2]
exact (le_div_iff₀ hshiftpowpos).2 (by simpa [mul_assoc] using hmulBound)
have htransportOut := hrighttransport b2 htransportIn
rw [← hb2] at htransportOut
exact (not_lt_of_ge htransportOut) hcross2
have hleftStep := hleftBoundary c R (hcapacity0 R hR)
have hcross0 := hleftStep.2 hcross1
have hrightStep := hrightBoundary c R (hcapacity0 R hR)
have hcrossd := hrightStep.2 hcross0
have hgrid := P798_T1_GridAlignment d hinput.1
rcases hgrid with ⟨a, ha⟩
have halign0 := P856_T1_CoefficientGridAlignment c R
d.decimal_point.val (by omega) hrightStep.1
rcases halign0 with ⟨b, hb⟩
let q : Real := (10 : Real) ^ (d.decimal_point.val - 768)
have htakeD : (d.digits.val.take d.num_digits.val).map
(fun z => z.val) =
(d.digits.val.map (fun z => z.val)).take d.num_digits.val := by
simp
have hq : 0 < q := by
dsimp [q]
exact zpow_pos (by norm_num) _
have ha' : V d = (a : Real) * q := by
simpa only [V, q, htakeD] using ha
have hb' : (c : Real) * (2 : Real) ^ R = (b : Real) * q := by
simpa [q] using hb
have hcrossd' : (a : Real) * q < (c : Real) * (2 : Real) ^ R := by
rw [← ha']
exact hcrossd
have habreal : (a : Real) * q < (b : Real) * q := by
rw [← hb']
exact hcrossd'
have hab : a < b := by
exact_mod_cast (lt_of_mul_lt_mul_right habreal (le_of_lt hq))
have hbaReal : (b : Real) * q < ((a : Nat) + 1 : Real) * q := by
calc
(b : Real) * q = (c : Real) * (2 : Real) ^ R := hb'.symm
_ < Y := hcrossY
_ = V d + q := by simpa [q] using hY
_ = (a : Real) * q + q := by rw [ha']
_ = ((a : Nat) + 1 : Real) * q := by push_cast; ring
have hba : b < a + 1 := by
exact_mod_cast (lt_of_mul_lt_mul_right hbaReal (le_of_lt hq))
omega
have hpowFactor (r s : Int) :
(2 : Real) ^ r = (2 : Real) ^ (r - s) * (2 : Real) ^ s := by
calc
(2 : Real) ^ r = (2 : Real) ^ ((r - s) + s) := by congr 1 <;> omega
_ = (2 : Real) ^ (r - s) * (2 : Real) ^ s :=
zpow_add₀ (by norm_num : (2 : Real) ≠ 0) _ _
constructor
· intro n
by_contra hbad
push_neg at hbad
rcases hbad with ⟨hleft, hright⟩
let c : Nat := 2 * n + 1
let R : Int := exp2.val - 53
let s : Int := exp2.val - 52
have hboundary : (n : Real) + 1 / 2 = (c : Real) *
(2 : Real) ^ (R - s) := by
have hexp : R - s = -1 := by dsimp [R, s]; omega
rw [hexp]
have hpow : (2 : Real) ^ (-1 : Int) = (1 / 2 : Real) := by norm_num
rw [hpow]
dsimp [c]
push_cast
ring
have hupperMul : ((n : Real) + 1 / 2) * (2 : Real) ^ s < Y :=
(lt_div_iff₀ (zpow_pos (by norm_num) s)).mp hright
have hcrossY : (c : Real) * (2 : Real) ^ R < Y := by
calc
(c : Real) * (2 : Real) ^ R =
((c : Real) * (2 : Real) ^ (R - s)) * (2 : Real) ^ s := by
conv_lhs => rw [hpowFactor R s]
ring
_ = ((n : Real) + 1 / 2) * (2 : Real) ^ s := by rw [← hboundary]
_ < Y := hupperMul
have hR : R = exp2.val - 53 ∨ R = exp2.val - 52 := Or.inl rfl
have hcross3 : V d3 < (c : Real) * (2 : Real) ^ (R - s) := by
rw [← hboundary]
exact hleft
exact hnoncross c R hR hcross3 hcrossY
· intro n
by_contra hbad
push_neg at hbad
rcases hbad with ⟨hleft, hright⟩
let c : Nat := 2 * n + 1
let R : Int := exp2.val - 52
let s : Int := exp2.val - 52
have hboundary : (2 * n + 1 : Nat) = (c : Real) *
(2 : Real) ^ (R - s) := by
have hexp : R - s = 0 := by dsimp [R, s]; omega
rw [hexp]
simp [c]
have hupperMul : ((2 * n + 1 : Nat) : Real) *
(2 : Real) ^ s < Y := (lt_div_iff₀ (zpow_pos (by norm_num) s)).mp hright
have hcrossY : (c : Real) * (2 : Real) ^ R < Y := by
calc
(c : Real) * (2 : Real) ^ R =
((c : Real) * (2 : Real) ^ (R - s)) * (2 : Real) ^ s := by
conv_lhs => rw [hpowFactor R s]
ring
_ = ((2 * n + 1 : Nat) : Real) * (2 : Real) ^ s := by
rw [← hboundary]
_ < Y := hupperMul
have hR : R = exp2.val - 53 ∨ R = exp2.val - 52 := Or.inr rfl
have hcross3 : V d3 < (c : Real) * (2 : Real) ^ (R - s) := by
rw [← hboundary]
exact hleft
exact hnoncross c R hR hcross3 hcrossY
end dec2flt_model
Proof structure
Follow the declared dependencies to read the supporting statements and proofs.
Uses
Used by
Inspect related source (152)
- Dec2flt_modelNumImpTraitsFloatU64 · traits.rs:309 Program Rust
- BITS · traits.rs:319 Program Rust
- LARGEST_POWER_OF_TEN · traits.rs:327 Program Rust
More program dependencies (110)
- MAX_EXPONENT_ROUND_TO_EVEN · traits.rs:325 Program Rust
- MIN_EXPONENT_ROUND_TO_EVEN · traits.rs:324 Program Rust
- SIG_TOTAL_BITS · traits.rs:320 Program Rust
- SMALLEST_POWER_OF_TEN · traits.rs:328 Program Rust
- DecimalSeq · dec2flt/decimal_seq.rs:22 Program Rust
- DECIMAL_POINT_RANGE · dec2flt/decimal_seq.rs:68 Program Rust
- MAX_DIGITS · dec2flt/decimal_seq.rs:64 Program Rust
- left_shift · dec2flt/decimal_seq.rs:130 Program Rust
- left_shift_loop0 · dec2flt/decimal_seq.rs:139 Program Rust
- body · dec2flt/decimal_seq.rs:139 Program Rust
- left_shift_loop1 · dec2flt/decimal_seq.rs:153 Program Rust
- body · dec2flt/decimal_seq.rs:153 Program Rust
- right_shift · dec2flt/decimal_seq.rs:176 Program Rust
- right_shift_loop0 · dec2flt/decimal_seq.rs:181 Program Rust
- body · dec2flt/decimal_seq.rs:181 Program Rust
- right_shift_loop0_loop0 · dec2flt/decimal_seq.rs:191 Program Rust
- body · dec2flt/decimal_seq.rs:191 Program Rust
- right_shift_loop1 · dec2flt/decimal_seq.rs:210 Program Rust
- body · dec2flt/decimal_seq.rs:210 Program Rust
- right_shift_loop2 · dec2flt/decimal_seq.rs:217 Program Rust
- body · dec2flt/decimal_seq.rs:217 Program Rust
- number_of_digits_decimal_left_shift · dec2flt/decimal_seq.rs:375 Program Rust
- number_of_digits_decimal_left_shift_loop · dec2flt/decimal_seq.rs:441 Program Rust
- body · dec2flt/decimal_seq.rs:441 Program Rust
- parse_long_mantissa · dec2flt/slow.rs:27 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
- parse_long_mantissa_loop0 · dec2flt/slow.rs:51 Program Rust
- body · dec2flt/slow.rs:51 Program Rust
- 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
- 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
- from_u64 · dec2flt/mod.rs:263 Program Rust
- EXP_MASK · traits.rs:321 Program Rust
- INFINITY · traits.rs:312 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
- classify · traits.rs:334 Program Rust
- to_bits · traits.rs:330 Program Rust
- Dec2flt_modelNumImpTraitsInt · traits.rs:51 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
- BiasedFp · dec2flt/common.rs:56 Program Rust
- zero_pow2 · dec2flt/common.rs:66 Program Rust
- ByteSlice · dec2flt/common.rs:4 Program Rust
- Decimal · dec2flt/decimal.rs:32 Program Rust
- default · dec2flt/decimal_seq.rs:34 Program Rust
- round · dec2flt/decimal_seq.rs:97 Program Rust
- round_loop · dec2flt/decimal_seq.rs:107 Program Rust
- body · dec2flt/decimal_seq.rs:107 Program Rust
- trim · dec2flt/decimal_seq.rs:83 Program Rust
- trim_loop · dec2flt/decimal_seq.rs:92 Program Rust
- body · dec2flt/decimal_seq.rs:92 Program Rust
- TABLE · dec2flt/decimal_seq.rs:377 Program Rust
- TABLE_POW5 · dec2flt/decimal_seq.rs:386 Program Rust
- parse_decimal_seq · dec2flt/decimal_seq.rs:288 Program Rust
- parse_decimal_seq_loop0 · dec2flt/decimal_seq.rs:296 Program Rust
- body · dec2flt/decimal_seq.rs:296 Program Rust
- parse_decimal_seq_loop1 · dec2flt/decimal_seq.rs:368 Program Rust
- body · dec2flt/decimal_seq.rs:368 Program Rust
- parse_decimal_seq_loop2 · dec2flt/decimal_seq.rs:309 Program Rust
- body · dec2flt/decimal_seq.rs:309 Program Rust
- parse_decimal_seq_loop3 · dec2flt/decimal_seq.rs:313 Program Rust
- body · dec2flt/decimal_seq.rs:313 Program Rust
- parse_decimal_seq_loop4 · dec2flt/decimal_seq.rs:368 Program Rust
- body · dec2flt/decimal_seq.rs:368 Program Rust
- parse_decimal_seq_loop5 · dec2flt/decimal_seq.rs:313 Program Rust
- body · dec2flt/decimal_seq.rs:313 Program Rust
- parse_decimal_seq_loop6 · dec2flt/decimal_seq.rs:368 Program Rust
- body · dec2flt/decimal_seq.rs:368 Program Rust
- parse_decimal_seq_loop7 · dec2flt/decimal_seq.rs:368 Program Rust
- body · dec2flt/decimal_seq.rs:368 Program Rust
- closure · dec2flt/slow.rs:33 Program Rust
- CastInto · traits.rs:18 Program Rust
- Float · traits.rs:74 Program Rust
- FloatExt · traits.rs:170 Program Rust
- Int · traits.rs:27 Program Rust
- read_u64 · dec2flt/common.rs:22 Program Rust
- write_u64 · dec2flt/common.rs:29 Program Rust
- Dec2flt_modelNumImpTraitsCastIntoI16 · traits.rs:45 Program Rust
- ONE · traits.rs:53 Program Rust
- ZERO · traits.rs:52 Program Rust
- is_8digits · dec2flt/common.rs:44 Program Rust
- MAX_DIGITS_WITHOUT_OVERFLOW · dec2flt/decimal_seq.rs:67 Program Rust
- count_trailing_zeros · dec2flt/decimal_seq.rs:236 Program Rust
- count_trailing_zeros_loop · dec2flt/decimal_seq.rs:240 Program Rust
- body · dec2flt/decimal_seq.rs:240 Program Rust
- final_decimal_point · dec2flt/decimal_seq.rs:269 Program Rust
- parse_digits_into_seq · dec2flt/decimal_seq.rs:257 Program Rust
- parse_digits_into_seq_loop · dec2flt/decimal_seq.rs:259 Program Rust
- body · dec2flt/decimal_seq.rs:259 Program Rust
- parse_scientific · dec2flt/parse.rs:121 Program Rust
- parse_scientific_loop · dec2flt/parse.rs:145 Program Rust
- body · dec2flt/parse.rs:145 Program Rust
- cast · traits.rs:46 Program Rust
- try_add_digit · dec2flt/decimal_seq.rs:74 Program Rust
Standard-library dependencies (39)
- MANTISSA_DIGITS · core/src/num/f64.rs:412 Rust library
- 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_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
- 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
- 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
- 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.P340_T1_selected_target_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 155 entries
- Binary64Model
- Binary64ModelDefault
- DecimalDigitLexScale
- DecimalLeftShiftDigitGrowth
- DecimalLeftShiftFirstLoopSemantics
- DecimalLeftShiftLoop1Execution
- DecimalLeftShiftLoopLex
- DecimalLeftShiftSecondLoopSemantics
- DecimalLeftShiftTableCertificate
- DecimalRightShiftU64DyadicBridge
- DecimalSeqLeftShiftRecordSemantics
- 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
- DecimalRightShiftFinalLoopSemantics
- DecimalRightShiftLoop0Execution
- DecimalRightShiftMainLoopSemantics
- DecimalRightShiftPrefixLoopSemantics
- DecimalSeqDyadicShiftSemantics
- DecimalSeqRightShiftRecordSemantics
- DecimalValueBounds
- LoopZeroRightShiftTransport
- RightLoopStep
- RightPrefixLengthBounds
- RightShiftCanonical
- SlowLoop0Execution
- FinalShiftCertificate
- LeftHistoryBoundary
- LeftLeadingProgress
- LeftLoopStep
- LeftShiftCertificate
- Loop1Execution
- Loop2Execution
- NormalizationBounds
- ReachableCapacity
- RightBoundaryTransport
- RightHistoryBoundary
- SeparationPackage
- GridAlignment
- GridBoundaryRetained
- LeftBoundaryTransport
- DecimalFoldBounds
- LeftShiftPointGrowth
- PointZeroGrowth
- SelectedLeftGrowth
- ExponentLowerBound
- PowerGridAlignment
- ResultLoopBackward
- LeftCoefficientTransport
- LeftHistoryInvariant
- LeftStepPotential
- CoefficientGridAlignment
- DecimalBinaryExponentBound
- LeftLoopBudgetTransition
- ParserExponentConstants
- 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 final decimal point
- 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 seq
- num imp dec2flt decimal seq parse digits into seq
- num imp dec2flt parse parse scientific
- 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": "P529_T1_SeparationPackage",
"closure_version": "patch_c_v1",
"active_decl_hash": "64f0bc07a289fd833fd0add89c1791a27e9dd7fd5ad7a29c1e60b934835408b8",
"active_statement_hash": "a39a916e9e2ea30a4cb0f96373fcaa0f11fc1bf4bcef962186bb3dce3eacb7da",
"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-200",
"boundary_theorems": {},
"strict_theorem_deps": {
"P472_T1_DecimalValueBounds": "4b5c924b5d52bc9d",
"P495_T1_SlowLoop0Execution": "5a1e49d921a1825a",
"P529_T1_FinalShiftCertificate": "6a5bd46c366c9837",
"P529_T1_LeftHistoryBoundary": "81ad17a70873ae99",
"P529_T1_Loop1Execution": "da66766413255a0f",
"P529_T1_Loop2Execution": "e8eeb6e19acff10b",
"P529_T1_NormalizationBounds": "deb4bf7513f18e80",
"P529_T1_ReachableCapacity": "eb6e974cd4ed2841",
"P529_T1_RightBoundaryTransport": "bb615631f8d7363c",
"P529_T1_RightHistoryBoundary": "2f9292b355b28e68",
"P798_T1_GridAlignment": "f2e86c75264ff7d3",
"P798_T1_LeftBoundaryTransport": "8382fe6b25ea536f",
"P856_T1_CoefficientGridAlignment": "811bf9ec1aa2ffd7",
"num_imp_dec2flt_decimal_seq_DecimalSeq": "3c283430b9003d37"
},
"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_DecimalSeq_right_shift": "1aaf1bb11c0b6a49",
"num_imp_dec2flt_slow_parse_long_mantissa": "f4b1825aa46c08b9"
}
}Prose assessment
{
"label": "Recorded Sound: VerifierPass",
"assessment_status": "VerifierPass",
"fingerprint_relation": "matches current fingerprint",
"assessment_fingerprint": "sound-v2:d0c9d0915c0468f276a043f9699a35ed0d2739be584e7cfe8666e3400f82b9ca",
"current_fingerprint": "sound-v2:d0c9d0915c0468f276a043f9699a35ed0d2739be584e7cfe8666e3400f82b9ca",
"superseded_for_theorem_closure": false
}Review verdicts
{
"corr_status": "Pass",
"sound_status": "Pass",
"substantiveness_status": "Pass"
}