-- Mathlib/.lake/packages/lean4/src/lean/Std/Sat/AIG/If.lean
theorem go_get_aux {w : Nat} (aig : AIG α) (curr : Nat) (hcurr : curr ≤ w) (discr : Ref aig)
    (lhs rhs : RefVec aig w) (s : RefVec aig curr) :
    ∀ (idx : Nat) (hidx : idx < curr) (hfoo),
      (go aig curr hcurr discr lhs rhs s).vec.get idx (by omega)
        =
      (s.get idx hidx).cast hfoo

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
idx : Nat
hidx : idx < 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
hfoo✝ :
  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.size
⊢ ((s.cast ⋯).get idx ?isTrue.hidx).cast ?isTrue.hfoo = (s.get idx hidx).cast hfoo✝

Tactic:
simp only [Ref.cast, Ref.mk.injEq]

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
idx : Nat
hidx : idx < 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
hfoo✝ :
  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.size
⊢ ((s.cast ⋯).get idx ?isTrue.hidx).gate = (s.get idx hidx).gate

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
idx : Nat
hidx : idx < 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
⊢ ∀ (hfoo : aig.decls.size ≤ res.aig.decls.size), res.vec.get idx ⋯ = (s.get idx hidx).cast hfoo

Tactic:
rw [← hgo]

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
idx : Nat
hidx : idx < 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
⊢ ∀
    (hfoo :
      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.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)).vec.get
        idx ⋯ =
      (s.get idx hidx).cast hfoo

Proof state:
α : 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
⊢ ∀ (idx : Nat) (hidx : idx < curr) (hfoo : aig.decls.size ≤ (go aig curr hcurr discr lhs rhs s).aig.decls.size),
    (go aig curr hcurr discr lhs rhs s).vec.get idx ⋯ = (s.get idx hidx).cast hfoo

Tactic:
intro idx hidx

Result:
α : 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
idx : Nat
hidx : idx < curr
⊢ ∀ (hfoo : aig.decls.size ≤ (go aig curr hcurr discr lhs rhs s).aig.decls.size),
    (go aig curr hcurr discr lhs rhs s).vec.get idx ⋯ = (s.get idx hidx).cast hfoo

Proof state:
case isTrue.hidx
α : 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
idx : Nat
hidx : idx < 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
hfoo✝ :
  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.size
⊢ idx < curr

Tactic:
assumption

Result:
no goals