Theorem: LRAT.DefaultFormula.contradiction_of_insertUnit_fold_success (LeanSAT/LRAT/Formula/RupAddSound.lean)

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
i : PosFin n
⊢ i.val < assignments.size
Tactic:
rw [assignments_size]
State after:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
i : PosFin n
⊢ i.val < n

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
i : PosFin n
⊢ i.val < n
Tactic:
exact i.2.2
State after:
no goals

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
j : PosFin n
⊢ j.val < insertUnit_fold_res.snd.fst.size
Tactic:
rw [insertUnit_fold_preserves_size, assignments_size]
State after:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
j : PosFin n
⊢ j.val < n

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
j : PosFin n
⊢ j.val < n
Tactic:
exact j.2.2
State after:
no goals

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
⊢ let insertUnit_fold_res := List.foldl insertUnit (units, assignments, foundContradiction) l;
  (foundContradiction = true → ∃ i, assignments[i.val] = both) →
    insertUnit_fold_res.snd.snd = true → ∃ j, insertUnit_fold_res.snd.fst[j.val] = both
Tactic:
intro insertUnit_fold_res h0 insertUnit_fold_success
State after:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
⊢ ∃ j, insertUnit_fold_res.snd.fst[j.val] = both

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
⊢ ∃ j, insertUnit_fold_res.snd.fst[j.val] = both
Tactic:
let acc0 := (units, assignments, foundContradiction)
State after:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
⊢ ∃ j, insertUnit_fold_res.snd.fst[j.val] = both

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
⊢ ∃ j, insertUnit_fold_res.snd.fst[j.val] = both
Tactic:
have hb : ∃ _hsize : acc0.2.1.size = n, acc0.2.2 → ∃ j : PosFin n, acc0.2.1[j.1]'(by rw [assignments_size]; exact j.2.2) = both := by
  apply Exists.intro assignments_size
  intro foundContradiction_eq_true
  exact h0 foundContradiction_eq_true
State after:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
⊢ ∃ j, insertUnit_fold_res.snd.fst[j.val] = both

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
⊢ ∃ j, insertUnit_fold_res.snd.fst[j.val] = both
Tactic:
have hl (acc : Array (Literal (PosFin n)) × Array Assignment × Bool)
  (h : ∃ hsize : acc.2.1.size = n, acc.2.2 → ∃ j : PosFin n, acc.2.1[j.1]'(by rw [hsize]; exact j.2.2) = both)
  (l' : Literal (PosFin n)) (_ : l' ∈ l) :
  let insertUnit_res := insertUnit acc l'
  ∃ hsize : insertUnit_res.2.1.size = n,
    insertUnit_res.2.2 → ∃ j : PosFin n, insertUnit_res.2.1[j.1]'(by rw [hsize]; exact j.2.2) = both := by
  intro insertUnit_res
  have hsize : insertUnit_res.2.1.size = n := by rw [insertUnit_preserves_size, h.1]
  apply Exists.intro hsize
  intro insertUnit_res_success
  rcases h with ⟨acc_size, h⟩
  exact contradiction_of_insertUnit_success acc.2.1 acc_size acc.1 acc.2.2 l' h insertUnit_res_success
State after:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
hl :
  ∀ (acc : Array (Literal (PosFin n)) × Array Assignment × Bool),
    (∃ hsize, acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both) →
      ∀ (l' : Literal (PosFin n)),
        l' ∈ l →
          let insertUnit_res := insertUnit acc l';
          ∃ hsize, insertUnit_res.snd.snd = true → ∃ j, insertUnit_res.snd.fst[j.val] = both
⊢ ∃ j, insertUnit_fold_res.snd.fst[j.val] = both

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
hl :
  ∀ (acc : Array (Literal (PosFin n)) × Array Assignment × Bool),
    (∃ hsize, acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both) →
      ∀ (l' : Literal (PosFin n)),
        l' ∈ l →
          let insertUnit_res := insertUnit acc l';
          ∃ hsize, insertUnit_res.snd.snd = true → ∃ j, insertUnit_res.snd.fst[j.val] = both
⊢ ∃ j, insertUnit_fold_res.snd.fst[j.val] = both
Tactic:
rcases List.foldlRecOn l insertUnit acc0 hb hl with ⟨_, h⟩
State after:
case intro
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
hl :
  ∀ (acc : Array (Literal (PosFin n)) × Array Assignment × Bool),
    (∃ hsize, acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both) →
      ∀ (l' : Literal (PosFin n)),
        l' ∈ l →
          let insertUnit_res := insertUnit acc l';
          ∃ hsize, insertUnit_res.snd.snd = true → ∃ j, insertUnit_res.snd.fst[j.val] = both
w✝ : (List.foldl insertUnit acc0 l).snd.fst.size = n
h : (List.foldl insertUnit acc0 l).snd.snd = true → ∃ j, (List.foldl insertUnit acc0 l).snd.fst[j.val] = both
⊢ ∃ j, insertUnit_fold_res.snd.fst[j.val] = both

State before:
case intro
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
hl :
  ∀ (acc : Array (Literal (PosFin n)) × Array Assignment × Bool),
    (∃ hsize, acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both) →
      ∀ (l' : Literal (PosFin n)),
        l' ∈ l →
          let insertUnit_res := insertUnit acc l';
          ∃ hsize, insertUnit_res.snd.snd = true → ∃ j, insertUnit_res.snd.fst[j.val] = both
w✝ : (List.foldl insertUnit acc0 l).snd.fst.size = n
h : (List.foldl insertUnit acc0 l).snd.snd = true → ∃ j, (List.foldl insertUnit acc0 l).snd.fst[j.val] = both
⊢ ∃ j, insertUnit_fold_res.snd.fst[j.val] = both
Tactic:
exact h insertUnit_fold_success
State after:
no goals

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
_hsize : acc0.snd.fst.size = n
j : PosFin n
⊢ j.val < acc0.snd.fst.size
Tactic:
rw [assignments_size]
State after:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
_hsize : acc0.snd.fst.size = n
j : PosFin n
⊢ j.val < n

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
_hsize : acc0.snd.fst.size = n
j : PosFin n
⊢ j.val < n
Tactic:
exact j.2.2
State after:
no goals

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
⊢ ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
Tactic:
apply Exists.intro assignments_size
State after:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
⊢ acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
⊢ acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
Tactic:
intro foundContradiction_eq_true
State after:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
foundContradiction_eq_true : acc0.snd.snd = true
⊢ ∃ j, acc0.snd.fst[j.val] = both

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
foundContradiction_eq_true : acc0.snd.snd = true
⊢ ∃ j, acc0.snd.fst[j.val] = both
Tactic:
exact h0 foundContradiction_eq_true
State after:
no goals

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
hsize : acc.snd.fst.size = n
j : PosFin n
⊢ j.val < acc.snd.fst.size
Tactic:
rw [hsize]
State after:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
hsize : acc.snd.fst.size = n
j : PosFin n
⊢ j.val < n

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
hsize : acc.snd.fst.size = n
j : PosFin n
⊢ j.val < n
Tactic:
exact j.2.2
State after:
no goals

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
h : ∃ hsize, acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both
l' : Literal (PosFin n)
x✝ : l' ∈ l
insertUnit_res : Array (Literal (PosFin n)) × Array Assignment × Bool := insertUnit acc l'
hsize : insertUnit_res.snd.fst.size = n
j : PosFin n
⊢ j.val < insertUnit_res.snd.fst.size
Tactic:
rw [hsize]
State after:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
h : ∃ hsize, acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both
l' : Literal (PosFin n)
x✝ : l' ∈ l
insertUnit_res : Array (Literal (PosFin n)) × Array Assignment × Bool := insertUnit acc l'
hsize : insertUnit_res.snd.fst.size = n
j : PosFin n
⊢ j.val < n

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
h : ∃ hsize, acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both
l' : Literal (PosFin n)
x✝ : l' ∈ l
insertUnit_res : Array (Literal (PosFin n)) × Array Assignment × Bool := insertUnit acc l'
hsize : insertUnit_res.snd.fst.size = n
j : PosFin n
⊢ j.val < n
Tactic:
exact j.2.2
State after:
no goals

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
h : ∃ hsize, acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both
l' : Literal (PosFin n)
x✝ : l' ∈ l
⊢ let insertUnit_res := insertUnit acc l';
  ∃ hsize, insertUnit_res.snd.snd = true → ∃ j, insertUnit_res.snd.fst[j.val] = both
Tactic:
intro insertUnit_res
State after:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
h : ∃ hsize, acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both
l' : Literal (PosFin n)
x✝ : l' ∈ l
insertUnit_res : Array (Literal (PosFin n)) × Array Assignment × Bool := insertUnit acc l'
⊢ ∃ hsize, insertUnit_res.snd.snd = true → ∃ j, insertUnit_res.snd.fst[j.val] = both

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
h : ∃ hsize, acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both
l' : Literal (PosFin n)
x✝ : l' ∈ l
insertUnit_res : Array (Literal (PosFin n)) × Array Assignment × Bool := insertUnit acc l'
⊢ ∃ hsize, insertUnit_res.snd.snd = true → ∃ j, insertUnit_res.snd.fst[j.val] = both
Tactic:
have hsize : insertUnit_res.2.1.size = n := by rw [insertUnit_preserves_size, h.1]
State after:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
h : ∃ hsize, acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both
l' : Literal (PosFin n)
x✝ : l' ∈ l
insertUnit_res : Array (Literal (PosFin n)) × Array Assignment × Bool := insertUnit acc l'
hsize : insertUnit_res.snd.fst.size = n
⊢ ∃ hsize, insertUnit_res.snd.snd = true → ∃ j, insertUnit_res.snd.fst[j.val] = both

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
h : ∃ hsize, acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both
l' : Literal (PosFin n)
x✝ : l' ∈ l
insertUnit_res : Array (Literal (PosFin n)) × Array Assignment × Bool := insertUnit acc l'
hsize : insertUnit_res.snd.fst.size = n
⊢ ∃ hsize, insertUnit_res.snd.snd = true → ∃ j, insertUnit_res.snd.fst[j.val] = both
Tactic:
apply Exists.intro hsize
State after:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
h : ∃ hsize, acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both
l' : Literal (PosFin n)
x✝ : l' ∈ l
insertUnit_res : Array (Literal (PosFin n)) × Array Assignment × Bool := insertUnit acc l'
hsize : insertUnit_res.snd.fst.size = n
⊢ insertUnit_res.snd.snd = true → ∃ j, insertUnit_res.snd.fst[j.val] = both

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
h : ∃ hsize, acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both
l' : Literal (PosFin n)
x✝ : l' ∈ l
insertUnit_res : Array (Literal (PosFin n)) × Array Assignment × Bool := insertUnit acc l'
hsize : insertUnit_res.snd.fst.size = n
⊢ insertUnit_res.snd.snd = true → ∃ j, insertUnit_res.snd.fst[j.val] = both
Tactic:
intro insertUnit_res_success
State after:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
h : ∃ hsize, acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both
l' : Literal (PosFin n)
x✝ : l' ∈ l
insertUnit_res : Array (Literal (PosFin n)) × Array Assignment × Bool := insertUnit acc l'
hsize : insertUnit_res.snd.fst.size = n
insertUnit_res_success : insertUnit_res.snd.snd = true
⊢ ∃ j, insertUnit_res.snd.fst[j.val] = both

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
h : ∃ hsize, acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both
l' : Literal (PosFin n)
x✝ : l' ∈ l
insertUnit_res : Array (Literal (PosFin n)) × Array Assignment × Bool := insertUnit acc l'
hsize : insertUnit_res.snd.fst.size = n
insertUnit_res_success : insertUnit_res.snd.snd = true
⊢ ∃ j, insertUnit_res.snd.fst[j.val] = both
Tactic:
rcases h with ⟨acc_size, h⟩
State after:
case intro
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
l' : Literal (PosFin n)
x✝ : l' ∈ l
insertUnit_res : Array (Literal (PosFin n)) × Array Assignment × Bool := insertUnit acc l'
hsize : insertUnit_res.snd.fst.size = n
insertUnit_res_success : insertUnit_res.snd.snd = true
acc_size : acc.snd.fst.size = n
h : acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both
⊢ ∃ j, insertUnit_res.snd.fst[j.val] = both

State before:
case intro
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
l' : Literal (PosFin n)
x✝ : l' ∈ l
insertUnit_res : Array (Literal (PosFin n)) × Array Assignment × Bool := insertUnit acc l'
hsize : insertUnit_res.snd.fst.size = n
insertUnit_res_success : insertUnit_res.snd.snd = true
acc_size : acc.snd.fst.size = n
h : acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both
⊢ ∃ j, insertUnit_res.snd.fst[j.val] = both
Tactic:
exact contradiction_of_insertUnit_success acc.2.1 acc_size acc.1 acc.2.2 l' h insertUnit_res_success
State after:
no goals

State before:
n : Nat
assignments : Array Assignment
assignments_size : assignments.size = n
units : Array (Literal (PosFin n))
foundContradiction : Bool
l : List (Literal (PosFin n))
insertUnit_fold_res : Array (Literal (PosFin n)) × Array Assignment × Bool :=
  List.foldl insertUnit (units, assignments, foundContradiction) l
h0 : foundContradiction = true → ∃ i, assignments[i.val] = both
insertUnit_fold_success : insertUnit_fold_res.snd.snd = true
acc0 : Array (Literal (PosFin n)) × Array Assignment × Bool := (units, assignments, foundContradiction)
hb : ∃ _hsize, acc0.snd.snd = true → ∃ j, acc0.snd.fst[j.val] = both
acc : Array (Literal (PosFin n)) × Array Assignment × Bool
h : ∃ hsize, acc.snd.snd = true → ∃ j, acc.snd.fst[j.val] = both
l' : Literal (PosFin n)
x✝ : l' ∈ l
insertUnit_res : Array (Literal (PosFin n)) × Array Assignment × Bool := insertUnit acc l'
⊢ insertUnit_res.snd.fst.size = n
Tactic:
rw [insertUnit_preserves_size, h.1]
State after:
no goals