cases Nat.eq_or_lt_of_le hidx2 with
| inl heq =>
  rw [← hgo]
  rw [go_getRef]
  rw [AIG.RefStream.getRef_push_ref_eq']
  . rw [← heq]
    rw [go_denote_mem_prefix]
    . simp [hlt]
    . simp [Ref.hgate]
  . rw [heq]
| inr =>
  rw [← hgo]
  dsimp
  rw [go_eq_eval_getLsb]
  . simp
  . omega
w : Nat
aig : AIG BVBit
a : Nat
assign : Assignment
curr : Nat
hcurr : curr ≤ w
s : aig.RefStream curr
idx : Nat
hidx1 : idx < w
hidx2 : curr ≤ idx
res : RefStreamEntry BVBit w
hlt : curr < w
hgo :
  go w (aig.mkAtomCached (BVBit.mk a ⟨curr, hlt⟩)).aig (curr + 1)
      ((s.cast ⋯).pushRef (aig.mkAtomCached (BVBit.mk a ⟨curr, hlt⟩)).ref) a ⋯ =
    res
⊢ ⟦{ aig := res.aig, ref := res.stream.getRef idx hidx1 }, assign.toAIGAssignment⟧ = (eval assign (var a)).getLsb idx
no goals