def gw_dvd

bend-collections-laws-crypto@1.0.0.0 · proofs/math/natural/lists.bend:95

import bend-collections-laws-crypto@1.0.0.0/proofs/math/natural/lists.bend as Lists
import Base
import bend-collections-laws-crypto@1.0.0.0/src/math/natural.bend as M
import bend-collections-laws-crypto@1.0.0.0/proofs/math/natural/gcd.bend as G

95# the quotient gcd_all_go(xs, acc) / d for a common divisor d
96def gw_dvd(+xs: List<&2, Nat>, +ks: List<&2, Nat>, +acc: Nat, +ka: Nat) -> Nat:
97  match xs ks:
98    case Nil{} Nil{}:
99      ka
100    case Nil{} Con{k, kt}:
101      ka
102    case Con{x, t} Nil{}:
103      0n
104    case Con{+x, +t} Con{+k, +kt}:
105      gw_dvd(t, kt, M.gcd(acc, x), G.dw(x, acc, x, ka, k))

Uses (4)

Used by (3)