-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/LRAT/Internal/Formula/RupAddResult.lean
theorem derivedLitsInvariant_confirmRupHint {n : Nat} (f : DefaultFormula n) (f_assignments_size : f.assignments.size = n)
    (rupHints : Array Nat) (i : Fin rupHints.size)
    (acc : Array Assignment × CNF.Clause (PosFin n) × Bool × Bool)
    (ih : ∃ hsize : acc.1.size = n, DerivedLitsInvariant f f_assignments_size acc.1 hsize acc.2.1) :
    let rupHint_res := (confirmRupHint f.clauses) acc rupHints[i]
    ∃ hsize : rupHint_res.1.size = n, DerivedLitsInvariant f f_assignments_size rupHint_res.1 hsize rupHint_res.2.1

Proof state:
case intro.isFalse.inr.inr.intro.inr.inr.inr
n : Nat
f : DefaultFormula n
f_assignments_size : f.assignments.size = n
rupHints : Array Nat
i : Fin rupHints.size
acc : Array Assignment × CNF.Clause (PosFin n) × Bool × Bool
hsize : acc.fst.size = n
ih : f.DerivedLitsInvariant f_assignments_size acc.fst hsize acc.snd.fst
hsize' : (confirmRupHint f.clauses acc rupHints[i]).fst.size = n
h✝ : ¬(acc.2.2.snd || acc.2.2.fst) = true
c : DefaultClause n
rupHint_clause_eq_c : f.clauses[rupHints[↑i]]? = some (some c)
hreducedToNonunit : c.reduce acc.fst = ReduceResult.reducedToNonunit
⊢ f.DerivedLitsInvariant f_assignments_size
    (match c.reduce acc.fst with
      | ReduceResult.encounteredBoth => (acc.fst, acc.2.fst, true, false)
      | ReduceResult.reducedToEmpty => (acc.fst, acc.2.fst, true, false)
      | ReduceResult.reducedToUnit (l, b) =>
        if hasAssignment b acc.fst[l.val]! = true then (acc.fst, acc.2.fst, false, false)
        else (acc.fst.modify l.val (addAssignment b), (l, b) :: acc.2.fst, false, false)
      | ReduceResult.reducedToNonunit => (acc.fst, acc.2.fst, false, true)).fst
    ⋯
    (match c.reduce acc.fst with
        | ReduceResult.encounteredBoth => (acc.fst, acc.2.fst, true, false)
        | ReduceResult.reducedToEmpty => (acc.fst, acc.2.fst, true, false)
        | ReduceResult.reducedToUnit (l, b) =>
          if hasAssignment b acc.fst[l.val]! = true then (acc.fst, acc.2.fst, false, false)
          else (acc.fst.modify l.val (addAssignment b), (l, b) :: acc.2.fst, false, false)
        | ReduceResult.reducedToNonunit => (acc.fst, acc.2.fst, false, true)).snd.fst

Tactic:
simp only [hreducedToNonunit]

Result:
case intro.isFalse.inr.inr.intro.inr.inr.inr
n : Nat
f : DefaultFormula n
f_assignments_size : f.assignments.size = n
rupHints : Array Nat
i : Fin rupHints.size
acc : Array Assignment × CNF.Clause (PosFin n) × Bool × Bool
hsize : acc.fst.size = n
ih : f.DerivedLitsInvariant f_assignments_size acc.fst hsize acc.snd.fst
hsize' : (confirmRupHint f.clauses acc rupHints[i]).fst.size = n
h✝ : ¬(acc.2.2.snd || acc.2.2.fst) = true
c : DefaultClause n
rupHint_clause_eq_c : f.clauses[rupHints[↑i]]? = some (some c)
hreducedToNonunit : c.reduce acc.fst = ReduceResult.reducedToNonunit
⊢ f.DerivedLitsInvariant f_assignments_size acc.fst ⋯ acc.2.fst

Proof state:
n : Nat
f : DefaultFormula n
f_assignments_size : f.assignments.size = n
rupHints : Array Nat
i : Fin rupHints.size
acc : Array Assignment × CNF.Clause (PosFin n) × Bool × Bool
ih : ∃ hsize, f.DerivedLitsInvariant f_assignments_size acc.fst hsize acc.snd.fst
⊢ let rupHint_res := confirmRupHint f.clauses acc rupHints[i];
  ∃ hsize, f.DerivedLitsInvariant f_assignments_size rupHint_res.fst hsize rupHint_res.snd.fst

Tactic:
rcases ih with ⟨hsize, ih⟩

Result:
case intro
n : Nat
f : DefaultFormula n
f_assignments_size : f.assignments.size = n
rupHints : Array Nat
i : Fin rupHints.size
acc : Array Assignment × CNF.Clause (PosFin n) × Bool × Bool
hsize : acc.fst.size = n
ih : f.DerivedLitsInvariant f_assignments_size acc.fst hsize acc.snd.fst
⊢ let rupHint_res := confirmRupHint f.clauses acc rupHints[i];
  ∃ hsize, f.DerivedLitsInvariant f_assignments_size rupHint_res.fst hsize rupHint_res.snd.fst

Proof state:
case intro.isFalse.inr.inl
n : Nat
f : DefaultFormula n
f_assignments_size : f.assignments.size = n
rupHints : Array Nat
i : Fin rupHints.size
acc : Array Assignment × CNF.Clause (PosFin n) × Bool × Bool
hsize : acc.fst.size = n
ih : f.DerivedLitsInvariant f_assignments_size acc.fst hsize acc.snd.fst
hsize' : (confirmRupHint f.clauses acc rupHints[i]).fst.size = n
h✝ : ¬(acc.2.2.snd || acc.2.2.fst) = true
rupHint_clause_eq_some_none : f.clauses[rupHints[↑i]]? = some none
⊢ f.DerivedLitsInvariant f_assignments_size
    (match f.clauses[rupHints[↑i]]? with
      | some (some c) =>
        match c.reduce acc.fst with
        | ReduceResult.encounteredBoth => (acc.fst, acc.2.fst, true, false)
        | ReduceResult.reducedToEmpty => (acc.fst, acc.2.fst, true, false)
        | ReduceResult.reducedToUnit (l, b) =>
          if hasAssignment b acc.fst[l.val]! = true then (acc.fst, acc.2.fst, false, false)
          else (acc.fst.modify l.val (addAssignment b), (l, b) :: acc.2.fst, false, false)
        | ReduceResult.reducedToNonunit => (acc.fst, acc.2.fst, false, true)
      | some none => (acc.fst, acc.2.fst, false, true)
      | none => (acc.fst, acc.2.fst, false, true)).fst
    ⋯
    (match f.clauses[rupHints[↑i]]? with
        | some (some c) =>
          match c.reduce acc.fst with
          | ReduceResult.encounteredBoth => (acc.fst, acc.2.fst, true, false)
          | ReduceResult.reducedToEmpty => (acc.fst, acc.2.fst, true, false)
          | ReduceResult.reducedToUnit (l, b) =>
            if hasAssignment b acc.fst[l.val]! = true then (acc.fst, acc.2.fst, false, false)
            else (acc.fst.modify l.val (addAssignment b), (l, b) :: acc.2.fst, false, false)
          | ReduceResult.reducedToNonunit => (acc.fst, acc.2.fst, false, true)
        | some none => (acc.fst, acc.2.fst, false, true)
        | none => (acc.fst, acc.2.fst, false, true)).snd.fst

Tactic:
simp only [rupHint_clause_eq_some_none]

Result:
case intro.isFalse.inr.inl
n : Nat
f : DefaultFormula n
f_assignments_size : f.assignments.size = n
rupHints : Array Nat
i : Fin rupHints.size
acc : Array Assignment × CNF.Clause (PosFin n) × Bool × Bool
hsize : acc.fst.size = n
ih : f.DerivedLitsInvariant f_assignments_size acc.fst hsize acc.snd.fst
hsize' : (confirmRupHint f.clauses acc rupHints[i]).fst.size = n
h✝ : ¬(acc.2.2.snd || acc.2.2.fst) = true
rupHint_clause_eq_some_none : f.clauses[rupHints[↑i]]? = some none
⊢ f.DerivedLitsInvariant f_assignments_size acc.fst ⋯ acc.2.fst