def okb

bend-collections-laws-crypto@1.0.0.0 · proofs/crypto/curve25519/limbs.bend:41

import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/curve25519/limbs.bend as Limbs
import Base

41# exactly n limbs, each at most b
42def okb(n: Nat, xs: List<&2, U32>, +b: Nat) -> Bool:
43  match n:
44    case 0n:
45      match xs:
46        case Nil{}:
47          True{}
48        case Con{x, xt}:
49          False{}
50    case 1n+m:
51      match xs:
52        case Nil{}:
53          False{}
54        case Con{x, xt}:
55          Bool.and(Nat.is_le(U32.to_nat(x), b), okb(m, xt, b))

Uses (7)

Used by (179)