-- 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:
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

Tactic:
rw [heq]

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

Tactic:
simp [hidx]

Result:
no goals

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

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.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
hidx : ¬idx < distance
⊢ ⟦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 }⟧ =
    ⟦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.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
hidx : ¬idx < distance
⊢ (if hidx : idx < distance then false
    else ⟦assign, { aig := (aig.mkConstCached false).aig, ref := (input.cast ⋯).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.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
      ((s.cast ⋯).push (aig.mkConstCached false).ref) =
    res
hidx : ¬idx < distance
⊢ curr + 1 ≤ idx

Proof state:
case isTrue.inl.isTrue.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
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
⊢ ⟦assign,
      { aig := (aig.mkConstCached false).aig,
        ref := { gate := ((aig.mkConstCached false).ref.cast ⋯).gate, hgate := ?isTrue.inl.isTrue.isTrue.hstart } }⟧ =
    false

Tactic:
simp

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

Tactic:
rw [← hgo]

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

Proof state:
case isTrue.inl.isTrue.isTrue.hstart
α : 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
⊢ ((aig.mkConstCached false).ref.cast ⋯).gate < (aig.mkConstCached false).aig.decls.size

Tactic:
simp [Ref.hgate]

Result:
no goals