F64addb.smb0: def of bend-collections-laws-math@1.0.0.0 Import: import bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64addb.bend as F64addb Lines 89-118 of bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64addb.bend: https://jend.leeeet.dev/read.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64addb.bend&start_line=89&end_line=118 import Base import bend-collections-laws-math@1.0.0.0/spec/lib/common.bend as C import bend-collections-laws-math@1.0.0.0/spec/math/f64.bend as SF import bend-collections-laws-math@1.0.0.0/spec/math/w64.bend as SW import bend-collections-laws-math@1.0.0.0/src/math/f64.bend as F import bend-collections-laws-math@1.0.0.0/src/math/w64.bend as X import bend-collections-laws-math@1.0.0.0/src/math/u64.bend as WU import bend-collections-laws-math@1.0.0.0/proofs/lib/nat.bend as N import bend-collections-laws-math@1.0.0.0/proofs/lib/logic.bend as L import bend-collections-laws-math@1.0.0.0/proofs/lib/lemmas/proofs/nat_algebra.bend as NA import bend-collections-laws-math@1.0.0.0/proofs/math/typed/width.bend as WW import bend-collections-laws-math@1.0.0.0/proofs/math/typed/w64add.bend as WA import bend-collections-laws-math@1.0.0.0/proofs/math/typed/w64sh.bend as SH import bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64rtools.bend as RT import bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64adda.bend as AA import bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64addp.bend as AP import bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64adds.bend as AS # subMags, the smaller operand subnormal (es = 0) def smb0(+one: Nat, +h1: {one == 1n : Nat}, +s: Bool, +el: Nat, +fl: WU.U64, +fs: WU.U64, +Fl: Nat, +Fs: Nat, +hfl: {SW.value(fl) == Fl : Nat}, +hfs: {SW.value(fs) == Fs : Nat}, +hFl: {C.fits(52n, Fl) == True{} : Bool}, +hFs: {C.fits(52n, Fs) == True{} : Bool}, +hlt: {Nat.is_lt(0n, el) == True{} : Bool}) -> {F.norm_round_pack(s, Nat.add(F.off(), Nat.sub(el, 1n)), X.sub(X.add(X.shl(fl, 10n), WU.U64{0, 1073741824}), X.shr_jam(F.sm_small(0n, X.shl(fs, 10n)), Nat.sub(el, 0n)))) == SF.round(s, Nat.sub(C.shift(Nat.sub(el, 1n), Nat.add(Fl, C.shift(52n, one))), Fs), 1926n) : F.F64}: +d = Nat.sub(el, 0n) +f10 = X.shl(fs, 10n) +et = top10(one, h1, fl, Fl, hfl, hFl, 1073741824, {==}) +hFv = L.subst(Nat, z => {C.fits(52n, z) == True{} : Bool}, Fs, SW.value(fs), Equal.sym(Nat, SW.value(fs), Fs, hfs), hFs) +e10 = Equal.trans(Nat, SW.value(f10), C.shift(10n, SW.value(fs)), C.shift(10n, Fs), AA.shl_v(fs, 10n, 52n, {==}, {==}, hFv), Equal.cong(Nat, Nat, z => C.shift(10n, z), SW.value(fs), Fs, hfs)) +S = C.shift(10n, C.shift(1n, Fs)) +f53s = Equal.trans(Bool, C.fits(Nat.add(1n, 52n), C.shift(1n, Fs)), C.fits(52n, Fs), True{}, RT.fits_sh(1n, 52n, Fs), hFs) +hS = SH.fits_mono(Nat.add(10n, 53n), 63n, S, {==}, Equal.trans(Bool, C.fits(Nat.add(10n, 53n), S), C.fits(53n, C.shift(1n, Fs)), True{}, RT.fits_sh(10n, 53n, C.shift(1n, Fs)), f53s)) a1 = WA.add_value(f10, f10) +eS0 = Equal.trans(Nat, Nat.add(SW.value(f10), SW.value(f10)), Nat.add(C.shift(10n, Fs), C.shift(10n, Fs)), S, Equal.trans(Nat, Nat.add(SW.value(f10), SW.value(f10)), Nat.add(C.shift(10n, Fs), SW.value(f10)), Nat.add(C.shift(10n, Fs), C.shift(10n, Fs)), Equal.cong(Nat, Nat, z => Nat.add(z, SW.value(f10)), SW.value(f10), C.shift(10n, Fs), e10), Equal.cong(Nat, Nat, z => Nat.add(C.shift(10n, Fs), z), SW.value(f10), C.shift(10n, Fs), e10)), Equal.trans(Nat, Nat.add(C.shift(10n, Fs), C.shift(10n, Fs)), Nat.double(C.shift(10n, Fs)), S, Equal.sym(Nat, Nat.double(C.shift(10n, Fs)), Nat.add(C.shift(10n, Fs), C.shift(10n, Fs)), NA.double_self(C.shift(10n, Fs))), Equal.sym(Nat, S, Nat.double(C.shift(10n, Fs)), WW.shift_dbl(10n, Fs)))) +es = Equal.trans(Nat, SW.value(X.add(f10, f10)), C.low(64n, Nat.add(SW.value(f10), SW.value(f10))), S, a1, Equal.trans(Nat, C.low(64n, Nat.add(SW.value(f10), SW.value(f10))), C.low(64n, S), S, Equal.cong(Nat, Nat, z => C.low(64n, z), Nat.add(SW.value(f10), SW.value(f10)), S, eS0), WW.low_fit(64n, S, SH.fits_mono(63n, 64n, S, {==}, hS)))) +ed = N.sub_zero(el) +eq1 = N.sub_add(el, 1n, N.lt_succ_le_succ(0n, el, hlt)) +hd1 = L.subst(Nat, z => {Nat.is_le(1n, z) == True{} : Bool}, el, d, Equal.sym(Nat, d, el, ed), N.lt_succ_le_succ(0n, el, hlt)) +hT63 = f63s(one, h1, 10n, Fl, hFl, {==}) +hT62 = Equal.trans(Bool, C.fits(Nat.add(10n, 52n), C.shift(10n, Nat.add(Fl, C.shift(52n, one)))), C.fits(52n, Nat.add(Fl, C.shift(52n, one))), False{}, RT.fits_sh(10n, 52n, Nat.add(Fl, C.shift(52n, one))), AA.n52(one, h1, Fl)) +hle = hlt2(one, h1, C.shift(9n, Nat.add(Fl, C.shift(52n, one))), C.shift(1n, Fs), d, hd1, hS, hT62) +hsig = subv(X.add(X.shl(fl, 10n), WU.U64{0, 1073741824}), X.add(f10, f10), C.shift(9n, Nat.add(Fl, C.shift(52n, one))), S, d, et, es, hle) +he = Equal.trans(Nat, Nat.add(Nat.add(1915n, d), 2180n), Nat.add(Nat.add(1915n, 1n+Nat.sub(el, 1n)), 2180n), Nat.add(F.off(), Nat.sub(el, 1n)), Equal.cong(Nat, Nat, z => Nat.add(Nat.add(1915n, z), 2180n), d, 1n+Nat.sub(el, 1n), Equal.trans(Nat, d, el, 1n+Nat.sub(el, 1n), ed, Equal.sym(Nat, 1n+Nat.sub(el, 1n), el, eq1))), Equal.cong(Nat, Nat, z => 1916n+z, Nat.add(Nat.sub(el, 1n), 2180n), Nat.add(2180n, Nat.sub(el, 1n)), NA.add_comm(Nat.sub(el, 1n), 2180n))) +hx63 = N.le_trans(63n, 1915n, Nat.add(1915n, d), {==}, N.le_add_right(1915n, d)) +r1 = AS.smb_c(one, h1, s, Nat.add(F.off(), Nat.sub(el, 1n)), X.sub(X.add(X.shl(fl, 10n), WU.U64{0, 1073741824}), X.shr_jam(F.sm_small(0n, X.shl(fs, 10n)), Nat.sub(el, 0n))), C.shift(9n, Nat.add(Fl, C.shift(52n, one))), C.shift(1n, Fs), d, 1915n, hsig, he, hx63, hd1, hS, hT62, hT63, Nat.is_eq(C.low(d, S), 0n), {==}) +r1b = Equal.trans(F.F64, F.norm_round_pack(s, Nat.add(F.off(), Nat.sub(el, 1n)), X.sub(X.add(X.shl(fl, 10n), WU.U64{0, 1073741824}), X.shr_jam(F.sm_small(0n, X.shl(fs, 10n)), Nat.sub(el, 0n)))), SF.round(s, Nat.sub(C.shift(d, Nat.double(C.shift(9n, Nat.add(Fl, C.shift(52n, one))))), S), 1915n), SF.round(s, Nat.sub(C.shift(d, C.shift(10n, Nat.add(Fl, C.shift(52n, one)))), S), 1915n), r1, Equal.cong(Nat, F.F64, z => SF.round(s, Nat.sub(C.shift(d, z), S), 1915n), Nat.double(C.shift(9n, Nat.add(Fl, C.shift(52n, one)))), C.shift(10n, Nat.add(Fl, C.shift(52n, one))), {==})) +A = C.shift(Nat.sub(el, 1n), Nat.add(Fl, C.shift(52n, one))) +hFA = N.le_trans(Fs, C.shift(52n, one), A, N.lt_le(Fs, C.shift(52n, one), WW.lt_one(52n, one, h1, Fs, hFs)), N.le_trans(C.shift(52n, one), Nat.add(Fl, C.shift(52n, one)), A, L.subst(Nat, z => {Nat.is_le(C.shift(52n, one), z) == True{} : Bool}, Nat.add(C.shift(52n, one), Fl), Nat.add(Fl, C.shift(52n, one)), NA.add_comm(C.shift(52n, one), Fl), N.le_add_right(C.shift(52n, one), Fl)), WW.shift_ge(Nat.sub(el, 1n), Nat.add(Fl, C.shift(52n, one))))) +eW = Equal.trans(Nat, Nat.sub(C.shift(d, C.shift(10n, Nat.add(Fl, C.shift(52n, one)))), S), Nat.sub(Nat.double(C.shift(Nat.sub(el, 1n), C.shift(10n, Nat.add(Fl, C.shift(52n, one))))), S), C.shift(11n, Nat.sub(A, Fs)), Equal.cong(Nat, Nat, z => Nat.sub(C.shift(z, C.shift(10n, Nat.add(Fl, C.shift(52n, one)))), S), d, 1n+Nat.sub(el, 1n), Equal.trans(Nat, d, el, 1n+Nat.sub(el, 1n), ed, Equal.sym(Nat, 1n+Nat.sub(el, 1n), el, eq1))), Equal.trans(Nat, Nat.sub(Nat.double(C.shift(Nat.sub(el, 1n), C.shift(10n, Nat.add(Fl, C.shift(52n, one))))), S), Nat.sub(Nat.double(C.shift(10n, A)), S), C.shift(11n, Nat.sub(A, Fs)), Equal.cong(Nat, Nat, z => Nat.sub(Nat.double(z), S), C.shift(Nat.sub(el, 1n), C.shift(10n, Nat.add(Fl, C.shift(52n, one)))), C.shift(10n, A), AA.shc(Nat.sub(el, 1n), 10n, Nat.add(Fl, C.shift(52n, one)))), Equal.trans(Nat, Nat.sub(Nat.double(C.shift(10n, A)), S), Nat.sub(C.shift(10n, C.shift(1n, A)), S), C.shift(11n, Nat.sub(A, Fs)), Equal.cong(Nat, Nat, z => Nat.sub(z, S), Nat.double(C.shift(10n, A)), C.shift(10n, C.shift(1n, A)), Equal.sym(Nat, C.shift(10n, C.shift(1n, A)), Nat.double(C.shift(10n, A)), WW.shift_dbl(10n, A))), Equal.trans(Nat, Nat.sub(C.shift(10n, C.shift(1n, A)), S), C.shift(10n, Nat.sub(C.shift(1n, A), C.shift(1n, Fs))), C.shift(11n, Nat.sub(A, Fs)), AP.sub_shift(10n, C.shift(1n, A), C.shift(1n, Fs), WW.shift_mono(1n, Fs, A, hFA)), Equal.trans(Nat, C.shift(10n, Nat.sub(C.shift(1n, A), C.shift(1n, Fs))), C.shift(10n, C.shift(1n, Nat.sub(A, Fs))), C.shift(11n, Nat.sub(A, Fs)), Equal.cong(Nat, Nat, z => C.shift(10n, z), Nat.sub(C.shift(1n, A), C.shift(1n, Fs)), C.shift(1n, Nat.sub(A, Fs)), AP.sub_shift(1n, A, Fs, hFA)), Equal.sym(Nat, C.shift(Nat.add(10n, 1n), Nat.sub(A, Fs)), C.shift(10n, C.shift(1n, Nat.sub(A, Fs))), WW.shift_comp(10n, 1n, Nat.sub(A, Fs)))))))) +r2 = Equal.cong(Nat, F.F64, z => SF.round(s, z, 1915n), Nat.sub(C.shift(d, C.shift(10n, Nat.add(Fl, C.shift(52n, one)))), S), C.shift(11n, Nat.sub(A, Fs)), eW) +r3 = RT.round_shift_to(s, 11n, Nat.sub(A, Fs), 1915n, 1926n, {==}) Equal.trans(F.F64, F.norm_round_pack(s, Nat.add(F.off(), Nat.sub(el, 1n)), X.sub(X.add(X.shl(fl, 10n), WU.U64{0, 1073741824}), X.shr_jam(F.sm_small(0n, X.shl(fs, 10n)), Nat.sub(el, 0n)))), SF.round(s, Nat.sub(C.shift(d, C.shift(10n, Nat.add(Fl, C.shift(52n, one)))), S), 1915n), SF.round(s, Nat.sub(A, Fs), 1926n), r1b, Equal.trans(F.F64, SF.round(s, Nat.sub(C.shift(d, C.shift(10n, Nat.add(Fl, C.shift(52n, one)))), S), 1915n), SF.round(s, C.shift(11n, Nat.sub(A, Fs)), 1915n), SF.round(s, Nat.sub(A, Fs), 1926n), r2, r3)) Uses (53): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.cong https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.sym https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.trans https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.double https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_le https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_lt https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.sub https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/lib/lemmas/proofs/nat_algebra.bend&name=add_comm https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/lib/lemmas/proofs/nat_algebra.bend&name=double_self https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/lib/logic.bend&name=subst https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/lib/nat.bend&name=le_add_right https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/lib/nat.bend&name=le_trans https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/lib/nat.bend&name=lt_le https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/lib/nat.bend&name=lt_succ_le_succ https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/lib/nat.bend&name=sub_add https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/lib/nat.bend&name=sub_zero https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64adda.bend&name=n52 https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64adda.bend&name=shc https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64adda.bend&name=shl_v https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64addb.bend&name=f63s https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64addb.bend&name=hlt2 https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64addb.bend&name=subv https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64addb.bend&name=top10 https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64addp.bend&name=sub_shift https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64adds.bend&name=smb_c https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64rtools.bend&name=fits_sh https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64rtools.bend&name=round_shift_to https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/w64add.bend&name=add_value https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/w64sh.bend&name=fits_mono https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/width.bend&name=low_fit https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/width.bend&name=lt_one https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/width.bend&name=shift_comp https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/width.bend&name=shift_dbl https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/width.bend&name=shift_ge https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/math/typed/width.bend&name=shift_mono https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/spec/lib/common.bend&name=fits https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/spec/lib/common.bend&name=low https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/spec/lib/common.bend&name=shift https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/spec/math/f64.bend&name=round https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/spec/math/w64.bend&name=value https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/f64.bend&name=F64 https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/f64.bend&name=norm_round_pack https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/f64.bend&name=off https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/f64.bend&name=sm_small https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/u64.bend&name=U64 https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/w64.bend&name=add https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/w64.bend&name=shl https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/w64.bend&name=shr_jam https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/w64.bend&name=sub