-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/Bitblast/BVExpr/Circuit/Lemmas/Var.lean
theorem go_denote_mem_prefix (aig : AIG BVBit) (idx : Nat) (hidx) (s : AIG.RefVec aig idx)
    (a : Nat) (start : Nat) (hstart) :
    ⟦
      (go aig w a idx s hidx).aig,
      ⟨start, by apply Nat.lt_of_lt_of_le; exact hstart; apply go_le_size⟩,
      assign
    ⟧
      =
    ⟦aig, ⟨start, hstart⟩, assign⟧

Proof state:
assign : BVBit → Bool
w : Nat
aig : AIG BVBit
idx : Nat
hidx : idx ≤ w
s : aig.RefVec idx
a start : Nat
hstart : start < aig.decls.size
⊢ start < (go aig w a idx s hidx).aig.decls.size

Tactic:
apply Nat.lt_of_lt_of_le

Result:
case a
assign : BVBit → Bool
w : Nat
aig : AIG BVBit
idx : Nat
hidx : idx ≤ w
s : aig.RefVec idx
a start : Nat
hstart : start < aig.decls.size
⊢ start < ?m

case a
assign : BVBit → Bool
w : Nat
aig : AIG BVBit
idx : Nat
hidx : idx ≤ w
s : aig.RefVec idx
a start : Nat
hstart : start < aig.decls.size
⊢ ?m ≤ (go aig w a idx s hidx).aig.decls.size

case m
assign : BVBit → Bool
w : Nat
aig : AIG BVBit
idx : Nat
hidx : idx ≤ w
s : aig.RefVec idx
a start : Nat
hstart : start < aig.decls.size
⊢ Nat

Proof state:
case a
assign : BVBit → Bool
w : Nat
aig : AIG BVBit
idx : Nat
hidx : idx ≤ w
s : aig.RefVec idx
a start : Nat
hstart : start < aig.decls.size
⊢ start < ?m

case a
assign : BVBit → Bool
w : Nat
aig : AIG BVBit
idx : Nat
hidx : idx ≤ w
s : aig.RefVec idx
a start : Nat
hstart : start < aig.decls.size
⊢ ?m ≤ (go aig w a idx s hidx).aig.decls.size

case m
assign : BVBit → Bool
w : Nat
aig : AIG BVBit
idx : Nat
hidx : idx ≤ w
s : aig.RefVec idx
a start : Nat
hstart : start < aig.decls.size
⊢ Nat

Tactic:
exact hstart

Result:
case a
assign : BVBit → Bool
w : Nat
aig : AIG BVBit
idx : Nat
hidx : idx ≤ w
s : aig.RefVec idx
a start : Nat
hstart : start < aig.decls.size
⊢ aig.decls.size ≤ (go aig w a idx s hidx).aig.decls.size

Proof state:
assign : BVBit → Bool
w : Nat
aig : AIG BVBit
idx : Nat
hidx : idx ≤ w
s : aig.RefVec idx
a start : Nat
hstart : start < aig.decls.size
⊢ ⟦assign, { aig := (go aig w a idx s hidx).aig, ref := { gate := start, hgate := ⋯ } }⟧ =
    ⟦assign, { aig := aig, ref := { gate := start, hgate := hstart } }⟧

Tactic:
apply denote.eq_of_isPrefix (entry := ⟨aig, start,hstart⟩)

Result:
case hprefix
assign : BVBit → Bool
w : Nat
aig : AIG BVBit
idx : Nat
hidx : idx ≤ w
s : aig.RefVec idx
a start : Nat
hstart : start < aig.decls.size
⊢ IsPrefix { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls (go aig w a idx s hidx).aig.decls

Proof state:
case hprefix
assign : BVBit → Bool
w : Nat
aig : AIG BVBit
idx : Nat
hidx : idx ≤ w
s : aig.RefVec idx
a start : Nat
hstart : start < aig.decls.size
⊢ IsPrefix { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls (go aig w a idx s hidx).aig.decls

Tactic:
apply IsPrefix.of

Result:
case hprefix.idx_eq
assign : BVBit → Bool
w : Nat
aig : AIG BVBit
idx : Nat
hidx : idx ≤ w
s : aig.RefVec idx
a start : Nat
hstart : start < aig.decls.size
⊢ ∀ (idx_1 : Nat) (h : idx_1 < { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls.size),
    (go aig w a idx s hidx).aig.decls[idx_1] =
      { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls[idx_1]

case hprefix.size_le
assign : BVBit → Bool
w : Nat
aig : AIG BVBit
idx : Nat
hidx : idx ≤ w
s : aig.RefVec idx
a start : Nat
hstart : start < aig.decls.size
⊢ { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls.size ≤ (go aig w a idx s hidx).aig.decls.size

Proof state:
case hprefix.idx_eq
assign : BVBit → Bool
w : Nat
aig : AIG BVBit
idx : Nat
hidx : idx ≤ w
s : aig.RefVec idx
a start : Nat
hstart : start < aig.decls.size
⊢ ∀ (idx_1 : Nat) (h : idx_1 < { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls.size),
    (go aig w a idx s hidx).aig.decls[idx_1] =
      { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls[idx_1]

Tactic:
intros

Result:
case hprefix.idx_eq
assign : BVBit → Bool
w : Nat
aig : AIG BVBit
idx : Nat
hidx : idx ≤ w
s : aig.RefVec idx
a start : Nat
hstart : start < aig.decls.size
idx✝ : Nat
h✝ : idx✝ < { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls.size
⊢ (go aig w a idx s hidx).aig.decls[idx✝] = { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls[idx✝]

Proof state:
case hprefix.idx_eq
assign : BVBit → Bool
w : Nat
aig : AIG BVBit
idx : Nat
hidx : idx ≤ w
s : aig.RefVec idx
a start : Nat
hstart : start < aig.decls.size
idx✝ : Nat
h✝ : idx✝ < { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls.size
⊢ (go aig w a idx s hidx).aig.decls[idx✝] = { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls[idx✝]

Tactic:
apply go_decl_eq

Result:
no goals

Proof state:
case a
assign : BVBit → Bool
w : Nat
aig : AIG BVBit
idx : Nat
hidx : idx ≤ w
s : aig.RefVec idx
a start : Nat
hstart : start < aig.decls.size
⊢ aig.decls.size ≤ (go aig w a idx s hidx).aig.decls.size

Tactic:
apply go_le_size

Result:
no goals

Proof state:
case hprefix.size_le
assign : BVBit → Bool
w : Nat
aig : AIG BVBit
idx : Nat
hidx : idx ≤ w
s : aig.RefVec idx
a start : Nat
hstart : start < aig.decls.size
⊢ { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls.size ≤ (go aig w a idx s hidx).aig.decls.size

Tactic:
apply go_le_size

Result:
no goals