-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/Bitblast/BVExpr/Circuit/Lemmas/Const.lean
theorem go_denote_eq (aig : AIG α) (c : BitVec w) (assign : α → Bool)
    (curr : Nat) (hcurr : curr ≤ w) (s : AIG.RefVec aig curr) :
    ∀ (idx : Nat) (hidx1 : idx < w),
        curr ≤ idx
          →
        ⟦
          (go aig c curr s hcurr).aig,
          (go aig c curr s hcurr).vec.get idx hidx1,
          assign
        ⟧
          =
        c.getLsbD idx

Proof state:
case isTrue.inr
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
c : BitVec w
assign : α → Bool
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
idx : Nat
hidx1 : idx < w
hidx2 : curr ≤ idx
res : RefVecEntry α w
h✝¹ : curr < w
hgo :
  go (aig.mkConstCached (c.getLsbD curr)).aig c (curr + 1) ((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref)
      ⋯ =
    res
h✝ : curr < idx
⊢ ⟦assign, { aig := res.aig, ref := res.vec.get idx hidx1 }⟧ = c.getLsbD idx

Tactic:
rw [← hgo]

Result:
case isTrue.inr
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
c : BitVec w
assign : α → Bool
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
idx : Nat
hidx1 : idx < w
hidx2 : curr ≤ idx
res : RefVecEntry α w
h✝¹ : curr < w
hgo :
  go (aig.mkConstCached (c.getLsbD curr)).aig c (curr + 1) ((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref)
      ⋯ =
    res
h✝ : curr < idx
⊢ ⟦assign,
      {
        aig :=
          (go (aig.mkConstCached (c.getLsbD curr)).aig c (curr + 1)
              ((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref) ⋯).aig,
        ref :=
          (go (aig.mkConstCached (c.getLsbD curr)).aig c (curr + 1)
                  ((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref) ⋯).vec.get
            idx hidx1 }⟧ =
    c.getLsbD idx

Proof state:
case isTrue.inr
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
c : BitVec w
assign : α → Bool
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
idx : Nat
hidx1 : idx < w
hidx2 : curr ≤ idx
res : RefVecEntry α w
h✝¹ : curr < w
hgo :
  go (aig.mkConstCached (c.getLsbD curr)).aig c (curr + 1) ((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref)
      ⋯ =
    res
h✝ : curr < idx
⊢ ⟦assign,
      {
        aig :=
          (go (aig.mkConstCached (c.getLsbD curr)).aig c (curr + 1)
              ((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref) ⋯).aig,
        ref :=
          (go (aig.mkConstCached (c.getLsbD curr)).aig c (curr + 1)
                  ((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref) ⋯).vec.get
            idx hidx1 }⟧ =
    c.getLsbD idx

Tactic:
rw [go_denote_eq]

Result:
case isTrue.inr.a
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
c : BitVec w
assign : α → Bool
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
idx : Nat
hidx1 : idx < w
hidx2 : curr ≤ idx
res : RefVecEntry α w
h✝¹ : curr < w
hgo :
  go (aig.mkConstCached (c.getLsbD curr)).aig c (curr + 1) ((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref)
      ⋯ =
    res
h✝ : curr < idx
⊢ curr + 1 ≤ idx

Proof state:
case isTrue.inl
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
c : BitVec w
assign : α → Bool
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
idx : Nat
hidx1 : idx < w
hidx2 : curr ≤ idx
res : RefVecEntry α w
h✝ : curr < w
hgo :
  go (aig.mkConstCached (c.getLsbD curr)).aig c (curr + 1) ((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref)
      ⋯ =
    res
heq : curr = idx
⊢ ⟦assign,
      {
        aig :=
          (go (aig.mkConstCached (c.getLsbD curr)).aig c (curr + 1)
              ((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref) ⋯).aig,
        ref :=
          (go (aig.mkConstCached (c.getLsbD curr)).aig c (curr + 1)
                  ((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref) ⋯).vec.get
            idx hidx1 }⟧ =
    c.getLsbD idx

Tactic:
rw [go_get]

Result:
case isTrue.inl
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
c : BitVec w
assign : α → Bool
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
idx : Nat
hidx1 : idx < w
hidx2 : curr ≤ idx
res : RefVecEntry α w
h✝ : curr < w
hgo :
  go (aig.mkConstCached (c.getLsbD curr)).aig c (curr + 1) ((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref)
      ⋯ =
    res
heq : curr = idx
⊢ ⟦assign,
      {
        aig :=
          (go (aig.mkConstCached (c.getLsbD curr)).aig c (curr + 1)
              ((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref) ⋯).aig,
        ref := (((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref).get idx ?isTrue.inl.hidx).cast ⋯ }⟧ =
    c.getLsbD idx

case isTrue.inl.hidx
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
c : BitVec w
assign : α → Bool
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
idx : Nat
hidx1 : idx < w
hidx2 : curr ≤ idx
res : RefVecEntry α w
h✝ : curr < w
hgo :
  go (aig.mkConstCached (c.getLsbD curr)).aig c (curr + 1) ((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref)
      ⋯ =
    res
heq : curr = idx
⊢ idx < curr + 1

Proof state:
case isTrue.inr.a
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
c : BitVec w
assign : α → Bool
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
idx : Nat
hidx1 : idx < w
hidx2 : curr ≤ idx
res : RefVecEntry α w
h✝¹ : curr < w
hgo :
  go (aig.mkConstCached (c.getLsbD curr)).aig c (curr + 1) ((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref)
      ⋯ =
    res
h✝ : curr < idx
⊢ curr + 1 ≤ idx

Tactic:
omega

Result:
no goals

Proof state:
case isTrue.inl
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
c : BitVec w
assign : α → Bool
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
idx : Nat
hidx1 : idx < w
hidx2 : curr ≤ idx
res : RefVecEntry α w
h✝ : curr < w
hgo :
  go (aig.mkConstCached (c.getLsbD curr)).aig c (curr + 1) ((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref)
      ⋯ =
    res
heq : curr = idx
⊢ ⟦assign,
      { aig := (aig.mkConstCached (c.getLsbD curr)).aig,
        ref := { gate := ((aig.mkConstCached (c.getLsbD curr)).ref.cast ⋯).gate, hgate := ?isTrue.inl.hstart } }⟧ =
    c.getLsbD curr

Tactic:
simp

Result:
no goals

Proof state:
case isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
c : BitVec w
assign : α → Bool
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
idx : Nat
hidx1 : idx < w
hidx2 : curr ≤ idx
res : RefVecEntry α w
h✝ : curr < w
hgo :
  (let res := aig.mkConstCached (c.getLsbD curr);
    let aig_1 := res.aig;
    let bitRef := res.ref;
    let s := s.cast ⋯;
    let s := s.push bitRef;
    go aig_1 c (curr + 1) s ⋯) =
    res
⊢ ⟦assign, { aig := res.aig, ref := res.vec.get idx hidx1 }⟧ = c.getLsbD idx

Tactic:
dsimp only at hgo

Result:
case isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
c : BitVec w
assign : α → Bool
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
idx : Nat
hidx1 : idx < w
hidx2 : curr ≤ idx
res : RefVecEntry α w
h✝ : curr < w
hgo :
  go (aig.mkConstCached (c.getLsbD curr)).aig c (curr + 1) ((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref)
      ⋯ =
    res
⊢ ⟦assign, { aig := res.aig, ref := res.vec.get idx hidx1 }⟧ = c.getLsbD idx

Proof state:
case isTrue.inl.hidx
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
c : BitVec w
assign : α → Bool
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
idx : Nat
hidx1 : idx < w
hidx2 : curr ≤ idx
res : RefVecEntry α w
h✝ : curr < w
hgo :
  go (aig.mkConstCached (c.getLsbD curr)).aig c (curr + 1) ((s.cast ⋯).push (aig.mkConstCached (c.getLsbD curr)).ref)
      ⋯ =
    res
heq : curr = idx
⊢ idx = curr

Tactic:
rw [heq]

Result:
no goals