-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/Bitblast/BVExpr/Circuit/Lemmas/Operations/SignExtend.lean
theorem go_get_aux (aig : AIG α) (w : Nat) (hw : 0 < w) (input : RefVec aig w) (newWidth : Nat)
    (curr : Nat) (hcurr : curr ≤ newWidth) (s : RefVec aig curr) :
    ∀ (idx : Nat) (hidx1 : idx < curr),
        (go w hw input newWidth curr hcurr s).get idx (by omega)
          =
        s.get idx hidx1

Proof state:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
aig : AIG α
w : Nat
hw : 0 < w
input : aig.RefVec w
newWidth curr : Nat
hcurr : curr ≤ newWidth
s : aig.RefVec curr
idx : Nat
hidx : idx < curr
⊢ (if hcurr1 : curr < newWidth then
          if hcurr2 : curr < w then
            let s := s.push (input.get curr hcurr2);
            go w hw input newWidth (curr + 1) ⋯ s
          else
            let s := s.push (input.get (w - 1) ⋯);
            go w hw input newWidth (curr + 1) ⋯ s
        else
          let_fun hcurr := ⋯;
          hcurr ▸ s).get
      idx ⋯ =
    s.get idx hidx

Tactic:
split

Result:
case isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
aig : AIG α
w : Nat
hw : 0 < w
input : aig.RefVec w
newWidth curr : Nat
hcurr : curr ≤ newWidth
s : aig.RefVec curr
idx : Nat
hidx : idx < curr
h✝ : curr < newWidth
⊢ (if hcurr2 : curr < w then
          let s := s.push (input.get curr hcurr2);
          go w hw input newWidth (curr + 1) ⋯ s
        else
          let s := s.push (input.get (w - 1) ⋯);
          go w hw input newWidth (curr + 1) ⋯ s).get
      idx ⋯ =
    s.get idx hidx

case isFalse
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
aig : AIG α
w : Nat
hw : 0 < w
input : aig.RefVec w
newWidth curr : Nat
hcurr : curr ≤ newWidth
s : aig.RefVec curr
idx : Nat
hidx : idx < curr
h✝ : ¬curr < newWidth
⊢ (let_fun hcurr := ⋯;
        hcurr ▸ s).get
      idx ⋯ =
    s.get idx hidx

Proof state:
case isTrue.isFalse
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
aig : AIG α
w : Nat
hw : 0 < w
input : aig.RefVec w
newWidth curr : Nat
hcurr : curr ≤ newWidth
s : aig.RefVec curr
idx : Nat
hidx : idx < curr
h✝¹ : curr < newWidth
h✝ : ¬curr < w
⊢ (go w hw input newWidth (curr + 1) ⋯ (s.push (input.get (w - 1) ⋯))).get idx ⋯ = s.get idx hidx

Tactic:
rw [go_get_aux]

Result:
case isTrue.isFalse
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
aig : AIG α
w : Nat
hw : 0 < w
input : aig.RefVec w
newWidth curr : Nat
hcurr : curr ≤ newWidth
s : aig.RefVec curr
idx : Nat
hidx : idx < curr
h✝¹ : curr < newWidth
h✝ : ¬curr < w
⊢ (s.push (input.get (w - 1) ⋯)).get idx ?isTrue.isFalse.hidx1 = s.get idx hidx

case isTrue.isFalse.hidx1
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
aig : AIG α
w : Nat
hw : 0 < w
input : aig.RefVec w
newWidth curr : Nat
hcurr : curr ≤ newWidth
s : aig.RefVec curr
idx : Nat
hidx : idx < curr
h✝¹ : curr < newWidth
h✝ : ¬curr < w
⊢ idx < curr + 1

Proof state:
case isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
aig : AIG α
w : Nat
hw : 0 < w
input : aig.RefVec w
newWidth curr : Nat
hcurr : curr ≤ newWidth
s : aig.RefVec curr
idx : Nat
hidx : idx < curr
h✝ : curr < newWidth
⊢ (if hcurr2 : curr < w then
          let s := s.push (input.get curr hcurr2);
          go w hw input newWidth (curr + 1) ⋯ s
        else
          let s := s.push (input.get (w - 1) ⋯);
          go w hw input newWidth (curr + 1) ⋯ s).get
      idx ⋯ =
    s.get idx hidx

Tactic:
dsimp only

Result:
case isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
aig : AIG α
w : Nat
hw : 0 < w
input : aig.RefVec w
newWidth curr : Nat
hcurr : curr ≤ newWidth
s : aig.RefVec curr
idx : Nat
hidx : idx < curr
h✝ : curr < newWidth
⊢ (if hcurr2 : curr < w then go w hw input newWidth (curr + 1) ⋯ (s.push (input.get curr hcurr2))
        else go w hw input newWidth (curr + 1) ⋯ (s.push (input.get (w - 1) ⋯))).get
      idx ⋯ =
    s.get idx hidx