-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/LRAT/Internal/Formula/RupAddResult.lean
theorem restoreAssignments_performRupCheck_base_case {n : Nat} (f : DefaultFormula n)
    (f_assignments_size : f.assignments.size = n)
    (f' : DefaultFormula n) (_f'_def : f' = (performRupCheck f rupHints).1)
    (f'_assignments_size : f'.assignments.size = n) (derivedLits : CNF.Clause (PosFin n))
    (derivedLits_arr : Array (Literal (PosFin n)))
    (derivedLits_arr_def : derivedLits_arr = {toList := derivedLits})
    (derivedLits_satisfies_invariant :
      DerivedLitsInvariant f f_assignments_size f'.assignments f'_assignments_size derivedLits)
    (_derivedLits_arr_nodup : ∀ (i j : Fin (Array.size derivedLits_arr)), i ≠ j → derivedLits_arr[i] ≠ derivedLits_arr[j]) :
    ClearInsertInductionMotive f f_assignments_size derivedLits_arr 0 f'.assignments

Proof state:
case inr.inl.intro.intro.intro.intro
rupHints : Array Nat
n : Nat
f : DefaultFormula n
f_assignments_size : f.assignments.size = n
f' : DefaultFormula n
_f'_def : f' = (f.performRupCheck rupHints).fst
f'_assignments_size : f'.assignments.size = n
derivedLits : CNF.Clause (PosFin n)
derivedLits_arr : Array (Literal (PosFin n))
derivedLits_arr_def : derivedLits_arr = { toList := derivedLits }
_derivedLits_arr_nodup : ∀ (i j : Fin derivedLits_arr.size), i ≠ j → derivedLits_arr[i] ≠ derivedLits_arr[j]
i : Fin n
j : Fin (List.length derivedLits)
j_eq_i : (List.get derivedLits j).fst.val = ↑i
h1 : f'.assignments[↑i] = addAssignment (List.get derivedLits j).snd f.assignments[↑i]
h2 : ¬hasAssignment (List.get derivedLits j).snd f.assignments[↑i] = true
h3 : ∀ (k : Fin (List.length derivedLits)), k ≠ j → (List.get derivedLits k).fst.val ≠ ↑i
⊢ ∃ j b i_gt_zero,
    ↑j ≥ 0 ∧
      derivedLits_arr[j] = (⟨↑i, ⋯⟩, b) ∧
        f'.assignments[↑i] = addAssignment b f.assignments[↑i] ∧
          ¬hasAssignment b f.assignments[↑i] = true ∧
            ∀ (k : Fin derivedLits_arr.size), ↑k ≥ 0 → k ≠ j → derivedLits_arr[k].fst.val ≠ ↑i

Tactic:
have j_lt_derivedLits_arr_size : j.1 < derivedLits_arr.size := by
  simp only [derivedLits_arr_def, Array.size_toArray]
  exact j.2

Result:
case inr.inl.intro.intro.intro.intro
rupHints : Array Nat
n : Nat
f : DefaultFormula n
f_assignments_size : f.assignments.size = n
f' : DefaultFormula n
_f'_def : f' = (f.performRupCheck rupHints).fst
f'_assignments_size : f'.assignments.size = n
derivedLits : CNF.Clause (PosFin n)
derivedLits_arr : Array (Literal (PosFin n))
derivedLits_arr_def : derivedLits_arr = { toList := derivedLits }
_derivedLits_arr_nodup : ∀ (i j : Fin derivedLits_arr.size), i ≠ j → derivedLits_arr[i] ≠ derivedLits_arr[j]
i : Fin n
j : Fin (List.length derivedLits)
j_eq_i : (List.get derivedLits j).fst.val = ↑i
h1 : f'.assignments[↑i] = addAssignment (List.get derivedLits j).snd f.assignments[↑i]
h2 : ¬hasAssignment (List.get derivedLits j).snd f.assignments[↑i] = true
h3 : ∀ (k : Fin (List.length derivedLits)), k ≠ j → (List.get derivedLits k).fst.val ≠ ↑i
j_lt_derivedLits_arr_size : ↑j < derivedLits_arr.size
⊢ ∃ j b i_gt_zero,
    ↑j ≥ 0 ∧
      derivedLits_arr[j] = (⟨↑i, ⋯⟩, b) ∧
        f'.assignments[↑i] = addAssignment b f.assignments[↑i] ∧
          ¬hasAssignment b f.assignments[↑i] = true ∧
            ∀ (k : Fin derivedLits_arr.size), ↑k ≥ 0 → k ≠ j → derivedLits_arr[k].fst.val ≠ ↑i

Proof state:
case inr.inl.intro.intro.intro.intro.right.left
rupHints : Array Nat
n : Nat
f : DefaultFormula n
f_assignments_size : f.assignments.size = n
f' : DefaultFormula n
_f'_def : f' = (f.performRupCheck rupHints).fst
f'_assignments_size : f'.assignments.size = n
derivedLits : CNF.Clause (PosFin n)
derivedLits_arr : Array (Literal (PosFin n))
derivedLits_arr_def : derivedLits_arr = { toList := derivedLits }
_derivedLits_arr_nodup : ∀ (i j : Fin derivedLits_arr.size), i ≠ j → derivedLits_arr[i] ≠ derivedLits_arr[j]
i : Fin n
j : Fin (List.length derivedLits)
j_eq_i : (List.get derivedLits j).fst.val = ↑i
h1 : f'.assignments[↑i] = addAssignment (List.get derivedLits j).snd f.assignments[↑i]
h2 : ¬hasAssignment (List.get derivedLits j).snd f.assignments[↑i] = true
h3 : ∀ (k : Fin (List.length derivedLits)), k ≠ j → (List.get derivedLits k).fst.val ≠ ↑i
j_lt_derivedLits_arr_size : ↑j < derivedLits_arr.size
i_gt_zero : ↑i > 0
⊢ derivedLits_arr[⟨↑j, j_lt_derivedLits_arr_size⟩] = (⟨↑i, ⋯⟩, (List.get derivedLits j).snd)

Tactic:
simp only [derivedLits_arr_def, Fin.getElem_fin, ← j_eq_i]

Result:
case inr.inl.intro.intro.intro.intro.right.left
rupHints : Array Nat
n : Nat
f : DefaultFormula n
f_assignments_size : f.assignments.size = n
f' : DefaultFormula n
_f'_def : f' = (f.performRupCheck rupHints).fst
f'_assignments_size : f'.assignments.size = n
derivedLits : CNF.Clause (PosFin n)
derivedLits_arr : Array (Literal (PosFin n))
derivedLits_arr_def : derivedLits_arr = { toList := derivedLits }
_derivedLits_arr_nodup : ∀ (i j : Fin derivedLits_arr.size), i ≠ j → derivedLits_arr[i] ≠ derivedLits_arr[j]
i : Fin n
j : Fin (List.length derivedLits)
j_eq_i : (List.get derivedLits j).fst.val = ↑i
h1 : f'.assignments[↑i] = addAssignment (List.get derivedLits j).snd f.assignments[↑i]
h2 : ¬hasAssignment (List.get derivedLits j).snd f.assignments[↑i] = true
h3 : ∀ (k : Fin (List.length derivedLits)), k ≠ j → (List.get derivedLits k).fst.val ≠ ↑i
j_lt_derivedLits_arr_size : ↑j < derivedLits_arr.size
i_gt_zero : ↑i > 0
⊢ { toList := derivedLits }[↑j] = (⟨(List.get derivedLits j).fst.val, ⋯⟩, (List.get derivedLits j).snd)

Proof state:
rupHints : Array Nat
n : Nat
f : DefaultFormula n
f_assignments_size : f.assignments.size = n
f' : DefaultFormula n
_f'_def : f' = (f.performRupCheck rupHints).fst
f'_assignments_size : f'.assignments.size = n
derivedLits : CNF.Clause (PosFin n)
derivedLits_arr : Array (Literal (PosFin n))
derivedLits_arr_def : derivedLits_arr = { toList := derivedLits }
_derivedLits_arr_nodup : ∀ (i j : Fin derivedLits_arr.size), i ≠ j → derivedLits_arr[i] ≠ derivedLits_arr[j]
i : Fin n
h1 : f'.assignments[↑i] = f.assignments[↑i]
h2 : ∀ (l : Literal (PosFin n)), l ∈ derivedLits → l.fst.val ≠ ↑i
j : Fin derivedLits_arr.size
a✝ : ↑j ≥ 0
⊢ { toList := derivedLits }[↑j] ∈ derivedLits

Tactic:
apply Array.getElem_mem_toList

Result:
no goals