Theorem: LRAT.DefaultFormula.performRatCheck_fold_success_entails_safe_insert
Proof state before:
case intro
n : Nat
f : DefaultFormula n
f_readyForRatAdd : f.readyForRatAdd
c : DefaultClause n
pivot : Literal (PosFin n)
rupHints : Array Nat
ratHints : Array (Nat × Array Nat)
pivot_in_c : limplies (PosFin n) pivot c
ratHintsExhaustive_eq_true : f.ratHintsExhaustive pivot ratHints = true
performRatCheck_fold_success :
  (Array.foldl
        (fun x ratHint => if x.snd = true then x.fst.performRatCheck pivot.negateLiteral ratHint else (x.fst, false))
        (((f.insertRupUnits c.negate).fst.performRupCheck rupHints).fst, true) ratHints 0).snd =
    true
p : PosFin n → Bool
pf : p ⊨ f
pc : ¬(p ⊨ c)
p' : PosFin n → Bool := fun a => if a = pivot.fst then pivot.snd else p a
p'_rw : p' = fun a => if a = pivot.fst then pivot.snd else p a
p'_entails_c : p' ⊨ c
c' : DefaultClause n
p'_not_entails_c' : ¬(p' ⊨ c')
c'_in_f : c' ∈ f.toList
pc' : p ⊨ c'
negPivot_in_c' : pivot.negateLiteral ∈ Clause.toList c'
i : Fin ratHints.size
hc' : f.clauses[ratHints[i].fst]! = some c'
h_performRupCheck_res :
  ((f.insertRupUnits c.negate).fst.performRupCheck rupHints).fst.ratUnits = #[] ∧
    ((f.insertRupUnits c.negate).fst.performRupCheck rupHints).fst.assignments.size = n
performRatCheck_success :
  (((f.insertRupUnits c.negate).fst.performRupCheck rupHints).fst.performRatCheck pivot.negateLiteral ratHints[i]).snd =
    true
performRupCheck_res_satisfies_assignments_invariant :
  ((f.insertRupUnits c.negate).fst.performRupCheck rupHints).fst.assignments_invariant
h :
  ∀ (c_1 : DefaultClause n),
    f.clauses[ratHints[↑i].fst]! = some c_1 →
      limplies (PosFin n) ((f.insertRupUnits c.negate).fst.performRupCheck rupHints).fst
        (c_1.delete pivot.negateLiteral)
⊢ (((f.insertRupUnits c.negate).fst.performRupCheck rupHints).fst.toList.all fun s =>
      decide (((Clause.toList s).any fun l => decide (p l.fst = l.snd)) = true)) =
    true
Tactic:
simp only [List.any_eq_true, Prod.exists, Bool.exists_bool,
  Bool.decide_coe, List.all_eq_true, decide_eq_true_eq]
Proof state after:
case intro
n : Nat
f : DefaultFormula n
f_readyForRatAdd : f.readyForRatAdd
c : DefaultClause n
pivot : Literal (PosFin n)
rupHints : Array Nat
ratHints : Array (Nat × Array Nat)
pivot_in_c : limplies (PosFin n) pivot c
ratHintsExhaustive_eq_true : f.ratHintsExhaustive pivot ratHints = true
performRatCheck_fold_success :
  (Array.foldl
        (fun x ratHint => if x.snd = true then x.fst.performRatCheck pivot.negateLiteral ratHint else (x.fst, false))
        (((f.insertRupUnits c.negate).fst.performRupCheck rupHints).fst, true) ratHints 0).snd =
    true
p : PosFin n → Bool
pf : p ⊨ f
pc : ¬(p ⊨ c)
p' : PosFin n → Bool := fun a => if a = pivot.fst then pivot.snd else p a
p'_rw : p' = fun a => if a = pivot.fst then pivot.snd else p a
p'_entails_c : p' ⊨ c
c' : DefaultClause n
p'_not_entails_c' : ¬(p' ⊨ c')
c'_in_f : c' ∈ f.toList
pc' : p ⊨ c'
negPivot_in_c' : pivot.negateLiteral ∈ Clause.toList c'
i : Fin ratHints.size
hc' : f.clauses[ratHints[i].fst]! = some c'
h_performRupCheck_res :
  ((f.insertRupUnits c.negate).fst.performRupCheck rupHints).fst.ratUnits = #[] ∧
    ((f.insertRupUnits c.negate).fst.performRupCheck rupHints).fst.assignments.size = n
performRatCheck_success :
  (((f.insertRupUnits c.negate).fst.performRupCheck rupHints).fst.performRatCheck pivot.negateLiteral ratHints[i]).snd =
    true
performRupCheck_res_satisfies_assignments_invariant :
  ((f.insertRupUnits c.negate).fst.performRupCheck rupHints).fst.assignments_invariant
h :
  ∀ (c_1 : DefaultClause n),
    f.clauses[ratHints[↑i].fst]! = some c_1 →
      limplies (PosFin n) ((f.insertRupUnits c.negate).fst.performRupCheck rupHints).fst
        (c_1.delete pivot.negateLiteral)
⊢ ∀ (x : DefaultClause n),
    x ∈ ((f.insertRupUnits c.negate).fst.performRupCheck rupHints).fst.toList →
      ∃ a, (a, false) ∈ Clause.toList x ∧ p a = false ∨ (a, true) ∈ Clause.toList x ∧ p a = true