-- 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 pos
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)
hsize : acc.size = n
ih : ∀ (i : PosFin n) (b : Bool), hasAssignment b acc[i.val] = true → unit (i, b) ∈ (ofArray arr).toList
i_eq_l : i.val = l.val
h : hasAssignment b acc[l.val].addNegAssignment = true
h✝ : b = true
⊢ unit (i, b) ∈ (ofArray arr).toList

Tactic:
next b_eq_true =>
simp only [hasAssignment, b_eq_true, ite_true, hasPos_addNeg] at h
specialize ih l true
simp only [hasAssignment, ite_false] at ih
rw [b_eq_true, Subtype.ext i_eq_l]
exact ih 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
h : hasAssignment b (mkArray n unassigned)[i.val] = true
⊢ unit (i, b) ∈ (ofArray arr).toList

Tactic:
by_cases hb : b <;> simp [hasAssignment, hb, hasPosAssignment, hasNegAssignment] at 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
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, true)
heq : c.clause = [(l, true)]
hsize : acc.size = n
ih : ∀ (i : PosFin n) (b : Bool), hasAssignment b acc[i.val] = true → unit (i, b) ∈ (ofArray arr).toList
i_eq_l✝ : i.val = l.val
h : hasAssignment b acc[l.val].addPosAssignment = true
b_eq_true : b = true
i_eq_l : i = l
⊢ some (unit (i, b)) ∈ arr.toList

Tactic:
simp only [unit, b_eq_true, i_eq_l]

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
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, true)
heq : c.clause = [(l, true)]
hsize : acc.size = n
ih : ∀ (i : PosFin n) (b : Bool), hasAssignment b acc[i.val] = true → unit (i, b) ∈ (ofArray arr).toList
i_eq_l✝ : i.val = l.val
h : hasAssignment b acc[l.val].addPosAssignment = true
b_eq_true : b = true
i_eq_l : i = l
⊢ some { clause := [(l, true)], nodupkey := ⋯, nodup := ⋯ } ∈ arr.toList

Proof state:
case right
n : Nat
arr : Array (Option (DefaultClause n))
hsize : (ofArray arr).assignments.size = n
⊢ (ofArray arr).StrongAssignmentsInvariant

Tactic:
apply Exists.intro hsize

Result:
case right
n : Nat
arr : Array (Option (DefaultClause n))
hsize : (ofArray arr).assignments.size = n
⊢ ∀ (i : PosFin n) (b : Bool),
    hasAssignment b (ofArray arr).assignments[i.val] = true → unit (i, b) ∈ (ofArray arr).toList

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
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)
heq : c.clause = [(l, false)]
hsize : acc.size = n
ih : ∀ (i : PosFin n) (b : Bool), hasAssignment b acc[i.val] = true → unit (i, b) ∈ (ofArray arr).toList
i_eq_l✝ : i.val = l.val
h : hasAssignment b acc[l.val].addNegAssignment = true
b_eq_false : ¬b = true
i_eq_l : i = l
⊢ some (unit (i, b)) ∈ arr.toList

Tactic:
simp only [unit, b_eq_false, i_eq_l]

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
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)
heq : c.clause = [(l, false)]
hsize : acc.size = n
ih : ∀ (i : PosFin n) (b : Bool), hasAssignment b acc[i.val] = true → unit (i, b) ∈ (ofArray arr).toList
i_eq_l✝ : i.val = l.val
h : hasAssignment b acc[l.val].addNegAssignment = true
b_eq_false : ¬b = true
i_eq_l : i = l
⊢ some { clause := [(l, false)], nodupkey := ⋯, nodup := ⋯ } ∈ arr.toList

Proof state:
n : Nat
arr : Array (Option (DefaultClause n))
⊢ (mkArray n unassigned).size = n

Tactic:
simp only [Array.size_mkArray]

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
i : PosFin n
b : Bool
cOpt : Option (DefaultClause n)
c : DefaultClause n
hsize✝ : (ofArray_fold_fn acc (some c)).size = n
l : PosFin n
heq✝ : c.isUnit = some (l, true)
heq : c.clause = [(l, true)]
cOpt_in_arr : some { clause := [(l, true)], nodupkey := ⋯, nodup := ⋯ } ∈ arr.toList
hsize : acc.size = n
ih : ∀ (i : PosFin n) (b : Bool), hasAssignment b acc[i.val] = true → unit (i, b) ∈ (ofArray arr).toList
i_eq_l✝ : i.val = l.val
h : hasAssignment b acc[l.val].addPosAssignment = true
b_eq_true : b = true
i_eq_l : i = l
c_def : c = { clause := [(l, true)], nodupkey := ⋯, nodup := ⋯ }
⊢ some { clause := [(l, true)], nodupkey := ⋯, nodup := ⋯ } ∈ arr.toList

Tactic:
exact cOpt_in_arr

Result:
no goals