-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/LRAT/Internal/Formula/Lemmas.lean
theorem readyForRupAdd_ofArray {n : Nat} (arr : Array (Option (DefaultClause n))) :
    ReadyForRupAdd (ofArray arr)

Proof state:
case right.intro
n : Nat
arr : Array (Option (DefaultClause n))
hsize : (ofArray arr).assignments.size = n
ModifiedAssignmentsInvariant : Array Assignment → Prop :=
  fun assignments =>
    ∃ hsize, ∀ (i : PosFin n) (b : Bool), hasAssignment b assignments[i.val] = true → unit (i, b) ∈ (ofArray arr).toList
hb : ModifiedAssignmentsInvariant (mkArray n unassigned)
hl :
  ∀ (acc : Array Assignment),
    ModifiedAssignmentsInvariant acc →
      ∀ (cOpt : Option (DefaultClause n)), cOpt ∈ arr.toList → ModifiedAssignmentsInvariant (ofArray_fold_fn acc cOpt)
_h_size : (List.foldl ofArray_fold_fn (mkArray n unassigned) arr.toList).size = n
h' :
  ∀ (i : PosFin n) (b : Bool),
    hasAssignment b (List.foldl ofArray_fold_fn (mkArray n unassigned) arr.toList)[i.val] = true →
      unit (i, b) ∈ (ofArray arr).toList
⊢ ∀ (i : PosFin n) (b : Bool),
    hasAssignment b (ofArray arr).assignments[i.val] = true → unit (i, b) ∈ (ofArray arr).toList

Tactic:
intro i b h

Result:
case right.intro
n : Nat
arr : Array (Option (DefaultClause n))
hsize : (ofArray arr).assignments.size = n
ModifiedAssignmentsInvariant : Array Assignment → Prop :=
  fun assignments =>
    ∃ hsize, ∀ (i : PosFin n) (b : Bool), hasAssignment b assignments[i.val] = true → unit (i, b) ∈ (ofArray arr).toList
hb : ModifiedAssignmentsInvariant (mkArray n unassigned)
hl :
  ∀ (acc : Array Assignment),
    ModifiedAssignmentsInvariant acc →
      ∀ (cOpt : Option (DefaultClause n)), cOpt ∈ arr.toList → ModifiedAssignmentsInvariant (ofArray_fold_fn acc cOpt)
_h_size : (List.foldl ofArray_fold_fn (mkArray n unassigned) arr.toList).size = n
h' :
  ∀ (i : PosFin n) (b : Bool),
    hasAssignment b (List.foldl ofArray_fold_fn (mkArray n unassigned) arr.toList)[i.val] = true →
      unit (i, b) ∈ (ofArray arr).toList
i : PosFin n
b : Bool
h : hasAssignment b (ofArray arr).assignments[i.val] = true
⊢ unit (i, b) ∈ (ofArray arr).toList

Proof state:
case right.intro
n : Nat
arr : Array (Option (DefaultClause n))
hsize : (ofArray arr).assignments.size = n
ModifiedAssignmentsInvariant : Array Assignment → Prop :=
  fun assignments =>
    ∃ hsize, ∀ (i : PosFin n) (b : Bool), hasAssignment b assignments[i.val] = true → unit (i, b) ∈ (ofArray arr).toList
hb : ModifiedAssignmentsInvariant (mkArray n unassigned)
hl :
  ∀ (acc : Array Assignment),
    ModifiedAssignmentsInvariant acc →
      ∀ (cOpt : Option (DefaultClause n)), cOpt ∈ arr.toList → ModifiedAssignmentsInvariant (ofArray_fold_fn acc cOpt)
_h_size : (List.foldl ofArray_fold_fn (mkArray n unassigned) arr.toList).size = n
h' :
  ∀ (i : PosFin n) (b : Bool),
    hasAssignment b (List.foldl ofArray_fold_fn (mkArray n unassigned) arr.toList)[i.val] = true →
      unit (i, b) ∈ (ofArray arr).toList
i : PosFin n
b : Bool
h : hasAssignment b (List.foldl ofArray_fold_fn (mkArray n unassigned) arr.toList)[i.val] = true
⊢ unit (i, b) ∈ (ofArray arr).toList

Tactic:
exact h' i b h

Result:
no goals

Proof state:
n : Nat
arr : Array (Option (DefaultClause n))
hsize✝ : (ofArray arr).assignments.size = n
ModifiedAssignmentsInvariant : Array Assignment → Prop :=
  fun assignments =>
    ∃ hsize, ∀ (i : PosFin n) (b : Bool), hasAssignment b assignments[i.val] = true → unit (i, b) ∈ (ofArray arr).toList
hb : ModifiedAssignmentsInvariant (mkArray n unassigned)
acc : Array Assignment
ih : ModifiedAssignmentsInvariant acc
i : PosFin n
b : Bool
cOpt : Option (DefaultClause n)
c : DefaultClause n
cOpt_in_arr : some c ∈ arr.toList
hsize : (ofArray_fold_fn acc (some c)).size = n
heq : c.isUnit = none
h : hasAssignment b acc[i.val] = true
⊢ unit (i, b) ∈ (ofArray arr).toList

Tactic:
exact ih.2 i b h

Result:
no goals

Proof state:
n : Nat
arr : Array (Option (DefaultClause n))
hsize✝ : (ofArray arr).assignments.size = n
ModifiedAssignmentsInvariant : Array Assignment → Prop :=
  fun assignments =>
    ∃ hsize, ∀ (i : PosFin n) (b : Bool), hasAssignment b assignments[i.val] = true → unit (i, b) ∈ (ofArray arr).toList
hb : ModifiedAssignmentsInvariant (mkArray n unassigned)
acc : Array Assignment
ih : ModifiedAssignmentsInvariant acc
cOpt : Option (DefaultClause n)
cOpt_in_arr : cOpt ∈ arr.toList
hsize : (ofArray_fold_fn acc cOpt).size = n
i : PosFin n
b : Bool
h : hasAssignment b (ofArray_fold_fn acc cOpt)[i.val] = true
⊢ unit (i, b) ∈ (ofArray arr).toList

Tactic:
simp only [ofArray_fold_fn] at h

Result:
n : Nat
arr : Array (Option (DefaultClause n))
hsize✝ : (ofArray arr).assignments.size = n
ModifiedAssignmentsInvariant : Array Assignment → Prop :=
  fun assignments =>
    ∃ hsize, ∀ (i : PosFin n) (b : Bool), hasAssignment b assignments[i.val] = true → unit (i, b) ∈ (ofArray arr).toList
hb : ModifiedAssignmentsInvariant (mkArray n unassigned)
acc : Array Assignment
ih : ModifiedAssignmentsInvariant acc
cOpt : Option (DefaultClause n)
cOpt_in_arr : cOpt ∈ arr.toList
hsize : (ofArray_fold_fn acc cOpt).size = n
i : PosFin n
b : Bool
h :
  hasAssignment b
      (match cOpt with
        | none => acc
        | some c =>
          match c.isUnit with
          | none => acc
          | some (l, true) => acc.modify l.val addPosAssignment
          | some (l, false) => acc.modify l.val addNegAssignment)[i.val] =
    true
⊢ unit (i, b) ∈ (ofArray arr).toList

Proof state:
n : Nat
arr : Array (Option (DefaultClause n))
hsize✝ : (ofArray arr).assignments.size = n
assignments : Array Assignment
hsize : assignments.size = n
i : PosFin n
b : Bool
⊢ i.val < n

Tactic:
exact i.2.2

Result:
no goals

Proof state:
case neg
n : Nat
arr : Array (Option (DefaultClause n))
hsize✝¹ : (ofArray arr).assignments.size = n
ModifiedAssignmentsInvariant : Array Assignment → Prop :=
  fun assignments =>
    ∃ hsize, ∀ (i : PosFin n) (b : Bool), hasAssignment b assignments[i.val] = true → unit (i, b) ∈ (ofArray arr).toList
hb : ModifiedAssignmentsInvariant (mkArray n unassigned)
acc : Array Assignment
i : PosFin n
b : Bool
cOpt : Option (DefaultClause n)
c : DefaultClause n
cOpt_in_arr : some c ∈ arr.toList
hsize✝ : (ofArray_fold_fn acc (some c)).size = n
l : PosFin n
heq : c.isUnit = some (l, false)
h : hasAssignment b (acc.modify l.val addNegAssignment)[i.val] = true
hsize : acc.size = n
ih : ∀ (i : PosFin n) (b : Bool), hasAssignment b acc[i.val] = true → unit (i, b) ∈ (ofArray arr).toList
h✝ : ¬i.val = l.val
⊢ unit (i, b) ∈ (ofArray arr).toList

Tactic:
next i_ne_l =>
simp only [Array.getElem_modify_of_ne (Ne.symm i_ne_l)] at h
exact ih i b h

Result:
no goals

Proof state:
n : Nat
arr : Array (Option (DefaultClause n))
hsize✝ : (ofArray arr).assignments.size = n
ModifiedAssignmentsInvariant : Array Assignment → Prop :=
  fun assignments =>
    ∃ hsize, ∀ (i : PosFin n) (b : Bool), hasAssignment b assignments[i.val] = true → unit (i, b) ∈ (ofArray arr).toList
hsize : (mkArray n unassigned).size = n
⊢ ∀ (i : PosFin n) (b : Bool), hasAssignment b (mkArray n unassigned)[i.val] = true → unit (i, b) ∈ (ofArray arr).toList

Tactic:
intro i b h

Result:
n : Nat
arr : Array (Option (DefaultClause n))
hsize✝ : (ofArray arr).assignments.size = n
ModifiedAssignmentsInvariant : Array Assignment → Prop :=
  fun assignments =>
    ∃ hsize, ∀ (i : PosFin n) (b : Bool), hasAssignment b assignments[i.val] = true → unit (i, b) ∈ (ofArray arr).toList
hsize : (mkArray n unassigned).size = n
i : PosFin n
b : Bool
h : hasAssignment b (mkArray n unassigned)[i.val] = true
⊢ unit (i, b) ∈ (ofArray arr).toList