-- Mathlib/.lake/packages/lean4/src/lean/Std/Sat/AIG/CachedGatesLemmas.lean
theorem mkXorCached_decl_eq idx (aig : AIG α) (input : BinaryInput aig) {h : idx < aig.decls.size}
    {h2} :
    (aig.mkXorCached input).aig.decls[idx]'h2 = aig.decls[idx]

Proof state:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ ((aig.mkGateCached (input.asGateInput false false)).aig.mkGateCached
            ((input.asGateInput true true).cast ⋯)).aig.decls[idx] =
    aig.decls[idx]

case h1
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ idx <
    ((aig.mkGateCached (input.asGateInput false false)).aig.mkGateCached
            ((input.asGateInput true true).cast ⋯)).aig.decls.size

Tactic:
rw [AIG.LawfulOperator.decl_eq (f := mkGateCached)]

Result:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ (aig.mkGateCached (input.asGateInput false false)).aig.decls[idx] = aig.decls[idx]

case h1
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ idx < (aig.mkGateCached (input.asGateInput false false)).aig.decls.size

case h2
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ idx <
    ((aig.mkGateCached (input.asGateInput false false)).aig.mkGateCached
            ((input.asGateInput true true).cast ⋯)).aig.decls.size

Proof state:
case h2
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ idx <
    ((aig.mkGateCached (input.asGateInput false false)).aig.mkGateCached
            ((input.asGateInput true true).cast ⋯)).aig.decls.size

Tactic:
apply LawfulOperator.lt_size_of_lt_aig_size

Result:
case h2.h
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ idx < (aig.mkGateCached (input.asGateInput false false)).aig.decls.size

Proof state:
case h2
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ idx < (aig.mkGateCached (input.asGateInput false false)).aig.decls.size

Tactic:
apply LawfulOperator.lt_size_of_lt_aig_size

Result:
case h2.h
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ idx < aig.decls.size

Proof state:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ (aig.mkGateCached (input.asGateInput false false)).aig.decls[idx] = aig.decls[idx]

Tactic:
rw [AIG.LawfulOperator.decl_eq (f := mkGateCached)]

Result:
case h2
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ idx < (aig.mkGateCached (input.asGateInput false false)).aig.decls.size

Proof state:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ (aig.mkXorCached input).aig.decls[idx] = aig.decls[idx]

Tactic:
simp only [mkXorCached]

Result:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ (((aig.mkGateCached (input.asGateInput false false)).aig.mkGateCached
                  ((input.asGateInput true true).cast ⋯)).aig.mkGateCached
            { lhs := { ref := (aig.mkGateCached (input.asGateInput false false)).ref.cast ⋯, inv := true },
              rhs :=
                {
                  ref :=
                    ((aig.mkGateCached (input.asGateInput false false)).aig.mkGateCached
                        ((input.asGateInput true true).cast ⋯)).ref,
                  inv := true } }).aig.decls[idx] =
    aig.decls[idx]

Proof state:
case h2.h.h
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ idx < aig.decls.size

Tactic:
assumption

Result:
no goals

Proof state:
case h2.h
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ idx < (aig.mkGateCached (input.asGateInput false false)).aig.decls.size

Tactic:
apply LawfulOperator.lt_size_of_lt_aig_size

Result:
case h2.h.h
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ idx < aig.decls.size

Proof state:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ (((aig.mkGateCached (input.asGateInput false false)).aig.mkGateCached
                  ((input.asGateInput true true).cast ⋯)).aig.mkGateCached
            { lhs := { ref := (aig.mkGateCached (input.asGateInput false false)).ref.cast ⋯, inv := true },
              rhs :=
                {
                  ref :=
                    ((aig.mkGateCached (input.asGateInput false false)).aig.mkGateCached
                        ((input.asGateInput true true).cast ⋯)).ref,
                  inv := true } }).aig.decls[idx] =
    aig.decls[idx]

Tactic:
rw [AIG.LawfulOperator.decl_eq (f := mkGateCached)]

Result:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ ((aig.mkGateCached (input.asGateInput false false)).aig.mkGateCached
            ((input.asGateInput true true).cast ⋯)).aig.decls[idx] =
    aig.decls[idx]

case h1
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ idx <
    ((aig.mkGateCached (input.asGateInput false false)).aig.mkGateCached
            ((input.asGateInput true true).cast ⋯)).aig.decls.size

Proof state:
case h2.h
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
idx : Nat
aig : AIG α
input : aig.BinaryInput
h : idx < aig.decls.size
h2 : idx < (aig.mkXorCached input).aig.decls.size
⊢ idx < aig.decls.size

Tactic:
assumption

Result:
no goals