def AP.index_wrap.go
bend-osdev-array@0.1.0.1 · PROOF.bend:1743
import bend-osdev-array@0.1.0.1/PROOF.bend as PROOF
import Base
import bend-osdev-array@0.1.0.1/array.bend as A
1743def AP.index_wrap.go(+d: Nat, +hd: {Nat.is_lt(d, 32n) == True{} : Bool}, +k: Nat, +hk: {Nat.is_lt(k, A.Arrays.slots(d)) == True{} : Bool}) -> {A.Arrays.index(d, U32.from_nat(Nat.add(A.Arrays.slots(d), k))) == k : Nat}:
1744 +s = A.Arrays.slots(d)
1745 +a = U32.from_nat(Nat.add(s, k))
1746 +hd1 = Equal.trans(Bool, Nat.is_le(1n+d, 32n), Nat.is_lt(d, 32n), True{}, AP.le_succ(d, 32n), hd)
1747 +fk = AP.from_nat(Nat.add(s, k), 1n+d, AP.wrap_lt(s, k, hk), hd1)
1748 %Equal.sym(U32, U32.sub(U32.shln(1, d), 1), U32{AP.lm(32n, d)}, AP.mask_lm(d)) : {U32.to_nat(U32.and(a, _)) == k : Nat}
1749 AP.u32_wrap(a, d, k, fk, hk, hd)