def inv_fin

bend-collections-laws-crypto@1.0.0.0 · src/math/natural.bend:314

import bend-collections-laws-crypto@1.0.0.0/src/math/natural.bend as Natural
import Base

314def inv_fin(+m: Nat, bz: Bezout) -> Result<&2, &2, MathError, Nat>:
315  match bz:
316    case BZ{1n, s}:
317      Done{Nat.mod(s, m)}
318    case BZ{0n, s}:
319      Fail{NotInvertible{}}
320    case BZ{2n+g, s}:
321      Fail{NotInvertible{}}

Uses (5)

Used by (3)