-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/LRAT/Internal/Formula/RupAddResult.lean
theorem restoreAssignments_performRupCheck {n : Nat} (f : DefaultFormula n) (f_assignments_size : f.assignments.size = n)
    (rupHints : Array Nat) :
    restoreAssignments (performRupCheck f rupHints).1.assignments (performRupCheck f rupHints).2.1
      =
    f.assignments

Proof state:
case intro
n : Nat
f : DefaultFormula n
f_assignments_size : f.assignments.size = n
rupHints : Array Nat
f' : DefaultFormula n := (f.performRupCheck rupHints).fst
f'_def : f' = (f.performRupCheck rupHints).fst
f'_assignments_size : f'.assignments.size = n
derivedLits : CNF.Clause (PosFin n)
derivedLits_satisfies_invariant :
  f.DerivedLitsInvariant f_assignments_size (f.performRupCheck rupHints).fst.assignments f'_assignments_size derivedLits
derivedLits_arr : Array (Literal (PosFin n)) := { toList := derivedLits }
derivedLits_arr_def : derivedLits_arr = { toList := derivedLits }
derivedLits_arr_nodup : ∀ (i j : Fin derivedLits_arr.size), i ≠ j → derivedLits_arr[i] ≠ derivedLits_arr[j]
motive : Nat → Array Assignment → Prop := f.ClearInsertInductionMotive f_assignments_size derivedLits_arr
h_base : f.ClearInsertInductionMotive f_assignments_size derivedLits_arr 0 f'.assignments
h_inductive :
  ∀ (idx : Fin derivedLits_arr.size) (assignments : Array Assignment),
    motive (↑idx) assignments →
      f.ClearInsertInductionMotive f_assignments_size derivedLits_arr (↑idx + 1)
        (clearUnit assignments derivedLits_arr[idx])
h_size : (Array.foldl clearUnit f'.assignments derivedLits_arr).size = n
h :
  ∀ (i : Fin n),
    let_fun i_lt_assignments_size := ⋯;
    let_fun i_lt_f_assignments_size := ⋯;
    let assignments_i := (Array.foldl clearUnit f'.assignments derivedLits_arr)[↑i];
    let fassignments_i := f.assignments[↑i];
    (assignments_i = fassignments_i ∧
        ∀ (j : Fin derivedLits_arr.size), ↑j ≥ derivedLits_arr.size → derivedLits_arr[j].fst.val ≠ ↑i) ∨
      (∃ j b i_gt_zero,
          ↑j ≥ derivedLits_arr.size ∧
            derivedLits_arr[j] = (⟨↑i, ⋯⟩, b) ∧
              assignments_i = addAssignment b fassignments_i ∧
                ¬hasAssignment b fassignments_i = true ∧
                  ∀ (k : Fin derivedLits_arr.size),
                    ↑k ≥ derivedLits_arr.size → k ≠ j → derivedLits_arr[k].fst.val ≠ ↑i) ∨
        ∃ j1 j2 i_gt_zero,
          ↑j1 ≥ derivedLits_arr.size ∧
            ↑j2 ≥ derivedLits_arr.size ∧
              derivedLits_arr[j1] = (⟨↑i, ⋯⟩, true) ∧
                derivedLits_arr[j2] = (⟨↑i, ⋯⟩, false) ∧
                  assignments_i = both ∧
                    fassignments_i = unassigned ∧
                      ∀ (k : Fin derivedLits_arr.size),
                        ↑k ≥ derivedLits_arr.size → k ≠ j1 → k ≠ j2 → derivedLits_arr[k].fst.val ≠ ↑i
⊢ Array.foldl clearUnit f'.assignments { toList := derivedLits } = f.assignments

Tactic:
apply Array.ext

Result:
case intro.h₁
n : Nat
f : DefaultFormula n
f_assignments_size : f.assignments.size = n
rupHints : Array Nat
f' : DefaultFormula n := (f.performRupCheck rupHints).fst
f'_def : f' = (f.performRupCheck rupHints).fst
f'_assignments_size : f'.assignments.size = n
derivedLits : CNF.Clause (PosFin n)
derivedLits_satisfies_invariant :
  f.DerivedLitsInvariant f_assignments_size (f.performRupCheck rupHints).fst.assignments f'_assignments_size derivedLits
derivedLits_arr : Array (Literal (PosFin n)) := { toList := derivedLits }
derivedLits_arr_def : derivedLits_arr = { toList := derivedLits }
derivedLits_arr_nodup : ∀ (i j : Fin derivedLits_arr.size), i ≠ j → derivedLits_arr[i] ≠ derivedLits_arr[j]
motive : Nat → Array Assignment → Prop := f.ClearInsertInductionMotive f_assignments_size derivedLits_arr
h_base : f.ClearInsertInductionMotive f_assignments_size derivedLits_arr 0 f'.assignments
h_inductive :
  ∀ (idx : Fin derivedLits_arr.size) (assignments : Array Assignment),
    motive (↑idx) assignments →
      f.ClearInsertInductionMotive f_assignments_size derivedLits_arr (↑idx + 1)
        (clearUnit assignments derivedLits_arr[idx])
h_size : (Array.foldl clearUnit f'.assignments derivedLits_arr).size = n
h :
  ∀ (i : Fin n),
    let_fun i_lt_assignments_size := ⋯;
    let_fun i_lt_f_assignments_size := ⋯;
    let assignments_i := (Array.foldl clearUnit f'.assignments derivedLits_arr)[↑i];
    let fassignments_i := f.assignments[↑i];
    (assignments_i = fassignments_i ∧
        ∀ (j : Fin derivedLits_arr.size), ↑j ≥ derivedLits_arr.size → derivedLits_arr[j].fst.val ≠ ↑i) ∨
      (∃ j b i_gt_zero,
          ↑j ≥ derivedLits_arr.size ∧
            derivedLits_arr[j] = (⟨↑i, ⋯⟩, b) ∧
              assignments_i = addAssignment b fassignments_i ∧
                ¬hasAssignment b fassignments_i = true ∧
                  ∀ (k : Fin derivedLits_arr.size),
                    ↑k ≥ derivedLits_arr.size → k ≠ j → derivedLits_arr[k].fst.val ≠ ↑i) ∨
        ∃ j1 j2 i_gt_zero,
          ↑j1 ≥ derivedLits_arr.size ∧
            ↑j2 ≥ derivedLits_arr.size ∧
              derivedLits_arr[j1] = (⟨↑i, ⋯⟩, true) ∧
                derivedLits_arr[j2] = (⟨↑i, ⋯⟩, false) ∧
                  assignments_i = both ∧
                    fassignments_i = unassigned ∧
                      ∀ (k : Fin derivedLits_arr.size),
                        ↑k ≥ derivedLits_arr.size → k ≠ j1 → k ≠ j2 → derivedLits_arr[k].fst.val ≠ ↑i
⊢ (Array.foldl clearUnit f'.assignments { toList := derivedLits }).size = f.assignments.size

case intro.h₂
n : Nat
f : DefaultFormula n
f_assignments_size : f.assignments.size = n
rupHints : Array Nat
f' : DefaultFormula n := (f.performRupCheck rupHints).fst
f'_def : f' = (f.performRupCheck rupHints).fst
f'_assignments_size : f'.assignments.size = n
derivedLits : CNF.Clause (PosFin n)
derivedLits_satisfies_invariant :
  f.DerivedLitsInvariant f_assignments_size (f.performRupCheck rupHints).fst.assignments f'_assignments_size derivedLits
derivedLits_arr : Array (Literal (PosFin n)) := { toList := derivedLits }
derivedLits_arr_def : derivedLits_arr = { toList := derivedLits }
derivedLits_arr_nodup : ∀ (i j : Fin derivedLits_arr.size), i ≠ j → derivedLits_arr[i] ≠ derivedLits_arr[j]
motive : Nat → Array Assignment → Prop := f.ClearInsertInductionMotive f_assignments_size derivedLits_arr
h_base : f.ClearInsertInductionMotive f_assignments_size derivedLits_arr 0 f'.assignments
h_inductive :
  ∀ (idx : Fin derivedLits_arr.size) (assignments : Array Assignment),
    motive (↑idx) assignments →
      f.ClearInsertInductionMotive f_assignments_size derivedLits_arr (↑idx + 1)
        (clearUnit assignments derivedLits_arr[idx])
h_size : (Array.foldl clearUnit f'.assignments derivedLits_arr).size = n
h :
  ∀ (i : Fin n),
    let_fun i_lt_assignments_size := ⋯;
    let_fun i_lt_f_assignments_size := ⋯;
    let assignments_i := (Array.foldl clearUnit f'.assignments derivedLits_arr)[↑i];
    let fassignments_i := f.assignments[↑i];
    (assignments_i = fassignments_i ∧
        ∀ (j : Fin derivedLits_arr.size), ↑j ≥ derivedLits_arr.size → derivedLits_arr[j].fst.val ≠ ↑i) ∨
      (∃ j b i_gt_zero,
          ↑j ≥ derivedLits_arr.size ∧
            derivedLits_arr[j] = (⟨↑i, ⋯⟩, b) ∧
              assignments_i = addAssignment b fassignments_i ∧
                ¬hasAssignment b fassignments_i = true ∧
                  ∀ (k : Fin derivedLits_arr.size),
                    ↑k ≥ derivedLits_arr.size → k ≠ j → derivedLits_arr[k].fst.val ≠ ↑i) ∨
        ∃ j1 j2 i_gt_zero,
          ↑j1 ≥ derivedLits_arr.size ∧
            ↑j2 ≥ derivedLits_arr.size ∧
              derivedLits_arr[j1] = (⟨↑i, ⋯⟩, true) ∧
                derivedLits_arr[j2] = (⟨↑i, ⋯⟩, false) ∧
                  assignments_i = both ∧
                    fassignments_i = unassigned ∧
                      ∀ (k : Fin derivedLits_arr.size),
                        ↑k ≥ derivedLits_arr.size → k ≠ j1 → k ≠ j2 → derivedLits_arr[k].fst.val ≠ ↑i
⊢ ∀ (i : Nat) (hi₁ : i < (Array.foldl clearUnit f'.assignments { toList := derivedLits }).size)
    (hi₂ : i < f.assignments.size),
    (Array.foldl clearUnit f'.assignments { toList := derivedLits })[i] = f.assignments[i]