def swap_at_occ

bend-collections-laws-math@1.0.0.0 · proofs/math/random/shuffle.bend:100

import bend-collections-laws-math@1.0.0.0/proofs/math/random/shuffle.bend as Shuffle
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

100def swap_at_occ(~A: Data, ~V: Data, ~rel: A -> V -> Bool, -S: Data, +v: V, +xs: List<&2, A>, +i: Nat, r: W.U64 & S) -> {occ(~A, ~V, ~rel, v, R.fst(List<&2, A>, S, R.swap_at(A, S, xs, i, r))) == occ(~A, ~V, ~rel, v, xs) : Nat}:
101  match r:
102    case Tuple{+j, s}:
103      swap_occ(~A, ~V, ~rel, v, xs, i, X.n48(j))

Uses (11)

Used by (1)