def shr_c

bend-collections-laws-math@1.0.0.0 · proofs/math/typed/w64sh.bend:189

import bend-collections-laws-math@1.0.0.0/proofs/math/typed/w64sh.bend as W64sh
import Base
import bend-collections-laws-math@1.0.0.0/spec/lib/common.bend as C
import bend-collections-laws-math@1.0.0.0/spec/math/w64.bend as SW
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/u64.bend as WU
import bend-collections-laws-math@1.0.0.0/proofs/lib/nat.bend as N

189def shr_c(+l: U32, +h: U32, +k: Nat, +c: Bool, +hc: {Nat.is_lt(k, 32n) == c : Bool}) -> {SW.value(X.shr_pick(WU.U64{l, h}, k, c)) == C.high(k, val(l, h)) : Nat}:
190  match k c:
191    case 0n True{}:
192      {==}
193    case 1n+ +j True{}:
194      shr_small(l, h, j, hc)
195    case _ False{}:
196      shr_ge_c(l, h, k, N.not_lt_le(k, 32n, hc), Nat.is_le(64n, k), {==})

Uses (13)

Used by (1)