split
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefStream w
curr : Nat
hcurr : curr ≤ w
s : aig.RefStream curr
idx : Nat
hidx1 : idx < w
hidx2 : curr ≤ idx
⊢ (if hcurr1 : curr < w then
          if hcurr2 : curr < w - distance % w then
            let ref := input.getRef (distance % w + curr) ⋯;
            let s := s.pushRef ref;
            go input distance (curr + 1) ⋯ s
          else
            let ref := input.getRef (curr - (w - distance % w)) ⋯;
            let s := s.pushRef ref;
            go input distance (curr + 1) ⋯ s
        else
          let_fun hcurr := ⋯;
          hcurr ▸ s).getRef
      idx hidx1 =
    if hidx3 : idx < w - distance % w then input.getRef (distance % w + idx) ⋯
    else input.getRef (idx - (w - distance % w)) ⋯
case isTrue
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefStream w
curr : Nat
hcurr : curr ≤ w
s : aig.RefStream curr
idx : Nat
hidx1 : idx < w
hidx2 : curr ≤ idx
h✝ : curr < w
⊢ (if hcurr2 : curr < w - distance % w then
          let ref := input.getRef (distance % w + curr) ⋯;
          let s := s.pushRef ref;
          go input distance (curr + 1) ⋯ s
        else
          let ref := input.getRef (curr - (w - distance % w)) ⋯;
          let s := s.pushRef ref;
          go input distance (curr + 1) ⋯ s).getRef
      idx hidx1 =
    if hidx3 : idx < w - distance % w then input.getRef (distance % w + idx) ⋯
    else input.getRef (idx - (w - distance % w)) ⋯

case isFalse
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefStream w
curr : Nat
hcurr : curr ≤ w
s : aig.RefStream curr
idx : Nat
hidx1 : idx < w
hidx2 : curr ≤ idx
h✝ : ¬curr < w
⊢ (let_fun hcurr := ⋯;
        hcurr ▸ s).getRef
      idx hidx1 =
    if hidx3 : idx < w - distance % w then input.getRef (distance % w + idx) ⋯
    else input.getRef (idx - (w - distance % w)) ⋯