def draw_lt

bend-collections-laws-crypto@1.0.0.0 · proofs/math/random/below.bend:105

import bend-collections-laws-crypto@1.0.0.0/proofs/math/random/below.bend as Below
import Base
import bend-collections-laws-crypto@1.0.0.0/spec/lib/common.bend as C
import bend-collections-laws-crypto@1.0.0.0/spec/math/random/rand.bend as SR
import bend-collections-laws-crypto@1.0.0.0/proofs/lib/logic.bend as L

105# THEOREM: an accepted draw is below n
106def draw_lt(+x: Nat, +n: Nat, +k: Nat, +hx: {C.fits(64n, x) == True{} : Bool}, +hn: {Nat.is_lt(0n, n) == True{} : Bool}, +e: {SR.draw(64n, x, n) == Some{k} : Maybe<&2, Nat>}) -> {Nat.is_lt(k, n) == True{} : Bool}:
107  match n:
108    case 0n:
109      Empty.absurd({Nat.is_lt(k, 0n) == True{} : Bool}, L.false_true(hn))
110    case 1n+m:
111      draw_pos_lt(x, m, k, hx, Nat.is_eq(SR.and_bits(64n, 1n+m, m), 0n), e)

Uses (11)

Used by (1)