def uint64n_lt
bend-collections-laws-math@1.0.0.0 · proofs/math/random/bounded.bend:28
import bend-collections-laws-math@1.0.0.0/proofs/math/random/bounded.bend as Bounded
import Base
import bend-collections-laws-math@1.0.0.0/src/math/u64.bend as W
import bend-collections-laws-math@1.0.0.0/src/math/w64.bend as X
import bend-collections-laws-math@1.0.0.0/src/math/random/rand.bend as R
import bend-collections-laws-math@1.0.0.0/spec/math/w64.bend as SW
import bend-collections-laws-math@1.0.0.0/spec/math/random.bend as SRM
import bend-collections-laws-math@1.0.0.0/spec/math/random/rand.bend as SR
import bend-collections-laws-math@1.0.0.0/proofs/math/typed/w64add.bend as WA
import bend-collections-laws-math@1.0.0.0/proofs/math/random/uint64n.bend as UN
import bend-collections-laws-math@1.0.0.0/proofs/math/random/below.bend as BL
28def 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):
29 +vn = SW.value(n)
30 +hv = Equal.trans(Bool, Nat.is_eq(vn, 0n), X.is_zero(n), False{}, Equal.sym(Bool, X.is_zero(n), Nat.is_eq(vn, 0n), WA.is_zero_value(n)), hn)
31 +e = Equal.trans(Nat, SW.value(R.fst(W.U64, S, R.uint64n(~S, ~next, s, n))), BL.pfst(S, SRM.val_pair(S, R.uint64n(~S, ~next, s, n))), BL.pfst(S, SR.below(~S, ~next, 127n, vn, s)),
32 Equal.sym(Nat, BL.pfst(S, SRM.val_pair(S, R.uint64n(~S, ~next, s, n))), SW.value(R.fst(W.U64, S, R.uint64n(~S, ~next, s, n))), fst_val(S, R.uint64n(~S, ~next, s, n))),
33 Equal.cong(Nat & S, Nat, p => BL.pfst(S, p), SRM.val_pair(S, R.uint64n(~S, ~next, s, n)), SR.below(~S, ~next, 127n, vn, s), UN.uint64n_value(~S, ~next, s, n)))
34 Equal.trans(Bool, Nat.is_lt(SW.value(R.fst(W.U64, S, R.uint64n(~S, ~next, s, n))), vn), Nat.is_lt(BL.pfst(S, SR.below(~S, ~next, 127n, vn, s)), vn), True{},
35 Equal.cong(Nat, Bool, z => Nat.is_lt(z, vn), SW.value(R.fst(W.U64, S, R.uint64n(~S, ~next, s, n))), BL.pfst(S, SR.below(~S, ~next, 127n, vn, s)), e),
36 BL.below_lt(~S, ~next, 127n, vn, s, nz_pos(vn, hv)))