def eg_up
import bend-collections-laws-math@1.0.0.0/src/math/number.bend as Numberimport Base
40# From the child (b, a mod b) to the parent (a, b): with q = a div b the
41# coefficients become (y', x' + q*y') and the sign flips (Knuth 4.5.2,
42# algorithm X, in magnitudes).
43def eg_up(+q: Nat, r: EGcd) -> EGcd:
44 match r:
45 case EG{+g, +x, +y, neg}:
46 EG{g, y, Nat.add(x, Nat.mul(q, y)), Bool.not(neg)}
Uses (5)
Used by (5)
- bend-collections-laws-math@1.0.0.0/src/math/number:egcd_go
- bend-collections-laws-math@1.0.0.0/proofs/math/number/egcd:gcd_go
- bend-collections-laws-math@1.0.0.0/proofs/math/number/egcd:up_bez
- bend-collections-laws-math@1.0.0.0/proofs/math/number/egcd:up_gcd
- bend-collections-laws-math@1.0.0.0/proofs/math/number/egcd:up_sign