-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/Bitblast/BVExpr/Circuit/Impl/Operations/ShiftLeft.lean
theorem blastShiftLeftConst.go_decl_eq (aig : AIG α) (distance : Nat) (input : AIG.RefVec aig w)
    (curr : Nat) (hcurr : curr ≤ w) (s : AIG.RefVec aig curr) :
    ∀ (idx : Nat) (h1) (h2),
        (go aig input distance curr hcurr s).aig.decls[idx]'h2 = aig.decls[idx]'h1

Proof state:
case isTrue.isFalse
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
res : AIG.RefVecEntry α w
h✝¹ : curr < w
h✝ : ¬curr < distance
hgo : go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯)) = res
⊢ ∀ (idx : Nat) (h1 : idx < aig.decls.size) (h2 : idx < res.aig.decls.size), res.aig.decls[idx] = aig.decls[idx]

Tactic:
rw [← hgo]

Result:
case isTrue.isFalse
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
res : AIG.RefVecEntry α w
h✝¹ : curr < w
h✝ : ¬curr < distance
hgo : go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯)) = res
⊢ ∀ (idx : Nat) (h1 : idx < aig.decls.size)
    (h2 : idx < (go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯))).aig.decls.size),
    (go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯))).aig.decls[idx] = aig.decls[idx]

Proof state:
case isTrue.isFalse
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
res : AIG.RefVecEntry α w
h✝¹ : curr < w
h✝ : ¬curr < distance
hgo : go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯)) = res
⊢ ∀ (idx : Nat) (h1 : idx < aig.decls.size)
    (h2 : idx < (go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯))).aig.decls.size),
    (go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯))).aig.decls[idx] = aig.decls[idx]

Tactic:
intro idx h1 h2

Result:
case isTrue.isFalse
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
res : AIG.RefVecEntry α w
h✝¹ : curr < w
h✝ : ¬curr < distance
hgo : go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯)) = res
idx : Nat
h1 : idx < aig.decls.size
h2 : idx < (go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯))).aig.decls.size
⊢ (go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯))).aig.decls[idx] = aig.decls[idx]

Proof state:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
res : AIG.RefVecEntry α w
hgo : go aig input distance curr hcurr s = 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 : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
res : AIG.RefVecEntry α w
hgo :
  (if hidx : curr < w then
      if hdist : curr < distance then
        let res := aig.mkConstCached false;
        let aig_1 := res.aig;
        let zeroRef := res.ref;
        let_fun hfinal := ⋯;
        let s := s.cast hfinal;
        let input := input.cast hfinal;
        let s := s.push zeroRef;
        go aig_1 input distance (curr + 1) ⋯ s
      else
        let s := s.push (input.get (curr - distance) ⋯);
        go aig input distance (curr + 1) ⋯ s
    else
      let_fun hcurr := ⋯;
      { aig := aig, vec := hcurr ▸ s }) =
    res
⊢ ∀ (idx : Nat) (h1 : idx < aig.decls.size) (h2 : idx < res.aig.decls.size), res.aig.decls[idx] = aig.decls[idx]

Proof state:
case isTrue.isTrue.h2.h
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
res : AIG.RefVecEntry α w
h✝¹ : curr < w
h✝ : curr < distance
hgo :
  go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
idx : Nat
h1 : idx < aig.decls.size
h2 :
  idx <
    (go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
            ((s.cast ⋯).push (aig.mkConstCached false).ref)).aig.decls.size
⊢ idx < aig.decls.size

Tactic:
assumption

Result:
no goals

Proof state:
case isTrue.isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
res : AIG.RefVecEntry α w
h✝¹ : curr < w
h✝ : curr < distance
hgo :
  go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
⊢ ∀ (idx : Nat) (h1 : idx < aig.decls.size) (h2 : idx < res.aig.decls.size), res.aig.decls[idx] = aig.decls[idx]

Tactic:
rw [← hgo]

Result:
case isTrue.isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
res : AIG.RefVecEntry α w
h✝¹ : curr < w
h✝ : curr < distance
hgo :
  go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
⊢ ∀ (idx : Nat) (h1 : idx < aig.decls.size)
    (h2 :
      idx <
        (go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
                ((s.cast ⋯).push (aig.mkConstCached false).ref)).aig.decls.size),
    (go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
              ((s.cast ⋯).push (aig.mkConstCached false).ref)).aig.decls[idx] =
      aig.decls[idx]

Proof state:
case isTrue.isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
res : AIG.RefVecEntry α w
h✝¹ : curr < w
h✝ : curr < distance
hgo :
  go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
idx : Nat
h1 : idx < aig.decls.size
h2 :
  idx <
    (go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
            ((s.cast ⋯).push (aig.mkConstCached false).ref)).aig.decls.size
⊢ (go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
            ((s.cast ⋯).push (aig.mkConstCached false).ref)).aig.decls[idx] =
    aig.decls[idx]

Tactic:
rw [blastShiftLeftConst.go_decl_eq]

Result:
case isTrue.isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
res : AIG.RefVecEntry α w
h✝¹ : curr < w
h✝ : curr < distance
hgo :
  go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
idx : Nat
h1 : idx < aig.decls.size
h2 :
  idx <
    (go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
            ((s.cast ⋯).push (aig.mkConstCached false).ref)).aig.decls.size
⊢ (aig.mkConstCached false).aig.decls[idx] = aig.decls[idx]

case isTrue.isTrue.h1
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
res : AIG.RefVecEntry α w
h✝¹ : curr < w
h✝ : curr < distance
hgo :
  go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
idx : Nat
h1 : idx < aig.decls.size
h2 :
  idx <
    (go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
            ((s.cast ⋯).push (aig.mkConstCached false).ref)).aig.decls.size
⊢ idx < (aig.mkConstCached false).aig.decls.size