Statement
This explanation was written alongside the formalization to describe the statement and its reasoning.
Helper · Quantitative step of slow normalization loop zero
Lean statement
Trellis authored these statements and proofs. Lean checks the formal proofs; the assumptions used by each proof are listed below.
import Tablet.DecimalSeqRightShiftCanonical
import Tablet.DecimalSeqRightShiftRecordSemantics
import Tablet.DecimalRightShiftLoop0Execution
import Tablet.DecimalRightShiftPrefixLoopSemantics
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64
import Tablet.P804_T1_DecimalValueBounds
import Tablet.P804_T1_RightPrefixLengthBounds
import Tablet.SlowShiftSelectorCertificate
import Tablet.num_imp_dec2flt_decimal_seq_DecimalSeq_DECIMAL_POINT_RANGE
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: P804_T1_RightLoopStep]
theorem P804_T1_RightLoopStep
(X Y : Real) (d : num.imp.dec2flt.decimal_seq.DecimalSeq)
(exp : Std.I32)
(hpointLo : 1 <= d.decimal_point.val)
(hpointHi : d.decimal_point.val < 310)
(hexpLo : 0 <= exp.val) (hexpHi : exp.val <= 1260)
(hinput :
let digits :=
(d.digits.val.take d.num_digits.val).map (fun q => q.val)
d.num_digits.val <= 768 /\
(forall q, q ∈ d.digits.val.take d.num_digits.val -> q.val < 10) /\
(exists z zs, digits = z :: zs /\ 1 <= z /\ z < 10 /\
digits.length = d.num_digits.val))
(hend :
let digits :=
(d.digits.val.take d.num_digits.val).map (fun q => q.val)
let I : Nat := digits.foldl (fun n q => 10 * n + q) 0
let V : Real := I * (10 : Real) ^
(d.decimal_point.val - (d.num_digits.val : Int))
exists eta u : Real, X = V + eta /\ Y = V + u /\
0 <= eta /\ eta < u /\ (d.truncated = true <-> 0 < eta)) :
exists (d' : num.imp.dec2flt.decimal_seq.DecimalSeq)
(shift : Std.Usize) (exp' : Std.I32) (read : Std.Usize)
(acc : Std.U64),
num.imp.dec2flt.slow.parse_long_mantissa_loop0.body
F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
{ m := 0#u64, p_biased := 0#i32 }
d.num_digits d.decimal_point d.truncated d.digits exp none =
ok (cont (d'.num_digits, d'.decimal_point, d'.truncated,
d'.digits, exp', none)) /\
num.imp.dec2flt.decimal_seq.DecimalSeq.right_shift d shift = ok d' /\
shift.val <= 60 /\
exp'.val = exp.val + (shift.val : Int) /\
(19 <= d.decimal_point.val ->
d'.decimal_point.val = d.decimal_point.val - 18 \/
d'.decimal_point.val = d.decimal_point.val - 19) /\
(d.decimal_point.val <= 18 ->
d'.decimal_point.val = 0 \/ d'.decimal_point.val = 1) /\
(let digits' :=
(d'.digits.val.take d'.num_digits.val).map (fun q => q.val)
let I' : Nat := digits'.foldl (fun n q => 10 * n + q) 0
let V' : Real := I' * (10 : Real) ^
(d'.decimal_point.val - (d'.num_digits.val : Int))
d'.num_digits.val <= 768 /\
(forall q, q ∈ d'.digits.val.take d'.num_digits.val -> q.val < 10) /\
(exists z zs, digits' = z :: zs /\ 1 <= z /\ z < 10 /\
digits'.length = d'.num_digits.val) /\
(exists eta' u' : Real,
X / (2 : Real) ^ shift.val = V' + eta' /\
Y / (2 : Real) ^ shift.val = V' + u' /\
0 <= eta' /\ eta' < u' /\
(d'.truncated = true <-> 0 < eta'))) /\
(d.decimal_point.val = 1 -> d'.decimal_point.val = 1 ->
exists zs,
(d'.digits.val.take d'.num_digits.val).map (fun q => q.val) =
1 :: zs) /\
(d.decimal_point.val = 1 ->
(exists zs,
(d.digits.val.take d.num_digits.val).map (fun q => q.val) =
1 :: zs) -> d'.decimal_point.val = 0) := 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
dsimp only at hinput hend
rcases hinput with ⟨hcap, hdigit, z, zs, hshape, hzLo, hzHi, hlen⟩
have hlenCons : (z :: zs).length = d.num_digits.val := by
rw [← hshape]
exact hlen
let n : Std.Usize := IScalar.hcast .Usize d.decimal_point
have hnVal' : (n.val : Int) = d.decimal_point.val := by
have hs := IScalar.hcast_inBounds_spec .Usize d.decimal_point (by
scalar_tac)
simpa [n, lift, WP.spec_ok] using hs
let shift : Std.Usize := match n.val with
| 0 => 0#usize | 1 => 3#usize | 2 => 6#usize | 3 => 9#usize
| 4 => 13#usize | 5 => 16#usize | 6 => 19#usize | 7 => 23#usize
| 8 => 26#usize | 9 => 29#usize | 10 => 33#usize | 11 => 36#usize
| 12 => 39#usize | 13 => 43#usize | 14 => 46#usize | 15 => 49#usize
| 16 => 53#usize | 17 => 56#usize | 18 => 59#usize | _ => 60#usize
have hsel := SlowShiftSelectorCertificate
F64.Insts.Dec2flt_modelNumImpTraitsFloatU64 n
change
num.imp.dec2flt.slow.parse_long_mantissa.closure.Insts.CoreOpsFunctionFnTupleUsizeUsize.call
F64.Insts.Dec2flt_modelNumImpTraitsFloatU64 () n = ok shift /\
shift.val <= 60 /\
(n.val = 0 -> shift.val = 0) /\
(1 <= n.val -> n.val <= 18 ->
2 ^ shift.val <= 10 ^ n.val /\ 10 ^ n.val < 2 ^ (shift.val + 1)) /\
(19 <= n.val -> shift.val = 60 /\
10 ^ 18 < 2 ^ 60 /\ 2 ^ 60 < 10 ^ 19) at hsel
rcases hsel with ⟨hselector, hshift, hzero, hsmall, hlarge⟩
obtain ⟨read, acc, d', hpref, hreadLo, hreadHi, haccLo, haccHi,
hprosLo, hprosHi, hright, hpoint, hnonzero⟩ :=
DecimalRightShiftLoop0Execution d shift hshift (by omega) hpointHi
⟨hcap, hdigit, z, zs, hshape, hzLo, hzHi, hlenCons⟩
have hprefix := P804_T1_RightPrefixLengthBounds d d shift read acc false
hshift hcap hdigit z zs hshape hzLo hlenCons hpref
have hprogressLarge : 19 <= d.decimal_point.val ->
d'.decimal_point.val = d.decimal_point.val - 18 \/
d'.decimal_point.val = d.decimal_point.val - 19 := by
intro hp
have hn19 : 19 <= n.val := by omega
obtain ⟨hk, hp18, hp19⟩ := hlarge hn19
have hr : read.val = 19 \/ read.val = 20 := by
rw [hk] at haccLo haccHi
norm_num at hp18 hp19 haccLo haccHi
rcases hprefix with ⟨hrlo, hrhi⟩
by_contra hnot
have hc : read.val <= 18 \/ 21 <= read.val := by omega
rcases hc with hc | hc
· have hpwr : 10 ^ read.val <= 10 ^ 18 :=
Nat.pow_le_pow_right (by omega) (by omega)
omega
· have hpwr : 10 ^ 20 <= 10 ^ (read.val - 1) :=
Nat.pow_le_pow_right (by omega) (by omega)
omega
rw [hpoint]
rcases hr with hr | hr <;> omega
have hprogressSmall : d.decimal_point.val <= 18 ->
d'.decimal_point.val = 0 \/ d'.decimal_point.val = 1 := by
intro hp
have hn1 : 1 <= n.val := by omega
have hn18 : n.val <= 18 := by omega
obtain ⟨hpowLo, hpowHi⟩ := hsmall hn1 hn18
have hten : 10 ^ (n.val - 1) < 2 ^ shift.val := by
have hpowTen : 10 ^ n.val = 10 ^ (n.val - 1) * 10 := by
calc
10 ^ n.val = 10 ^ ((n.val - 1) + 1) := by congr 1 <;> omega
_ = 10 ^ (n.val - 1) * 10 := by rw [pow_succ]
have hpowTwo : 2 ^ (shift.val + 1) = 2 ^ shift.val * 2 := by
rw [pow_succ]
rw [hpowTen] at hpowHi
rw [hpowTwo] at hpowHi
nlinarith [pow_pos (by omega : 0 < 10) (n.val - 1)]
have hr : read.val = n.val \/ read.val = n.val + 1 := by
rcases hprefix with ⟨hrlo, hrhi⟩
by_contra hnot
have hc : read.val < n.val \/ n.val + 1 < read.val := by omega
rcases hc with hc | hc
· have hpwr : 10 ^ read.val <= 10 ^ (n.val - 1) :=
Nat.pow_le_pow_right (by omega) (by omega)
omega
· have hpwr : 10 ^ (n.val + 1) <= 10 ^ read.val :=
Nat.pow_le_pow_right (by omega) (by omega)
have hpwr' : 10 ^ (n.val + 1) <= 10 ^ (read.val - 1) :=
Nat.pow_le_pow_right (by omega) (by omega)
have haccUpper : acc.val < 10 ^ (n.val + 1) := by
calc
acc.val < 10 * 2 ^ shift.val := haccHi
_ <= 10 * 10 ^ n.val := Nat.mul_le_mul_left 10 hpowLo
_ = 10 ^ (n.val + 1) := by rw [pow_succ]; ring
omega
rw [hpoint]
rcases hr with hr | hr <;> omega
have hcanon := DecimalSeqRightShiftCanonical d d' shift X Y
⟨hcap, hdigit, z, zs, hshape, hzLo, hzHi, hlen⟩ hend hshift hright hnonzero
dsimp only at hcanon
rcases hcanon with ⟨hcap', hdigit', hshape', hend', hpointLower⟩
rcases hshape' with ⟨z', zs', hshape', hz'Lo, hz'Hi, hlen', hlast'⟩
have hstall : d.decimal_point.val = 1 -> d'.decimal_point.val = 1 ->
exists tail,
(d'.digits.val.take d'.num_digits.val).map (fun q => q.val) =
1 :: tail := by
intro hp hp'
have hinBounds := P804_T1_DecimalValueBounds
((d.digits.val.take d.num_digits.val).map (fun q => q.val))
z zs hshape hzLo (by
intro q hq
simp only [List.mem_map] at hq
rcases hq with ⟨u, hu, rfl⟩
exact hdigit u hu) d.decimal_point.val
have houtBounds := P804_T1_DecimalValueBounds
((d'.digits.val.take d'.num_digits.val).map (fun q => q.val))
z' zs' hshape' hz'Lo (by
intro q hq
simp only [List.mem_map] at hq
rcases hq with ⟨u, hu, rfl⟩
exact hdigit' u hu) d'.decimal_point.val
dsimp only at hinBounds houtBounds
rw [hlen] at hinBounds
rw [hlen'] at houtBounds
have hinLower :
(z : Real) * (10 : Real) ^ (d.decimal_point.val - 1) <=
(((d.digits.val.take d.num_digits.val).map (fun q => q.val)).foldl
(fun a q => 10 * a + q) 0 : Nat) * (10 : Real) ^
(d.decimal_point.val - (d.num_digits.val : Int)) := by
exact hinBounds.1
have hvaluePos : 0 <
(((d.digits.val.take d.num_digits.val).map (fun q => q.val)).foldl
(fun a q => 10 * a + q) 0 : Nat) * (10 : Real) ^
(d.decimal_point.val - (d.num_digits.val : Int)) := by
have hzpos : (0 : Real) < z := by exact_mod_cast (by omega : 0 < z)
have hpw : 0 < (10 : Real) ^ (d.decimal_point.val - 1) :=
zpow_pos (by norm_num) _
exact lt_of_lt_of_le (mul_pos hzpos hpw) hinLower
have hrecord := DecimalSeqRightShiftRecordSemantics d d' shift hshift
hvaluePos
hdigit hright
rcases hrecord with hreset | ⟨rho, hrho0, hrhoCut, hvalue, hsticky⟩
· omega
· have hk : shift.val = 3 := by
have hn : n.val = 1 := by omega
simp [shift, hn]
have hvin :
(((d.digits.val.take d.num_digits.val).map (fun q => q.val)).foldl
(fun a q => 10 * a + q) 0 : Nat) *
(10 : Real) ^
(d.decimal_point.val - (d.num_digits.val : Int)) < 10 := by
simpa [hp] using hinBounds.2
have hvoutlt :
(((d'.digits.val.take d'.num_digits.val).map (fun q => q.val)).foldl
(fun a q => 10 * a + q) 0 : Nat) *
(10 : Real) ^
(d'.decimal_point.val - (d'.num_digits.val : Int)) < 2 := by
change
(((d'.digits.val.take d'.num_digits.val).map (fun q => q.val)).foldl
(fun a q => 10 * a + q) 0 : Nat) * (10 : Real) ^
(d'.decimal_point.val - (d'.num_digits.val : Int)) =
(((d.digits.val.take d.num_digits.val).map (fun q => q.val)).foldl
(fun a q => 10 * a + q) 0 : Nat) * (10 : Real) ^
(d.decimal_point.val - (d.num_digits.val : Int)) /
(2 : Real) ^ shift.val - rho at hvalue
calc
(((d'.digits.val.take d'.num_digits.val).map (fun q => q.val)).foldl
(fun a q => 10 * a + q) 0 : Nat) * (10 : Real) ^
(d'.decimal_point.val - (d'.num_digits.val : Int)) =
(((d.digits.val.take d.num_digits.val).map (fun q => q.val)).foldl
(fun a q => 10 * a + q) 0 : Nat) * (10 : Real) ^
(d.decimal_point.val - (d.num_digits.val : Int)) /
(2 : Real) ^ shift.val - rho := hvalue
_ <= (((d.digits.val.take d.num_digits.val).map (fun q => q.val)).foldl
(fun a q => 10 * a + q) 0 : Nat) * (10 : Real) ^
(d.decimal_point.val - (d.num_digits.val : Int)) / 8 := by
rw [hk]
norm_num
linarith
_ < 2 := by nlinarith
have hz'lt : (z' : Real) < 2 := by
have hlo : (z' : Real) * (10 : Real) ^
(d'.decimal_point.val - 1) <=
(((d'.digits.val.take d'.num_digits.val).map
(fun q => q.val)).foldl (fun a q => 10 * a + q) 0 : Nat) *
(10 : Real) ^
(d'.decimal_point.val - (d'.num_digits.val : Int)) := by
exact houtBounds.1
norm_num [hp'] at hlo
have hvoutlt' :
(((d'.digits.val.map (fun q => q.val)).take d'.num_digits.val).foldl
(fun a q => 10 * a + q) 0 : Nat) * (10 : Real) ^
(1 - (d'.num_digits.val : Int)) < 2 := by
simpa [List.map_take, hp'] using hvoutlt
exact lt_of_le_of_lt hlo hvoutlt'
have hz'eq : z' = 1 := by
have hz'ltNat : z' < 2 := by exact_mod_cast hz'lt
omega
exact ⟨zs', by simpa [hz'eq] using hshape'⟩
have hnoStallOne : d.decimal_point.val = 1 ->
(exists tail,
(d.digits.val.take d.num_digits.val).map (fun q => q.val) =
1 :: tail) -> d'.decimal_point.val = 0 := by
intro hp hhead
rcases hprogressSmall (by omega) with hp0 | hp1
· exact hp0
· exfalso
have hreadOne : read.val = 1 := by
rw [hpoint] at hp1
omega
rcases hhead with ⟨tail, hhead⟩
have hzOne : z = 1 := by
rw [hshape] at hhead
exact List.cons.inj hhead |>.1
have hnOne : n.val = 1 := by omega
have hk : shift.val = 3 := by simp [shift, hnOne]
have hprefSem := DecimalRightShiftPrefixLoopSemantics
d d shift read acc false hshift (by
have hb := P804_T1_DecimalFoldBounds
((d.digits.val.take d.num_digits.val).map (fun q => q.val))
(by
intro q hq
simp only [List.mem_map] at hq
rcases hq with ⟨u, hu, rfl⟩
exact hdigit u hu)
z zs hshape hzLo
have hpw : 0 < 10 ^
(((d.digits.val.take d.num_digits.val).map
(fun q => q.val)).length - 1) := by positivity
omega) hdigit hpref
dsimp only at hprefSem
rcases hprefSem with ⟨_, _, _, _, _, hphase⟩
rcases hphase with hwithin | hextend
· rcases hwithin with ⟨_, _, hacc⟩
have hfoldOne :
((d.digits.val.map (fun q => q.val)).take read.val).foldl
(fun a q => 10 * a + q) 0 = 1 := by
rw [hreadOne]
have hfull :
(d.digits.val.map (fun q => q.val)).take d.num_digits.val =
z :: zs := by
simpa [List.map_take] using hshape
have hnpos : 1 <= d.num_digits.val := by
rw [← hlenCons]
simp
have hone :
(d.digits.val.map (fun q => q.val)).take 1 = [z] := by
have ht :
((d.digits.val.map (fun q => q.val)).take
d.num_digits.val).take 1 = [z] := by simp [hfull]
simpa [List.take_take, Nat.min_eq_left hnpos] using ht
rw [hone, hzOne]
decide
rw [hacc, hfoldOne, hk] at haccLo
norm_num at haccLo
· rcases hextend with ⟨hnread, _, _, _⟩
have hnpos : 1 <= d.num_digits.val := by
rw [← hlenCons]
simp
omega
have hnegRange :
(-. num.imp.dec2flt.decimal_seq.DecimalSeq.DECIMAL_POINT_RANGE) =
ok ((-2047)#i32) := by
unfold num.imp.dec2flt.decimal_seq.DecimalSeq.DECIMAL_POINT_RANGE
change IScalar.neg (2047#i32 : Std.I32) = _
unfold IScalar.neg IScalar.tryMk IScalar.tryMkOpt
norm_num [IScalar.check_bounds, IScalarTy.numBits]
have hshiftCast : (UScalar.hcast .I32 shift).val = (shift.val : Int) := by
have hs := UScalar.hcast_inBounds_spec .I32 shift (by
rw [IScalar.max_I32_eq]
omega)
simpa [lift, WP.spec_ok] using hs
let shiftI : Std.I32 := UScalar.hcast .I32 shift
have hshiftIVal : shiftI.val = (shift.val : Int) := by
simpa [shiftI] using hshiftCast
have haddBounds : IScalar.min .I32 <= exp.val + shiftI.val /\
exp.val + shiftI.val <= IScalar.max .I32 := by
rw [hshiftIVal]
constructor
· rw [IScalar.min_I32_eq]
omega
· rw [IScalar.max_I32_eq]
omega
obtain ⟨exp', hexpAdd, hexpVal⟩ := Aeneas.Std.WP.spec_imp_exists
(IScalar.add_spec haddBounds.1 haddBounds.2)
have hexpVal' : exp'.val = exp.val + (shift.val : Int) := by
rw [hexpVal, hshiftCast]
refine ⟨d', shift, exp', read, acc, ?_, hright, hshift, hexpVal',
hprogressLarge, hprogressSmall, ?_, hstall, hnoStallOne⟩
· unfold num.imp.dec2flt.slow.parse_long_mantissa_loop0.body
have hpgt : d.decimal_point > 0#i32 := by
change d.decimal_point.val > 0
omega
simp only [hpgt, if_true, core.option.Option.is_none, lift]
rw [show IScalar.hcast .Usize d.decimal_point = n by rfl]
simp only [bind_tc_ok, hselector, hright, hnegRange]
have hnotReset : ¬ d'.decimal_point < (-2047)#i32 := by
change ¬ d'.decimal_point.val < -2047
rw [hpoint]
omega
simp only [hnotReset, if_false]
rw [show UScalar.hcast .I32 shift = shiftI by rfl]
simp only [bind_tc_ok, hexpAdd]
simp
· exact ⟨hcap', hdigit', ⟨z', zs', hshape', hz'Lo, hz'Hi, hlen'⟩, hend'⟩
end dec2flt_model
Download Lean source · Download TeX source
Complete Lean module
import Tablet.DecimalSeqRightShiftCanonical
import Tablet.DecimalSeqRightShiftRecordSemantics
import Tablet.DecimalRightShiftLoop0Execution
import Tablet.DecimalRightShiftPrefixLoopSemantics
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64
import Tablet.P804_T1_DecimalValueBounds
import Tablet.P804_T1_RightPrefixLengthBounds
import Tablet.SlowShiftSelectorCertificate
import Tablet.num_imp_dec2flt_decimal_seq_DecimalSeq_DECIMAL_POINT_RANGE
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: P804_T1_RightLoopStep]
theorem P804_T1_RightLoopStep
(X Y : Real) (d : num.imp.dec2flt.decimal_seq.DecimalSeq)
(exp : Std.I32)
(hpointLo : 1 <= d.decimal_point.val)
(hpointHi : d.decimal_point.val < 310)
(hexpLo : 0 <= exp.val) (hexpHi : exp.val <= 1260)
(hinput :
let digits :=
(d.digits.val.take d.num_digits.val).map (fun q => q.val)
d.num_digits.val <= 768 /\
(forall q, q ∈ d.digits.val.take d.num_digits.val -> q.val < 10) /\
(exists z zs, digits = z :: zs /\ 1 <= z /\ z < 10 /\
digits.length = d.num_digits.val))
(hend :
let digits :=
(d.digits.val.take d.num_digits.val).map (fun q => q.val)
let I : Nat := digits.foldl (fun n q => 10 * n + q) 0
let V : Real := I * (10 : Real) ^
(d.decimal_point.val - (d.num_digits.val : Int))
exists eta u : Real, X = V + eta /\ Y = V + u /\
0 <= eta /\ eta < u /\ (d.truncated = true <-> 0 < eta)) :
exists (d' : num.imp.dec2flt.decimal_seq.DecimalSeq)
(shift : Std.Usize) (exp' : Std.I32) (read : Std.Usize)
(acc : Std.U64),
num.imp.dec2flt.slow.parse_long_mantissa_loop0.body
F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
{ m := 0#u64, p_biased := 0#i32 }
d.num_digits d.decimal_point d.truncated d.digits exp none =
ok (cont (d'.num_digits, d'.decimal_point, d'.truncated,
d'.digits, exp', none)) /\
num.imp.dec2flt.decimal_seq.DecimalSeq.right_shift d shift = ok d' /\
shift.val <= 60 /\
exp'.val = exp.val + (shift.val : Int) /\
(19 <= d.decimal_point.val ->
d'.decimal_point.val = d.decimal_point.val - 18 \/
d'.decimal_point.val = d.decimal_point.val - 19) /\
(d.decimal_point.val <= 18 ->
d'.decimal_point.val = 0 \/ d'.decimal_point.val = 1) /\
(let digits' :=
(d'.digits.val.take d'.num_digits.val).map (fun q => q.val)
let I' : Nat := digits'.foldl (fun n q => 10 * n + q) 0
let V' : Real := I' * (10 : Real) ^
(d'.decimal_point.val - (d'.num_digits.val : Int))
d'.num_digits.val <= 768 /\
(forall q, q ∈ d'.digits.val.take d'.num_digits.val -> q.val < 10) /\
(exists z zs, digits' = z :: zs /\ 1 <= z /\ z < 10 /\
digits'.length = d'.num_digits.val) /\
(exists eta' u' : Real,
X / (2 : Real) ^ shift.val = V' + eta' /\
Y / (2 : Real) ^ shift.val = V' + u' /\
0 <= eta' /\ eta' < u' /\
(d'.truncated = true <-> 0 < eta'))) /\
(d.decimal_point.val = 1 -> d'.decimal_point.val = 1 ->
exists zs,
(d'.digits.val.take d'.num_digits.val).map (fun q => q.val) =
1 :: zs) /\
(d.decimal_point.val = 1 ->
(exists zs,
(d.digits.val.take d.num_digits.val).map (fun q => q.val) =
1 :: zs) -> d'.decimal_point.val = 0) := by
-- BODY
dsimp only at hinput hend
rcases hinput with ⟨hcap, hdigit, z, zs, hshape, hzLo, hzHi, hlen⟩
have hlenCons : (z :: zs).length = d.num_digits.val := by
rw [← hshape]
exact hlen
let n : Std.Usize := IScalar.hcast .Usize d.decimal_point
have hnVal' : (n.val : Int) = d.decimal_point.val := by
have hs := IScalar.hcast_inBounds_spec .Usize d.decimal_point (by
scalar_tac)
simpa [n, lift, WP.spec_ok] using hs
let shift : Std.Usize := match n.val with
| 0 => 0#usize | 1 => 3#usize | 2 => 6#usize | 3 => 9#usize
| 4 => 13#usize | 5 => 16#usize | 6 => 19#usize | 7 => 23#usize
| 8 => 26#usize | 9 => 29#usize | 10 => 33#usize | 11 => 36#usize
| 12 => 39#usize | 13 => 43#usize | 14 => 46#usize | 15 => 49#usize
| 16 => 53#usize | 17 => 56#usize | 18 => 59#usize | _ => 60#usize
have hsel := SlowShiftSelectorCertificate
F64.Insts.Dec2flt_modelNumImpTraitsFloatU64 n
change
num.imp.dec2flt.slow.parse_long_mantissa.closure.Insts.CoreOpsFunctionFnTupleUsizeUsize.call
F64.Insts.Dec2flt_modelNumImpTraitsFloatU64 () n = ok shift /\
shift.val <= 60 /\
(n.val = 0 -> shift.val = 0) /\
(1 <= n.val -> n.val <= 18 ->
2 ^ shift.val <= 10 ^ n.val /\ 10 ^ n.val < 2 ^ (shift.val + 1)) /\
(19 <= n.val -> shift.val = 60 /\
10 ^ 18 < 2 ^ 60 /\ 2 ^ 60 < 10 ^ 19) at hsel
rcases hsel with ⟨hselector, hshift, hzero, hsmall, hlarge⟩
obtain ⟨read, acc, d', hpref, hreadLo, hreadHi, haccLo, haccHi,
hprosLo, hprosHi, hright, hpoint, hnonzero⟩ :=
DecimalRightShiftLoop0Execution d shift hshift (by omega) hpointHi
⟨hcap, hdigit, z, zs, hshape, hzLo, hzHi, hlenCons⟩
have hprefix := P804_T1_RightPrefixLengthBounds d d shift read acc false
hshift hcap hdigit z zs hshape hzLo hlenCons hpref
have hprogressLarge : 19 <= d.decimal_point.val ->
d'.decimal_point.val = d.decimal_point.val - 18 \/
d'.decimal_point.val = d.decimal_point.val - 19 := by
intro hp
have hn19 : 19 <= n.val := by omega
obtain ⟨hk, hp18, hp19⟩ := hlarge hn19
have hr : read.val = 19 \/ read.val = 20 := by
rw [hk] at haccLo haccHi
norm_num at hp18 hp19 haccLo haccHi
rcases hprefix with ⟨hrlo, hrhi⟩
by_contra hnot
have hc : read.val <= 18 \/ 21 <= read.val := by omega
rcases hc with hc | hc
· have hpwr : 10 ^ read.val <= 10 ^ 18 :=
Nat.pow_le_pow_right (by omega) (by omega)
omega
· have hpwr : 10 ^ 20 <= 10 ^ (read.val - 1) :=
Nat.pow_le_pow_right (by omega) (by omega)
omega
rw [hpoint]
rcases hr with hr | hr <;> omega
have hprogressSmall : d.decimal_point.val <= 18 ->
d'.decimal_point.val = 0 \/ d'.decimal_point.val = 1 := by
intro hp
have hn1 : 1 <= n.val := by omega
have hn18 : n.val <= 18 := by omega
obtain ⟨hpowLo, hpowHi⟩ := hsmall hn1 hn18
have hten : 10 ^ (n.val - 1) < 2 ^ shift.val := by
have hpowTen : 10 ^ n.val = 10 ^ (n.val - 1) * 10 := by
calc
10 ^ n.val = 10 ^ ((n.val - 1) + 1) := by congr 1 <;> omega
_ = 10 ^ (n.val - 1) * 10 := by rw [pow_succ]
have hpowTwo : 2 ^ (shift.val + 1) = 2 ^ shift.val * 2 := by
rw [pow_succ]
rw [hpowTen] at hpowHi
rw [hpowTwo] at hpowHi
nlinarith [pow_pos (by omega : 0 < 10) (n.val - 1)]
have hr : read.val = n.val \/ read.val = n.val + 1 := by
rcases hprefix with ⟨hrlo, hrhi⟩
by_contra hnot
have hc : read.val < n.val \/ n.val + 1 < read.val := by omega
rcases hc with hc | hc
· have hpwr : 10 ^ read.val <= 10 ^ (n.val - 1) :=
Nat.pow_le_pow_right (by omega) (by omega)
omega
· have hpwr : 10 ^ (n.val + 1) <= 10 ^ read.val :=
Nat.pow_le_pow_right (by omega) (by omega)
have hpwr' : 10 ^ (n.val + 1) <= 10 ^ (read.val - 1) :=
Nat.pow_le_pow_right (by omega) (by omega)
have haccUpper : acc.val < 10 ^ (n.val + 1) := by
calc
acc.val < 10 * 2 ^ shift.val := haccHi
_ <= 10 * 10 ^ n.val := Nat.mul_le_mul_left 10 hpowLo
_ = 10 ^ (n.val + 1) := by rw [pow_succ]; ring
omega
rw [hpoint]
rcases hr with hr | hr <;> omega
have hcanon := DecimalSeqRightShiftCanonical d d' shift X Y
⟨hcap, hdigit, z, zs, hshape, hzLo, hzHi, hlen⟩ hend hshift hright hnonzero
dsimp only at hcanon
rcases hcanon with ⟨hcap', hdigit', hshape', hend', hpointLower⟩
rcases hshape' with ⟨z', zs', hshape', hz'Lo, hz'Hi, hlen', hlast'⟩
have hstall : d.decimal_point.val = 1 -> d'.decimal_point.val = 1 ->
exists tail,
(d'.digits.val.take d'.num_digits.val).map (fun q => q.val) =
1 :: tail := by
intro hp hp'
have hinBounds := P804_T1_DecimalValueBounds
((d.digits.val.take d.num_digits.val).map (fun q => q.val))
z zs hshape hzLo (by
intro q hq
simp only [List.mem_map] at hq
rcases hq with ⟨u, hu, rfl⟩
exact hdigit u hu) d.decimal_point.val
have houtBounds := P804_T1_DecimalValueBounds
((d'.digits.val.take d'.num_digits.val).map (fun q => q.val))
z' zs' hshape' hz'Lo (by
intro q hq
simp only [List.mem_map] at hq
rcases hq with ⟨u, hu, rfl⟩
exact hdigit' u hu) d'.decimal_point.val
dsimp only at hinBounds houtBounds
rw [hlen] at hinBounds
rw [hlen'] at houtBounds
have hinLower :
(z : Real) * (10 : Real) ^ (d.decimal_point.val - 1) <=
(((d.digits.val.take d.num_digits.val).map (fun q => q.val)).foldl
(fun a q => 10 * a + q) 0 : Nat) * (10 : Real) ^
(d.decimal_point.val - (d.num_digits.val : Int)) := by
exact hinBounds.1
have hvaluePos : 0 <
(((d.digits.val.take d.num_digits.val).map (fun q => q.val)).foldl
(fun a q => 10 * a + q) 0 : Nat) * (10 : Real) ^
(d.decimal_point.val - (d.num_digits.val : Int)) := by
have hzpos : (0 : Real) < z := by exact_mod_cast (by omega : 0 < z)
have hpw : 0 < (10 : Real) ^ (d.decimal_point.val - 1) :=
zpow_pos (by norm_num) _
exact lt_of_lt_of_le (mul_pos hzpos hpw) hinLower
have hrecord := DecimalSeqRightShiftRecordSemantics d d' shift hshift
hvaluePos
hdigit hright
rcases hrecord with hreset | ⟨rho, hrho0, hrhoCut, hvalue, hsticky⟩
· omega
· have hk : shift.val = 3 := by
have hn : n.val = 1 := by omega
simp [shift, hn]
have hvin :
(((d.digits.val.take d.num_digits.val).map (fun q => q.val)).foldl
(fun a q => 10 * a + q) 0 : Nat) *
(10 : Real) ^
(d.decimal_point.val - (d.num_digits.val : Int)) < 10 := by
simpa [hp] using hinBounds.2
have hvoutlt :
(((d'.digits.val.take d'.num_digits.val).map (fun q => q.val)).foldl
(fun a q => 10 * a + q) 0 : Nat) *
(10 : Real) ^
(d'.decimal_point.val - (d'.num_digits.val : Int)) < 2 := by
change
(((d'.digits.val.take d'.num_digits.val).map (fun q => q.val)).foldl
(fun a q => 10 * a + q) 0 : Nat) * (10 : Real) ^
(d'.decimal_point.val - (d'.num_digits.val : Int)) =
(((d.digits.val.take d.num_digits.val).map (fun q => q.val)).foldl
(fun a q => 10 * a + q) 0 : Nat) * (10 : Real) ^
(d.decimal_point.val - (d.num_digits.val : Int)) /
(2 : Real) ^ shift.val - rho at hvalue
calc
(((d'.digits.val.take d'.num_digits.val).map (fun q => q.val)).foldl
(fun a q => 10 * a + q) 0 : Nat) * (10 : Real) ^
(d'.decimal_point.val - (d'.num_digits.val : Int)) =
(((d.digits.val.take d.num_digits.val).map (fun q => q.val)).foldl
(fun a q => 10 * a + q) 0 : Nat) * (10 : Real) ^
(d.decimal_point.val - (d.num_digits.val : Int)) /
(2 : Real) ^ shift.val - rho := hvalue
_ <= (((d.digits.val.take d.num_digits.val).map (fun q => q.val)).foldl
(fun a q => 10 * a + q) 0 : Nat) * (10 : Real) ^
(d.decimal_point.val - (d.num_digits.val : Int)) / 8 := by
rw [hk]
norm_num
linarith
_ < 2 := by nlinarith
have hz'lt : (z' : Real) < 2 := by
have hlo : (z' : Real) * (10 : Real) ^
(d'.decimal_point.val - 1) <=
(((d'.digits.val.take d'.num_digits.val).map
(fun q => q.val)).foldl (fun a q => 10 * a + q) 0 : Nat) *
(10 : Real) ^
(d'.decimal_point.val - (d'.num_digits.val : Int)) := by
exact houtBounds.1
norm_num [hp'] at hlo
have hvoutlt' :
(((d'.digits.val.map (fun q => q.val)).take d'.num_digits.val).foldl
(fun a q => 10 * a + q) 0 : Nat) * (10 : Real) ^
(1 - (d'.num_digits.val : Int)) < 2 := by
simpa [List.map_take, hp'] using hvoutlt
exact lt_of_le_of_lt hlo hvoutlt'
have hz'eq : z' = 1 := by
have hz'ltNat : z' < 2 := by exact_mod_cast hz'lt
omega
exact ⟨zs', by simpa [hz'eq] using hshape'⟩
have hnoStallOne : d.decimal_point.val = 1 ->
(exists tail,
(d.digits.val.take d.num_digits.val).map (fun q => q.val) =
1 :: tail) -> d'.decimal_point.val = 0 := by
intro hp hhead
rcases hprogressSmall (by omega) with hp0 | hp1
· exact hp0
· exfalso
have hreadOne : read.val = 1 := by
rw [hpoint] at hp1
omega
rcases hhead with ⟨tail, hhead⟩
have hzOne : z = 1 := by
rw [hshape] at hhead
exact List.cons.inj hhead |>.1
have hnOne : n.val = 1 := by omega
have hk : shift.val = 3 := by simp [shift, hnOne]
have hprefSem := DecimalRightShiftPrefixLoopSemantics
d d shift read acc false hshift (by
have hb := P804_T1_DecimalFoldBounds
((d.digits.val.take d.num_digits.val).map (fun q => q.val))
(by
intro q hq
simp only [List.mem_map] at hq
rcases hq with ⟨u, hu, rfl⟩
exact hdigit u hu)
z zs hshape hzLo
have hpw : 0 < 10 ^
(((d.digits.val.take d.num_digits.val).map
(fun q => q.val)).length - 1) := by positivity
omega) hdigit hpref
dsimp only at hprefSem
rcases hprefSem with ⟨_, _, _, _, _, hphase⟩
rcases hphase with hwithin | hextend
· rcases hwithin with ⟨_, _, hacc⟩
have hfoldOne :
((d.digits.val.map (fun q => q.val)).take read.val).foldl
(fun a q => 10 * a + q) 0 = 1 := by
rw [hreadOne]
have hfull :
(d.digits.val.map (fun q => q.val)).take d.num_digits.val =
z :: zs := by
simpa [List.map_take] using hshape
have hnpos : 1 <= d.num_digits.val := by
rw [← hlenCons]
simp
have hone :
(d.digits.val.map (fun q => q.val)).take 1 = [z] := by
have ht :
((d.digits.val.map (fun q => q.val)).take
d.num_digits.val).take 1 = [z] := by simp [hfull]
simpa [List.take_take, Nat.min_eq_left hnpos] using ht
rw [hone, hzOne]
decide
rw [hacc, hfoldOne, hk] at haccLo
norm_num at haccLo
· rcases hextend with ⟨hnread, _, _, _⟩
have hnpos : 1 <= d.num_digits.val := by
rw [← hlenCons]
simp
omega
have hnegRange :
(-. num.imp.dec2flt.decimal_seq.DecimalSeq.DECIMAL_POINT_RANGE) =
ok ((-2047)#i32) := by
unfold num.imp.dec2flt.decimal_seq.DecimalSeq.DECIMAL_POINT_RANGE
change IScalar.neg (2047#i32 : Std.I32) = _
unfold IScalar.neg IScalar.tryMk IScalar.tryMkOpt
norm_num [IScalar.check_bounds, IScalarTy.numBits]
have hshiftCast : (UScalar.hcast .I32 shift).val = (shift.val : Int) := by
have hs := UScalar.hcast_inBounds_spec .I32 shift (by
rw [IScalar.max_I32_eq]
omega)
simpa [lift, WP.spec_ok] using hs
let shiftI : Std.I32 := UScalar.hcast .I32 shift
have hshiftIVal : shiftI.val = (shift.val : Int) := by
simpa [shiftI] using hshiftCast
have haddBounds : IScalar.min .I32 <= exp.val + shiftI.val /\
exp.val + shiftI.val <= IScalar.max .I32 := by
rw [hshiftIVal]
constructor
· rw [IScalar.min_I32_eq]
omega
· rw [IScalar.max_I32_eq]
omega
obtain ⟨exp', hexpAdd, hexpVal⟩ := Aeneas.Std.WP.spec_imp_exists
(IScalar.add_spec haddBounds.1 haddBounds.2)
have hexpVal' : exp'.val = exp.val + (shift.val : Int) := by
rw [hexpVal, hshiftCast]
refine ⟨d', shift, exp', read, acc, ?_, hright, hshift, hexpVal',
hprogressLarge, hprogressSmall, ?_, hstall, hnoStallOne⟩
· unfold num.imp.dec2flt.slow.parse_long_mantissa_loop0.body
have hpgt : d.decimal_point > 0#i32 := by
change d.decimal_point.val > 0
omega
simp only [hpgt, if_true, core.option.Option.is_none, lift]
rw [show IScalar.hcast .Usize d.decimal_point = n by rfl]
simp only [bind_tc_ok, hselector, hright, hnegRange]
have hnotReset : ¬ d'.decimal_point < (-2047)#i32 := by
change ¬ d'.decimal_point.val < -2047
rw [hpoint]
omega
simp only [hnotReset, if_false]
rw [show UScalar.hcast .I32 shift = shiftI by rfl]
simp only [bind_tc_ok, hexpAdd]
simp
· exact ⟨hcap', hdigit', ⟨z', zs', hshape', hz'Lo, hz'Hi, hlen'⟩, hend'⟩
end dec2flt_model
Proof structure
Follow the declared dependencies to read the supporting statements and proofs.
Uses
- DecimalRightShiftLoop0Execution
- DecimalRightShiftPrefixLoopSemantics
- DecimalSeqRightShiftCanonical
- DecimalSeqRightShiftRecordSemantics
- F64 Insts Dec2flt modelNumImpTraitsFloatU64
- DecimalValueBounds
All 10 entries
- DecimalRightShiftLoop0Execution
- DecimalRightShiftPrefixLoopSemantics
- DecimalSeqRightShiftCanonical
- DecimalSeqRightShiftRecordSemantics
- F64 Insts Dec2flt modelNumImpTraitsFloatU64
- DecimalValueBounds
- RightPrefixLengthBounds
- SlowShiftSelectorCertificate
- num imp dec2flt decimal seq DecimalSeq DECIMAL POINT RANGE
- num imp dec2flt slow parse long mantissa
Inspect related source (151)
- Dec2flt_modelNumImpTraitsFloatU64 · traits.rs:309 Program Rust
- DECIMAL_POINT_RANGE · dec2flt/decimal_seq.rs:67 Program Rust
- parse_long_mantissa · dec2flt/slow.rs:27 Program Rust
More program dependencies (109)
- 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
- 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
- BiasedFp · dec2flt/common.rs:52 Program Rust
- zero_pow2 · dec2flt/common.rs:62 Program Rust
- DecimalSeq · dec2flt/decimal_seq.rs:21 Program Rust
- MAX_DIGITS · dec2flt/decimal_seq.rs:63 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
- 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
- read_u64 · dec2flt/common.rs:18 Program Rust
- write_u64 · dec2flt/common.rs:25 Program Rust
- Dec2flt_modelNumImpTraitsCastIntoI16 · traits.rs:45 Program Rust
- ONE · traits.rs:53 Program Rust
- ZERO · traits.rs:52 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_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
- 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
- cast · traits.rs:46 Program Rust
- try_add_digit · dec2flt/decimal_seq.rs:73 Program Rust
- TABLE · dec2flt/decimal_seq.rs:370 Program Rust
- TABLE_POW5 · dec2flt/decimal_seq.rs:379 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
- 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
- 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.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
- DecimalLeftShiftLoopLex
All 123 entries
- Binary64Model
- Binary64ModelDefault
- DecimalDigitLexScale
- DecimalLeftShiftDigitGrowth
- DecimalLeftShiftFirstLoopSemantics
- DecimalLeftShiftLoopLex
- DecimalLeftShiftSecondLoopSemantics
- DecimalLeftShiftTableCertificate
- DecimalRightShiftFinalLoopSemantics
- DecimalRightShiftLoop0Execution
- DecimalRightShiftMainLoopSemantics
- DecimalRightShiftPrefixLoopSemantics
- DecimalRightShiftU64DyadicBridge
- DecimalSeqDyadicShiftSemantics
- DecimalSeqLeftShiftRecordSemantics
- DecimalSeqRightShiftCanonical
- 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
- DecimalFoldBounds
- DecimalValueBounds
- RightLoopStep
- RightPrefixLengthBounds
- 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": "P804_T1_RightLoopStep",
"closure_version": "patch_c_v1",
"active_decl_hash": "47bfd015dda28b90c87c084af763ebd7f9f7c90a3bb6cfcb535aeb7de2dc78df",
"active_statement_hash": "fcbf826adab21518281538c29388a61a0b13d67aa67aeb6671f6c7ea4f058555",
"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": "revalidate-cycle-192",
"boundary_theorems": {},
"strict_theorem_deps": {
"DecimalRightShiftLoop0Execution": "e27252660de78d95",
"DecimalRightShiftPrefixLoopSemantics": "0d5cb25f18eedbfb",
"DecimalSeqRightShiftCanonical": "fc2c059f527d234a",
"DecimalSeqRightShiftRecordSemantics": "81ed2135baca7c94",
"P804_T1_DecimalFoldBounds": "9af7ca1186664411",
"P804_T1_DecimalValueBounds": "4b5c924b5d52bc9d",
"P804_T1_RightPrefixLengthBounds": "1ef34b1c9650b938",
"SlowShiftSelectorCertificate": "963b7a2e670856e8",
"num_imp_dec2flt_decimal_seq_DecimalSeq_DECIMAL_POINT_RANGE": "01b84a7a35e5bcf4",
"num_imp_dec2flt_slow_parse_long_mantissa": "0eb6fb2627d0ff5c"
},
"strict_definition_deps": {
"F64": "ec4e25fbaf4e11d4",
"F64_Insts_Dec2flt_modelNumImpTraitsFloatU64": "94095c9bf79da164",
"SlowShiftSelectorCertificate": "7ebc2b39d69850c4",
"num_imp_dec2flt_common_BiasedFp": "c43614ff2149ecf2",
"num_imp_dec2flt_decimal_seq_DecimalSeq": "b0286c42454b158d",
"num_imp_dec2flt_decimal_seq_DecimalSeq_DECIMAL_POINT_RANGE": "0cc5155758bc976a",
"num_imp_dec2flt_decimal_seq_DecimalSeq_right_shift": "1aaf1bb11c0b6a49",
"num_imp_dec2flt_slow_parse_long_mantissa": "0ce7bdcf55d68c29",
"num_imp_dec2flt_slow_parse_long_mantissa_closure_Insts_CoreOpsFunctionFnTupleUsizeUsize_call": "7df8a2c8e3717790"
}
}Prose assessment
{
"label": "Lean proof closed; predictive prose review no longer required",
"assessment_status": null,
"fingerprint_relation": "unknown",
"assessment_fingerprint": null,
"current_fingerprint": "sound-v2:472d9733668452d122d00eb300957106513fdeb186e3e82026198b51a9363673",
"superseded_for_theorem_closure": false
}Review verdicts
{
"corr_status": "Pass",
"substantiveness_status": "Pass"
}