Statement
This explanation was written alongside the formalization to describe the statement and its reasoning.
Helper
compute_float(q,w)
returns b normally and b has biased exponent 2047, then b has zero
mantissa.Lean statement
Trellis authored these statements and proofs. Lean checks the formal proofs; the assumptions used by each proof are listed below.
import Tablet.ParserExponentConstants
import Tablet.num_imp_dec2flt_lemire_compute_float
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
set_option pp.universes false
namespace dec2flt_model
-- [TABLET NODE: ParserComputeFloatInfinityMantissa]
theorem ParserComputeFloatInfinityMantissa (q : Std.I64) (w : Std.U64)
(b : num.imp.dec2flt.common.BiasedFp)
(h : num.imp.dec2flt.lemire.compute_float
F64.Insts.Dec2flt_modelNumImpTraitsFloatU64 q w = ok b) :
b.p_biased.val = 2047 -> b.m.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
ok. After the product, the extracted definition has two
copies of the same exponent block: the maximal-low-limb safe-exponent branch
and the nonmaximal-low-limb branch. Analyze both copies separately.power2 is nonpositive, a shift count
at least 64 returns the zero sentinel. Otherwise the record exponent is a
signed cast of a Boolean and hence is either zero or one. Neither possibility
can equal 2047, so the implication is vacuous on all underflow records.power2 is positive, the optional tie correction changes only the
mantissa. In the carry branch, invert the checked addition and identify the
candidate exponent as power2+1; in the noncarry branch the
candidate is power2. The final comparison tests that exact candidate
against 2047. If the test succeeds, the function returns the already
identified infinity sentinel (0,2047). If it fails, the ordinary record
retains the candidate and the failed test proves that its exponent is strictly
less than 2047, contradicting the theorem's exponent hypothesis. The
maximal-low-limb unsafe-exponent branches return the error pair of exponent
-1. These cases exhaust all successful exits of both duplicated blocks,
so exponent 2047 always has mantissa zero.Lean proof
intro hp
have bind_ok_inv : ∀ {α β : Type} (r : Result α) (f : α → Result β) y,
Bind.bind r f = ok y → ∃ x, r = ok x ∧ f x = ok y := by
intro α β r f y hr
cases r <;> simp_all [Bind.bind, Aeneas.Std.bind]
rcases ParserExponentConstants with
⟨hbits, htotal, hsig, hexpbits, hexpsat, hinf, hbias, hmin,
hsmall, hlarge, hroundmin, hroundmax⟩
have hzero : num.imp.dec2flt.common.BiasedFp.zero_pow2 0#i32 =
ok { m := 0#u64, p_biased := 0#i32 } := by rfl
have hinfFp : num.imp.dec2flt.common.BiasedFp.zero_pow2 2047#i32 =
ok { m := 0#u64, p_biased := 2047#i32 } := by rfl
have herr : num.imp.dec2flt.common.BiasedFp.zero_pow2 (-1)#i32 =
ok { m := 0#u64, p_biased := (-1)#i32 } := by rfl
have hcastSmall : lift (IScalar.cast .I64 (-342)#i32) =
ok (-342)#i64 := by rfl
have hcastLarge : lift (IScalar.cast .I64 308#i32) =
ok 308#i64 := by rfl
have hsigop : (53#u32 - 1#u32) = ok 52#u32 := by rfl
unfold num.imp.dec2flt.lemire.compute_float at h
rw [hzero, hinf] at h
simp only [bind_tc_ok] at h
rw [hinfFp, herr] at h
simp only [bind_tc_ok] at h
by_cases hw : w = 0#u64
· simp only [hw, if_true] at h
cases h
norm_num at hp
simp only [hw, if_false] at h
rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SMALLEST_POWER_OF_TEN.eq_def] at h
rw [hcastSmall] at h
simp only [bind_tc_ok] at h
by_cases hqsmall : q < (-342)#i64
· simp only [hqsmall, if_true] at h
cases h
norm_num at hp
simp only [hqsmall, if_false] at h
rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.LARGEST_POWER_OF_TEN.eq_def] at h
rw [hcastLarge] at h
simp only [bind_tc_ok] at h
by_cases hqlarge : q > 308#i64
· simp only [hqlarge, if_true] at h
cases h
rfl
simp only [hqlarge, if_false] at h
simp only [lift, bind_tc_ok] at h
cases hwshift : (w <<< core.num.U64.leading_zeros w) with
| fail e => simp only [hwshift, bind_tc_fail] at h; contradiction
| div => simp only [hwshift, bind_tc_div] at h; contradiction
| ok w1 =>
simp only [hwshift, bind_tc_ok] at h
rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SIG_TOTAL_BITS.eq_def] at h
simp only [core.f64.F64.MANTISSA_DIGITS, ModelF64MantissaDigits,
Binary64ModelDefault] at h
rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.BITS.eq_def] at h
simp only [bind_tc_ok] at h
rw [hsigop] at h
simp only [bind_tc_ok] at h
obtain ⟨i7, hi7, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨pair, hpair, h⟩ := bind_ok_inv _ _ _ h
rcases pair with ⟨lo, hi⟩
simp only [Aeneas.Std.uncurry_apply_pair] at h
by_cases hlo : lo = 18446744073709551615#u64
· simp only [hlo, if_true] at h
by_cases hqneg : q ≥ (-27)#i64
· simp only [hqneg, if_true, bind_tc_ok] at h
by_cases hq55 : q ≤ 55#i64
· have hbtrue : decide (q ≤ 55#i64) = true := by simpa using hq55
simp only [hbtrue, if_true, bind_tc_ok] at h
obtain ⟨i8, hi8, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i9, hi9, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i11, hi11, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i12, hi12, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa, hmantissa, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i14, hi14, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i15, hi15, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i17, hi17, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i18, hi18, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i19, hi19, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨power2, hpower2, h⟩ := bind_ok_inv _ _ _ h
by_cases hp2 : power2 ≤ 0#i32
· simp only [hp2, if_true] at h
obtain ⟨i20, hi20, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i21, hi21, h⟩ := bind_ok_inv _ _ _ h
by_cases hz : i21 ≥ 64#i32
· simp only [hz, if_true] at h
cases h
norm_num at hp
· simp only [hz, if_false] at h
obtain ⟨i22, hi22, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa1, hm1, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa2, hm2, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa3, hm3, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i24, hi24, h⟩ := bind_ok_inv _ _ _ h
cases h
have hc := IScalar.cast_fromBool_bound_eq .I32
(decide (mantissa3 ≥ i24))
change (IScalar.cast_fromBool IScalarTy.I32
(decide (mantissa3 ≥ i24))).val = 2047 at hp
have hupper : (IScalar.cast_fromBool IScalarTy.I32
(decide (mantissa3 ≥ i24))).val ≤ 1 :=
hc.2.trans (by norm_num)
exfalso
omega
· simp only [hp2, if_false] at h
obtain ⟨mantissa1, hm1, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa2, hm2, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa3, hm3, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i21, hi21, h⟩ := bind_ok_inv _ _ _ h
by_cases hcarry : mantissa3 ≥ i21
· simp only [hcarry, if_true] at h
obtain ⟨pair2, hpair2, h⟩ := bind_ok_inv _ _ _ h
rcases pair2 with ⟨mantissa4, power21⟩
obtain ⟨i22, hi22, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa5, hm5, hpair2⟩ :=
bind_ok_inv _ _ _ hpair2
obtain ⟨power22, hp22, hpair2⟩ :=
bind_ok_inv _ _ _ hpair2
cases hpair2
by_cases hsat : power21 ≥ 2047#i32
· simp only [hsat, if_true] at h
cases h
rfl
· simp only [hsat, if_false] at h
cases h
change power21.val = 2047 at hp
change ¬ 2047 ≤ power21.val at hsat
omega
· simp only [hcarry, if_false, bind_tc_ok,
Aeneas.Std.uncurry_apply_pair] at h
obtain ⟨i22, hi22, h⟩ := bind_ok_inv _ _ _ h
by_cases hsat : power2 ≥ 2047#i32
· simp only [hsat, if_true] at h
cases h
rfl
· simp only [hsat, if_false] at h
cases h
change power2.val = 2047 at hp
change ¬ 2047 ≤ power2.val at hsat
omega
· have hbfalse : decide (q ≤ 55#i64) = false := by simpa using hq55
simp only [hbfalse, if_false, bind_tc_ok] at h
cases h
norm_num at hp
· simp only [hqneg, if_false, bind_tc_ok] at h
cases h
norm_num at hp
· simp only [hlo, if_false] at h
obtain ⟨i8, hi8, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i9, hi9, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i11, hi11, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i12, hi12, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa, hmantissa, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i14, hi14, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i15, hi15, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i17, hi17, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i18, hi18, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i19, hi19, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨power2, hpower2, h⟩ := bind_ok_inv _ _ _ h
by_cases hp2 : power2 ≤ 0#i32
· simp only [hp2, if_true] at h
obtain ⟨i20, hi20, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i21, hi21, h⟩ := bind_ok_inv _ _ _ h
by_cases hz : i21 ≥ 64#i32
· simp only [hz, if_true] at h
cases h
norm_num at hp
· simp only [hz, if_false] at h
obtain ⟨i22, hi22, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa1, hm1, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa2, hm2, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa3, hm3, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i24, hi24, h⟩ := bind_ok_inv _ _ _ h
cases h
have hc := IScalar.cast_fromBool_bound_eq .I32
(decide (mantissa3 ≥ i24))
change (IScalar.cast_fromBool IScalarTy.I32
(decide (mantissa3 ≥ i24))).val = 2047 at hp
have hupper : (IScalar.cast_fromBool IScalarTy.I32
(decide (mantissa3 ≥ i24))).val ≤ 1 :=
hc.2.trans (by norm_num)
exfalso
omega
· simp only [hp2, if_false] at h
obtain ⟨mantissa1, hm1, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa2, hm2, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa3, hm3, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i21, hi21, h⟩ := bind_ok_inv _ _ _ h
by_cases hcarry : mantissa3 ≥ i21
· simp only [hcarry, if_true] at h
obtain ⟨pair2, hpair2, h⟩ := bind_ok_inv _ _ _ h
rcases pair2 with ⟨mantissa4, power21⟩
obtain ⟨i22, hi22, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa5, hm5, hpair2⟩ :=
bind_ok_inv _ _ _ hpair2
obtain ⟨power22, hp22, hpair2⟩ :=
bind_ok_inv _ _ _ hpair2
cases hpair2
by_cases hsat : power21 ≥ 2047#i32
· simp only [hsat, if_true] at h
cases h
rfl
· simp only [hsat, if_false] at h
cases h
change power21.val = 2047 at hp
change ¬ 2047 ≤ power21.val at hsat
omega
· simp only [hcarry, if_false, bind_tc_ok,
Aeneas.Std.uncurry_apply_pair] at h
obtain ⟨i22, hi22, h⟩ := bind_ok_inv _ _ _ h
by_cases hsat : power2 ≥ 2047#i32
· simp only [hsat, if_true] at h
cases h
rfl
· simp only [hsat, if_false] at h
cases h
change power2.val = 2047 at hp
change ¬ 2047 ≤ power2.val at hsat
omega
end dec2flt_model
Download Lean source · Download TeX source
Complete Lean module
import Tablet.ParserExponentConstants
import Tablet.num_imp_dec2flt_lemire_compute_float
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
set_option pp.universes false
namespace dec2flt_model
-- [TABLET NODE: ParserComputeFloatInfinityMantissa]
theorem ParserComputeFloatInfinityMantissa (q : Std.I64) (w : Std.U64)
(b : num.imp.dec2flt.common.BiasedFp)
(h : num.imp.dec2flt.lemire.compute_float
F64.Insts.Dec2flt_modelNumImpTraitsFloatU64 q w = ok b) :
b.p_biased.val = 2047 -> b.m.val = 0 := by
-- BODY
intro hp
have bind_ok_inv : ∀ {α β : Type} (r : Result α) (f : α → Result β) y,
Bind.bind r f = ok y → ∃ x, r = ok x ∧ f x = ok y := by
intro α β r f y hr
cases r <;> simp_all [Bind.bind, Aeneas.Std.bind]
rcases ParserExponentConstants with
⟨hbits, htotal, hsig, hexpbits, hexpsat, hinf, hbias, hmin,
hsmall, hlarge, hroundmin, hroundmax⟩
have hzero : num.imp.dec2flt.common.BiasedFp.zero_pow2 0#i32 =
ok { m := 0#u64, p_biased := 0#i32 } := by rfl
have hinfFp : num.imp.dec2flt.common.BiasedFp.zero_pow2 2047#i32 =
ok { m := 0#u64, p_biased := 2047#i32 } := by rfl
have herr : num.imp.dec2flt.common.BiasedFp.zero_pow2 (-1)#i32 =
ok { m := 0#u64, p_biased := (-1)#i32 } := by rfl
have hcastSmall : lift (IScalar.cast .I64 (-342)#i32) =
ok (-342)#i64 := by rfl
have hcastLarge : lift (IScalar.cast .I64 308#i32) =
ok 308#i64 := by rfl
have hsigop : (53#u32 - 1#u32) = ok 52#u32 := by rfl
unfold num.imp.dec2flt.lemire.compute_float at h
rw [hzero, hinf] at h
simp only [bind_tc_ok] at h
rw [hinfFp, herr] at h
simp only [bind_tc_ok] at h
by_cases hw : w = 0#u64
· simp only [hw, if_true] at h
cases h
norm_num at hp
simp only [hw, if_false] at h
rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SMALLEST_POWER_OF_TEN.eq_def] at h
rw [hcastSmall] at h
simp only [bind_tc_ok] at h
by_cases hqsmall : q < (-342)#i64
· simp only [hqsmall, if_true] at h
cases h
norm_num at hp
simp only [hqsmall, if_false] at h
rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.LARGEST_POWER_OF_TEN.eq_def] at h
rw [hcastLarge] at h
simp only [bind_tc_ok] at h
by_cases hqlarge : q > 308#i64
· simp only [hqlarge, if_true] at h
cases h
rfl
simp only [hqlarge, if_false] at h
simp only [lift, bind_tc_ok] at h
cases hwshift : (w <<< core.num.U64.leading_zeros w) with
| fail e => simp only [hwshift, bind_tc_fail] at h; contradiction
| div => simp only [hwshift, bind_tc_div] at h; contradiction
| ok w1 =>
simp only [hwshift, bind_tc_ok] at h
rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SIG_TOTAL_BITS.eq_def] at h
simp only [core.f64.F64.MANTISSA_DIGITS, ModelF64MantissaDigits,
Binary64ModelDefault] at h
rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.BITS.eq_def] at h
simp only [bind_tc_ok] at h
rw [hsigop] at h
simp only [bind_tc_ok] at h
obtain ⟨i7, hi7, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨pair, hpair, h⟩ := bind_ok_inv _ _ _ h
rcases pair with ⟨lo, hi⟩
simp only [Aeneas.Std.uncurry_apply_pair] at h
by_cases hlo : lo = 18446744073709551615#u64
· simp only [hlo, if_true] at h
by_cases hqneg : q ≥ (-27)#i64
· simp only [hqneg, if_true, bind_tc_ok] at h
by_cases hq55 : q ≤ 55#i64
· have hbtrue : decide (q ≤ 55#i64) = true := by simpa using hq55
simp only [hbtrue, if_true, bind_tc_ok] at h
obtain ⟨i8, hi8, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i9, hi9, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i11, hi11, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i12, hi12, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa, hmantissa, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i14, hi14, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i15, hi15, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i17, hi17, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i18, hi18, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i19, hi19, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨power2, hpower2, h⟩ := bind_ok_inv _ _ _ h
by_cases hp2 : power2 ≤ 0#i32
· simp only [hp2, if_true] at h
obtain ⟨i20, hi20, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i21, hi21, h⟩ := bind_ok_inv _ _ _ h
by_cases hz : i21 ≥ 64#i32
· simp only [hz, if_true] at h
cases h
norm_num at hp
· simp only [hz, if_false] at h
obtain ⟨i22, hi22, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa1, hm1, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa2, hm2, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa3, hm3, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i24, hi24, h⟩ := bind_ok_inv _ _ _ h
cases h
have hc := IScalar.cast_fromBool_bound_eq .I32
(decide (mantissa3 ≥ i24))
change (IScalar.cast_fromBool IScalarTy.I32
(decide (mantissa3 ≥ i24))).val = 2047 at hp
have hupper : (IScalar.cast_fromBool IScalarTy.I32
(decide (mantissa3 ≥ i24))).val ≤ 1 :=
hc.2.trans (by norm_num)
exfalso
omega
· simp only [hp2, if_false] at h
obtain ⟨mantissa1, hm1, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa2, hm2, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa3, hm3, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i21, hi21, h⟩ := bind_ok_inv _ _ _ h
by_cases hcarry : mantissa3 ≥ i21
· simp only [hcarry, if_true] at h
obtain ⟨pair2, hpair2, h⟩ := bind_ok_inv _ _ _ h
rcases pair2 with ⟨mantissa4, power21⟩
obtain ⟨i22, hi22, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa5, hm5, hpair2⟩ :=
bind_ok_inv _ _ _ hpair2
obtain ⟨power22, hp22, hpair2⟩ :=
bind_ok_inv _ _ _ hpair2
cases hpair2
by_cases hsat : power21 ≥ 2047#i32
· simp only [hsat, if_true] at h
cases h
rfl
· simp only [hsat, if_false] at h
cases h
change power21.val = 2047 at hp
change ¬ 2047 ≤ power21.val at hsat
omega
· simp only [hcarry, if_false, bind_tc_ok,
Aeneas.Std.uncurry_apply_pair] at h
obtain ⟨i22, hi22, h⟩ := bind_ok_inv _ _ _ h
by_cases hsat : power2 ≥ 2047#i32
· simp only [hsat, if_true] at h
cases h
rfl
· simp only [hsat, if_false] at h
cases h
change power2.val = 2047 at hp
change ¬ 2047 ≤ power2.val at hsat
omega
· have hbfalse : decide (q ≤ 55#i64) = false := by simpa using hq55
simp only [hbfalse, if_false, bind_tc_ok] at h
cases h
norm_num at hp
· simp only [hqneg, if_false, bind_tc_ok] at h
cases h
norm_num at hp
· simp only [hlo, if_false] at h
obtain ⟨i8, hi8, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i9, hi9, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i11, hi11, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i12, hi12, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa, hmantissa, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i14, hi14, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i15, hi15, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i17, hi17, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i18, hi18, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i19, hi19, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨power2, hpower2, h⟩ := bind_ok_inv _ _ _ h
by_cases hp2 : power2 ≤ 0#i32
· simp only [hp2, if_true] at h
obtain ⟨i20, hi20, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i21, hi21, h⟩ := bind_ok_inv _ _ _ h
by_cases hz : i21 ≥ 64#i32
· simp only [hz, if_true] at h
cases h
norm_num at hp
· simp only [hz, if_false] at h
obtain ⟨i22, hi22, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa1, hm1, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa2, hm2, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa3, hm3, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i24, hi24, h⟩ := bind_ok_inv _ _ _ h
cases h
have hc := IScalar.cast_fromBool_bound_eq .I32
(decide (mantissa3 ≥ i24))
change (IScalar.cast_fromBool IScalarTy.I32
(decide (mantissa3 ≥ i24))).val = 2047 at hp
have hupper : (IScalar.cast_fromBool IScalarTy.I32
(decide (mantissa3 ≥ i24))).val ≤ 1 :=
hc.2.trans (by norm_num)
exfalso
omega
· simp only [hp2, if_false] at h
obtain ⟨mantissa1, hm1, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa2, hm2, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa3, hm3, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨i21, hi21, h⟩ := bind_ok_inv _ _ _ h
by_cases hcarry : mantissa3 ≥ i21
· simp only [hcarry, if_true] at h
obtain ⟨pair2, hpair2, h⟩ := bind_ok_inv _ _ _ h
rcases pair2 with ⟨mantissa4, power21⟩
obtain ⟨i22, hi22, h⟩ := bind_ok_inv _ _ _ h
obtain ⟨mantissa5, hm5, hpair2⟩ :=
bind_ok_inv _ _ _ hpair2
obtain ⟨power22, hp22, hpair2⟩ :=
bind_ok_inv _ _ _ hpair2
cases hpair2
by_cases hsat : power21 ≥ 2047#i32
· simp only [hsat, if_true] at h
cases h
rfl
· simp only [hsat, if_false] at h
cases h
change power21.val = 2047 at hp
change ¬ 2047 ≤ power21.val at hsat
omega
· simp only [hcarry, if_false, bind_tc_ok,
Aeneas.Std.uncurry_apply_pair] at h
obtain ⟨i22, hi22, h⟩ := bind_ok_inv _ _ _ h
by_cases hsat : power2 ≥ 2047#i32
· simp only [hsat, if_true] at h
cases h
rfl
· simp only [hsat, if_false] at h
cases h
change power2.val = 2047 at hp
change ¬ 2047 ≤ power2.val at hsat
omega
end dec2flt_model
Proof structure
Follow the declared dependencies to read the supporting statements and proofs.
Inspect related source (87)
- compute_float · dec2flt/lemire.rs:26 Program Rust
- Dec2flt_modelNumImpTraitsFloatU64 · traits.rs:309 Program Rust
- BITS · traits.rs:319 Program Rust
More program dependencies (45)
- 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
- SIG_TOTAL_BITS · traits.rs:320 Program Rust
- SMALLEST_POWER_OF_TEN · traits.rs:328 Program Rust
- BiasedFp · dec2flt/common.rs:52 Program Rust
- zero_pow2 · dec2flt/common.rs:62 Program Rust
- compute_product_approx · dec2flt/lemire.rs:134 Program Rust
- power · dec2flt/lemire.rs:121 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
- 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
- ByteSlice · dec2flt/common.rs:4 Program Rust
- Decimal · dec2flt/decimal.rs:32 Program Rust
- DecimalSeq · dec2flt/decimal_seq.rs:21 Program Rust
- full_multiplication · dec2flt/lemire.rs:126 Program Rust
- LARGEST_POWER_OF_FIVE · dec2flt/table.rs:10 Program Rust
- POWER_OF_FIVE_128 · dec2flt/table.rs:19 Program Rust
- SMALLEST_POWER_OF_FIVE · dec2flt/table.rs:9 Program Rust
- CastInto · traits.rs:18 Program Rust
- FloatExt · traits.rs:170 Program Rust
- Int · traits.rs:27 Program Rust
- Dec2flt_modelNumImpTraitsCastIntoI16 · traits.rs:45 Program Rust
- ONE · traits.rs:53 Program Rust
- ZERO · traits.rs:52 Program Rust
- cast · traits.rs:46 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
- 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
- F64
- F64 Insts CoreCloneClone
- F64 Insts CoreMarkerCopy
- F64 Insts CoreOpsArithDivF64F64
All 83 entries
- Binary64Model
- Binary64ModelDefault
- 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
- ParserComputeFloatInfinityMantissa
- ParserExponentConstants
- Preamble
- 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 lemire compute float
- num imp dec2flt lemire compute product approx
- num imp dec2flt lemire full multiplication
- num imp dec2flt lemire power
- num imp dec2flt table LARGEST POWER OF FIVE
- num imp dec2flt table POWER OF FIVE 128
- num imp dec2flt table SMALLEST POWER OF FIVE
- 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": "ParserComputeFloatInfinityMantissa",
"closure_version": "patch_c_v1",
"active_decl_hash": "c3b1a18cdd8077c80f6efe4fa1476eeb8225bd33223aad3bdc63d07d07cc20aa",
"active_statement_hash": "fb71f8e96c6e95574306c4b594e44aa4449c58ce097518e513df4b6731450cb6",
"kernel_axioms": [
"Classical.choice",
"Quot.sound",
"propext"
],
"toolchain_hash": "ce4c4e3d87434b9663f46de25ce34b48a0cf0d392e0a320a0787b4674a2d7b61",
"lean_executable_hash": "3e0d0d3d801675359f2d4cf9815bfdb417b20b92fdd9d48b3b14c95bbae28bbf",
"checker_script_hash": "c8e4a03273e23b9a8f2e141020652a4e0b7b0a8ab0883366ea9d031ca3f37aa1",
"approved_axioms_hash": "ab64d13f256386ee0e494a5abcc6a5db49512cf3d90bbdfcabd6327793a31f95",
"axcheck_status": "Agreed",
"accepted_at_snapshot_id": "worker-result-local-closure-issuance-cycle-136",
"boundary_theorems": {},
"strict_theorem_deps": {
"Binary64ModelDefault": "c722a2c00805b545",
"F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_BITS": "cfedcf26d6dae341",
"F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_LARGEST_POWER_OF_TEN": "2532cbe447dc07c7",
"F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SMALLEST_POWER_OF_TEN": "8a9e3dfa7e9aa5ec",
"ParserExponentConstants": "c1391b605f3cfebb",
"num_imp_dec2flt_lemire_compute_float": "7539bc2a998f5c1c",
"num_imp_traits_Float_EXP_BIAS_default": "39417be39e20ce5d",
"num_imp_traits_Float_EXP_BITS_default": "9ab622d85ef04d94",
"num_imp_traits_Float_EXP_MIN_default": "39417be39e20ce5d",
"num_imp_traits_Float_EXP_SAT_default": "9ab622d85ef04d94",
"num_imp_traits_Float_SIG_BITS_default": "9ab622d85ef04d94"
},
"strict_definition_deps": {
"Binary64Model": "c43614ff2149ecf2",
"Binary64ModelDefault": "dc548d1e27696ba4",
"F64": "ec4e25fbaf4e11d4",
"F64_Insts_Dec2flt_modelNumImpTraitsFloatU64": "94095c9bf79da164",
"F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_BITS": "d9fd91641cb78c5e",
"F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_LARGEST_POWER_OF_TEN": "e23324c94fa5d1b5",
"F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_MAX_EXPONENT_ROUND_TO_EVEN": "3dbd3f15a918cb2c",
"F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_MIN_EXPONENT_ROUND_TO_EVEN": "e508b987ade7bf71",
"F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SIG_TOTAL_BITS": "887b52d84a3fc9c4",
"F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SMALLEST_POWER_OF_TEN": "0c461c0c4f5aa880",
"Preamble": "1f712bede6a5dae6",
"core_num_FpCategory": "f500de642a5d5148",
"num_imp_dec2flt_common_BiasedFp": "63baac539d218a81",
"num_imp_dec2flt_common_BiasedFp_zero_pow2": "0f99ae12c6707137",
"num_imp_dec2flt_lemire_compute_float": "39d89e3f0a8a9d4c",
"num_imp_dec2flt_lemire_compute_product_approx": "af91b9cbef7779f3",
"num_imp_dec2flt_lemire_power": "56b7c3bd69ca3c6a",
"num_imp_traits_Float": "4442e69083aa891d"
}
}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:1e3757eb255af64286bd316dea98f17395986f852569920a12aec9b3e948fb61",
"superseded_for_theorem_closure": false
}Review verdicts
{
"corr_status": "Pass",
"substantiveness_status": "Pass"
}