-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/LRAT/Internal/Formula/RatAddSound.lean
theorem assignmentsInvariant_performRupCheck_of_assignmentsInvariant {n : Nat} (f : DefaultFormula n)
    (f_AssignmentsInvariant : AssignmentsInvariant f) (rupHints : Array Nat) :
    AssignmentsInvariant (performRupCheck f rupHints).1

Proof state:
n : Nat
f : DefaultFormula n
f_AssignmentsInvariant : f.AssignmentsInvariant
rupHints : Array Nat
motive : Nat → Array Assignment × CNF.Clause (PosFin n) × Bool × Bool → Prop := f.ConfirmRupHintFoldEntailsMotive
h_base : motive 0 (f.assignments, [], false, false)
h_inductive :
  ∀ (idx : Fin rupHints.size) (acc : Array Assignment × CNF.Clause (PosFin n) × Bool × Bool),
    motive (↑idx) acc → f.ConfirmRupHintFoldEntailsMotive (↑idx + 1) (confirmRupHint f.clauses acc rupHints[idx])
hsize : (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst.size = n
right✝ :
  (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).snd.snd.fst = true →
    Incompatible (PosFin n) (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst f
i : PosFin n
b : Bool
h :
  hasAssignment b (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst[i.val] = true
p : PosFin n → Bool
pf :
  p ⊨
    { clauses := f.clauses, rupUnits := f.rupUnits, ratUnits := f.ratUnits,
      assignments := (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst }
h1 :
  hasAssignment (decide (p i = false))
      (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst[i.val]! =
    false
in_bounds_motive : Nat → Array Assignment × CNF.Clause (PosFin n) × Bool × Bool → Prop :=
  fun _idx acc => acc.fst.size = n
in_bounds_base : in_bounds_motive 0 (f.assignments, [], false, false)
idx : Fin rupHints.size
acc : Array Assignment × CNF.Clause (PosFin n) × Bool × Bool
ih : in_bounds_motive (↑idx) acc
⊢ in_bounds_motive (↑idx + 1) (confirmRupHint f.clauses acc rupHints[idx])

Tactic:
have h := size_assignemnts_confirmRupHint f.clauses acc.1 acc.2.1 acc.2.2.1 acc.2.2.2 rupHints[idx]

Result:
n : Nat
f : DefaultFormula n
f_AssignmentsInvariant : f.AssignmentsInvariant
rupHints : Array Nat
motive : Nat → Array Assignment × CNF.Clause (PosFin n) × Bool × Bool → Prop := f.ConfirmRupHintFoldEntailsMotive
h_base : motive 0 (f.assignments, [], false, false)
h_inductive :
  ∀ (idx : Fin rupHints.size) (acc : Array Assignment × CNF.Clause (PosFin n) × Bool × Bool),
    motive (↑idx) acc → f.ConfirmRupHintFoldEntailsMotive (↑idx + 1) (confirmRupHint f.clauses acc rupHints[idx])
hsize : (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst.size = n
right✝ :
  (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).snd.snd.fst = true →
    Incompatible (PosFin n) (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst f
i : PosFin n
b : Bool
h✝ :
  hasAssignment b (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst[i.val] = true
p : PosFin n → Bool
pf :
  p ⊨
    { clauses := f.clauses, rupUnits := f.rupUnits, ratUnits := f.ratUnits,
      assignments := (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst }
h1 :
  hasAssignment (decide (p i = false))
      (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst[i.val]! =
    false
in_bounds_motive : Nat → Array Assignment × CNF.Clause (PosFin n) × Bool × Bool → Prop :=
  fun _idx acc => acc.fst.size = n
in_bounds_base : in_bounds_motive 0 (f.assignments, [], false, false)
idx : Fin rupHints.size
acc : Array Assignment × CNF.Clause (PosFin n) × Bool × Bool
ih : in_bounds_motive (↑idx) acc
h :
  (confirmRupHint f.clauses (acc.fst, acc.snd.fst, acc.snd.snd.fst, acc.snd.snd.snd) rupHints[idx]).fst.size =
    acc.fst.size
⊢ in_bounds_motive (↑idx + 1) (confirmRupHint f.clauses acc rupHints[idx])

Proof state:
n : Nat
f : DefaultFormula n
f_AssignmentsInvariant : f.AssignmentsInvariant
rupHints : Array Nat
motive : Nat → Array Assignment × CNF.Clause (PosFin n) × Bool × Bool → Prop := f.ConfirmRupHintFoldEntailsMotive
h_base : motive 0 (f.assignments, [], false, false)
h_inductive :
  ∀ (idx : Fin rupHints.size) (acc : Array Assignment × CNF.Clause (PosFin n) × Bool × Bool),
    motive (↑idx) acc → f.ConfirmRupHintFoldEntailsMotive (↑idx + 1) (confirmRupHint f.clauses acc rupHints[idx])
hsize : (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst.size = n
right✝ :
  (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).snd.snd.fst = true →
    Incompatible (PosFin n) (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst f
i : PosFin n
b : Bool
h✝ :
  hasAssignment b (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst[i.val] = true
p : PosFin n → Bool
pf :
  p ⊨
    { clauses := f.clauses, rupUnits := f.rupUnits, ratUnits := f.ratUnits,
      assignments := (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst }
h1 :
  hasAssignment (decide (p i = false))
      (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst[i.val]! =
    false
in_bounds_motive : Nat → Array Assignment × CNF.Clause (PosFin n) × Bool × Bool → Prop :=
  fun _idx acc => acc.fst.size = n
in_bounds_base : in_bounds_motive 0 (f.assignments, [], false, false)
idx : Fin rupHints.size
acc : Array Assignment × CNF.Clause (PosFin n) × Bool × Bool
ih : in_bounds_motive (↑idx) acc
h :
  (confirmRupHint f.clauses (acc.fst, acc.snd.fst, acc.snd.snd.fst, acc.snd.snd.snd) rupHints[idx]).fst.size =
    acc.fst.size
⊢ in_bounds_motive (↑idx + 1) (confirmRupHint f.clauses acc rupHints[idx])

Tactic:
have : (acc.fst, acc.snd.fst, acc.snd.snd.fst, acc.snd.snd.snd) = acc := rfl

Result:
n : Nat
f : DefaultFormula n
f_AssignmentsInvariant : f.AssignmentsInvariant
rupHints : Array Nat
motive : Nat → Array Assignment × CNF.Clause (PosFin n) × Bool × Bool → Prop := f.ConfirmRupHintFoldEntailsMotive
h_base : motive 0 (f.assignments, [], false, false)
h_inductive :
  ∀ (idx : Fin rupHints.size) (acc : Array Assignment × CNF.Clause (PosFin n) × Bool × Bool),
    motive (↑idx) acc → f.ConfirmRupHintFoldEntailsMotive (↑idx + 1) (confirmRupHint f.clauses acc rupHints[idx])
hsize : (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst.size = n
right✝ :
  (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).snd.snd.fst = true →
    Incompatible (PosFin n) (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst f
i : PosFin n
b : Bool
h✝ :
  hasAssignment b (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst[i.val] = true
p : PosFin n → Bool
pf :
  p ⊨
    { clauses := f.clauses, rupUnits := f.rupUnits, ratUnits := f.ratUnits,
      assignments := (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst }
h1 :
  hasAssignment (decide (p i = false))
      (Array.foldl (confirmRupHint f.clauses) (f.assignments, [], false, false) rupHints).fst[i.val]! =
    false
in_bounds_motive : Nat → Array Assignment × CNF.Clause (PosFin n) × Bool × Bool → Prop :=
  fun _idx acc => acc.fst.size = n
in_bounds_base : in_bounds_motive 0 (f.assignments, [], false, false)
idx : Fin rupHints.size
acc : Array Assignment × CNF.Clause (PosFin n) × Bool × Bool
ih : in_bounds_motive (↑idx) acc
h :
  (confirmRupHint f.clauses (acc.fst, acc.snd.fst, acc.snd.snd.fst, acc.snd.snd.snd) rupHints[idx]).fst.size =
    acc.fst.size
this : (acc.fst, acc.snd.fst, acc.snd.snd.fst, acc.snd.snd.snd) = acc
⊢ in_bounds_motive (↑idx + 1) (confirmRupHint f.clauses acc rupHints[idx])