Statement
This explanation was written alongside the formalization to describe the statement and its reasoning.
Lemma · Constructed final 53-bit shift
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_LeftShiftCertificate
import Tablet.P472_T1_DecimalValueBounds
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: P529_T1_FinalShiftCertificate]
theorem P529_T1_FinalShiftCertificate (X Y : Real)
(d2 : num.imp.dec2flt.decimal_seq.DecimalSeq) (exp2 : Std.I32)
(hpointLo : -18 <= d2.decimal_point.val)
(hpointHi : d2.decimal_point.val <= 0)
(hinput : d2.num_digits.val <= 768 /\
(forall b, b ∈ d2.digits.val.take d2.num_digits.val -> b.val < 10) /\
(exists h tail,
(d2.digits.val.take d2.num_digits.val).map (fun b => b.val) = h :: tail /\
1 <= h /\ h < 10 /\ (h :: tail).length = d2.num_digits.val))
(hupper : Y / (2 : Real) ^ (exp2.val + 1) <= 1) :
let V := fun a : num.imp.dec2flt.decimal_seq.DecimalSeq =>
((((a.digits.val.take a.num_digits.val).map (fun b => b.val)).foldl
(fun n z => 10 * n + z) 0 : Nat) : Real) *
(10 : Real) ^ (a.decimal_point.val - (a.num_digits.val : Int))
(exists eta2 u2 : Real,
X / (2 : Real) ^ (exp2.val + 1) = V d2 + eta2 /\
Y / (2 : Real) ^ (exp2.val + 1) = V d2 + u2 /\
0 <= eta2 /\ eta2 < u2 /\ (d2.truncated = true <-> 0 < eta2)) ->
exists d3 : num.imp.dec2flt.decimal_seq.DecimalSeq,
num.imp.dec2flt.decimal_seq.DecimalSeq.left_shift d2 53#usize = ok d3 /\
-18 <= d3.decimal_point.val /\ d3.decimal_point.val <= 16 /\
d3.num_digits.val <= 768 /\
(forall b, b ∈ d3.digits.val.take d3.num_digits.val -> b.val < 10) /\
(exists h tail,
(d3.digits.val.take d3.num_digits.val).map (fun b => b.val) = h :: tail /\
1 <= h /\ h < 10 /\ (h :: tail).length = d3.num_digits.val) /\
d3.digits.val[d3.num_digits.val - 1]? ≠ some 0#u8 /\
0 < X / (2 : Real) ^ (exp2.val - 52) /\
X / (2 : Real) ^ (exp2.val - 52) < (2 : Real) ^ (53 : Nat) /\
(exists eta3 u3 : Real,
X / (2 : Real) ^ (exp2.val - 52) = V d3 + eta3 /\
Y / (2 : Real) ^ (exp2.val - 52) = V d3 + u3 /\
0 <= eta3 /\ eta3 < u3 /\ (d3.truncated = true <-> 0 < eta3)) := 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 Vfun hinterval
rcases hinput with ⟨hcount, hdigits, hshape⟩
rcases hshape with ⟨head, tail, hword, hheadLo, hheadHi, hlen⟩
let V := fun a : num.imp.dec2flt.decimal_seq.DecimalSeq =>
((((a.digits.val.take a.num_digits.val).map (fun b => b.val)).foldl
(fun n z => 10 * n + z) 0 : Nat) : Real) *
(10 : Real) ^ (a.decimal_point.val - (a.num_digits.val : Int))
let xs := (d2.digits.val.take d2.num_digits.val).map (fun b => b.val)
have hxs : xs = head :: tail := hword
have hlenxs : xs.length = d2.num_digits.val := by rw [hxs]; exact hlen
have hxsDigits : ∀ q, q ∈ xs → q < 10 := by
intro q hq
rcases List.mem_map.mp hq with ⟨b, hb, hq⟩
have hb' := hdigits b hb
rw [← hq]
exact hb'
have hVbounds := P472_T1_DecimalValueBounds xs head tail hxs
hheadLo hxsDigits d2.decimal_point.val
have hVpos : 0 < V d2 := by
have hheadpos : (0 : Real) < (head : Nat) := by exact_mod_cast (by omega : 0 < head)
have hval := hVbounds.1
rw [hlenxs] at hval
have hpowpos : 0 < (10 : Real) ^ (d2.decimal_point.val - 1) :=
zpow_pos (by norm_num) _
have hmul : 0 < (head : Real) *
(10 : Real) ^ (d2.decimal_point.val - 1) := mul_pos hheadpos hpowpos
have : 0 < ((xs.foldl (fun n z => 10 * n + z) 0 : Nat) : Real) *
(10 : Real) ^ (d2.decimal_point.val - (d2.num_digits.val : Int)) :=
lt_of_lt_of_le hmul hval
simpa [V, xs] using this
rcases hinterval with ⟨eta2, u2, hXeq, hYeq, hetaLo, hetaLt, htrunc⟩
have hXpos0 : 0 < X / (2 : Real) ^ (exp2.val + 1) := by
rw [hXeq]
linarith
have hXYlt0 : X / (2 : Real) ^ (exp2.val + 1) <
Y / (2 : Real) ^ (exp2.val + 1) := by
rw [hXeq, hYeq]
linarith
have hshift := P529_T1_LeftShiftCertificate
(X / (2 : Real) ^ (exp2.val + 1))
(Y / (2 : Real) ^ (exp2.val + 1)) d2 53#usize
(by norm_num) (by omega) (by omega)
⟨hcount, hdigits, ⟨head, tail, hword, hheadLo, hheadHi, hlen⟩⟩
⟨eta2, u2, hXeq, hYeq, hetaLo, hetaLt, htrunc⟩
rcases hshift with ⟨d3, growth, hleft, hgrowth, hgrowthHi, hpointEq,
hpointLo3, hpointHi3, hcount3, hdigits3, hshape3, hlast3,
eta3, u3, hXscale, hYscale, heta3Lo, heta3Lt, htrunc3⟩
have hpointLoFinal : -18 <= d3.decimal_point.val := by
rw [hpointEq]
have hgrowthLo : (0 : Int) <= growth.val := Int.natCast_nonneg _
omega
have hscaleX : (2 : Real) ^ (53 : Nat) *
(X / (2 : Real) ^ (exp2.val + 1)) = X / (2 : Real) ^ (exp2.val - 52) := by
rw [div_eq_mul_inv, div_eq_mul_inv]
rw [← zpow_neg, ← zpow_neg]
calc
(2 : Real) ^ (53 : Nat) * (X * (2 : Real) ^ (-(exp2.val + 1))) =
((2 : Real) ^ (53 : Nat) * (2 : Real) ^ (-(exp2.val + 1))) * X := by ring
_ = (2 : Real) ^ (-(exp2.val - 52)) * X := by
rw [← zpow_natCast (2 : Real) 53]
rw [← zpow_add₀ (by norm_num : (2 : Real) ≠ 0)]
rw [show (↑(53 : Nat) : Int) + -(exp2.val + 1) =
-(exp2.val - 52) by norm_num; omega]
_ = X * (2 : Real) ^ (-(exp2.val - 52)) := by ring
have hscaleY : (2 : Real) ^ (53 : Nat) *
(Y / (2 : Real) ^ (exp2.val + 1)) = Y / (2 : Real) ^ (exp2.val - 52) := by
rw [div_eq_mul_inv, div_eq_mul_inv]
rw [← zpow_neg, ← zpow_neg]
calc
(2 : Real) ^ (53 : Nat) * (Y * (2 : Real) ^ (-(exp2.val + 1))) =
((2 : Real) ^ (53 : Nat) * (2 : Real) ^ (-(exp2.val + 1))) * Y := by ring
_ = (2 : Real) ^ (-(exp2.val - 52)) * Y := by
rw [← zpow_natCast (2 : Real) 53]
rw [← zpow_add₀ (by norm_num : (2 : Real) ≠ 0)]
rw [show (↑(53 : Nat) : Int) + -(exp2.val + 1) =
-(exp2.val - 52) by norm_num; omega]
_ = Y * (2 : Real) ^ (-(exp2.val - 52)) := by ring
have hXeq3 : X / (2 : Real) ^ (exp2.val - 52) = V d3 + eta3 := by
calc
X / (2 : Real) ^ (exp2.val - 52) =
(2 : Real) ^ (53 : Nat) *
(X / (2 : Real) ^ (exp2.val + 1)) := hscaleX.symm
_ = V d3 + eta3 := hXscale
have hYeq3 : Y / (2 : Real) ^ (exp2.val - 52) = V d3 + u3 := by
calc
Y / (2 : Real) ^ (exp2.val - 52) =
(2 : Real) ^ (53 : Nat) *
(Y / (2 : Real) ^ (exp2.val + 1)) := hscaleY.symm
_ = V d3 + u3 := hYscale
have hXltY0 : X / (2 : Real) ^ (exp2.val + 1) < 1 := lt_of_lt_of_le hXYlt0 hupper
have hXlt1 : X / (2 : Real) ^ (exp2.val + 1) < 1 := hXltY0
have hpow53pos : (0 : Real) < (2 : Real) ^ (53 : Nat) := by positivity
have hXpos3 : 0 < X / (2 : Real) ^ (exp2.val - 52) := by
rw [← hscaleX]
exact mul_pos hpow53pos hXpos0
have hXlt3 : X / (2 : Real) ^ (exp2.val - 52) < (2 : Real) ^ (53 : Nat) := by
rw [← hscaleX]
nlinarith
have hV3le : V d3 <= X / (2 : Real) ^ (exp2.val - 52) := by
rw [hXeq3]
linarith
rcases hshape3 with ⟨head3, tail3, hword3, hhead3Lo, hhead3Hi, hlen3⟩
let xs3 := (d3.digits.val.take d3.num_digits.val).map (fun b => b.val)
have hxs3 : xs3 = head3 :: tail3 := hword3
have hxs3Digits : ∀ q, q ∈ xs3 → q < 10 := by
intro q hq
rcases List.mem_map.mp hq with ⟨b, hb, hq⟩
have hb' := hdigits3 b hb
rw [← hq]
exact hb'
have hlenxs3 : xs3.length = d3.num_digits.val := by rw [hxs3]; exact hlen3
have hV3bounds := P472_T1_DecimalValueBounds xs3 head3 tail3 hxs3
hhead3Lo hxs3Digits d3.decimal_point.val
have hpointHiFinal : d3.decimal_point.val <= 16 := by
by_contra hnot
have hgt : 16 < d3.decimal_point.val := by omega
have hptle : d3.decimal_point.val <= 19 := hpointHi3
have hhead3pos : (1 : Real) ≤ (head3 : Nat) := by exact_mod_cast hhead3Lo
have hpowbound : (2 : Real) ^ (53 : Nat) < (10 : Real) ^ (16 : Nat) := by norm_num
have hp : d3.decimal_point.val = 17 ∨ d3.decimal_point.val = 18 ∨
d3.decimal_point.val = 19 := by omega
have hVlarge : (10 : Real) ^ (16 : Nat) <= V d3 := by
rcases hp with hp | hp | hp
· have hpowlower := hV3bounds.1
rw [hp, hlenxs3] at hpowlower
have hleft : (10 : Real) ^ (16 : Nat) <=
(head3 : Real) * (10 : Real) ^ (16 : Nat) := by nlinarith
calc
(10 : Real) ^ (16 : Nat) <= (head3 : Real) * (10 : Real) ^ (16 : Nat) := hleft
_ <= V d3 := by simpa [V, xs3, hlenxs3, hp] using hpowlower
· have hpowlower := hV3bounds.1
rw [hp, hlenxs3] at hpowlower
have hleft : (10 : Real) ^ (16 : Nat) <=
(head3 : Real) * (10 : Real) ^ (17 : Nat) := by nlinarith
calc
(10 : Real) ^ (16 : Nat) <= (head3 : Real) * (10 : Real) ^ (17 : Nat) := hleft
_ <= V d3 := by simpa [V, xs3, hlenxs3, hp] using hpowlower
· have hpowlower := hV3bounds.1
rw [hp, hlenxs3] at hpowlower
have hleft : (10 : Real) ^ (16 : Nat) <=
(head3 : Real) * (10 : Real) ^ (18 : Nat) := by nlinarith
calc
(10 : Real) ^ (16 : Nat) <= (head3 : Real) * (10 : Real) ^ (18 : Nat) := hleft
_ <= V d3 := by simpa [V, xs3, hlenxs3, hp] using hpowlower
linarith
refine ⟨d3, hleft, hpointLoFinal, hpointHiFinal, hcount3, hdigits3,
⟨head3, tail3, hword3, hhead3Lo, hhead3Hi, hlen3⟩, hlast3, hXpos3, hXlt3, ?_⟩
exact ⟨eta3, u3, hXeq3, hYeq3, heta3Lo, heta3Lt, htrunc3⟩
end dec2flt_model
Download Lean source · Download TeX source
Complete Lean module
import Tablet.P529_T1_LeftShiftCertificate
import Tablet.P472_T1_DecimalValueBounds
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: P529_T1_FinalShiftCertificate]
theorem P529_T1_FinalShiftCertificate (X Y : Real)
(d2 : num.imp.dec2flt.decimal_seq.DecimalSeq) (exp2 : Std.I32)
(hpointLo : -18 <= d2.decimal_point.val)
(hpointHi : d2.decimal_point.val <= 0)
(hinput : d2.num_digits.val <= 768 /\
(forall b, b ∈ d2.digits.val.take d2.num_digits.val -> b.val < 10) /\
(exists h tail,
(d2.digits.val.take d2.num_digits.val).map (fun b => b.val) = h :: tail /\
1 <= h /\ h < 10 /\ (h :: tail).length = d2.num_digits.val))
(hupper : Y / (2 : Real) ^ (exp2.val + 1) <= 1) :
let V := fun a : num.imp.dec2flt.decimal_seq.DecimalSeq =>
((((a.digits.val.take a.num_digits.val).map (fun b => b.val)).foldl
(fun n z => 10 * n + z) 0 : Nat) : Real) *
(10 : Real) ^ (a.decimal_point.val - (a.num_digits.val : Int))
(exists eta2 u2 : Real,
X / (2 : Real) ^ (exp2.val + 1) = V d2 + eta2 /\
Y / (2 : Real) ^ (exp2.val + 1) = V d2 + u2 /\
0 <= eta2 /\ eta2 < u2 /\ (d2.truncated = true <-> 0 < eta2)) ->
exists d3 : num.imp.dec2flt.decimal_seq.DecimalSeq,
num.imp.dec2flt.decimal_seq.DecimalSeq.left_shift d2 53#usize = ok d3 /\
-18 <= d3.decimal_point.val /\ d3.decimal_point.val <= 16 /\
d3.num_digits.val <= 768 /\
(forall b, b ∈ d3.digits.val.take d3.num_digits.val -> b.val < 10) /\
(exists h tail,
(d3.digits.val.take d3.num_digits.val).map (fun b => b.val) = h :: tail /\
1 <= h /\ h < 10 /\ (h :: tail).length = d3.num_digits.val) /\
d3.digits.val[d3.num_digits.val - 1]? ≠ some 0#u8 /\
0 < X / (2 : Real) ^ (exp2.val - 52) /\
X / (2 : Real) ^ (exp2.val - 52) < (2 : Real) ^ (53 : Nat) /\
(exists eta3 u3 : Real,
X / (2 : Real) ^ (exp2.val - 52) = V d3 + eta3 /\
Y / (2 : Real) ^ (exp2.val - 52) = V d3 + u3 /\
0 <= eta3 /\ eta3 < u3 /\ (d3.truncated = true <-> 0 < eta3)) := by
-- BODY
intro Vfun hinterval
rcases hinput with ⟨hcount, hdigits, hshape⟩
rcases hshape with ⟨head, tail, hword, hheadLo, hheadHi, hlen⟩
let V := fun a : num.imp.dec2flt.decimal_seq.DecimalSeq =>
((((a.digits.val.take a.num_digits.val).map (fun b => b.val)).foldl
(fun n z => 10 * n + z) 0 : Nat) : Real) *
(10 : Real) ^ (a.decimal_point.val - (a.num_digits.val : Int))
let xs := (d2.digits.val.take d2.num_digits.val).map (fun b => b.val)
have hxs : xs = head :: tail := hword
have hlenxs : xs.length = d2.num_digits.val := by rw [hxs]; exact hlen
have hxsDigits : ∀ q, q ∈ xs → q < 10 := by
intro q hq
rcases List.mem_map.mp hq with ⟨b, hb, hq⟩
have hb' := hdigits b hb
rw [← hq]
exact hb'
have hVbounds := P472_T1_DecimalValueBounds xs head tail hxs
hheadLo hxsDigits d2.decimal_point.val
have hVpos : 0 < V d2 := by
have hheadpos : (0 : Real) < (head : Nat) := by exact_mod_cast (by omega : 0 < head)
have hval := hVbounds.1
rw [hlenxs] at hval
have hpowpos : 0 < (10 : Real) ^ (d2.decimal_point.val - 1) :=
zpow_pos (by norm_num) _
have hmul : 0 < (head : Real) *
(10 : Real) ^ (d2.decimal_point.val - 1) := mul_pos hheadpos hpowpos
have : 0 < ((xs.foldl (fun n z => 10 * n + z) 0 : Nat) : Real) *
(10 : Real) ^ (d2.decimal_point.val - (d2.num_digits.val : Int)) :=
lt_of_lt_of_le hmul hval
simpa [V, xs] using this
rcases hinterval with ⟨eta2, u2, hXeq, hYeq, hetaLo, hetaLt, htrunc⟩
have hXpos0 : 0 < X / (2 : Real) ^ (exp2.val + 1) := by
rw [hXeq]
linarith
have hXYlt0 : X / (2 : Real) ^ (exp2.val + 1) <
Y / (2 : Real) ^ (exp2.val + 1) := by
rw [hXeq, hYeq]
linarith
have hshift := P529_T1_LeftShiftCertificate
(X / (2 : Real) ^ (exp2.val + 1))
(Y / (2 : Real) ^ (exp2.val + 1)) d2 53#usize
(by norm_num) (by omega) (by omega)
⟨hcount, hdigits, ⟨head, tail, hword, hheadLo, hheadHi, hlen⟩⟩
⟨eta2, u2, hXeq, hYeq, hetaLo, hetaLt, htrunc⟩
rcases hshift with ⟨d3, growth, hleft, hgrowth, hgrowthHi, hpointEq,
hpointLo3, hpointHi3, hcount3, hdigits3, hshape3, hlast3,
eta3, u3, hXscale, hYscale, heta3Lo, heta3Lt, htrunc3⟩
have hpointLoFinal : -18 <= d3.decimal_point.val := by
rw [hpointEq]
have hgrowthLo : (0 : Int) <= growth.val := Int.natCast_nonneg _
omega
have hscaleX : (2 : Real) ^ (53 : Nat) *
(X / (2 : Real) ^ (exp2.val + 1)) = X / (2 : Real) ^ (exp2.val - 52) := by
rw [div_eq_mul_inv, div_eq_mul_inv]
rw [← zpow_neg, ← zpow_neg]
calc
(2 : Real) ^ (53 : Nat) * (X * (2 : Real) ^ (-(exp2.val + 1))) =
((2 : Real) ^ (53 : Nat) * (2 : Real) ^ (-(exp2.val + 1))) * X := by ring
_ = (2 : Real) ^ (-(exp2.val - 52)) * X := by
rw [← zpow_natCast (2 : Real) 53]
rw [← zpow_add₀ (by norm_num : (2 : Real) ≠ 0)]
rw [show (↑(53 : Nat) : Int) + -(exp2.val + 1) =
-(exp2.val - 52) by norm_num; omega]
_ = X * (2 : Real) ^ (-(exp2.val - 52)) := by ring
have hscaleY : (2 : Real) ^ (53 : Nat) *
(Y / (2 : Real) ^ (exp2.val + 1)) = Y / (2 : Real) ^ (exp2.val - 52) := by
rw [div_eq_mul_inv, div_eq_mul_inv]
rw [← zpow_neg, ← zpow_neg]
calc
(2 : Real) ^ (53 : Nat) * (Y * (2 : Real) ^ (-(exp2.val + 1))) =
((2 : Real) ^ (53 : Nat) * (2 : Real) ^ (-(exp2.val + 1))) * Y := by ring
_ = (2 : Real) ^ (-(exp2.val - 52)) * Y := by
rw [← zpow_natCast (2 : Real) 53]
rw [← zpow_add₀ (by norm_num : (2 : Real) ≠ 0)]
rw [show (↑(53 : Nat) : Int) + -(exp2.val + 1) =
-(exp2.val - 52) by norm_num; omega]
_ = Y * (2 : Real) ^ (-(exp2.val - 52)) := by ring
have hXeq3 : X / (2 : Real) ^ (exp2.val - 52) = V d3 + eta3 := by
calc
X / (2 : Real) ^ (exp2.val - 52) =
(2 : Real) ^ (53 : Nat) *
(X / (2 : Real) ^ (exp2.val + 1)) := hscaleX.symm
_ = V d3 + eta3 := hXscale
have hYeq3 : Y / (2 : Real) ^ (exp2.val - 52) = V d3 + u3 := by
calc
Y / (2 : Real) ^ (exp2.val - 52) =
(2 : Real) ^ (53 : Nat) *
(Y / (2 : Real) ^ (exp2.val + 1)) := hscaleY.symm
_ = V d3 + u3 := hYscale
have hXltY0 : X / (2 : Real) ^ (exp2.val + 1) < 1 := lt_of_lt_of_le hXYlt0 hupper
have hXlt1 : X / (2 : Real) ^ (exp2.val + 1) < 1 := hXltY0
have hpow53pos : (0 : Real) < (2 : Real) ^ (53 : Nat) := by positivity
have hXpos3 : 0 < X / (2 : Real) ^ (exp2.val - 52) := by
rw [← hscaleX]
exact mul_pos hpow53pos hXpos0
have hXlt3 : X / (2 : Real) ^ (exp2.val - 52) < (2 : Real) ^ (53 : Nat) := by
rw [← hscaleX]
nlinarith
have hV3le : V d3 <= X / (2 : Real) ^ (exp2.val - 52) := by
rw [hXeq3]
linarith
rcases hshape3 with ⟨head3, tail3, hword3, hhead3Lo, hhead3Hi, hlen3⟩
let xs3 := (d3.digits.val.take d3.num_digits.val).map (fun b => b.val)
have hxs3 : xs3 = head3 :: tail3 := hword3
have hxs3Digits : ∀ q, q ∈ xs3 → q < 10 := by
intro q hq
rcases List.mem_map.mp hq with ⟨b, hb, hq⟩
have hb' := hdigits3 b hb
rw [← hq]
exact hb'
have hlenxs3 : xs3.length = d3.num_digits.val := by rw [hxs3]; exact hlen3
have hV3bounds := P472_T1_DecimalValueBounds xs3 head3 tail3 hxs3
hhead3Lo hxs3Digits d3.decimal_point.val
have hpointHiFinal : d3.decimal_point.val <= 16 := by
by_contra hnot
have hgt : 16 < d3.decimal_point.val := by omega
have hptle : d3.decimal_point.val <= 19 := hpointHi3
have hhead3pos : (1 : Real) ≤ (head3 : Nat) := by exact_mod_cast hhead3Lo
have hpowbound : (2 : Real) ^ (53 : Nat) < (10 : Real) ^ (16 : Nat) := by norm_num
have hp : d3.decimal_point.val = 17 ∨ d3.decimal_point.val = 18 ∨
d3.decimal_point.val = 19 := by omega
have hVlarge : (10 : Real) ^ (16 : Nat) <= V d3 := by
rcases hp with hp | hp | hp
· have hpowlower := hV3bounds.1
rw [hp, hlenxs3] at hpowlower
have hleft : (10 : Real) ^ (16 : Nat) <=
(head3 : Real) * (10 : Real) ^ (16 : Nat) := by nlinarith
calc
(10 : Real) ^ (16 : Nat) <= (head3 : Real) * (10 : Real) ^ (16 : Nat) := hleft
_ <= V d3 := by simpa [V, xs3, hlenxs3, hp] using hpowlower
· have hpowlower := hV3bounds.1
rw [hp, hlenxs3] at hpowlower
have hleft : (10 : Real) ^ (16 : Nat) <=
(head3 : Real) * (10 : Real) ^ (17 : Nat) := by nlinarith
calc
(10 : Real) ^ (16 : Nat) <= (head3 : Real) * (10 : Real) ^ (17 : Nat) := hleft
_ <= V d3 := by simpa [V, xs3, hlenxs3, hp] using hpowlower
· have hpowlower := hV3bounds.1
rw [hp, hlenxs3] at hpowlower
have hleft : (10 : Real) ^ (16 : Nat) <=
(head3 : Real) * (10 : Real) ^ (18 : Nat) := by nlinarith
calc
(10 : Real) ^ (16 : Nat) <= (head3 : Real) * (10 : Real) ^ (18 : Nat) := hleft
_ <= V d3 := by simpa [V, xs3, hlenxs3, hp] using hpowlower
linarith
refine ⟨d3, hleft, hpointLoFinal, hpointHiFinal, hcount3, hdigits3,
⟨head3, tail3, hword3, hhead3Lo, hhead3Hi, hlen3⟩, hlast3, hXpos3, hXlt3, ?_⟩
exact ⟨eta3, u3, hXeq3, hYeq3, heta3Lo, heta3Lt, htrunc3⟩
end dec2flt_model
Proof structure
Follow the declared dependencies to read the supporting statements and proofs.
Inspect related source (117)
- DecimalSeq · dec2flt/decimal_seq.rs:22 Program Rust
- default · dec2flt/decimal_seq.rs:34 Program Rust
- left_shift · dec2flt/decimal_seq.rs:130 Program Rust
More program dependencies (84)
- 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
- 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
- number_of_digits_decimal_left_shift · dec2flt/decimal_seq.rs:375 Program Rust
- TABLE · dec2flt/decimal_seq.rs:377 Program Rust
- TABLE_POW5 · dec2flt/decimal_seq.rs:386 Program Rust
- number_of_digits_decimal_left_shift_loop · dec2flt/decimal_seq.rs:441 Program Rust
- body · dec2flt/decimal_seq.rs:441 Program Rust
- from_u64 · dec2flt/mod.rs:263 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
- ByteSlice · dec2flt/common.rs:4 Program Rust
- Decimal · dec2flt/decimal.rs:32 Program Rust
- DECIMAL_POINT_RANGE · dec2flt/decimal_seq.rs:68 Program Rust
- MAX_DIGITS · dec2flt/decimal_seq.rs:64 Program Rust
- 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
- 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
- CastInto · traits.rs:18 Program Rust
- Float · traits.rs:74 Program Rust
- FloatExt · traits.rs:170 Program Rust
- Int · traits.rs:27 Program Rust
- zero_pow2 · dec2flt/common.rs:66 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
- 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
- MAX_SHIFT · dec2flt/slow.rs:28 Program Rust
- call · dec2flt/slow.rs:33 Program Rust
- read_u64 · dec2flt/common.rs:22 Program Rust
- write_u64 · dec2flt/common.rs:29 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
- NUM_POWERS · dec2flt/slow.rs:29 Program Rust
- POWERS · dec2flt/slow.rs:30 Program Rust
- closure · dec2flt/slow.rs:33 Program Rust
- try_add_digit · dec2flt/decimal_seq.rs:74 Program Rust
Standard-library dependencies (30)
- 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
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
- DecimalDigitLexScale
- DecimalLeftShiftDigitGrowth
- DecimalLeftShiftFirstLoopSemantics
- DecimalLeftShiftLoop1Execution
- DecimalLeftShiftLoopLex
- DecimalLeftShiftSecondLoopSemantics
All 31 entries
- DecimalDigitLexScale
- DecimalLeftShiftDigitGrowth
- DecimalLeftShiftFirstLoopSemantics
- DecimalLeftShiftLoop1Execution
- DecimalLeftShiftLoopLex
- DecimalLeftShiftSecondLoopSemantics
- DecimalLeftShiftTableCertificate
- DecimalRightShiftU64DyadicBridge
- DecimalSeqLeftShiftRecordSemantics
- DecimalSeqTrimSemantics
- DecimalRightShiftFinalLoopSemantics
- DecimalRightShiftMainLoopSemantics
- DecimalRightShiftPrefixLoopSemantics
- DecimalSeqDyadicShiftSemantics
- DecimalSeqRightShiftRecordSemantics
- DecimalValueBounds
- FinalShiftCertificate
- LeftShiftCertificate
- DecimalFoldBounds
- LeftShiftPointGrowth
- PositiveScaleErrorTransport
- ResultLoopPartial
- num imp dec2flt decimal seq DecimalSeq
- num imp dec2flt decimal seq DecimalSeq DECIMAL POINT RANGE
- num imp dec2flt decimal seq DecimalSeq MAX DIGITS
- num imp dec2flt decimal seq DecimalSeq left shift
- num imp dec2flt decimal seq DecimalSeq right shift
- num imp dec2flt decimal seq DecimalSeq trim
- 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
Technical checking records
Local closure summary
{
"node": "P529_T1_FinalShiftCertificate",
"closure_version": "patch_c_v1",
"active_decl_hash": "e102052f939fbcabc5b64117d0774aa27107d5b7461a3f0b6701d1a8ffbfb8e7",
"active_statement_hash": "88062fda152f07ed8b566e5eeb083eaa8255ab57824cbf1520e36fd98d256aa9",
"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-181",
"boundary_theorems": {},
"strict_theorem_deps": {
"P472_T1_DecimalValueBounds": "4b5c924b5d52bc9d",
"P529_T1_LeftShiftCertificate": "abbc26ccb53b0399"
},
"strict_definition_deps": {
"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"
}
}Prose assessment
{
"label": "Recorded Sound: VerifierPass",
"assessment_status": "VerifierPass",
"fingerprint_relation": "matches current fingerprint",
"assessment_fingerprint": "sound-v2:ce99cb98e139be4d070f124c3323d8bc29687683f73060fb409efd44046349a0",
"current_fingerprint": "sound-v2:ce99cb98e139be4d070f124c3323d8bc29687683f73060fb409efd44046349a0",
"superseded_for_theorem_closure": false
}Review verdicts
{
"corr_status": "Pass",
"sound_status": "Pass",
"substantiveness_status": "Pass"
}