def div_exact
bend-collections-laws-crypto@1.0.0.0 · proofs/crypto/argon2/top.bend:38
import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/argon2/top.bend as Top
import Base
import bend-collections-laws-crypto@1.0.0.0/proofs/lib/logic.bend as L
import bend-collections-laws-crypto@1.0.0.0/proofs/lib/lemmas/proofs/nat_algebra.bend as NA
import bend-collections-laws-crypto@1.0.0.0/proofs/math/natural/arith.bend as NR
38
39def div_exact(+y: Nat, +d: Nat, +hd: {Nat.is_le(1n, d) == True{} : Bool}) -> {Nat.div(Nat.mul(y, d), d) == y : Nat}:
40 match d:
41 case 0n:
42 Empty.absurd({Nat.div(Nat.mul(y, 0n), 0n) == y : Nat}, L.false_true(hd))
43 case 1n+ +b:
44 %NA.add_zero(Nat.mul(y, 1n+b)) : {Nat.div(_, 1n+b) == y : Nat}
45 NR.div_of(y, b, 0n, {==})