def swap_high
bendtorch-core@0.1.0.0 · src/storage/refinement.bend:142
import bendtorch-core@0.1.0.0/src/storage/refinement.bend as Refinement
import Base
import bendtorch-core@0.1.0.0/src/storage/model.bend as Model
import bendtorch-core@0.1.0.0/src/storage/array.bend as Core
142def swap_high(-T: Data, -p: Nat, -original: Array<T>, -n: U32, -i: U32, -new: T,
143 xs: Array<T>,
144 child: Swap<T, p, original, U32.shr(n), U32.sub(i, U32.shr(n)),
145 U32.is_lt(U32.sub(i, U32.shr(n)), U32.shr(U32.shr(n))), new>,
146 ex: Model.Balanced(T, p, xs)) -> Swap<T, 1n+p, ANode{xs, original}, n, i, False{}, new>:
147 match child:
148 case Swap{ys, old, equal, written, observed, ey}:
149 Swap{ANode{xs, ys}, old,
150 Equal.cong(Array<T> & T, Array<T> & T, r => Array.swap.hi(T, xs, r),
151 (ys, old), Array.swap.go(T, original, U32.shr(n), U32.sub(i, U32.shr(n)), new,
152 U32.is_lt(U32.sub(i, U32.shr(n)), U32.shr(U32.shr(n)))), equal),
153 Equal.cong(Array<T>, Array<T>, y => ANode{xs, y}, ys,
154 Core.write_path(T, p, original,
155 trace(p, U32.shr(n), U32.sub(i, U32.shr(n)),
156 U32.is_lt(U32.sub(i, U32.shr(n)), U32.shr(U32.shr(n)))), new), written),
157 observed, (ex, ey)}