-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/LRAT/Internal/Formula/RupAddSound.lean
theorem sat_of_insertRup {n : Nat} (f : DefaultFormula n) (f_readyForRupAdd : ReadyForRupAdd f) (c : DefaultClause n)
    (p : PosFin n → Bool) (pf : p ⊨ f) :
    (insertRupUnits f (negate c)).2 = true → p ⊨ c

Proof state:
case intro.inr.inr.intro.intro.intro.intro.intro.intro.intro
n : Nat
f : DefaultFormula n
f_readyForRupAdd : f.ReadyForRupAdd
c : DefaultClause n
p : PosFin n → Bool
pf : p ⊨ f
insertUnit_fold_success : (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).2.snd = true
false_imp : false = true → ∃ i, f.assignments[i.val] = both
i : PosFin n
hboth : (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).snd.fst[i.val] = both
i_in_bounds : i.val < f.assignments.size
h0 : InsertUnitInvariant f.assignments ⋯ f.rupUnits f.assignments ⋯
insertUnit_fold_satisfies_invariant :
  let update_res := List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate;
  let_fun update_res_size := ⋯;
  InsertUnitInvariant f.assignments ⋯ update_res.fst update_res.snd.fst update_res_size
j1 j2 : Fin (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).fst.size
i_gt_zero : ↑⟨i.val, ⋯⟩ > 0
h1 : (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).fst[j1] = (⟨↑⟨i.val, ⋯⟩, ⋯⟩, true)
h2 : (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).fst[j2] = (⟨↑⟨i.val, ⋯⟩, ⋯⟩, false)
left✝¹ : (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).snd.fst[↑⟨i.val, ⋯⟩] = both
left✝ : f.assignments[↑⟨i.val, ⋯⟩] = unassigned
right✝ :
  ∀ (k : Fin (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).fst.size),
    k ≠ j1 → k ≠ j2 → (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).fst[k].fst.val ≠ ↑⟨i.val, ⋯⟩
i_true_in_insertUnit_fold✝ :
  (i, true) ∈ (List.foldl insertUnit (#[], f.assignments, false) (List.map Literal.negate c.clause)).fst.toList
i_false_in_insertUnit_fold✝ :
  (i, false) ∈ (List.foldl insertUnit (#[], f.assignments, false) (List.map Literal.negate c.clause)).fst.toList
i_true_in_insertUnit_fold : (i, false) ∈ c.clause
i_false_in_insertUnit_fold : (i, true) ∈ c.clause
⊢ False

Tactic:
have c_not_tautology := Clause.not_tautology c (i, true)

Result:
case intro.inr.inr.intro.intro.intro.intro.intro.intro.intro
n : Nat
f : DefaultFormula n
f_readyForRupAdd : f.ReadyForRupAdd
c : DefaultClause n
p : PosFin n → Bool
pf : p ⊨ f
insertUnit_fold_success : (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).2.snd = true
false_imp : false = true → ∃ i, f.assignments[i.val] = both
i : PosFin n
hboth : (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).snd.fst[i.val] = both
i_in_bounds : i.val < f.assignments.size
h0 : InsertUnitInvariant f.assignments ⋯ f.rupUnits f.assignments ⋯
insertUnit_fold_satisfies_invariant :
  let update_res := List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate;
  let_fun update_res_size := ⋯;
  InsertUnitInvariant f.assignments ⋯ update_res.fst update_res.snd.fst update_res_size
j1 j2 : Fin (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).fst.size
i_gt_zero : ↑⟨i.val, ⋯⟩ > 0
h1 : (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).fst[j1] = (⟨↑⟨i.val, ⋯⟩, ⋯⟩, true)
h2 : (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).fst[j2] = (⟨↑⟨i.val, ⋯⟩, ⋯⟩, false)
left✝¹ : (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).snd.fst[↑⟨i.val, ⋯⟩] = both
left✝ : f.assignments[↑⟨i.val, ⋯⟩] = unassigned
right✝ :
  ∀ (k : Fin (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).fst.size),
    k ≠ j1 → k ≠ j2 → (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).fst[k].fst.val ≠ ↑⟨i.val, ⋯⟩
i_true_in_insertUnit_fold✝ :
  (i, true) ∈ (List.foldl insertUnit (#[], f.assignments, false) (List.map Literal.negate c.clause)).fst.toList
i_false_in_insertUnit_fold✝ :
  (i, false) ∈ (List.foldl insertUnit (#[], f.assignments, false) (List.map Literal.negate c.clause)).fst.toList
i_true_in_insertUnit_fold : (i, false) ∈ c.clause
i_false_in_insertUnit_fold : (i, true) ∈ c.clause
c_not_tautology : ¬(i, true) ∈ Clause.toList c ∨ ¬Literal.negate (i, true) ∈ Clause.toList c
⊢ False

Proof state:
n : Nat
f : DefaultFormula n
f_readyForRupAdd : f.ReadyForRupAdd
c : DefaultClause n
p : PosFin n → Bool
pf : p ⊨ f
insertUnit_fold_success : (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).2.snd = true
false_imp : false = true → ∃ i, f.assignments[i.val] = both
i : PosFin n
hboth : (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).snd.fst[i.val] = both
i_in_bounds : i.val < f.assignments.size
h0 : InsertUnitInvariant f.assignments ⋯ f.rupUnits f.assignments ⋯
insertUnit_fold_satisfies_invariant :
  let update_res := List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate;
  let_fun update_res_size := ⋯;
  InsertUnitInvariant f.assignments ⋯ update_res.fst update_res.snd.fst update_res_size
j : Fin (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).fst.size
b : Bool
i_gt_zero : ↑⟨i.val, ⋯⟩ > 0
h1 : (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).fst[j] = (⟨↑⟨i.val, ⋯⟩, ⋯⟩, b)
h3 : ¬hasAssignment b f.assignments[↑⟨i.val, ⋯⟩] = true
h4 :
  ∀ (k : Fin (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).fst.size),
    k ≠ j → (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).fst[k].fst.val ≠ ↑⟨i.val, ⋯⟩
ib_in_insertUnit_fold : (i, b) ∈ (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).fst.toList
i' : PosFin n
i_false_in_c : (i, false) ∈ c.clause
i'_eq_i : i' = i
b_eq_true : true = b
a✝ : Assignment
heq : f.assignments[i.val] = neg
h2 : both = both
hasNegAssignment_fi : hasAssignment false f.assignments[i.val] = true
p_entails_i : p i = false
⊢ decide (p i = false) = true

Tactic:
simp only [p_entails_i, decide_true]

Result:
no goals

Proof state:
n : Nat
f : DefaultFormula n
f_readyForRupAdd : f.ReadyForRupAdd
c : DefaultClause n
p : PosFin n → Bool
pf : p ⊨ f
insertUnit_fold_success : (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).2.snd = true
i : PosFin n
⊢ i.val < f.assignments.size

Tactic:
rw [f_readyForRupAdd.2.1]

Result:
n : Nat
f : DefaultFormula n
f_readyForRupAdd : f.ReadyForRupAdd
c : DefaultClause n
p : PosFin n → Bool
pf : p ⊨ f
insertUnit_fold_success : (List.foldl insertUnit (f.rupUnits, f.assignments, false) c.negate).2.snd = true
i : PosFin n
⊢ i.val < n