internlm/Lean-Github huggingface dataset:
Theorem: LRAT.DefaultFormula.clear_insertRat_base_case
Proof state before:
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
insertRatUnits_assignments_size : (f.insertRatUnits units).fst.assignments.size = n
i : Fin n
⊢ ((f.insertRatUnits units).fst.assignments[↑i] = f.assignments[↑i] ∧
      ∀ (j : Fin (f.insertRatUnits units).fst.ratUnits.size), ¬(f.insertRatUnits units).fst.ratUnits[↑j].fst.val = ↑i) ∨
    (∃ j b i_gt_zero,
        (f.insertRatUnits units).fst.ratUnits[↑j] = (⟨↑i, ⋯⟩, b) ∧
          (f.insertRatUnits units).fst.assignments[↑i] = addAssignment b f.assignments[↑i] ∧
            ¬hasAssignment b f.assignments[↑i] = true ∧
              ∀ (k : Fin (f.insertRatUnits units).fst.ratUnits.size),
                ¬k = j → ¬(f.insertRatUnits units).fst.ratUnits[↑k].fst.val = ↑i) ∨
      ∃ j1 j2 i_gt_zero,
        (f.insertRatUnits units).fst.ratUnits[↑j1] = (⟨↑i, ⋯⟩, true) ∧
          (f.insertRatUnits units).fst.ratUnits[↑j2] = (⟨↑i, ⋯⟩, false) ∧
            (f.insertRatUnits units).fst.assignments[↑i] = both ∧
              f.assignments[↑i] = unassigned ∧
                ∀ (k : Fin (f.insertRatUnits units).fst.ratUnits.size),
                  ¬k = j1 → ¬k = j2 → ¬(f.insertRatUnits units).fst.ratUnits[↑k].fst.val = ↑i
Tactic:
exact insertRatUnits_postcondition f hf units i
Proof state after:
no goals
Theorem: LRAT.DefaultFormula.clear_insertRat
Proof state before:
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ (f.insertRatUnits units).fst.clearRatUnits = f
Tactic:
simp only [clearRatUnits]
Proof state after:
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
      assignments :=
        Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits 0 } =
    f
Theorem: LRAT.DefaultFormula.clear_insertRat
Proof state before:
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
      assignments :=
        Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits 0 } =
    f
Tactic:
ext
Proof state after:
case clauses
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits 0 }.clauses =
    f.clauses

case rupUnits
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.rupUnits =
    f.rupUnits

case ratUnits
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.ratUnits =
    f.ratUnits

case assignments
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.assignments =
    f.assignments
Theorem: LRAT.DefaultFormula.clear_insertRat
Proof state before:
case clauses
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits 0 }.clauses =
    f.clauses

case rupUnits
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.rupUnits =
    f.rupUnits

case ratUnits
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.ratUnits =
    f.ratUnits

case assignments
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.assignments =
    f.assignments
Tactic:
. simp only [insertRatUnits]
Proof state after:
case rupUnits
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.rupUnits =
    f.rupUnits

case ratUnits
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.ratUnits =
    f.ratUnits

case assignments
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.assignments =
    f.assignments
Theorem: LRAT.DefaultFormula.clear_insertRat
Proof state before:
case rupUnits
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.rupUnits =
    f.rupUnits

case ratUnits
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.ratUnits =
    f.ratUnits

case assignments
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.assignments =
    f.assignments
Tactic:
. simp only [insertRatUnits]
Proof state after:
case ratUnits
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.ratUnits =
    f.ratUnits

case assignments
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.assignments =
    f.assignments
Theorem: LRAT.DefaultFormula.clear_insertRat
Proof state before:
case ratUnits
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.ratUnits =
    f.ratUnits

case assignments
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.assignments =
    f.assignments
Tactic:
. rw [hf.1]
Proof state after:
case assignments
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.assignments =
    f.assignments
Theorem: LRAT.DefaultFormula.clear_insertRat
Proof state before:
case assignments
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.assignments =
    f.assignments
Tactic:
. simp only
  let motive := clear_insert_induction_motive f hf.2 (insertRatUnits f units).1.ratUnits
  have h_base : motive 0 (insertRatUnits f units).1.assignments := clear_insertRat_base_case f hf units
  have h_inductive (idx : Fin (insertRatUnits f units).1.ratUnits.size) (assignments : Array Assignment)
    (ih : motive idx.val assignments) : motive (idx.val + 1) (clearUnit assignments (insertRatUnits f units).1.ratUnits[idx]) :=
    clear_insert_inductive_case f hf.2 (insertRatUnits f units).1.ratUnits
      (insertRatUnits_nodup f hf units) idx assignments ih
  rcases Array.foldl_induction motive h_base h_inductive with ⟨h_size, h⟩
  apply Array.ext
  . rw [h_size, hf.2]
  . intro i hi1 hi2
    have i_lt_n : i < n := by omega
    specialize h ⟨i, i_lt_n⟩
    rcases h with h | h | h
    . exact h.1
    . omega
    . omega
Proof state after:
no goals
Theorem: LRAT.DefaultFormula.clear_insertRat
Proof state before:
case clauses
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits 0 }.clauses =
    f.clauses
Tactic:
simp only [insertRatUnits]
Proof state after:
no goals
Theorem: LRAT.DefaultFormula.clear_insertRat
Proof state before:
case rupUnits
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.rupUnits =
    f.rupUnits
Tactic:
simp only [insertRatUnits]
Proof state after:
no goals
Theorem: LRAT.DefaultFormula.clear_insertRat
Proof state before:
case ratUnits
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.ratUnits =
    f.ratUnits
Tactic:
rw [hf.1]
Proof state after:
no goals
Theorem: LRAT.DefaultFormula.clear_insertRat
Proof state before:
case assignments
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ { clauses := (f.insertRatUnits units).1.clauses, rupUnits := (f.insertRatUnits units).1.rupUnits, ratUnits := #[],
        assignments :=
          Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits
            0 }.assignments =
    f.assignments
Tactic:
simp only
Proof state after:
case assignments
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits 0 = f.assignments
Theorem: LRAT.DefaultFormula.clear_insertRat
Proof state before:
case assignments
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
⊢ Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits 0 = f.assignments
Tactic:
let motive := clear_insert_induction_motive f hf.2 (insertRatUnits f units).1.ratUnits
Proof state after:
case assignments
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
motive : Nat → Array Assignment → Prop := f.clear_insert_induction_motive ⋯ (f.insertRatUnits units).fst.ratUnits
⊢ Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits 0 = f.assignments
Theorem: LRAT.DefaultFormula.clear_insertRat
Proof state before:
case assignments
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
motive : Nat → Array Assignment → Prop := f.clear_insert_induction_motive ⋯ (f.insertRatUnits units).fst.ratUnits
⊢ Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits 0 = f.assignments
Tactic:
have h_base : motive 0 (insertRatUnits f units).1.assignments := clear_insertRat_base_case f hf units
Proof state after:
case assignments
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
motive : Nat → Array Assignment → Prop := f.clear_insert_induction_motive ⋯ (f.insertRatUnits units).fst.ratUnits
h_base : motive 0 (f.insertRatUnits units).fst.assignments
⊢ Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits 0 = f.assignments
Theorem: LRAT.DefaultFormula.clear_insertRat
Proof state before:
case assignments
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
motive : Nat → Array Assignment → Prop := f.clear_insert_induction_motive ⋯ (f.insertRatUnits units).fst.ratUnits
h_base : motive 0 (f.insertRatUnits units).fst.assignments
⊢ Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits 0 = f.assignments
Tactic:
have h_inductive (idx : Fin (insertRatUnits f units).1.ratUnits.size) (assignments : Array Assignment)
  (ih : motive idx.val assignments) : motive (idx.val + 1) (clearUnit assignments (insertRatUnits f units).1.ratUnits[idx]) :=
  clear_insert_inductive_case f hf.2 (insertRatUnits f units).1.ratUnits
    (insertRatUnits_nodup f hf units) idx assignments ih
Proof state after:
case assignments
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
motive : Nat → Array Assignment → Prop := f.clear_insert_induction_motive ⋯ (f.insertRatUnits units).fst.ratUnits
h_base : motive 0 (f.insertRatUnits units).fst.assignments
h_inductive :
  ∀ (idx : Fin (f.insertRatUnits units).fst.ratUnits.size) (assignments : Array Assignment),
    motive (↑idx) assignments → motive (↑idx + 1) (clearUnit assignments (f.insertRatUnits units).fst.ratUnits[idx])
⊢ Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits 0 = f.assignments
Theorem: LRAT.DefaultFormula.clear_insertRat
Proof state before:
case assignments.intro.h₂
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
motive : Nat → Array Assignment → Prop := f.clear_insert_induction_motive ⋯ (f.insertRatUnits units).fst.ratUnits
h_base : motive 0 (f.insertRatUnits units).fst.assignments
h_inductive :
  ∀ (idx : Fin (f.insertRatUnits units).fst.ratUnits.size) (assignments : Array Assignment),
    motive (↑idx) assignments → motive (↑idx + 1) (clearUnit assignments (f.insertRatUnits units).fst.ratUnits[idx])
h_size :
  (Array.foldl (fun b => clearUnit b) (f.insertRatUnits units).fst.assignments (f.insertRatUnits units).fst.ratUnits
        0).size =
    n
h :
  ∀ (i : Fin n),
    let_fun i_lt_assignments_size := ⋯;
    let_fun i_lt_f_assignments_size := ⋯;
    let assignments_i :=
      (Array.foldl (fun b => clearUnit b) (f.insertRatUnits units).fst.assignments (f.insertRatUnits units).fst.ratUnits
          0)[↑i];
    let fassignments_i := f.assignments[↑i];
    (assignments_i = fassignments_i ∧
        ∀ (j : Fin (f.insertRatUnits units).fst.ratUnits.size),
          ↑j ≥ (f.insertRatUnits units).fst.ratUnits.size → (f.insertRatUnits units).fst.ratUnits[j].fst.val ≠ ↑i) ∨
      (∃ j b i_gt_zero,
          ↑j ≥ (f.insertRatUnits units).fst.ratUnits.size ∧
            (f.insertRatUnits units).fst.ratUnits[j] = (⟨↑i, ⋯⟩, b) ∧
              assignments_i = addAssignment b fassignments_i ∧
                ¬hasAssignment b fassignments_i = true ∧
                  ∀ (k : Fin (f.insertRatUnits units).fst.ratUnits.size),
                    ↑k ≥ (f.insertRatUnits units).fst.ratUnits.size →
                      k ≠ j → (f.insertRatUnits units).fst.ratUnits[k].fst.val ≠ ↑i) ∨
        ∃ j1 j2 i_gt_zero,
          ↑j1 ≥ (f.insertRatUnits units).fst.ratUnits.size ∧
            ↑j2 ≥ (f.insertRatUnits units).fst.ratUnits.size ∧
              (f.insertRatUnits units).fst.ratUnits[j1] = (⟨↑i, ⋯⟩, true) ∧
                (f.insertRatUnits units).fst.ratUnits[j2] = (⟨↑i, ⋯⟩, false) ∧
                  assignments_i = both ∧
                    fassignments_i = unassigned ∧
                      ∀ (k : Fin (f.insertRatUnits units).fst.ratUnits.size),
                        ↑k ≥ (f.insertRatUnits units).fst.ratUnits.size →
                          k ≠ j1 → k ≠ j2 → (f.insertRatUnits units).fst.ratUnits[k].fst.val ≠ ↑i
⊢ ∀ (i : Nat)
    (hi₁ :
      i < (Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits 0).size)
    (hi₂ : i < f.assignments.size),
    (Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits 0)[i] =
      f.assignments[i]
Tactic:
. intro i hi1 hi2
  have i_lt_n : i < n := by omega
  specialize h ⟨i, i_lt_n⟩
  rcases h with h | h | h
  . exact h.1
  . omega
  . omega
Proof state after:
no goals
Theorem: LRAT.DefaultFormula.clear_insertRat
Proof state before:
case assignments.intro.h₁
n : Nat
f : DefaultFormula n
hf : f.ratUnits = #[] ∧ f.assignments.size = n
units : List (Literal (PosFin n))
motive : Nat → Array Assignment → Prop := f.clear_insert_induction_motive ⋯ (f.insertRatUnits units).fst.ratUnits
h_base : motive 0 (f.insertRatUnits units).fst.assignments
h_inductive :
  ∀ (idx : Fin (f.insertRatUnits units).fst.ratUnits.size) (assignments : Array Assignment),
    motive (↑idx) assignments → motive (↑idx + 1) (clearUnit assignments (f.insertRatUnits units).fst.ratUnits[idx])
h_size :
  (Array.foldl (fun b => clearUnit b) (f.insertRatUnits units).fst.assignments (f.insertRatUnits units).fst.ratUnits
        0).size =
    n
h :
  ∀ (i : Fin n),
    let_fun i_lt_assignments_size := ⋯;
    let_fun i_lt_f_assignments_size := ⋯;
    let assignments_i :=
      (Array.foldl (fun b => clearUnit b) (f.insertRatUnits units).fst.assignments (f.insertRatUnits units).fst.ratUnits
          0)[↑i];
    let fassignments_i := f.assignments[↑i];
    (assignments_i = fassignments_i ∧
        ∀ (j : Fin (f.insertRatUnits units).fst.ratUnits.size),
          ↑j ≥ (f.insertRatUnits units).fst.ratUnits.size → (f.insertRatUnits units).fst.ratUnits[j].fst.val ≠ ↑i) ∨
      (∃ j b i_gt_zero,
          ↑j ≥ (f.insertRatUnits units).fst.ratUnits.size ∧
            (f.insertRatUnits units).fst.ratUnits[j] = (⟨↑i, ⋯⟩, b) ∧
              assignments_i = addAssignment b fassignments_i ∧
                ¬hasAssignment b fassignments_i = true ∧
                  ∀ (k : Fin (f.insertRatUnits units).fst.ratUnits.size),
                    ↑k ≥ (f.insertRatUnits units).fst.ratUnits.size →
                      k ≠ j → (f.insertRatUnits units).fst.ratUnits[k].fst.val ≠ ↑i) ∨
        ∃ j1 j2 i_gt_zero,
          ↑j1 ≥ (f.insertRatUnits units).fst.ratUnits.size ∧
            ↑j2 ≥ (f.insertRatUnits units).fst.ratUnits.size ∧
              (f.insertRatUnits units).fst.ratUnits[j1] = (⟨↑i, ⋯⟩, true) ∧
                (f.insertRatUnits units).fst.ratUnits[j2] = (⟨↑i, ⋯⟩, false) ∧
                  assignments_i = both ∧
                    fassignments_i = unassigned ∧
                      ∀ (k : Fin (f.insertRatUnits units).fst.ratUnits.size),
                        ↑k ≥ (f.insertRatUnits units).fst.ratUnits.size →
                          k ≠ j1 → k ≠ j2 → (f.insertRatUnits units).fst.ratUnits[k].fst.val ≠ ↑i
⊢ (Array.foldl clearUnit (f.insertRatUnits units).1.assignments (f.insertRatUnits units).1.ratUnits 0).size =
    f.assignments.size
Tactic:
rw [h_size, hf.2]
Proof state after:
no goals