def wsd.sd

bend-osdev-word64@0.1.1.0 · PROOF_text.bend:337

import bend-osdev-word64@0.1.1.0/PROOF_text.bend as PROOFText
import Base
import bend-osdev-u32@0.1.0.0/u32.bend as U
import bend-osdev-u32@0.1.0.0/LAWS.bend as UL
import bend-osdev-word64@0.1.1.0/word64.bend as W

337# a = 10 q + r with r < 10, for q and r from W64.small.divmod(a, 10)
338def wsd.sd(+a: W.W64) -> {Nat.add(Nat.mul(W.W64.to_nat(wsh.q(a)), 10n), U32.to_nat(wsh.r(a))) == W.W64.to_nat(a) : Nat} & {Nat.is_lt(U32.to_nat(wsh.r(a)), 10n) == True{} : Bool}:
339  match a:
340    case W.W64{+hh, +ll}:
341      wsd.sd1(hh, ll, wsd.step(0, 0, U32.shrn(hh, 16n), {==}, Equal.trans(Bool, Nat.is_lt(U32.to_nat(U32.shrn(hh, 16n)), U.U32Nat.dbl(16n, 1n)), Nat.is_lt(U.U32Nat.high(16n, U32.to_nat(hh)), U.U32Nat.dbl(16n, 1n)), True{}, Equal.cong(Nat, Bool, zz => Nat.is_lt(zz, U.U32Nat.dbl(16n, 1n)), U32.to_nat(U32.shrn(hh, 16n)), U.U32Nat.high(16n, U32.to_nat(hh)), Equal.sym(Nat, U.U32Nat.high(16n, U32.to_nat(hh)), U32.to_nat(U32.shrn(hh, 16n)), Equal.sym(Nat, U32.to_nat(U32.shrn(hh, 16n)), U.U32Nat.high(16n, U32.to_nat(hh)), UL.u32_shrn_value(hh, 16n)))), UL.high_lt(16n, 16n, 32n, U32.to_nat(hh), {==}, wu.lt(hh))), {==}))

Uses (22)

Used by (2)