-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/Bitblast/BVExpr/Circuit/Lemmas/Operations/Ult.lean
theorem mkUlt_denote_eq (aig : AIG α) (lhs rhs : BitVec w) (input : BinaryRefVec aig w)
    (assign : α → Bool)
    (hleft : ∀ (idx : Nat) (hidx : idx < w), ⟦aig, input.lhs.get idx hidx, assign⟧ = lhs.getLsbD idx)
    (hright : ∀ (idx : Nat) (hidx : idx < w), ⟦aig, input.rhs.get idx hidx, assign⟧ = rhs.getLsbD idx) :
    ⟦(mkUlt aig input).aig, (mkUlt aig input).ref, assign⟧ = BitVec.ult lhs rhs

Proof state:
case e_a.hleft
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
lhs rhs : BitVec w
input : aig.BinaryRefVec w
assign : α → Bool
hleft : ∀ (idx : Nat) (hidx : idx < w), ⟦assign, { aig := aig, ref := input.lhs.get idx hidx }⟧ = lhs.getLsbD idx
hright : ∀ (idx : Nat) (hidx : idx < w), ⟦assign, { aig := aig, ref := input.rhs.get idx hidx }⟧ = rhs.getLsbD idx
⊢ ∀ (idx : Nat)
    (hidx :
      idx <
        { w := w, vec := { lhs := input.lhs.cast ⋯, rhs := (BVExpr.bitblast.blastNot aig input.rhs).vec.cast ⋯ },
            cin := ((BVExpr.bitblast.blastNot aig input.rhs).aig.mkConstCached true).ref }.w),
    ⟦assign,
        { aig := ((BVExpr.bitblast.blastNot aig input.rhs).aig.mkConstCached true).aig,
          ref :=
            { w := w, vec := { lhs := input.lhs.cast ⋯, rhs := (BVExpr.bitblast.blastNot aig input.rhs).vec.cast ⋯ },
                      cin := ((BVExpr.bitblast.blastNot aig input.rhs).aig.mkConstCached true).ref }.vec.lhs.get
              idx hidx }⟧ =
      lhs.getLsbD idx

Tactic:
dsimp only

Result:
case e_a.hleft
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
lhs rhs : BitVec w
input : aig.BinaryRefVec w
assign : α → Bool
hleft : ∀ (idx : Nat) (hidx : idx < w), ⟦assign, { aig := aig, ref := input.lhs.get idx hidx }⟧ = lhs.getLsbD idx
hright : ∀ (idx : Nat) (hidx : idx < w), ⟦assign, { aig := aig, ref := input.rhs.get idx hidx }⟧ = rhs.getLsbD idx
⊢ ∀ (idx : Nat) (hidx : idx < w),
    ⟦assign,
        { aig := ((BVExpr.bitblast.blastNot aig input.rhs).aig.mkConstCached true).aig,
          ref := (input.lhs.cast ⋯).get idx hidx }⟧ =
      lhs.getLsbD idx

Proof state:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
lhs rhs : BitVec w
input : aig.BinaryRefVec w
assign : α → Bool
hleft : ∀ (idx : Nat) (hidx : idx < w), ⟦assign, { aig := aig, ref := input.lhs.get idx hidx }⟧ = lhs.getLsbD idx
hright : ∀ (idx : Nat) (hidx : idx < w), ⟦assign, { aig := aig, ref := input.rhs.get idx hidx }⟧ = rhs.getLsbD idx
⊢ ⟦assign,
      {
        aig :=
          (match input with
            | { lhs := lhsRefs, rhs := rhsRefs } =>
              let res := BVExpr.bitblast.blastNot aig rhsRefs;
              let aig_1 := res.aig;
              let rhsNotRefs := res.vec;
              let res_1 := aig_1.mkConstCached true;
              let aig_2 := res_1.aig;
              let trueRef := res_1.ref;
              let lhsRefs := lhsRefs.cast ⋯;
              let rhsNotRefs := rhsNotRefs.cast ⋯;
              let res :=
                BVExpr.bitblast.mkOverflowBit aig_2
                  { w := w, vec := { lhs := lhsRefs, rhs := rhsNotRefs }, cin := trueRef };
              let aig := res.aig;
              let overflowRef := res.ref;
              aig.mkNotCached overflowRef).aig,
        ref :=
          (match input with
            | { lhs := lhsRefs, rhs := rhsRefs } =>
              let res := BVExpr.bitblast.blastNot aig rhsRefs;
              let aig_1 := res.aig;
              let rhsNotRefs := res.vec;
              let res_1 := aig_1.mkConstCached true;
              let aig_2 := res_1.aig;
              let trueRef := res_1.ref;
              let lhsRefs := lhsRefs.cast ⋯;
              let rhsNotRefs := rhsNotRefs.cast ⋯;
              let res :=
                BVExpr.bitblast.mkOverflowBit aig_2
                  { w := w, vec := { lhs := lhsRefs, rhs := rhsNotRefs }, cin := trueRef };
              let aig := res.aig;
              let overflowRef := res.ref;
              aig.mkNotCached overflowRef).ref }⟧ =
    !BitVec.carry w lhs (~~~rhs) true

Tactic:
simp only [denote_projected_entry, denote_mkNotCached, denote_projected_entry']

Result:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
lhs rhs : BitVec w
input : aig.BinaryRefVec w
assign : α → Bool
hleft : ∀ (idx : Nat) (hidx : idx < w), ⟦assign, { aig := aig, ref := input.lhs.get idx hidx }⟧ = lhs.getLsbD idx
hright : ∀ (idx : Nat) (hidx : idx < w), ⟦assign, { aig := aig, ref := input.rhs.get idx hidx }⟧ = rhs.getLsbD idx
⊢ (!⟦assign,
        BVExpr.bitblast.mkOverflowBit ((BVExpr.bitblast.blastNot aig input.rhs).aig.mkConstCached true).aig
          { w := w, vec := { lhs := input.lhs.cast ⋯, rhs := (BVExpr.bitblast.blastNot aig input.rhs).vec.cast ⋯ },
            cin := ((BVExpr.bitblast.blastNot aig input.rhs).aig.mkConstCached true).ref }⟧) =
    !BitVec.carry w lhs (~~~rhs) true

Proof state:
case e_a.hright
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
lhs rhs : BitVec w
input : aig.BinaryRefVec w
assign : α → Bool
hleft : ∀ (idx : Nat) (hidx : idx < w), ⟦assign, { aig := aig, ref := input.lhs.get idx hidx }⟧ = lhs.getLsbD idx
hright : ∀ (idx : Nat) (hidx : idx < w), ⟦assign, { aig := aig, ref := input.rhs.get idx hidx }⟧ = rhs.getLsbD idx
idx : Nat
hidx : idx < w
⊢ (((BVExpr.bitblast.blastNot aig input.rhs).vec.cast ⋯).get idx hidx).gate <
    (BVExpr.bitblast.blastNot aig input.rhs).aig.decls.size

Tactic:
simp [Ref.hgate]

Result:
no goals

Proof state:
case e_a.hright.e_a
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
lhs rhs : BitVec w
input : aig.BinaryRefVec w
assign : α → Bool
hleft : ∀ (idx : Nat) (hidx : idx < w), ⟦assign, { aig := aig, ref := input.lhs.get idx hidx }⟧ = lhs.getLsbD idx
hright : ∀ (idx : Nat) (hidx : idx < w), ⟦assign, { aig := aig, ref := input.rhs.get idx hidx }⟧ = rhs.getLsbD idx
idx : Nat
hidx : idx < w
⊢ ⟦assign, { aig := aig, ref := input.rhs.get idx hidx }⟧ = rhs.getLsbD idx

Tactic:
apply hright

Result:
no goals

Proof state:
case e_a.hleft
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
lhs rhs : BitVec w
input : aig.BinaryRefVec w
assign : α → Bool
hleft : ∀ (idx : Nat) (hidx : idx < w), ⟦assign, { aig := aig, ref := input.lhs.get idx hidx }⟧ = lhs.getLsbD idx
hright : ∀ (idx : Nat) (hidx : idx < w), ⟦assign, { aig := aig, ref := input.rhs.get idx hidx }⟧ = rhs.getLsbD idx
⊢ ∀ (idx : Nat) (hidx : idx < w),
    ⟦assign,
        { aig := ((BVExpr.bitblast.blastNot aig input.rhs).aig.mkConstCached true).aig,
          ref := (input.lhs.cast ⋯).get idx hidx }⟧ =
      lhs.getLsbD idx

Tactic:
intro idx hidx

Result:
case e_a.hleft
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
lhs rhs : BitVec w
input : aig.BinaryRefVec w
assign : α → Bool
hleft : ∀ (idx : Nat) (hidx : idx < w), ⟦assign, { aig := aig, ref := input.lhs.get idx hidx }⟧ = lhs.getLsbD idx
hright : ∀ (idx : Nat) (hidx : idx < w), ⟦assign, { aig := aig, ref := input.rhs.get idx hidx }⟧ = rhs.getLsbD idx
idx : Nat
hidx : idx < w
⊢ ⟦assign,
      { aig := ((BVExpr.bitblast.blastNot aig input.rhs).aig.mkConstCached true).aig,
        ref := (input.lhs.cast ⋯).get idx hidx }⟧ =
    lhs.getLsbD idx