-- Mathlib/.lake/packages/lean4/src/lean/Std/Sat/AIG/If.lean
theorem go_decl_eq (aig : AIG α) (curr : Nat) (hcurr : curr ≤ w) (discr : Ref aig)
    (lhs rhs : RefVec aig w) (s : RefVec aig curr) :
    ∀ (idx : Nat) (h1) (h2),
      (go aig curr hcurr discr lhs rhs s).aig.decls[idx]'h2 = aig.decls[idx]'h1

Proof state:
case isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
discr : aig.Ref
lhs rhs : aig.RefVec w
s : aig.RefVec curr
res : RefVecEntry α w
h✝ : curr < w
hgo :
  go (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1) ⋯ (discr.cast ⋯)
      (lhs.cast ⋯) (rhs.cast ⋯)
      ((s.cast ⋯).push (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref) =
    res
idx : Nat
h1 : idx < aig.decls.size
h2 :
  idx <
    (go (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1) ⋯
            (discr.cast ⋯) (lhs.cast ⋯) (rhs.cast ⋯)
            ((s.cast ⋯).push
              (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref)).aig.decls.size
⊢ (go (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1) ⋯
            (discr.cast ⋯) (lhs.cast ⋯) (rhs.cast ⋯)
            ((s.cast ⋯).push
              (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref)).aig.decls[idx] =
    aig.decls[idx]

Tactic:
rw [go_decl_eq]

Result:
case isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
discr : aig.Ref
lhs rhs : aig.RefVec w
s : aig.RefVec curr
res : RefVecEntry α w
h✝ : curr < w
hgo :
  go (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1) ⋯ (discr.cast ⋯)
      (lhs.cast ⋯) (rhs.cast ⋯)
      ((s.cast ⋯).push (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref) =
    res
idx : Nat
h1 : idx < aig.decls.size
h2 :
  idx <
    (go (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1) ⋯
            (discr.cast ⋯) (lhs.cast ⋯) (rhs.cast ⋯)
            ((s.cast ⋯).push
              (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref)).aig.decls.size
⊢ (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig.decls[idx] = aig.decls[idx]

case isTrue.h1
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
discr : aig.Ref
lhs rhs : aig.RefVec w
s : aig.RefVec curr
res : RefVecEntry α w
h✝ : curr < w
hgo :
  go (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1) ⋯ (discr.cast ⋯)
      (lhs.cast ⋯) (rhs.cast ⋯)
      ((s.cast ⋯).push (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref) =
    res
idx : Nat
h1 : idx < aig.decls.size
h2 :
  idx <
    (go (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1) ⋯
            (discr.cast ⋯) (lhs.cast ⋯) (rhs.cast ⋯)
            ((s.cast ⋯).push
              (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref)).aig.decls.size
⊢ idx < (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig.decls.size

Proof state:
case isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
discr : aig.Ref
lhs rhs : aig.RefVec w
s : aig.RefVec curr
res : RefVecEntry α w
h✝ : curr < w
hgo :
  go (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1) ⋯ (discr.cast ⋯)
      (lhs.cast ⋯) (rhs.cast ⋯)
      ((s.cast ⋯).push (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref) =
    res
idx : Nat
h1 : idx < aig.decls.size
h2 :
  idx <
    (go (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1) ⋯
            (discr.cast ⋯) (lhs.cast ⋯) (rhs.cast ⋯)
            ((s.cast ⋯).push
              (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref)).aig.decls.size
⊢ (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig.decls[idx] = aig.decls[idx]

case isTrue.h1
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
discr : aig.Ref
lhs rhs : aig.RefVec w
s : aig.RefVec curr
res : RefVecEntry α w
h✝ : curr < w
hgo :
  go (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1) ⋯ (discr.cast ⋯)
      (lhs.cast ⋯) (rhs.cast ⋯)
      ((s.cast ⋯).push (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref) =
    res
idx : Nat
h1 : idx < aig.decls.size
h2 :
  idx <
    (go (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1) ⋯
            (discr.cast ⋯) (lhs.cast ⋯) (rhs.cast ⋯)
            ((s.cast ⋯).push
              (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref)).aig.decls.size
⊢ idx < (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig.decls.size

Tactic:
rw [AIG.LawfulOperator.decl_eq (f := AIG.mkIfCached)]

Result:
case isTrue.h2
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
discr : aig.Ref
lhs rhs : aig.RefVec w
s : aig.RefVec curr
res : RefVecEntry α w
h✝ : curr < w
hgo :
  go (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1) ⋯ (discr.cast ⋯)
      (lhs.cast ⋯) (rhs.cast ⋯)
      ((s.cast ⋯).push (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref) =
    res
idx : Nat
h1 : idx < aig.decls.size
h2 :
  idx <
    (go (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1) ⋯
            (discr.cast ⋯) (lhs.cast ⋯) (rhs.cast ⋯)
            ((s.cast ⋯).push
              (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref)).aig.decls.size
⊢ idx < (aig.mkIfCached { discr := discr, lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig.decls.size