-- Mathlib/.lake/packages/lean4/src/lean/Std/Sat/AIG/RefVecOperator/Zip.lean
theorem go_get_aux {aig : AIG α} (curr : Nat) (hcurr : curr ≤ len) (s : RefVec aig curr)
    (lhs rhs : RefVec aig len) (f : (aig : AIG α) → BinaryInput aig → Entrypoint α)
    [LawfulOperator α BinaryInput f] [chainable : LawfulZipOperator α f] :
    -- The hfoo here is a trick to make the dependent type gods happy
    ∀ (idx : Nat) (hidx : idx < curr) (hfoo),
      (go aig curr s hcurr lhs rhs 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
lhs rhs : aig.RefVec len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx : idx < curr
res : RefVecEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).push (f aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref) ⋯ (lhs.cast ⋯) (rhs.cast ⋯) f =
    res
⊢ ∀
    (hfoo :
      aig.decls.size ≤
        (go (f aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1)
                ((s.cast ⋯).push (f aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref) ⋯ (lhs.cast ⋯)
                (rhs.cast ⋯) f).aig.decls.size),
    (go (f aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1)
              ((s.cast ⋯).push (f aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref) ⋯ (lhs.cast ⋯)
              (rhs.cast ⋯) f).vec.get
        idx ⋯ =
      (s.get idx hidx).cast hfoo

Tactic:
intro hfoo

Result:
case isTrue
α : Type
inst✝² : Hashable α
inst✝¹ : DecidableEq α
len : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefVec curr
lhs rhs : aig.RefVec len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx : idx < curr
res : RefVecEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).push (f aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref) ⋯ (lhs.cast ⋯) (rhs.cast ⋯) f =
    res
hfoo :
  aig.decls.size ≤
    (go (f aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1)
            ((s.cast ⋯).push (f aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref) ⋯ (lhs.cast ⋯) (rhs.cast ⋯)
            f).aig.decls.size
⊢ (go (f aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1)
            ((s.cast ⋯).push (f aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref) ⋯ (lhs.cast ⋯) (rhs.cast ⋯)
            f).vec.get
      idx ⋯ =
    (s.get idx hidx).cast hfoo

Proof state:
case isTrue.hidx
α : Type
inst✝² : Hashable α
inst✝¹ : DecidableEq α
len : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefVec curr
lhs rhs : aig.RefVec len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx : idx < curr
res : RefVecEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).push (f aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref) ⋯ (lhs.cast ⋯) (rhs.cast ⋯) f =
    res
hfoo :
  aig.decls.size ≤
    (go (f aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).aig (curr + 1)
            ((s.cast ⋯).push (f aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝ }).ref) ⋯ (lhs.cast ⋯) (rhs.cast ⋯)
            f).aig.decls.size
⊢ idx < curr

Tactic:
assumption

Result:
no goals

Proof state:
case isFalse
α : Type
inst✝² : Hashable α
inst✝¹ : DecidableEq α
len : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefVec curr
lhs rhs : aig.RefVec len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx : idx < curr
res : RefVecEntry α len
h✝ : ¬curr < len
hgo : { aig := aig, vec := ⋯ ▸ s } = res
⊢ ∀ (hfoo : aig.decls.size ≤ { aig := aig, vec := ⋯ ▸ s }.aig.decls.size),
    { aig := aig, vec := ⋯ ▸ s }.vec.get idx ⋯ = (s.get idx hidx).cast hfoo

Tactic:
simp only [Nat.le_refl, get, Ref.cast_eq, Ref.mk.injEq, true_implies]

Result:
case isFalse
α : Type
inst✝² : Hashable α
inst✝¹ : DecidableEq α
len : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefVec curr
lhs rhs : aig.RefVec len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx : idx < curr
res : RefVecEntry α len
h✝ : ¬curr < len
hgo : { aig := aig, vec := ⋯ ▸ s } = res
⊢ (⋯ ▸ s).refs[idx] = s.refs[idx]

Proof state:
case isFalse
α : Type
inst✝² : Hashable α
inst✝¹ : DecidableEq α
len : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefVec curr
lhs rhs : aig.RefVec len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx : idx < curr
res : RefVecEntry α len
h✝ : ¬curr < len
hgo : { aig := aig, vec := ⋯ ▸ s } = res
this : curr = len
⊢ (⋯ ▸ s).refs[idx] = s.refs[idx]

Tactic:
subst this

Result:
case isFalse
α : Type
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig : AIG α
curr : Nat
s : aig.RefVec curr
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx : idx < curr
hcurr : curr ≤ curr
lhs rhs : aig.RefVec curr
res : RefVecEntry α curr
h✝ : ¬curr < curr
hgo : { aig := aig, vec := ⋯ ▸ s } = res
⊢ (⋯ ▸ s).refs[idx] = s.refs[idx]