-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/LRAT/Internal/Formula/Lemmas.lean
theorem mem_of_insertRupUnits {n : Nat} (f : DefaultFormula n) (units : CNF.Clause (PosFin n))
    (c : DefaultClause n) :
    c ∈ toList (insertRupUnits f units).1 → c ∈ units.map Clause.unit ∨ c ∈ toList f

Proof state:
n : Nat
f : DefaultFormula n
units : CNF.Clause (PosFin n)
c : DefaultClause n
h :
  some c ∈ f.clauses.toList ∨
    (∃ a,
        (a, false) ∈ (List.foldl insertUnit (f.rupUnits, f.assignments, false) units).fst.toList ∧ unit (a, false) = c ∨
          (a, true) ∈ (List.foldl insertUnit (f.rupUnits, f.assignments, false) units).fst.toList ∧
            unit (a, true) = c) ∨
      ∃ a, (a, false) ∈ f.ratUnits.toList ∧ unit (a, false) = c ∨ (a, true) ∈ f.ratUnits.toList ∧ unit (a, true) = c
⊢ ∀ (l : Literal (PosFin n)), l ∈ (f.rupUnits, f.assignments, false).fst.toList → l ∈ f.rupUnits.toList ∨ l ∈ units

Tactic:
intro l hl

Result:
n : Nat
f : DefaultFormula n
units : CNF.Clause (PosFin n)
c : DefaultClause n
h :
  some c ∈ f.clauses.toList ∨
    (∃ a,
        (a, false) ∈ (List.foldl insertUnit (f.rupUnits, f.assignments, false) units).fst.toList ∧ unit (a, false) = c ∨
          (a, true) ∈ (List.foldl insertUnit (f.rupUnits, f.assignments, false) units).fst.toList ∧
            unit (a, true) = c) ∨
      ∃ a, (a, false) ∈ f.ratUnits.toList ∧ unit (a, false) = c ∨ (a, true) ∈ f.ratUnits.toList ∧ unit (a, true) = c
l : Literal (PosFin n)
hl : l ∈ (f.rupUnits, f.assignments, false).fst.toList
⊢ l ∈ f.rupUnits.toList ∨ l ∈ units

Proof state:
n : Nat
f : DefaultFormula n
units : CNF.Clause (PosFin n)
c : DefaultClause n
h :
  some c ∈ f.clauses.toList ∨
    (∃ a,
        (a, false) ∈ (List.foldl insertUnit (f.rupUnits, f.assignments, false) units).fst.toList ∧ unit (a, false) = c ∨
          (a, true) ∈ (List.foldl insertUnit (f.rupUnits, f.assignments, false) units).fst.toList ∧
            unit (a, true) = c) ∨
      ∃ a, (a, false) ∈ f.ratUnits.toList ∧ unit (a, false) = c ∨ (a, true) ∈ f.ratUnits.toList ∧ unit (a, true) = c
l : Literal (PosFin n)
hl : l ∈ (f.rupUnits, f.assignments, false).fst.toList
⊢ l ∈ f.rupUnits.toList ∨ l ∈ units

Tactic:
exact Or.inl hl

Result:
no goals

Proof state:
case inr.inl.intro.inl.intro.inr
n : Nat
f : DefaultFormula n
units : CNF.Clause (PosFin n)
c : DefaultClause n
hb : ∀ (l : Literal (PosFin n)), l ∈ (f.rupUnits, f.assignments, false).fst.toList → l ∈ f.rupUnits.toList ∨ l ∈ units
hl :
  ∀ (acc : Array (Literal (PosFin n)) × Array Assignment × Bool),
    (∀ (l : Literal (PosFin n)), l ∈ acc.fst.toList → l ∈ f.rupUnits.toList ∨ l ∈ units) →
      ∀ (unit : Literal (PosFin n)),
        unit ∈ units →
          ∀ (l : Literal (PosFin n)), l ∈ (insertUnit acc unit).fst.toList → l ∈ f.rupUnits.toList ∨ l ∈ units
h_insertUnit_fold✝ :
  ∀ (l : Literal (PosFin n)),
    l ∈ (List.foldl insertUnit (f.rupUnits, f.assignments, false) units).fst.toList → l ∈ f.rupUnits.toList ∨ l ∈ units
i : PosFin n
h1 : (i, false) ∈ (List.foldl insertUnit (f.rupUnits, f.assignments, false) units).fst.toList
h2 : unit (i, false) = c
h_insertUnit_fold : (i, false) ∈ units
⊢ (i, false) ∈ units ∧ Clause.unit (i, false) = c

Tactic:
exact ⟨h_insertUnit_fold, h2⟩

Result:
no goals

Proof state:
n : Nat
f : DefaultFormula n
units : CNF.Clause (PosFin n)
c : DefaultClause n
h :
  some c ∈ f.clauses.toList ∨
    (∃ a,
        (a, false) ∈ (List.foldl insertUnit (f.rupUnits, f.assignments, false) units).fst.toList ∧ unit (a, false) = c ∨
          (a, true) ∈ (List.foldl insertUnit (f.rupUnits, f.assignments, false) units).fst.toList ∧
            unit (a, true) = c) ∨
      ∃ a, (a, false) ∈ f.ratUnits.toList ∧ unit (a, false) = c ∨ (a, true) ∈ f.ratUnits.toList ∧ unit (a, true) = c
hb : ∀ (l : Literal (PosFin n)), l ∈ (f.rupUnits, f.assignments, false).fst.toList → l ∈ f.rupUnits.toList ∨ l ∈ units
hl :
  ∀ (acc : Array (Literal (PosFin n)) × Array Assignment × Bool),
    (∀ (l : Literal (PosFin n)), l ∈ acc.fst.toList → l ∈ f.rupUnits.toList ∨ l ∈ units) →
      ∀ (unit : Literal (PosFin n)),
        unit ∈ units →
          ∀ (l : Literal (PosFin n)), l ∈ (insertUnit acc unit).fst.toList → l ∈ f.rupUnits.toList ∨ l ∈ units
⊢ (∃ a, (a, false) ∈ units ∧ Clause.unit (a, false) = c ∨ (a, true) ∈ units ∧ Clause.unit (a, true) = c) ∨
    some c ∈ f.clauses.toList ∨
      (∃ a, (a, false) ∈ f.rupUnits.toList ∧ unit (a, false) = c ∨ (a, true) ∈ f.rupUnits.toList ∧ unit (a, true) = c) ∨
        ∃ a, (a, false) ∈ f.ratUnits.toList ∧ unit (a, false) = c ∨ (a, true) ∈ f.ratUnits.toList ∧ unit (a, true) = c

Tactic:
have h_insertUnit_fold := List.foldlRecOn units insertUnit (f.rupUnits, f.assignments, false) hb hl

Result:
n : Nat
f : DefaultFormula n
units : CNF.Clause (PosFin n)
c : DefaultClause n
h :
  some c ∈ f.clauses.toList ∨
    (∃ a,
        (a, false) ∈ (List.foldl insertUnit (f.rupUnits, f.assignments, false) units).fst.toList ∧ unit (a, false) = c ∨
          (a, true) ∈ (List.foldl insertUnit (f.rupUnits, f.assignments, false) units).fst.toList ∧
            unit (a, true) = c) ∨
      ∃ a, (a, false) ∈ f.ratUnits.toList ∧ unit (a, false) = c ∨ (a, true) ∈ f.ratUnits.toList ∧ unit (a, true) = c
hb : ∀ (l : Literal (PosFin n)), l ∈ (f.rupUnits, f.assignments, false).fst.toList → l ∈ f.rupUnits.toList ∨ l ∈ units
hl :
  ∀ (acc : Array (Literal (PosFin n)) × Array Assignment × Bool),
    (∀ (l : Literal (PosFin n)), l ∈ acc.fst.toList → l ∈ f.rupUnits.toList ∨ l ∈ units) →
      ∀ (unit : Literal (PosFin n)),
        unit ∈ units →
          ∀ (l : Literal (PosFin n)), l ∈ (insertUnit acc unit).fst.toList → l ∈ f.rupUnits.toList ∨ l ∈ units
h_insertUnit_fold :
  ∀ (l : Literal (PosFin n)),
    l ∈ (List.foldl insertUnit (f.rupUnits, f.assignments, false) units).fst.toList → l ∈ f.rupUnits.toList ∨ l ∈ units
⊢ (∃ a, (a, false) ∈ units ∧ Clause.unit (a, false) = c ∨ (a, true) ∈ units ∧ Clause.unit (a, true) = c) ∨
    some c ∈ f.clauses.toList ∨
      (∃ a, (a, false) ∈ f.rupUnits.toList ∧ unit (a, false) = c ∨ (a, true) ∈ f.rupUnits.toList ∧ unit (a, true) = c) ∨
        ∃ a, (a, false) ∈ f.ratUnits.toList ∧ unit (a, false) = c ∨ (a, true) ∈ f.ratUnits.toList ∧ unit (a, true) = c

Proof state:
case isFalse.inl
n : Nat
f : DefaultFormula n
units : CNF.Clause (PosFin n)
c : DefaultClause n
h :
  some c ∈ f.clauses.toList ∨
    (∃ a,
        (a, false) ∈ (List.foldl insertUnit (f.rupUnits, f.assignments, false) units).fst.toList ∧
            Std.Tactic.BVDecide.LRAT.Internal.DefaultClause.unit (a, false) = c ∨
          (a, true) ∈ (List.foldl insertUnit (f.rupUnits, f.assignments, false) units).fst.toList ∧
            Std.Tactic.BVDecide.LRAT.Internal.DefaultClause.unit (a, true) = c) ∨
      ∃ a,
        (a, false) ∈ f.ratUnits.toList ∧ Std.Tactic.BVDecide.LRAT.Internal.DefaultClause.unit (a, false) = c ∨
          (a, true) ∈ f.ratUnits.toList ∧ Std.Tactic.BVDecide.LRAT.Internal.DefaultClause.unit (a, true) = c
hb : ∀ (l : Literal (PosFin n)), l ∈ (f.rupUnits, f.assignments, false).fst.toList → l ∈ f.rupUnits.toList ∨ l ∈ units
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
ih : ∀ (l : Literal (PosFin n)), l ∈ acc.fst.toList → l ∈ f.rupUnits.toList ∨ l ∈ units
unit : Literal (PosFin n)
unit_in_units : unit ∈ units
l : Literal (PosFin n)
h✝ : ¬hasAssignment unit.snd acc.2.fst[unit.fst.val]! = true
l_in_acc : l ∈ acc.fst.toList
⊢ l ∈ f.rupUnits.toList ∨ l ∈ units

Tactic:
exact ih l l_in_acc

Result:
no goals