-- Mathlib/.lake/packages/lean4/src/lean/Std/Sat/AIG/LawfulOperator.lean
theorem denote.go_eq_of_isPrefix (decls1 decls2 : Array (Decl α)) (start : Nat) {hdag1} {hdag2}
    {hbounds1} {hbounds2} (hprefix : IsPrefix decls1 decls2) :
    denote.go start decls2 assign hbounds2 hdag2
      =
    denote.go start decls1 assign hbounds1 hdag1

Proof state:
α : Type
assign : α → Bool
decls1 decls2 : Array (Decl α)
start : Nat
hdag1 : IsDAG α decls1
hdag2 : IsDAG α decls2
hbounds1 : start < decls1.size
hbounds2 : start < decls2.size
hprefix : IsPrefix decls1 decls2
hidx1 : decls2[start] = decls1[start]
idx✝ : α
heq : decls1[start] = Decl.atom idx✝
⊢ assign idx✝ =
    match elem : decls1[start] with
    | Decl.const b => b
    | Decl.atom v => assign v
    | Decl.gate lhs rhs linv rinv =>
      let_fun this := ⋯;
      let lval := go lhs decls1 assign ⋯ ⋯;
      let rval := go rhs decls1 assign ⋯ ⋯;
      (lval ^^ linv) && (rval ^^ rinv)

Tactic:
split <;> simp_all

Result:
no goals

Proof state:
case h_3
α : Type
assign : α → Bool
decls1 decls2 : Array (Decl α)
start : Nat
hdag1 : IsDAG α decls1
hdag2 : IsDAG α decls2
hbounds1 : start < decls1.size
hbounds2 : start < decls2.size
hprefix : IsPrefix decls1 decls2
lhs rhs : Nat
linv rinv : Bool
heq✝² : decls2[start] = Decl.gate lhs rhs linv rinv
heq✝¹ : decls1[start] = Decl.gate lhs rhs linv rinv
this : lhs < start ∧ rhs < start
lidx✝ ridx✝ : Nat
linv✝ rinv✝ : Bool
heq✝ : decls1[start] = Decl.gate lidx✝ ridx✝ linv✝ rinv✝
heq : lidx✝ = lhs ∧ ridx✝ = rhs ∧ linv✝ = linv ∧ rinv✝ = rinv
hidx2 : decls2[lhs] = decls1[lhs]
hidx3 : decls2[rhs] = decls1[rhs]
⊢ ((go lhs decls2 assign ⋯ ⋯ ^^ linv) && (go rhs decls2 assign ⋯ ⋯ ^^ rinv)) =
    ((go lhs decls1 assign ⋯ ⋯ ^^ linv) && (go rhs decls1 assign ⋯ ⋯ ^^ rinv))

Tactic:
congr 2

Result:
case h_3.e_x.e_a
α : Type
assign : α → Bool
decls1 decls2 : Array (Decl α)
start : Nat
hdag1 : IsDAG α decls1
hdag2 : IsDAG α decls2
hbounds1 : start < decls1.size
hbounds2 : start < decls2.size
hprefix : IsPrefix decls1 decls2
lhs rhs : Nat
linv rinv : Bool
heq✝² : decls2[start] = Decl.gate lhs rhs linv rinv
heq✝¹ : decls1[start] = Decl.gate lhs rhs linv rinv
this : lhs < start ∧ rhs < start
lidx✝ ridx✝ : Nat
linv✝ rinv✝ : Bool
heq✝ : decls1[start] = Decl.gate lidx✝ ridx✝ linv✝ rinv✝
heq : lidx✝ = lhs ∧ ridx✝ = rhs ∧ linv✝ = linv ∧ rinv✝ = rinv
hidx2 : decls2[lhs] = decls1[lhs]
hidx3 : decls2[rhs] = decls1[rhs]
⊢ go lhs decls2 assign ⋯ ⋯ = go lhs decls1 assign ⋯ ⋯

case h_3.e_y.e_a
α : Type
assign : α → Bool
decls1 decls2 : Array (Decl α)
start : Nat
hdag1 : IsDAG α decls1
hdag2 : IsDAG α decls2
hbounds1 : start < decls1.size
hbounds2 : start < decls2.size
hprefix : IsPrefix decls1 decls2
lhs rhs : Nat
linv rinv : Bool
heq✝² : decls2[start] = Decl.gate lhs rhs linv rinv
heq✝¹ : decls1[start] = Decl.gate lhs rhs linv rinv
this : lhs < start ∧ rhs < start
lidx✝ ridx✝ : Nat
linv✝ rinv✝ : Bool
heq✝ : decls1[start] = Decl.gate lidx✝ ridx✝ linv✝ rinv✝
heq : lidx✝ = lhs ∧ ridx✝ = rhs ∧ linv✝ = linv ∧ rinv✝ = rinv
hidx2 : decls2[lhs] = decls1[lhs]
hidx3 : decls2[rhs] = decls1[rhs]
⊢ go rhs decls2 assign ⋯ ⋯ = go rhs decls1 assign ⋯ ⋯

Proof state:
case h_3.e_x.e_a.hprefix
α : Type
assign : α → Bool
decls1 decls2 : Array (Decl α)
start : Nat
hdag1 : IsDAG α decls1
hdag2 : IsDAG α decls2
hbounds1 : start < decls1.size
hbounds2 : start < decls2.size
hprefix : IsPrefix decls1 decls2
lhs rhs : Nat
linv rinv : Bool
heq✝² : decls2[start] = Decl.gate lhs rhs linv rinv
heq✝¹ : decls1[start] = Decl.gate lhs rhs linv rinv
this : lhs < start ∧ rhs < start
lidx✝ ridx✝ : Nat
linv✝ rinv✝ : Bool
heq✝ : decls1[start] = Decl.gate lidx✝ ridx✝ linv✝ rinv✝
heq : lidx✝ = lhs ∧ ridx✝ = rhs ∧ linv✝ = linv ∧ rinv✝ = rinv
hidx2 : decls2[lhs] = decls1[lhs]
hidx3 : decls2[rhs] = decls1[rhs]
⊢ IsPrefix decls1 decls2

Tactic:
assumption

Result:
no goals

Proof state:
case h_3
α : Type
assign : α → Bool
decls1 decls2 : Array (Decl α)
start : Nat
hdag1 : IsDAG α decls1
hdag2 : IsDAG α decls2
hbounds1 : start < decls1.size
hbounds2 : start < decls2.size
hprefix : IsPrefix decls1 decls2
hidx1 : decls2[start] = decls1[start]
lhs rhs : Nat
linv rinv : Bool
heq✝¹ : decls2[start] = Decl.gate lhs rhs linv rinv
heq : decls1[start] = Decl.gate lhs rhs linv rinv
this : lhs < start ∧ rhs < start
hidx2 : decls2[lhs] = decls1[lhs]
hidx3 : decls2[rhs] = decls1[rhs]
lidx✝ ridx✝ : Nat
linv✝ rinv✝ : Bool
heq✝ : decls1[start] = Decl.gate lidx✝ ridx✝ linv✝ rinv✝
⊢ (let_fun this := ⋯;
    let lval := go lhs decls2 assign ⋯ ⋯;
    let rval := go rhs decls2 assign ⋯ ⋯;
    (lval ^^ linv) && (rval ^^ rinv)) =
    let_fun this := ⋯;
    let lval := go lidx✝ decls1 assign ⋯ ⋯;
    let rval := go ridx✝ decls1 assign ⋯ ⋯;
    (lval ^^ linv✝) && (rval ^^ rinv✝)

Tactic:
simp_all

Result:
case h_3
α : Type
assign : α → Bool
decls1 decls2 : Array (Decl α)
start : Nat
hdag1 : IsDAG α decls1
hdag2 : IsDAG α decls2
hbounds1 : start < decls1.size
hbounds2 : start < decls2.size
hprefix : IsPrefix decls1 decls2
lhs rhs : Nat
linv rinv : Bool
heq✝² : decls2[start] = Decl.gate lhs rhs linv rinv
heq✝¹ : decls1[start] = Decl.gate lhs rhs linv rinv
this : lhs < start ∧ rhs < start
lidx✝ ridx✝ : Nat
linv✝ rinv✝ : Bool
heq✝ : decls1[start] = Decl.gate lidx✝ ridx✝ linv✝ rinv✝
heq : lidx✝ = lhs ∧ ridx✝ = rhs ∧ linv✝ = linv ∧ rinv✝ = rinv
hidx2 : decls2[lhs] = decls1[lhs]
hidx3 : decls2[rhs] = decls1[rhs]
⊢ ((go lhs decls2 assign ⋯ ⋯ ^^ linv) && (go rhs decls2 assign ⋯ ⋯ ^^ rinv)) =
    ((go lhs decls1 assign ⋯ ⋯ ^^ linv) && (go rhs decls1 assign ⋯ ⋯ ^^ rinv))