-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/Bitblast/BVExpr/Circuit/Lemmas/Operations/ShiftLeft.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 : idx < distance then
          false
        else
          ⟦aig, input.get (idx - distance) (by omega), assign⟧

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✝ : curr < distance
hgo :
  go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
hidx : ¬idx < distance
⊢ ⟦assign,
      { aig := (aig.mkConstCached false).aig, ref := { gate := (input.get (idx - distance) ⋯).gate, hgate := ⋯ } }⟧ =
    ⟦assign, { aig := aig, ref := input.get (idx - distance) ⋯ }⟧

Tactic:
rw [AIG.LawfulOperator.denote_mem_prefix (f := AIG.mkConstCached)]

Result:
no goals

Proof state:
case isTrue.inl.isTrue.isTrue.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✝¹ : curr < distance
hgo :
  go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
h✝ : idx < distance
⊢ idx = curr

Tactic:
rw [heq]

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✝¹ : ¬curr < distance
hgo : go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯)) = res
h✝ : ¬idx < distance
⊢ ⟦assign,
      { aig := (go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯))).aig,
        ref := ((s.push (input.get (curr - distance) ⋯)).get idx ?isTrue.inl.isFalse.isFalse.hidx).cast ⋯ }⟧ =
    ⟦assign, { aig := aig, ref := input.get (idx - distance) ⋯ }⟧

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✝¹ : ¬curr < distance
hgo : go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯)) = res
h✝ : ¬idx < distance
⊢ 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✝¹ : ¬curr < distance
hgo : go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯)) = res
h✝ : ¬idx < distance
⊢ ⟦assign,
      { aig := (go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯))).aig,
        ref := (input.get (curr - distance) ⋯).cast ⋯ }⟧ =
    ⟦assign, { aig := aig, ref := input.get (idx - distance) ⋯ }⟧

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✝¹ : ¬curr < distance
hgo : go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯)) = res
h✝ : ¬idx < distance
⊢ idx = curr

Proof state:
case 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
hgo :
  (let_fun hcurr := ⋯;
    { aig := aig, vec := hcurr ▸ s }) =
    res
⊢ ⟦assign, { aig := res.aig, ref := res.vec.get idx hidx1 }⟧ =
    if hidx : idx < distance then false else ⟦assign, { aig := aig, ref := input.get (idx - distance) ⋯ }⟧

Tactic:
omega

Result:
no goals

Proof state:
case a
α : 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✝ : curr < distance
hgo :
  go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
hidx : ¬idx < distance
⊢ curr + 1 ≤ 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
hidx2 : curr ≤ idx
res : RefVecEntry α w
h✝² : curr < w
h✝¹ : curr < idx
h✝ : ¬curr < distance
hgo : go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯)) = res
hidx : ¬idx < distance
⊢ ⟦assign,
      { aig := (go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯))).aig,
        ref := (go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯))).vec.get idx hidx1 }⟧ =
    ⟦assign, { aig := aig, ref := input.get (idx - distance) ⋯ }⟧

Tactic:
rw [go_denote_eq]

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

case a
α : 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✝ : ¬curr < distance
hgo : go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯)) = res
hidx : ¬idx < distance
⊢ curr + 1 ≤ idx