-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/Bitblast/BVExpr/Circuit/Lemmas/Operations/ShiftRight.lean
theorem go_denote_eq (aig : AIG α) (distance : Nat) (input : AIG.RefVec aig w)
    (assign : α → Bool) (curr : Nat) (hcurr : curr ≤ w) (s : AIG.RefVec aig curr) :
    ∀ (idx : Nat) (hidx1 : idx < w),
        curr ≤ idx
          →
        ⟦
          (go aig input distance curr hcurr s).aig,
          (go aig input distance curr hcurr s).vec.get idx hidx1,
          assign
        ⟧
          =
        if hidx : (distance + idx) < w then
          ⟦aig, input.get (distance + idx) (by omega), assign⟧
        else
          false

Proof state:
case isTrue.inr.isFalse.isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec 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
h✝² : curr < idx
h✝¹ : ¬distance + curr < w
hgo :
  go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
h✝ : distance + idx < w
⊢ ⟦assign, { aig := res.aig, ref := res.vec.get idx hidx1 }⟧ =
    ⟦assign, { aig := aig, ref := input.get (distance + idx) ⋯ }⟧

Tactic:
omega

Result:
no goals

Proof state:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
assign : α → Bool
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
⊢ ∀ (idx : Nat) (hidx1 : idx < w),
    curr ≤ idx →
      ⟦assign,
          { aig := (go aig input distance curr hcurr s).aig,
            ref := (go aig input distance curr hcurr s).vec.get idx hidx1 }⟧ =
        if hidx : distance + idx < w then ⟦assign, { aig := aig, ref := input.get (distance + idx) ⋯ }⟧ else false

Tactic:
intro idx hidx1 hidx2

Result:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
assign : α → Bool
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
idx : Nat
hidx1 : idx < w
hidx2 : curr ≤ idx
⊢ ⟦assign,
      { aig := (go aig input distance curr hcurr s).aig,
        ref := (go aig input distance curr hcurr s).vec.get idx hidx1 }⟧ =
    if hidx : distance + idx < w then ⟦assign, { aig := aig, ref := input.get (distance + idx) ⋯ }⟧ else false

Proof state:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec 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
h✝¹ : curr < idx
h✝ : distance + curr < w
hgo : go aig input distance (curr + 1) ⋯ (s.push (input.get (distance + curr) ⋯)) = res
hidx : ¬distance + idx < w
⊢ (if hidx : distance + idx < w then ⟦assign, { aig := aig, ref := input.get (distance + idx) ⋯ }⟧ else false) = false

Tactic:
simp [hidx]

Result:
no goals

Proof state:
case isTrue.inl.isFalse.isFalse
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec 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
heq : curr = idx
h✝¹ : ¬distance + curr < w
hgo :
  go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
h✝ : ¬distance + idx < w
⊢ ⟦assign, { aig := res.aig, ref := res.vec.get idx hidx1 }⟧ = false

Tactic:
rw [← hgo]

Result:
case isTrue.inl.isFalse.isFalse
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec 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
heq : curr = idx
h✝¹ : ¬distance + curr < w
hgo :
  go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
h✝ : ¬distance + idx < w
⊢ ⟦assign,
      {
        aig :=
          (go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
              ((s.cast ⋯).push (aig.mkConstCached false).ref)).aig,
        ref :=
          (go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
                  ((s.cast ⋯).push (aig.mkConstCached false).ref)).vec.get
            idx hidx1 }⟧ =
    false

Proof state:
case isTrue.inl.isFalse.isFalse
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec 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
heq : curr = idx
h✝¹ : ¬distance + curr < w
hgo :
  go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
h✝ : ¬distance + idx < w
⊢ ⟦assign,
      {
        aig :=
          (go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
              ((s.cast ⋯).push (aig.mkConstCached false).ref)).aig,
        ref := (((s.cast ⋯).push (aig.mkConstCached false).ref).get idx ?isTrue.inl.isFalse.isFalse.hidx).cast ⋯ }⟧ =
    false

case isTrue.inl.isFalse.isFalse.hidx
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec 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
heq : curr = idx
h✝¹ : ¬distance + curr < w
hgo :
  go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
h✝ : ¬distance + idx < w
⊢ idx < curr + 1

Tactic:
rw [AIG.RefVec.get_push_ref_eq']

Result:
case isTrue.inl.isFalse.isFalse
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec 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
heq : curr = idx
h✝¹ : ¬distance + curr < w
hgo :
  go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
h✝ : ¬distance + idx < w
⊢ ⟦assign,
      {
        aig :=
          (go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
              ((s.cast ⋯).push (aig.mkConstCached false).ref)).aig,
        ref := (aig.mkConstCached false).ref.cast ⋯ }⟧ =
    false

case isTrue.inl.isFalse.isFalse.hidx
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec 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
heq : curr = idx
h✝¹ : ¬distance + curr < w
hgo :
  go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
h✝ : ¬distance + idx < w
⊢ idx = curr