-- Mathlib/.lake/packages/lean4/src/lean/Std/Sat/AIG/RefVecOperator/Map.lean
theorem go_get_aux {aig : AIG α} (curr : Nat) (hcurr : curr ≤ len) (s : RefVec aig curr)
    (input : RefVec aig len) (f : (aig : AIG α) → Ref aig → Entrypoint α)
    [LawfulOperator α Ref f] [LawfulMapOperator α f] :
    -- The hfoo here is a trick to make the dependent type gods happy.
    ∀ (idx : Nat) (hidx : idx < curr) (hfoo),
      (go aig curr hcurr s input f).vec.get idx (by omega)
        =
      (s.get idx hidx).cast hfoo

Proof state:
case isTrue
α : Type
inst✝³ : Hashable α
inst✝² : DecidableEq α
len : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefVec curr
input : aig.RefVec len
f : (aig : AIG α) → aig.Ref → Entrypoint α
inst✝¹ : LawfulOperator α Ref f
inst✝ : LawfulMapOperator α f
idx : Nat
hidx : idx < curr
res : RefVecEntry α len
h✝ : curr < len
hgo :
  go (f aig (input.get curr h✝)).aig (curr + 1) ⋯ ((s.cast ⋯).push (f aig (input.get curr h✝)).ref) (input.cast ⋯) f =
    res
hfoo :
  aig.decls.size ≤
    (go (f aig (input.get curr h✝)).aig (curr + 1) ⋯ ((s.cast ⋯).push (f aig (input.get curr h✝)).ref) (input.cast ⋯)
            f).aig.decls.size
⊢ (((s.cast ⋯).push (f aig (input.get curr h✝)).ref).get idx ?isTrue.hidx).cast ?isTrue.hfoo =
    (s.get idx hidx).cast hfoo

case isTrue.hidx
α : Type
inst✝³ : Hashable α
inst✝² : DecidableEq α
len : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefVec curr
input : aig.RefVec len
f : (aig : AIG α) → aig.Ref → Entrypoint α
inst✝¹ : LawfulOperator α Ref f
inst✝ : LawfulMapOperator α f
idx : Nat
hidx : idx < curr
res : RefVecEntry α len
h✝ : curr < len
hgo :
  go (f aig (input.get curr h✝)).aig (curr + 1) ⋯ ((s.cast ⋯).push (f aig (input.get curr h✝)).ref) (input.cast ⋯) f =
    res
hfoo :
  aig.decls.size ≤
    (go (f aig (input.get curr h✝)).aig (curr + 1) ⋯ ((s.cast ⋯).push (f aig (input.get curr h✝)).ref) (input.cast ⋯)
            f).aig.decls.size
⊢ idx < curr + 1

case isTrue.hfoo
α : Type
inst✝³ : Hashable α
inst✝² : DecidableEq α
len : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefVec curr
input : aig.RefVec len
f : (aig : AIG α) → aig.Ref → Entrypoint α
inst✝¹ : LawfulOperator α Ref f
inst✝ : LawfulMapOperator α f
idx : Nat
hidx : idx < curr
res : RefVecEntry α len
h✝ : curr < len
hgo :
  go (f aig (input.get curr h✝)).aig (curr + 1) ⋯ ((s.cast ⋯).push (f aig (input.get curr h✝)).ref) (input.cast ⋯) f =
    res
hfoo :
  aig.decls.size ≤
    (go (f aig (input.get curr h✝)).aig (curr + 1) ⋯ ((s.cast ⋯).push (f aig (input.get curr h✝)).ref) (input.cast ⋯)
            f).aig.decls.size
⊢ (f aig (input.get curr h✝)).aig.decls.size ≤
    (go (f aig (input.get curr h✝)).aig (curr + 1) ⋯ ((s.cast ⋯).push (f aig (input.get curr h✝)).ref) (input.cast ⋯)
            f).aig.decls.size

Tactic:
rw [AIG.RefVec.get_push_ref_lt]

Result:
case isTrue
α : Type
inst✝³ : Hashable α
inst✝² : DecidableEq α
len : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefVec curr
input : aig.RefVec len
f : (aig : AIG α) → aig.Ref → Entrypoint α
inst✝¹ : LawfulOperator α Ref f
inst✝ : LawfulMapOperator α f
idx : Nat
hidx : idx < curr
res : RefVecEntry α len
h✝ : curr < len
hgo :
  go (f aig (input.get curr h✝)).aig (curr + 1) ⋯ ((s.cast ⋯).push (f aig (input.get curr h✝)).ref) (input.cast ⋯) f =
    res
hfoo :
  aig.decls.size ≤
    (go (f aig (input.get curr h✝)).aig (curr + 1) ⋯ ((s.cast ⋯).push (f aig (input.get curr h✝)).ref) (input.cast ⋯)
            f).aig.decls.size
⊢ ((s.cast ⋯).get idx ?isTrue.hidx).cast ?isTrue.hfoo = (s.get idx hidx).cast hfoo

case isTrue.hidx
α : Type
inst✝³ : Hashable α
inst✝² : DecidableEq α
len : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefVec curr
input : aig.RefVec len
f : (aig : AIG α) → aig.Ref → Entrypoint α
inst✝¹ : LawfulOperator α Ref f
inst✝ : LawfulMapOperator α f
idx : Nat
hidx : idx < curr
res : RefVecEntry α len
h✝ : curr < len
hgo :
  go (f aig (input.get curr h✝)).aig (curr + 1) ⋯ ((s.cast ⋯).push (f aig (input.get curr h✝)).ref) (input.cast ⋯) f =
    res
hfoo :
  aig.decls.size ≤
    (go (f aig (input.get curr h✝)).aig (curr + 1) ⋯ ((s.cast ⋯).push (f aig (input.get curr h✝)).ref) (input.cast ⋯)
            f).aig.decls.size
⊢ idx < curr

case isTrue.hfoo
α : Type
inst✝³ : Hashable α
inst✝² : DecidableEq α
len : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefVec curr
input : aig.RefVec len
f : (aig : AIG α) → aig.Ref → Entrypoint α
inst✝¹ : LawfulOperator α Ref f
inst✝ : LawfulMapOperator α f
idx : Nat
hidx : idx < curr
res : RefVecEntry α len
h✝ : curr < len
hgo :
  go (f aig (input.get curr h✝)).aig (curr + 1) ⋯ ((s.cast ⋯).push (f aig (input.get curr h✝)).ref) (input.cast ⋯) f =
    res
hfoo :
  aig.decls.size ≤
    (go (f aig (input.get curr h✝)).aig (curr + 1) ⋯ ((s.cast ⋯).push (f aig (input.get curr h✝)).ref) (input.cast ⋯)
            f).aig.decls.size
⊢ (f aig (input.get curr h✝)).aig.decls.size ≤
    (go (f aig (input.get curr h✝)).aig (curr + 1) ⋯ ((s.cast ⋯).push (f aig (input.get curr h✝)).ref) (input.cast ⋯)
            f).aig.decls.size

Proof state:
α : Type
inst✝³ : Hashable α
inst✝² : DecidableEq α
len : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefVec curr
input : aig.RefVec len
f : (aig : AIG α) → aig.Ref → Entrypoint α
inst✝¹ : LawfulOperator α Ref f
inst✝ : LawfulMapOperator α f
idx : Nat
hidx : idx < curr
⊢ ∀ (hfoo : aig.decls.size ≤ (go aig curr hcurr s input f).aig.decls.size),
    (go aig curr hcurr s input f).vec.get idx ⋯ = (s.get idx hidx).cast hfoo

Tactic:
generalize hgo : go aig curr hcurr s input f = res

Result:
α : Type
inst✝³ : Hashable α
inst✝² : DecidableEq α
len : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefVec curr
input : aig.RefVec len
f : (aig : AIG α) → aig.Ref → Entrypoint α
inst✝¹ : LawfulOperator α Ref f
inst✝ : LawfulMapOperator α f
idx : Nat
hidx : idx < curr
res : RefVecEntry α len
hgo : go aig curr hcurr s input f = res
⊢ ∀ (hfoo : aig.decls.size ≤ res.aig.decls.size), res.vec.get idx ⋯ = (s.get idx hidx).cast hfoo

Proof state:
α : Type
inst✝³ : Hashable α
inst✝² : DecidableEq α
len : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefVec curr
input : aig.RefVec len
f : (aig : AIG α) → aig.Ref → Entrypoint α
inst✝¹ : LawfulOperator α Ref f
inst✝ : LawfulMapOperator α f
⊢ ∀ (idx : Nat) (hidx : idx < curr) (hfoo : aig.decls.size ≤ (go aig curr hcurr s input f).aig.decls.size),
    (go aig curr hcurr s input f).vec.get idx ⋯ = (s.get idx hidx).cast hfoo

Tactic:
intro idx hidx

Result:
α : Type
inst✝³ : Hashable α
inst✝² : DecidableEq α
len : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefVec curr
input : aig.RefVec len
f : (aig : AIG α) → aig.Ref → Entrypoint α
inst✝¹ : LawfulOperator α Ref f
inst✝ : LawfulMapOperator α f
idx : Nat
hidx : idx < curr
⊢ ∀ (hfoo : aig.decls.size ≤ (go aig curr hcurr s input f).aig.decls.size),
    (go aig curr hcurr s input f).vec.get idx ⋯ = (s.get idx hidx).cast hfoo