-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/LRAT/Internal/Clause.lean
theorem ofArray_eq (arr : Array (Literal (PosFin n)))
    (arrNodup : ∀ i : Fin arr.size, ∀ j : Fin arr.size, i.1 ≠ j.1 → arr[i] ≠ arr[j])
    (c : DefaultClause n) :
    ofArray arr = some c → toList c = Array.toList arr

Proof state:
case pos
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin (List.length c'.clause)),
              let_fun idx_in_bounds := ⋯;
              List.get c'.clause i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : List.length c.clause = arr.size - 0
i : Nat
l : Literal (PosFin n)
i_in_bounds : i < List.length c.clause
h :
  let_fun idx_in_bounds := ⋯;
  List.get c.clause ⟨i, i_in_bounds⟩ = arr[0 + ↑⟨i, i_in_bounds⟩]
i_in_bounds' : i < arr.toList.length
⊢ l ∈ some c.clause[i] ↔ l ∈ some arr.toList[i]

Tactic:
simp only [List.get_eq_getElem, Nat.zero_add] at h

Result:
case pos
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin (List.length c'.clause)),
              let_fun idx_in_bounds := ⋯;
              List.get c'.clause i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : List.length c.clause = arr.size - 0
i : Nat
l : Literal (PosFin n)
i_in_bounds : i < List.length c.clause
i_in_bounds' : i < arr.toList.length
h : c.clause[i] = arr[i]
⊢ l ∈ some c.clause[i] ↔ l ∈ some arr.toList[i]

Proof state:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin (List.length c'.clause)),
              let_fun idx_in_bounds := ⋯;
              List.get c'.clause i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
acc : Option (DefaultClause n)
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
ih :
  ∀ (c' : DefaultClause n),
    acc = some c' →
      ∃ hsize,
        ∀ (i : Fin (List.length c'.clause)),
          let_fun idx_in_bounds := ⋯;
          List.get c'.clause i = arr[↑idx + 1 + ↑i]
c' : DefaultClause n
heq : fold_fn arr[idx] acc = some c'
⊢ ∃ hsize,
    ∀ (i : Fin (List.length c'.clause)),
      let_fun idx_in_bounds := ⋯;
      List.get c'.clause i = arr[↑idx + ↑i]

Tactic:
simp only [Fin.getElem_fin, fold_fn] at heq

Result:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin (List.length c'.clause)),
              let_fun idx_in_bounds := ⋯;
              List.get c'.clause i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
acc : Option (DefaultClause n)
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
ih :
  ∀ (c' : DefaultClause n),
    acc = some c' →
      ∃ hsize,
        ∀ (i : Fin (List.length c'.clause)),
          let_fun idx_in_bounds := ⋯;
          List.get c'.clause i = arr[↑idx + 1 + ↑i]
c' : DefaultClause n
heq :
  (match acc with
    | none => none
    | some acc => acc.insert arr[↑idx]) =
    some c'
⊢ ∃ hsize,
    ∀ (i : Fin (List.length c'.clause)),
      let_fun idx_in_bounds := ⋯;
      List.get c'.clause i = arr[↑idx + ↑i]