proofs/math/random/proof_draws.bend
bend-collections-laws-math@1.0.0.0 · 41 lines · 8 definitions
1import Base
2import bend-collections-laws-math@1.0.0.0/spec/lib/common.bend as C
3import bend-collections-laws-math@1.0.0.0/src/math/u64.bend as W
4import bend-collections-laws-math@1.0.0.0/src/math/w64.bend as X
5import bend-collections-laws-math@1.0.0.0/spec/math/random.bend as SRM
6import bend-collections-laws-math@1.0.0.0/proofs/math/random/uint64n.bend as UN
7import bend-collections-laws-math@1.0.0.0/proofs/math/random/bounded.bend as BD
8import bend-collections-laws-math@1.0.0.0/proofs/math/random/wrappers.bend as WR
9
10
11
12
13
14
15
16
17
18
19def Uint64n.value(~S: Data, ~next: S -> W.U64 & S, +s: S, +n: W.U64) -> SRM.Uint64n.value(~S, ~next, s, n):
20 UN.uint64n_value(~S, ~next, s, n)
21
22def Uint64n.lt(~S: Data, ~next: S -> W.U64 & S, +s: S, +n: W.U64, +hn: {X.is_zero(n) == False{} : Bool}) -> SRM.Uint64n.lt(~S, ~next, s, n, hn):
23 BD.uint64n_lt(~S, ~next, s, n, hn)
24
25def Uint32.value(~S: Data, ~next: S -> W.U64 & S, +s: S) -> SRM.Uint32.value(~S, ~next, s):
26 WR.uint32_value(~S, ~next, s)
27
28def Int64.value(~S: Data, ~next: S -> W.U64 & S, +s: S) -> SRM.Int64.value(~S, ~next, s):
29 WR.int64_value(~S, ~next, s)
30
31def Int32.value(~S: Data, ~next: S -> W.U64 & S, +s: S) -> SRM.Int32.value(~S, ~next, s):
32 WR.int32_value(~S, ~next, s)
33
34def Uint32n.lt(~S: Data, ~next: S -> W.U64 & S, +s: S, +n: U32, +hn: {U32.is_zero(n) == False{} : Bool}) -> SRM.Uint32n.lt(~S, ~next, s, n, hn):
35 WR.uint32n_lt(~S, ~next, s, n, hn)
36
37def Intn.lt(~S: Data, ~next: S -> W.U64 & S, +s: S, +n: Nat, +hn: {Nat.is_lt(0n, n) == True{} : Bool}, +hw: {C.fits(64n, n) == True{} : Bool}) -> SRM.Intn.lt(~S, ~next, s, n, hn, hw):
38 WR.intn_lt(~S, ~next, s, n, hn, hw)
39
40def IntRange.bounds(~S: Data, ~next: S -> W.U64 & S, +s: S, +lo: Nat, +hi: Nat, +h: {Nat.is_lt(lo, hi) == True{} : Bool}, +hw: {C.fits(64n, Nat.sub(hi, lo)) == True{} : Bool}) -> SRM.IntRange.bounds(~S, ~next, s, lo, hi, h, hw):
41 WR.int_range_bounds(~S, ~next, s, lo, hi, h, hw)