Theorem: LRAT.DefaultFormula.insertRupUnits_preserves_assignments_invariant
Proof state before:
case inr.inr.intro.intro.intro.intro.intro.intro.intro
n : Nat
f : DefaultFormula n
f_readyForRupAdd : f.readyForRupAdd
units : List (Literal (PosFin n))
h :
  let assignments := (f.insertRupUnits units).fst.assignments;
  let_fun hsize := ⋯;
  let rupUnits := (f.insertRupUnits units).fst.rupUnits;
  insertUnit_invariant f.assignments ⋯ rupUnits assignments hsize
hsize : (f.insertRupUnits units).fst.assignments.size = n
i : PosFin n
b : Bool
hb : hasAssignment b (f.insertRupUnits units).fst.assignments[i.val] = true
p : PosFin n → Bool
hp :
  ∀ (x : DefaultClause n),
    (some x ∈ (f.insertRupUnits units).fst.clauses.data ∨
        (∃ a,
            (a, false) ∈ (f.insertRupUnits units).fst.rupUnits.data ∧ unit (a, false) = x ∨
              (a, true) ∈ (f.insertRupUnits units).fst.rupUnits.data ∧ unit (a, true) = x) ∨
          ∃ a,
            (a, false) ∈ (f.insertRupUnits units).fst.ratUnits.data ∧ unit (a, false) = x ∨
              (a, true) ∈ (f.insertRupUnits units).fst.ratUnits.data ∧ unit (a, true) = x) →
      ∃ a, (a, false) ∈ Clause.toList x ∧ decide (p a = false) = true ∨ (a, true) ∈ Clause.toList x ∧ p a = true
pf : p ⊨ f
j1 j2 : Fin (f.insertRupUnits units).fst.rupUnits.size
i_gt_zero : ↑⟨i.val, ⋯⟩ > 0
h1 : (f.insertRupUnits units).fst.rupUnits[j1] = (⟨↑⟨i.val, ⋯⟩, ⋯⟩, true)
h2 : (f.insertRupUnits units).fst.rupUnits[j2] = (⟨↑⟨i.val, ⋯⟩, ⋯⟩, false)
left✝¹ : (f.insertRupUnits units).fst.assignments[↑⟨i.val, ⋯⟩] = both
left✝ : f.assignments[↑⟨i.val, ⋯⟩] = unassigned
right✝ :
  ∀ (k : Fin (f.insertRupUnits units).fst.rupUnits.size),
    k ≠ j1 → k ≠ j2 → (f.insertRupUnits units).fst.rupUnits[k].fst.val ≠ ↑⟨i.val, ⋯⟩
⊢ p ⊨ (i, b)
Tactic:
. let j1_unit := unit (insertRupUnits f units).1.rupUnits[j1]
  have j1_unit_def : j1_unit = unit (insertRupUnits f units).1.rupUnits[j1] := rfl
  have j1_unit_in_insertRupUnits_res :
    ∃ i : PosFin n,
      (i, false) ∈ (insertRupUnits f units).1.rupUnits.data ∧ unit (i, false) = j1_unit ∨
      (i, true) ∈ (insertRupUnits f units).1.rupUnits.data ∧ unit (i, true) = j1_unit := by
    apply Exists.intro i ∘ Or.inr
    rw [j1_unit_def, h1]
    constructor
    . have h1 : (insertRupUnits f units).fst.rupUnits[j1] = (i, true) := by
        rw [h1]
        simp only [Prod.mk.injEq, and_true]
        apply Subtype.ext
        rfl
      rw [← h1]
      apply Array.getElem_mem_data
    . rfl
  let j2_unit := unit (insertRupUnits f units).1.rupUnits[j2]
  have j2_unit_def : j2_unit = unit (insertRupUnits f units).1.rupUnits[j2] := rfl
  have j2_unit_in_insertRupUnits_res :
    ∃ i : PosFin n,
      (i, false) ∈ (insertRupUnits f units).1.rupUnits.data ∧ unit (i, false) = j2_unit ∨
      (i, true) ∈ (insertRupUnits f units).1.rupUnits.data ∧ unit (i, true) = j2_unit := by
    apply Exists.intro i ∘ Or.inl
    rw [j2_unit_def, h2]
    constructor
    . have h2 : (insertRupUnits f units).fst.rupUnits[j2] = (i, false) := by
        rw [h2]
        simp only [Prod.mk.injEq, and_true]
        apply Subtype.ext
        rfl
      rw [← h2]
      apply Array.getElem_mem_data
    . rfl
  have hp1 := hp j1_unit ((Or.inr ∘ Or.inl) j1_unit_in_insertRupUnits_res)
  have hp2 := hp j2_unit ((Or.inr ∘ Or.inl) j2_unit_in_insertRupUnits_res)
  simp only [List.any_eq_true, Prod.exists, Bool.exists_bool, Bool.decide_coe, Fin.getElem_fin, List.find?, j1_unit, j2_unit] at hp1 hp2
  rcases hp1 with ⟨i1, hp1⟩
  rcases hp2 with ⟨i2, hp2⟩
  simp only [Fin.getElem_fin] at h1
  simp only [Fin.getElem_fin] at h2
  simp only [h1, Clause.toList, unit_eq, List.mem_singleton, Prod.mk.injEq,
    and_false, false_and, and_true, false_or, h2, or_false] at hp1 hp2
  simp only [hp2.1, ← hp1.1, decide_eq_true_eq, true_and] at hp2
  simp only [hp1.2] at hp2
Proof state after:
no goals