. next hidx =>
  rw [← hgo]
  rw [go_eq_eval_getLsb]
  . simp only [hidx, ↓reduceDite, RefStream.getRef_cast, Ref_cast']
    rw [AIG.LawfulOperator.denote_mem_prefix (f := AIG.mkConstCached)]
  . omega
case isTrue.inr.isTrue.isFalse
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefStream w
assign : α → Bool
curr : Nat
hcurr : curr ≤ w
s : aig.RefStream curr
idx : Nat
hidx1 : idx < w
hidx2 : curr ≤ idx
res : RefStreamEntry α w
h✝³ : curr < w
h✝² : curr < idx
h✝¹ : curr < distance
hgo :
  go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).pushRef (aig.mkConstCached false).ref) =
    res
h✝ : ¬idx < distance
⊢ ⟦{ aig := res.aig, ref := res.stream.getRef idx hidx1 }, assign⟧ =
    ⟦{ aig := aig, ref := input.getRef (idx - distance) ⋯ }, assign⟧
no goals