-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/Bitblast/BVExpr/Circuit/Lemmas/Expr.lean
theorem go_denote_mem_prefix (aig : AIG BVBit) (expr : BVExpr w) (assign : Assignment) (start : Nat)
    (hstart) :
    ⟦
      (go aig expr).val.aig,
      ⟨start, by apply Nat.lt_of_lt_of_le; exact hstart; apply (go aig expr).property⟩,
      assign.toAIGAssignment
    ⟧
      =
    ⟦aig, ⟨start, hstart⟩, assign.toAIGAssignment⟧

Proof state:
case hprefix.size_le
w : Nat
aig : AIG BVBit
expr : BVExpr w
assign : Assignment
start : Nat
hstart : start < aig.decls.size
⊢ { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls.size ≤ (go aig expr).val.aig.decls.size

Tactic:
apply (go aig expr).property

Result:
no goals

Proof state:
w : Nat
aig : AIG BVBit
expr : BVExpr w
assign : Assignment
start : Nat
hstart : start < aig.decls.size
⊢ ⟦assign.toAIGAssignment, { aig := (go aig expr).val.aig, ref := { gate := start, hgate := ⋯ } }⟧ =
    ⟦assign.toAIGAssignment, { aig := aig, ref := { gate := start, hgate := hstart } }⟧

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

Result:
case hprefix
w : Nat
aig : AIG BVBit
expr : BVExpr w
assign : Assignment
start : Nat
hstart : start < aig.decls.size
⊢ IsPrefix { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls (go aig expr).val.aig.decls

Proof state:
w : Nat
aig : AIG BVBit
expr : BVExpr w
assign : Assignment
start : Nat
hstart : start < aig.decls.size
⊢ start < (go aig expr).val.aig.decls.size

Tactic:
apply Nat.lt_of_lt_of_le

Result:
case a
w : Nat
aig : AIG BVBit
expr : BVExpr w
assign : Assignment
start : Nat
hstart : start < aig.decls.size
⊢ start < ?m

case a
w : Nat
aig : AIG BVBit
expr : BVExpr w
assign : Assignment
start : Nat
hstart : start < aig.decls.size
⊢ ?m ≤ (go aig expr).val.aig.decls.size

case m
w : Nat
aig : AIG BVBit
expr : BVExpr w
assign : Assignment
start : Nat
hstart : start < aig.decls.size
⊢ Nat

Proof state:
case hprefix.idx_eq
w : Nat
aig : AIG BVBit
expr : BVExpr w
assign : Assignment
start : Nat
hstart : start < aig.decls.size
⊢ ∀ (idx : Nat) (h : idx < { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls.size),
    (go aig expr).val.aig.decls[idx] = { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls[idx]

Tactic:
intros

Result:
case hprefix.idx_eq
w : Nat
aig : AIG BVBit
expr : BVExpr w
assign : Assignment
start : Nat
hstart : start < aig.decls.size
idx✝ : Nat
h✝ : idx✝ < { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls.size
⊢ (go aig expr).val.aig.decls[idx✝] = { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls[idx✝]

Proof state:
case a
w : Nat
aig : AIG BVBit
expr : BVExpr w
assign : Assignment
start : Nat
hstart : start < aig.decls.size
⊢ start < ?m

case a
w : Nat
aig : AIG BVBit
expr : BVExpr w
assign : Assignment
start : Nat
hstart : start < aig.decls.size
⊢ ?m ≤ (go aig expr).val.aig.decls.size

case m
w : Nat
aig : AIG BVBit
expr : BVExpr w
assign : Assignment
start : Nat
hstart : start < aig.decls.size
⊢ Nat

Tactic:
exact hstart

Result:
case a
w : Nat
aig : AIG BVBit
expr : BVExpr w
assign : Assignment
start : Nat
hstart : start < aig.decls.size
⊢ aig.decls.size ≤ (go aig expr).val.aig.decls.size

Proof state:
case hprefix.idx_eq
w : Nat
aig : AIG BVBit
expr : BVExpr w
assign : Assignment
start : Nat
hstart : start < aig.decls.size
idx✝ : Nat
h✝ : idx✝ < { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls.size
⊢ (go aig expr).val.aig.decls[idx✝] = { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls[idx✝]

Tactic:
apply go_decl_eq

Result:
no goals

Proof state:
case hprefix
w : Nat
aig : AIG BVBit
expr : BVExpr w
assign : Assignment
start : Nat
hstart : start < aig.decls.size
⊢ IsPrefix { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls (go aig expr).val.aig.decls

Tactic:
apply IsPrefix.of

Result:
case hprefix.idx_eq
w : Nat
aig : AIG BVBit
expr : BVExpr w
assign : Assignment
start : Nat
hstart : start < aig.decls.size
⊢ ∀ (idx : Nat) (h : idx < { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls.size),
    (go aig expr).val.aig.decls[idx] = { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls[idx]

case hprefix.size_le
w : Nat
aig : AIG BVBit
expr : BVExpr w
assign : Assignment
start : Nat
hstart : start < aig.decls.size
⊢ { aig := aig, ref := { gate := start, hgate := hstart } }.aig.decls.size ≤ (go aig expr).val.aig.decls.size

Proof state:
case a
w : Nat
aig : AIG BVBit
expr : BVExpr w
assign : Assignment
start : Nat
hstart : start < aig.decls.size
⊢ aig.decls.size ≤ (go aig expr).val.aig.decls.size

Tactic:
apply (go aig expr).property

Result:
no goals