-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/LRAT/Internal/Formula/Lemmas.lean
theorem readyForRupAdd_insert {n : Nat} (f : DefaultFormula n) (c : DefaultClause n) :
    ReadyForRupAdd f → ReadyForRupAdd (insert f c)

Proof state:
n : Nat
f : DefaultFormula n
c : DefaultClause n
f_readyForRupAdd : f.ReadyForRupAdd
x✝ : Option (Literal (PosFin n))
l : PosFin n
hc : c.isUnit = some (l, true)
hsize : (f.assignments.modify l.val addPosAssignment).size = n
i : PosFin n
b : Bool
hb : hasAssignment b (f.assignments.modify l.val addPosAssignment)[i.val] = true
hf : hasAssignment b f.assignments[i.val] = true → unit (i, b) ∈ f.toList
i_in_bounds : i.val < f.assignments.size
ib_ne_c : ¬(i, b) = (l, true)
l_eq_i : l.val = i.val
b_eq_false : b = false
⊢ hasAssignment b f.assignments[i.val] = true

Tactic:
simp only [hasAssignment, b_eq_false, l_eq_i, Array.getElem_modify_self, ite_false, hasNeg_addPos, reduceCtorEq] at hb

Result:
n : Nat
f : DefaultFormula n
c : DefaultClause n
f_readyForRupAdd : f.ReadyForRupAdd
x✝ : Option (Literal (PosFin n))
l : PosFin n
hc : c.isUnit = some (l, true)
hsize : (f.assignments.modify l.val addPosAssignment).size = n
i : PosFin n
b : Bool
hf : hasAssignment b f.assignments[i.val] = true → unit (i, b) ∈ f.toList
i_in_bounds : i.val < f.assignments.size
ib_ne_c : ¬(i, b) = (l, true)
l_eq_i : l.val = i.val
b_eq_false : b = false
hb : f.assignments[i.val].hasNegAssignment = true
⊢ hasAssignment b f.assignments[i.val] = true

Proof state:
case pos
n : Nat
f : DefaultFormula n
c : DefaultClause n
f_readyForRupAdd : f.ReadyForRupAdd
x✝ : Option (Literal (PosFin n))
l : PosFin n
hc : c.isUnit = some (l, false)
hsize : (f.assignments.modify l.val addNegAssignment).size = n
i : PosFin n
b : Bool
hb : hasAssignment b (f.assignments.modify l.val addNegAssignment)[i.val] = true
hf : hasAssignment b f.assignments[i.val] = true → unit (i, b) ∈ f.toList
i_in_bounds : i.val < f.assignments.size
h✝ : (i, b) = (l, false)
⊢ unit (i, b) ∈
    { clauses := f.clauses.push (some c), rupUnits := f.rupUnits, ratUnits := f.ratUnits,
        assignments := f.assignments.modify l.val addNegAssignment }.toList

Tactic:
next ib_eq_c =>
simp only [toList, Array.push_toList, List.append_assoc, List.mem_append, List.mem_filterMap,
  List.mem_singleton, id_eq, exists_eq_right, Option.some.injEq, List.mem_map, Prod.exists, Bool.exists_bool]
apply Or.inl ∘ Or.inr
rw [isUnit_iff, DefaultClause.toList, ← ib_eq_c] at hc
apply DefaultClause.ext
simp only [unit, hc]

Result:
no goals

Proof state:
n : Nat
f : DefaultFormula n
c : DefaultClause n
f_readyForRupAdd : f.ReadyForRupAdd
x✝ : Option (Literal (PosFin n))
l : PosFin n
hc : c.isUnit = some (l, true)
hsize : (f.assignments.modify l.val addPosAssignment).size = n
i : PosFin n
b : Bool
hb :
  hasAssignment b
      { clauses := f.clauses.push (some c), rupUnits := f.rupUnits, ratUnits := f.ratUnits,
            assignments := f.assignments.modify l.val addPosAssignment }.assignments[i.val] =
    true
hf : hasAssignment b f.assignments[i.val] = true → unit (i, b) ∈ f.toList
i_in_bounds : i.val < f.assignments.size
⊢ unit (i, b) ∈
    { clauses := f.clauses.push (some c), rupUnits := f.rupUnits, ratUnits := f.ratUnits,
        assignments := f.assignments.modify l.val addPosAssignment }.toList

Tactic:
simp only at hb

Result:
n : Nat
f : DefaultFormula n
c : DefaultClause n
f_readyForRupAdd : f.ReadyForRupAdd
x✝ : Option (Literal (PosFin n))
l : PosFin n
hc : c.isUnit = some (l, true)
hsize : (f.assignments.modify l.val addPosAssignment).size = n
i : PosFin n
b : Bool
hb : hasAssignment b (f.assignments.modify l.val addPosAssignment)[i.val] = true
hf : hasAssignment b f.assignments[i.val] = true → unit (i, b) ∈ f.toList
i_in_bounds : i.val < f.assignments.size
⊢ unit (i, b) ∈
    { clauses := f.clauses.push (some c), rupUnits := f.rupUnits, ratUnits := f.ratUnits,
        assignments := f.assignments.modify l.val addPosAssignment }.toList

Proof state:
n : Nat
f : DefaultFormula n
c : DefaultClause n
f_readyForRupAdd : f.ReadyForRupAdd
x✝ : Option (Literal (PosFin n))
l : PosFin n
hc : c.isUnit = some (l, true)
hsize : (f.assignments.modify l.val addPosAssignment).size = n
⊢ { clauses := f.clauses.push (some c), rupUnits := f.rupUnits, ratUnits := f.ratUnits,
      assignments := f.assignments.modify l.val addPosAssignment }.ReadyForRupAdd

Tactic:
refine ⟨f_readyForRupAdd.1, hsize, ?_⟩

Result:
n : Nat
f : DefaultFormula n
c : DefaultClause n
f_readyForRupAdd : f.ReadyForRupAdd
x✝ : Option (Literal (PosFin n))
l : PosFin n
hc : c.isUnit = some (l, true)
hsize : (f.assignments.modify l.val addPosAssignment).size = n
⊢ ∀ (i : PosFin n) (b : Bool),
    hasAssignment b
          { clauses := f.clauses.push (some c), rupUnits := f.rupUnits, ratUnits := f.ratUnits,
                assignments := f.assignments.modify l.val addPosAssignment }.assignments[i.val] =
        true →
      unit (i, b) ∈
        { clauses := f.clauses.push (some c), rupUnits := f.rupUnits, ratUnits := f.ratUnits,
            assignments := f.assignments.modify l.val addPosAssignment }.toList

Proof state:
n : Nat
f : DefaultFormula n
c : DefaultClause n
f_readyForRupAdd : f.ReadyForRupAdd
x✝ : Option (Literal (PosFin n))
l : PosFin n
hsize : (f.assignments.modify l.val addNegAssignment).size = n
i : PosFin n
b : Bool
hc : c.clause = [(i, b)]
hb : hasAssignment b (f.assignments.modify l.val addNegAssignment)[i.val] = true
hf : hasAssignment b f.assignments[i.val] = true → unit (i, b) ∈ f.toList
i_in_bounds : i.val < f.assignments.size
ib_eq_c : (i, b) = (l, false)
⊢ unit (i, b) = c

Tactic:
apply DefaultClause.ext

Result:
case clause
n : Nat
f : DefaultFormula n
c : DefaultClause n
f_readyForRupAdd : f.ReadyForRupAdd
x✝ : Option (Literal (PosFin n))
l : PosFin n
hsize : (f.assignments.modify l.val addNegAssignment).size = n
i : PosFin n
b : Bool
hc : c.clause = [(i, b)]
hb : hasAssignment b (f.assignments.modify l.val addNegAssignment)[i.val] = true
hf : hasAssignment b f.assignments[i.val] = true → unit (i, b) ∈ f.toList
i_in_bounds : i.val < f.assignments.size
ib_eq_c : (i, b) = (l, false)
⊢ (unit (i, b)).clause = c.clause

Proof state:
n : Nat
f : DefaultFormula n
c : DefaultClause n
f_readyForRupAdd : f.ReadyForRupAdd
x✝ : Option (Literal (PosFin n))
l : PosFin n
hc : c.isUnit = some (l, false)
hsize : (f.assignments.modify l.val addNegAssignment).size = n
⊢ ∀ (i : PosFin n) (b : Bool),
    hasAssignment b
          { clauses := f.clauses.push (some c), rupUnits := f.rupUnits, ratUnits := f.ratUnits,
                assignments := f.assignments.modify l.val addNegAssignment }.assignments[i.val] =
        true →
      unit (i, b) ∈
        { clauses := f.clauses.push (some c), rupUnits := f.rupUnits, ratUnits := f.ratUnits,
            assignments := f.assignments.modify l.val addNegAssignment }.toList

Tactic:
intro i b hb

Result:
n : Nat
f : DefaultFormula n
c : DefaultClause n
f_readyForRupAdd : f.ReadyForRupAdd
x✝ : Option (Literal (PosFin n))
l : PosFin n
hc : c.isUnit = some (l, false)
hsize : (f.assignments.modify l.val addNegAssignment).size = n
i : PosFin n
b : Bool
hb :
  hasAssignment b
      { clauses := f.clauses.push (some c), rupUnits := f.rupUnits, ratUnits := f.ratUnits,
            assignments := f.assignments.modify l.val addNegAssignment }.assignments[i.val] =
    true
⊢ unit (i, b) ∈
    { clauses := f.clauses.push (some c), rupUnits := f.rupUnits, ratUnits := f.ratUnits,
        assignments := f.assignments.modify l.val addNegAssignment }.toList