-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/Bitblast/BVExpr/Circuit/Impl/Carry.lean
theorem go_decl_eq {aig : AIG α} {cin} {lhs rhs : AIG.RefVec aig w} :
    ∀ (idx : Nat) (h1) (h2),
        (go aig lhs rhs curr cin).aig.decls[idx]'h2 = aig.decls[idx]'h1

Proof state:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w curr : Nat
aig : AIG α
cin : aig.Ref
lhs rhs : aig.RefVec w
res : AIG.Entrypoint α
hgo : go aig lhs rhs curr cin = res
⊢ ∀ (idx : Nat) (h1 : idx < aig.decls.size) (h2 : idx < res.aig.decls.size), res.aig.decls[idx] = aig.decls[idx]

Tactic:
unfold go at hgo

Result:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w curr : Nat
aig : AIG α
cin : aig.Ref
lhs rhs : aig.RefVec w
res : AIG.Entrypoint α
hgo :
  (if hidx : curr < w then
      let lin := lhs.get curr hidx;
      let rin := rhs.get curr hidx;
      let res := mkFullAdderCarry aig { lhs := lin, rhs := rin, cin := cin };
      let_fun this := ⋯;
      let aig_1 := res.aig;
      let carryRef := res.ref;
      let lhs := lhs.cast this;
      let rhs := rhs.cast this;
      go aig_1 lhs rhs (curr + 1) carryRef
    else { aig := aig, ref := cin }) =
    res
⊢ ∀ (idx : Nat) (h1 : idx < aig.decls.size) (h2 : idx < res.aig.decls.size), res.aig.decls[idx] = aig.decls[idx]

Proof state:
case isFalse
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w curr : Nat
aig : AIG α
cin : aig.Ref
lhs rhs : aig.RefVec w
res : AIG.Entrypoint α
h✝ : ¬curr < w
hgo : { aig := aig, ref := cin } = res
⊢ ∀ (idx : Nat) (h1 : idx < aig.decls.size) (h2 : idx < res.aig.decls.size), res.aig.decls[idx] = aig.decls[idx]

Tactic:
simp [← hgo]

Result:
no goals

Proof state:
case isTrue.h2
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w curr : Nat
aig : AIG α
cin : aig.Ref
lhs rhs : aig.RefVec w
res : AIG.Entrypoint α
h✝ : curr < w
hgo :
  go (mkFullAdderCarry aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝, cin := cin }).aig (lhs.cast ⋯) (rhs.cast ⋯)
      (curr + 1) (mkFullAdderCarry aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝, cin := cin }).ref =
    res
idx✝ : Nat
h1✝ : idx✝ < aig.decls.size
h2✝ :
  idx✝ <
    (go (mkFullAdderCarry aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝, cin := cin }).aig (lhs.cast ⋯)
            (rhs.cast ⋯) (curr + 1)
            (mkFullAdderCarry aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝, cin := cin }).ref).aig.decls.size
⊢ idx✝ < (mkFullAdderCarry aig { lhs := lhs.get curr h✝, rhs := rhs.get curr h✝, cin := cin }).aig.decls.size

Tactic:
apply AIG.LawfulOperator.lt_size_of_lt_aig_size (f := mkFullAdderCarry)

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