-- 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]
⊢ (match elem : decls2[start] with
    | Decl.const b => b
    | Decl.atom v => assign v
    | Decl.gate lhs rhs linv rinv =>
      let_fun this := ⋯;
      let lval := go lhs decls2 assign ⋯ ⋯;
      let rval := go rhs decls2 assign ⋯ ⋯;
      (lval ^^ linv) && (rval ^^ rinv)) =
    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

Result:
case h_1
α : 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]
b✝ : Bool
heq✝ : decls2[start] = Decl.const b✝
⊢ b✝ =
    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)

case h_2
α : 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✝ : decls2[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)

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]
lidx✝ ridx✝ : Nat
linv✝ rinv✝ : Bool
heq✝ : decls2[start] = Decl.gate lidx✝ ridx✝ linv✝ rinv✝
⊢ (let_fun this := ⋯;
    let lval := go lidx✝ decls2 assign ⋯ ⋯;
    let rval := go ridx✝ decls2 assign ⋯ ⋯;
    (lval ^^ linv✝) && (rval ^^ rinv✝)) =
    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)

Proof state:
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 ⋯ ⋯

Tactic:
apply denote.go_eq_of_isPrefix

Result:
case h_3.e_y.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

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
⊢ go start decls2 assign hbounds2 hdag2 = go start decls1 assign hbounds1 hdag1

Tactic:
unfold denote.go

Result:
α : 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
⊢ (match elem : decls2[start] with
    | Decl.const b => b
    | Decl.atom v => assign v
    | Decl.gate lhs rhs linv rinv =>
      let_fun this := ⋯;
      let lval := go lhs decls2 assign ⋯ ⋯;
      let rval := go rhs decls2 assign ⋯ ⋯;
      (lval ^^ linv) && (rval ^^ rinv)) =
    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)

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 : decls2[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:
rw [hidx1] at heq

Result:
α : 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)

Proof state:
case h_1
α : 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]
b✝ : Bool
heq✝ : decls1[start] = Decl.const b✝
⊢ (let_fun this := ⋯;
    let lval := go lhs decls2 assign ⋯ ⋯;
    let rval := go rhs decls2 assign ⋯ ⋯;
    (lval ^^ linv) && (rval ^^ rinv)) =
    b✝

Tactic:
simp_all

Result:
no goals