def below_take

bend-collections-laws-crypto@1.0.0.0 · proofs/crypto/random/bytes.bend:162

import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/random/bytes.bend as Bytes
import Base
import bend-collections-laws-crypto@1.0.0.0/spec/crypto/random.bend as SCR
import bend-collections-laws-crypto@1.0.0.0/proofs/lib/logic.bend as L

162def below_take(+n: Nat, +xs: List<&2, U32>, +h: {SCR.below256(xs) == True{} : Bool}) -> {SCR.below256(SCR.take(n, xs)) == True{} : Bool}:
163  match n xs:
164    case 0n _:
165      {==}
166    case 1n+p Nil{}:
167      {==}
168    case 1n+p Con{+x, +rest}:
169      %Equal.sym(Bool, U32.is_lt(x, 256), True{}, L.and_left(U32.is_lt(x, 256), SCR.below256(rest), h)) : {Bool.and(_, SCR.below256(SCR.take(p, rest))) == True{} : Bool}
170      below_take(p, rest, L.and_right(U32.is_lt(x, 256), SCR.below256(rest), h))

Uses (11)

Used by (1)